Capitoli del corso
Formazione · Percorso 9. Fondamenti di SysML v2 · Capitolo 9.7 di 8
9.7 Constraints and Calculations 4:26
Scrivere vincoli e calcoli, verificare i valori della berlina con le unità e contrassegnare i valori aperti.
Mostra Holarch 2.22.
Che cosa si impara
- Scrivere una definizione di constraint e una definizione di calcolo con parametri
- Legare i parametri di un uso di constraint a valori del modello
- Vedere un constraint superato e fallito in una Vista parametrica e verificare tutti i constraint con Risolvi tutto
- Contrassegnare i valori aperti con i metadati TBD e TBR e trovarli nel registro TBD/TBR
- Consolidare la massa di una part in Budget e TPM
Scrivere constraint e calcoli SysML v2 in Holarch, seguendo il tutorial SysML v2 Constraints and Calculations su un piccolo progetto Hybrid Car: una definizione di constraint e un calcolo, un uso di constraint legato ai valori della berlina, una Vista parametrica in cui la verifica fallisce e poi viene superata, Risolvi tutto, un analysis case, valori TBD e TBR con il loro registro e un consolidamento della massa in Budget. SysML è un marchio registrato di Object Management Group, Inc.
File di progetto
- Progetto completato (.holarch.json; Gestisci progetti → File di progetto ▾ → Importa progetto (.json)…)
Il video viene riprodotto da holarch.app; vedere l’Informativa sulla privacy.
Esercitazione
Provare in prima persona in Holarch, sul progetto demo Hybrid Car (SysML v2).
- Aprire il progetto demo Hybrid Car (crearlo se necessario: Gestisci progetti → File di progetto ▾ → Nuovo progetto demo → Hybrid Car (SysML v2)), aprire Modello → Editor e il package
VehicleRequirements. - Dopo
constraint def SpeedLimit, aggiungereconstraint sedanBatteryCheck : MassLimit { in mass = fleet.sedan.powertrain.battery.mass; in limit = 50 [kg]; }. - Nella pagina Diagrammi, fare clic su + Nuovo diagramma, scegliere Vista parametrica e
VehicleRequirementsin Mostra, e fare clic su Crea. La nuova verifica è superata: 48 kg rientrano nei 50 kg. - Nel package
Vehicles, cambiare la massa della batteria della berlina in52 [kg]; la vista mostra la verifica fallita. Premere ⌘Z / Ctrl+Z, poi fare clic su Risolvi tutto per verificare di nuovo tutti i constraint. - In
requirement def <'VR-2'> Acceleration, sostituireattribute zeroToHundred : TimeValue;conattribute zeroToHundred : TimeValue { @TBD { owner = "Test lead"; rationale = "The test track is not booked yet."; } }. Aprire Esigenze e requisiti → TBD/TBR e trovare il requisito con il suo responsabile. - Aprire Architettura → Budget e TPM, fare clic su Seleziona parte radice… e scegliere
sedan. In Grandezza, scegliere Massa e trovare i 48 kg della batteria.
L’esercizio è completato quando sedanBatteryCheck mostra Superato nella Vista parametrica e il registro TBD/TBR elenca il requisito Acceleration con il responsabile Test lead.
Verifica
- Qual è la differenza tra un
constraint defe uncalc def? - Un constraint nella Vista parametrica mostra Richiede input. Che cosa manca?
- Perché contrassegnare un valore aperto con
#TBDo@TBD { … }invece di scrivere TBD come valore? - Che cosa aggiunge un analysis case a un calcolo?
Mostra le risposte
Qual è la differenza tra un
constraint defe uncalc def?Una definizione di constraint esprime sui suoi parametri una condizione che è vera o falsa, come
mass <= limit. Una definizione di calcolo calcola e restituisce un valore, comereturn ratio = power / mass;.Un constraint nella Vista parametrica mostra Richiede input. Che cosa manca?
Un parametro non ha ancora un valore. Legare ogni parametro a un valore, ad esempio
in mass = fleet.sedan.curbMass;.Perché contrassegnare un valore aperto con
#TBDo@TBD { … }invece di scrivere TBD come valore?TBDal posto di un valore non è SysML valido. I metadati del packageHolarchMetadatadi Holarch mantengono il testo valido; TBD e TBR specializzano i metadati standardStatusInfo, quindi gli altri strumenti SysML v2 li leggono come annotazioni di stato.Che cosa aggiunge un analysis case a un calcolo?
Applica il calcolo a un soggetto, come la berlina, restituisce il risultato e ha un obiettivo il cui require constraint Holarch valuta come qualsiasi altro constraint.
Per saperne di più
- Tutorial: Constraints and Calculations (Tutorial SysML v2)
- Docs: Analisi SysML v2, Verificare i constraint in una Vista parametrica
- Docs: Analisi SysML v2, Risolvere i valori
- Docs: Requisiti nei progetti SysML v2, Contrassegnare un valore come TBD o TBR
- Docs: Analisi SysML v2, Consolidare un budget
- Guida: Budget e TPM nei progetti SysML v2
Trascrizione
Mostra la trascrizione (narrazione e contenuto dello schermo)
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.