Rozdziały kursu
Szkolenia · Ścieżka 9. Podstawy SysML v2 · Rozdział 9.7 z 8
9.7 Ograniczenia i obliczenia 4:26
Zapisywanie ograniczeń i obliczeń, sprawdzanie wartości sedana z jednostkami i oznaczanie otwartych wartości.
Pokazuje Holarch 2.22.
Czego się nauczysz
- Zapisywanie definicji ograniczenia i definicji obliczenia z parametrami
- Wiązanie parametrów użycia ograniczenia z wartościami w modelu
- Spełnianie i niespełnianie ograniczenia w Widoku parametrycznym oraz sprawdzanie wszystkich ograniczeń za pomocą Rozwiąż wszystko
- Oznaczanie otwartych wartości metadanymi TBD i TBR i odnajdywanie ich w rejestrze TBD/TBR
- Sumowanie masy części w Budżety i TPM
Zapisuj ograniczenia i obliczenia SysML v2 w Holarch zgodnie z samouczkiem SysML v2 Ograniczenia i obliczenia na małym projekcie Hybrid Car: definicja ograniczenia i obliczenie, użycie ograniczenia powiązane z wartościami sedana, Widok parametryczny, w którym kontrola kończy się niepowodzeniem i powodzeniem, Rozwiąż wszystko, przypadek analizy, wartości TBD i TBR z ich rejestrem oraz sumowanie masy w budżetach. SysML jest zastrzeżonym znakiem towarowym Object Management Group, Inc.
Pliki projektu
- Projekt ukończony (.holarch.json; Zarządzaj projektami → Pliki projektu ▾ → Importuj projekt (.json)…)
Film jest odtwarzany z holarch.app; zobacz Politykę prywatności.
Ćwiczenie
Wykonaj to samodzielnie w Holarch na projekcie demonstracyjnym Hybrid Car (SysML v2).
- Otwórz swój projekt demonstracyjny Hybrid Car (w razie potrzeby utwórz go: Zarządzaj projektami → Pliki projektu ▾ → Nowy projekt demonstracyjny → Hybrid Car (SysML v2)), otwórz Model → Edytor i pakiet
VehicleRequirements. - Po
constraint def SpeedLimitdodajconstraint sedanBatteryCheck : MassLimit { in mass = fleet.sedan.powertrain.battery.mass; in limit = 50 [kg]; }. - Na stronie Diagramy kliknij + Nowy diagram, wybierz Widok parametryczny i
VehicleRequirementsw polu Pokazuje i kliknij Utwórz. Nowa kontrola kończy się powodzeniem: 48 kg mieści się w 50 kg. - W pakiecie
Vehicleszmień masę akumulatora sedana na52 [kg]; widok pokazuje niepowodzenie kontroli. Naciśnij ⌘Z / Ctrl+Z, a następnie kliknij Rozwiąż wszystko, aby ponownie sprawdzić wszystkie ograniczenia. - W
requirement def <'VR-2'> Accelerationzastąpattribute zeroToHundred : TimeValue;przezattribute zeroToHundred : TimeValue { @TBD { owner = "Test lead"; rationale = "The test track is not booked yet."; } }. Otwórz Potrzeby i wymagania → TBD/TBR i znajdź wymaganie z jego właścicielem. - Otwórz Architektura → Budżety i TPM, kliknij Wybierz część główną… i wybierz
sedan. W polu Wielkość wybierz Mass i znajdź 48 kg akumulatora.
Gotowe, gdy sedanBatteryCheck pokazuje Spełnione w Widoku parametrycznym, a rejestr TBD/TBR wymienia wymaganie Acceleration z właścicielem Test lead.
Sprawdź się
- Czym różni się
constraint defodcalc def? - Ograniczenie w Widoku parametrycznym pokazuje Wymaga danych. Czego brakuje?
- Dlaczego oznaczać otwartą wartość przez
#TBDlub@TBD { … }zamiast wpisywać TBD jako wartość? - Co przypadek analizy dodaje do obliczenia?
Pokaż odpowiedzi
Czym różni się
constraint defodcalc def?Definicja ograniczenia wyraża warunek na swoich parametrach, który jest spełniony lub nie, np.
mass <= limit. Definicja obliczenia oblicza i zwraca wartość, np.return ratio = power / mass;.Ograniczenie w Widoku parametrycznym pokazuje Wymaga danych. Czego brakuje?
Parametr nie ma jeszcze wartości. Powiąż każdy parametr z wartością, np.
in mass = fleet.sedan.curbMass;.Dlaczego oznaczać otwartą wartość przez
#TBDlub@TBD { … }zamiast wpisywać TBD jako wartość?TBDw miejscu wartości nie jest poprawnym SysML. Metadane z pakietuHolarchMetadataw Holarch zachowują poprawność tekstu; TBD i TBR specjalizują standardowe metadaneStatusInfo, więc inne narzędzia SysML v2 odczytują je jako adnotacje statusu.Co przypadek analizy dodaje do obliczenia?
Stosuje obliczenie do podmiotu, np. sedana, zwraca wynik i ma cel, którego ograniczenie require Holarch ocenia jak każde inne ograniczenie.
Więcej informacji
- Samouczek: Ograniczenia i obliczenia (Samouczki SysML v2)
- Docs: Analiza SysML v2, Sprawdzanie ograniczeń w Widoku parametrycznym
- Docs: Analiza SysML v2, Rozwiązywanie wartości
- Docs: Wymagania w projektach SysML v2, Oznaczanie wartości jako TBD lub TBR
- Docs: Analiza SysML v2, Sumowanie budżetu
- Pomoc: Budżety i TPM w projektach SysML v2
Transkrypcja
Pokaż transkrypcję (narracja i to, co widać na ekranie)
Introduction
Chapter seven: constraints and calculations. They turn the model's values into checks and results that Holarch evaluates with units.
In this chapter you write a constraint and a calculation, bind a check to the sedan's values, see it fail and pass in a Parametric View, run an analysis case, and mark open values.
Start the tutorial
Start the tutorial Constraints and Calculations from Project Files, Start a Tutorial. Its starter project holds the sedan with its engine and battery values, and two targets: the maximum curb mass and the minimum power to weight.
On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Constraints and Calculations → Start; Model → Editor.
Constraints and calculations
A constraint definition states a condition over its parameters. After the constraints comment, write the mass limit: the mass is at most the limit.
On screen: After // ---- Constraints and calculations ----: constraint def MassLimit.
Below it, a calculation: power to weight divides the power by the mass, and returns the ratio.
On screen: Below it: calc def PowerToWeight.
A constraint usage binds each parameter to a value: here, the sedan's curb mass and the maximum curb mass.
On screen: Below it: constraint sedanMassCheck : MassLimit with bound inputs.
The Parametric View
Open the Diagrams page, click New Diagram, and choose Parametric View. Choose the vehicle analysis package under Shows, and click Create.
On screen: Diagrams → + New Diagram → Parametric View; Shows: VehicleAnalysis; Create.
The check shows its expression, with its parameters bound to the values. Fifteen hundred eighty kilograms is within sixteen hundred fifty, so it passes.
On screen: The mass check: pass.
In the Editor, change the sedan's curb mass to seventeen hundred kilograms. Back in the Parametric View, the mass check now fails.
On screen: Model → Editor: curbMass 1580 → 1700; Diagrams → the Parametric View: fail.
Change it back to fifteen hundred eighty in the Editor. In the view, Solve All checks every constraint again, with units.
On screen: Model → Editor: 1700 → 1580; the view → Solve All → Pass; Close.
An analysis case
An analysis case computes a result for a subject. At the end of the package, add the power to weight analysis, and apply it to the sedan. Its objective requires at least the minimum, and the checker evaluates it like any constraint.
On screen: Model → Editor; after sedanMassCheck: analysis def PowerToWeightAnalysis; analysis sedanPowerToWeight.
TBD and TBR
Values that are still open get a mark. First import Holarch's metadata package after the other imports.
On screen: After the imports: private import HolarchMetadata::*;
Then add a charge time requirement. TBR marks the time limit to be reviewed, and TBD marks the charger power to be determined, with an owner, a due date and a rationale. Both come from Holarch's metadata library and specialize the standard status metadata, so other SysML v2 tools see them as status annotations.
On screen: At the end: requirement def <'VR-5'> ChargeTime with #TBR and @TBD.
Open Needs and Requirements, then TBD/TBR. The charge time is listed with the owner and the due date from its metadata. The register only lists them: to change them, edit the metadata in the Editor.
On screen: Needs & Requirements → TBD/TBR; the ChargeTime row with owner and due date.
Budgets
Last, open Architecture, then Budgets, and select the sedan as the root part. The quantity Mass reads each part's mass attribute with its unit: the battery shows the sedan's own forty eight kilograms.
On screen: Architecture → Budgets & TPMs → Select Root Part… → sedan; the battery 48 kg.
Recap
Every step is ticked off. Click Mark as Done.
On screen: Step panel → Mark as Done.
Let's recap. You wrote a constraint and a calculation, bound a check to the sedan's values, saw it fail and pass in a Parametric View, ran an analysis case, marked open values for the register, and rolled up the mass.
Next, variants and configurations describe a product line.