Capítulos del curso
Formación · Curso 9. Fundamentos de SysML v2 · Capítulo 9.5 de 8
9.5 Requisitos 4:15
Escribir requisitos comprobables, anidarlos en una especificación y ver uno que no se cumple.
Muestra Holarch 2.22.
Lo que aprenderá
- Nombrar los límites de los requisitos como atributos con unidades
- Escribir una definición de requisito con un número, un enunciado, un sujeto y una restricción require
- Anidar usos de requisito en una especificación y darles sus propios límites con `:>>`
- Indicar qué satisface un requisito y leer la marca del Editor cuando el diseño no lo cumple
- Comprobar los enunciados de los requisitos en la página Calidad
Escriba requisitos de SysML v2 en Holarch, siguiendo el tutorial de SysML v2 Requirements en un pequeño proyecto Hybrid Car: límites con nombre, definiciones de requisito con un número, un enunciado, un sujeto y una restricción require, Insertar, una especificación con requisitos anidados, satisfy, un requisito que el sedán ya no cumple, la tabla de requisitos, una Vista de requisitos y la comprobación de calidad. SysML es una marca registrada de Object Management Group, Inc.
Archivos de proyecto
- Proyecto terminado (.holarch.json; Gestionar proyectos → Archivos de proyecto ▾ → Importar proyecto (.json)…)
El vídeo se reproduce desde holarch.app; consulte la Política de privacidad.
Práctica
Hágalo usted mismo en Holarch, en el proyecto de demostración Hybrid Car (SysML v2).
- Abra su proyecto de demostración Hybrid Car (créelo si hace falta: Gestionar proyectos → Archivos de proyecto ▾ → Nuevo proyecto de demostración → Hybrid Car (SysML v2)), abra Modelo → Editor y el paquete
VehicleRequirements. - Después de
attribute minElectricRange, añadaattribute minTopSpeed : SpeedValue = 180 [km/h];. - Debajo de
requirement def <'VR-5'> ChargeTime, elija Insertar ▾ → Definición de requisito y escriba<'VR-8'> TopSpeedcon el enunciadoThe sports car shall reach at least the minimum top speed., el sujetocar : SportCaryrequire constraint { car.topSpeed >= minTopSpeed }. - Después de las demás líneas
satisfy, añadasatisfy requirement roadsterSpeed : TopSpeed by fleet.roadster;. - Cambie
minTopSpeeda220 [km/h]. Sitúe el puntero sobre la marca que el Editor pone en el satisfy para leer los valores que comparó y después pulse ⌘Z / Ctrl+Z. - Abra Necesidades y requisitos → Requisitos y busque VR-8; después abra Necesidades y requisitos → Calidad y haga clic en Comprobar calidad.
Habrá terminado cuando VR-8 esté en la tabla Requisitos, el satisfy no tenga marca a 180 km/h y Comprobar calidad haya puntuado su enunciado.
Compruebe lo aprendido
- ¿Por qué mantener límites como
maxCurbMasscomo atributos con nombre en lugar de escribir el número en cada restricción? - En
requirement <'VR-1.1'> sedanMass : CurbMass { attribute :>> limit = maxCurbMass; }, ¿qué hace:>>? - ¿Qué permite comprobar a Holarch
satisfy carSpec by fleet.sedan;? - Fija el Status y la Priority de un requisito en la página Requisitos. ¿Cambia el texto de SysML?
Mostrar las respuestas
¿Por qué mantener límites como
maxCurbMasscomo atributos con nombre en lugar de escribir el número en cada restricción?Todos los requisitos que usan el nombre siguen una única edición, y el límite lleva su unidad, de modo que el comprobador compara valores con unidades.
En
requirement <'VR-1.1'> sedanMass : CurbMass { attribute :>> limit = maxCurbMass; }, ¿qué hace:>>?Redefine el atributo
limitque sedanMass hereda de CurbMass y da a este uso su propio valor.¿Qué permite comprobar a Holarch
satisfy carSpec by fleet.sedan;?Si los valores del sedán cumplen las restricciones de carSpec. Si la masa en vacío del sedán supera el límite, el Editor marca el satisfy y muestra los valores comparados.
Fija el Status y la Priority de un requisito en la página Requisitos. ¿Cambia el texto de SysML?
No. El estado, la prioridad y el método de verificación son datos de Holarch que se guardan junto al modelo; nunca cambian el texto.
Más información
Transcripción
Mostrar la transcripción (narración y lo que aparece en pantalla)
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.