Capitoli del corso
Formazione · Percorso 9. Fondamenti di SysML v2 · Capitolo 9.5 di 8
9.5 Requirements 4:15
Scrivere requisiti verificabili, annidarli in una specifica e vederne uno non soddisfatto.
Mostra Holarch 2.22.
Che cosa si impara
- Dare un nome ai limiti dei requisiti come attributi con unità
- Scrivere una definizione di requisito con un numero, un enunciato, un soggetto e un require constraint
- Annidare usi di requisito in una specifica e dare loro limiti propri con `:>>`
- Indicare che cosa soddisfa un requisito e leggere il segno dell’Editor quando il progetto non lo soddisfa
- Verificare gli enunciati dei requisiti nella pagina Qualità
Scrivere requisiti SysML v2 in Holarch, seguendo il tutorial SysML v2 Requirements su un piccolo progetto Hybrid Car: limiti con nome, definizioni di requisito con un numero, un enunciato, un soggetto e un require constraint, Inserisci, una specifica con requisiti annidati, satisfy, un requisito che la berlina non soddisfa più, la tabella dei requisiti, una Vista dei requisiti e il controllo di qualità. 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
attribute minElectricRange, aggiungereattribute minTopSpeed : SpeedValue = 180 [km/h];. - Sotto
requirement def <'VR-5'> ChargeTime, scegliere Inserisci ▾ → Definizione di requisito e scrivere<'VR-8'> TopSpeedcon l’enunciatoThe sports car shall reach at least the minimum top speed., il soggettocar : SportCarerequire constraint { car.topSpeed >= minTopSpeed }. - Dopo le altre righe
satisfy, aggiungeresatisfy requirement roadsterSpeed : TopSpeed by fleet.roadster;. - Cambiare
minTopSpeedin220 [km/h]. Puntare sul segno che l’Editor mette sul satisfy per leggere i valori confrontati, poi premere ⌘Z / Ctrl+Z. - Aprire Esigenze e requisiti → Requisiti e trovare VR-8, poi aprire Esigenze e requisiti → Qualità e fare clic su Controlla la qualità.
L’esercizio è completato quando VR-8 compare nella tabella Requisiti, il satisfy non ha alcun segno a 180 km/h e Controlla la qualità ha assegnato un punteggio al suo enunciato.
Verifica
- Perché tenere limiti come
maxCurbMasscome attributi con nome invece di scrivere il numero in ogni constraint? - In
requirement <'VR-1.1'> sedanMass : CurbMass { attribute :>> limit = maxCurbMass; }, che cosa fa:>>? - Che cosa permette di verificare a Holarch
satisfy carSpec by fleet.sedan;? - Lo Stato e la Priorità di un requisito si impostano nella pagina Requisiti. Il testo SysML cambia?
Mostra le risposte
Perché tenere limiti come
maxCurbMasscome attributi con nome invece di scrivere il numero in ogni constraint?Ogni requisito che usa il nome segue un’unica modifica, e il limite porta con sé la sua unità, quindi il controllo confronta valori con unità.
In
requirement <'VR-1.1'> sedanMass : CurbMass { attribute :>> limit = maxCurbMass; }, che cosa fa:>>?Ridefinisce l’attributo
limitche sedanMass eredita da CurbMass, dando a questo uso un valore proprio.Che cosa permette di verificare a Holarch
satisfy carSpec by fleet.sedan;?Se i valori della berlina rispettano i constraint di carSpec. Se la massa a vuoto della berlina supera il limite, l’Editor contrassegna il satisfy e mostra i valori confrontati.
Lo Stato e la Priorità di un requisito si impostano nella pagina Requisiti. Il testo SysML cambia?
No. Stato, priorità e metodo di verifica sono dati di Holarch tenuti accanto al modello; non modificano mai il testo.
Per saperne di più
Trascrizione
Mostra la trascrizione (narrazione e contenuto dello schermo)
Introduction
Chapter five: requirements. In SysML v2 a requirement can carry a constraint, so the model can check whether a design meets it.
In this chapter you write limits and requirement definitions, nest requirements in a specification, say what satisfies them, and see a requirement that is not met.
Start the tutorial
Start the tutorial Requirements from Project Files, Start a Tutorial. Its starter project holds a small copy of the design: a battery, a car, and a fleet with a sedan of fifteen hundred eighty kilograms.
On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Requirements → Start; Model → Editor.
Requirement definitions
Keep limits as named values, so one edit updates every requirement that uses them. After the requirements comment, add the maximum curb mass and the minimum battery capacity.
On screen: After // ---- Requirements ----: maxCurbMass and minBatteryCapacity.
Below the limits, write the first requirement definition. V R one is its number, doc is its statement, subject is what it is about, and require constraint makes it checkable: Holarch evaluates it with units.
On screen: Below the limits: requirement def <'VR-1'> CurbMass.
Insert
Insert writes the frame of a construct for you. Below the curb mass requirement, open Insert and choose Requirement Definition. Type its number and name, then press Tab to move to the subject, its type and the statement.
On screen: Insert ▾ (open on camera) → Requirement Definition; <'VR-3'> BatteryCapacity, Tab, battery, Tab, Battery, Tab, statement.
Then give it its constraint: the battery's capacity is at least the minimum.
On screen: After the doc line: require constraint { battery.capacity >= minBatteryCapacity }
Specification and satisfy
A specification holds the sedan's requirements. Each one is a usage of a definition, and the symbol after attribute redefines the limit with the sedan's own value.
On screen: After BatteryCapacity: requirement carSpec with sedanMass : CurbMass.
Now say what satisfies them. The sedan of the fleet satisfies the car specification, and a named satisfy says that the sedan's battery satisfies the battery capacity requirement.
On screen: After carSpec: satisfy carSpec by fleet.sedan; satisfy requirement batterySpec …
Break a requirement on purpose. In the fleet, change the sedan's curb mass from fifteen hundred eighty to seventeen hundred kilograms.
On screen: In fleet: curbMass = 1580 → 1700.
The Editor marks the satisfy: the sedan no longer meets V R one point one. Point at the mark to read the values it compared.
On screen: The mark on the satisfy; its information card.
Change it back, or press Command Z, and the mark clears.
On screen: curbMass = 1700 → 1580; No problems.
Pages on the model
The requirements pages work on the model. Open Needs and Requirements, then Requirements. The model's requirements are the rows, numbered by their short names. Status, priority and verification method are Holarch data next to the model; they never change the text.
On screen: Needs & Requirements → Requirements.
Open the Diagrams page, click New Diagram, and choose Requirement View. Choose the car specification under Shows, and click Create: the specification as a tree, with what satisfies it.
On screen: Diagrams → + New Diagram → Requirement View; Shows: VehicleRequirements::carSpec; Create.
Last, open Needs and Requirements, then Quality, and click Check Quality. Each requirement's statement is scored on the quality criteria, as in an LML project.
On screen: Needs & Requirements → Quality → Check Quality.
Recap
Every step is ticked off. Click Mark as Done.
On screen: Step panel → Mark as Done.
Let's recap. You named the limits, wrote requirement definitions with a number, a statement, a subject and a constraint, used Insert, nested requirements in a specification, said what satisfies them, and saw the Editor mark a requirement that was not met.
Next, verification cases check these requirements, and the matrix traces them.