Розділи курсів
Навчання · Курс 9. Основи SysML v2 · Розділ 9.5 з 8
9.5 Вимоги 4:15
Пишіть перевірювані вимоги, вкладайте їх у специфікацію й побачте вимогу, яку не виконано.
Показано Holarch 2.22.
Що ви дізнаєтеся
- Іменувати межі вимог як атрибути з одиницями
- Написати визначення вимоги з номером, формулюванням, суб’єктом і require constraint
- Вкладати використання вимог у специфікацію й давати їм власні межі через `:>>`
- Указати, що задовольняє вимогу, і прочитати позначку Редактора, коли проєкт її не виконує
- Перевіряти формулювання вимог на сторінці «Якість»
Пишіть вимоги SysML v2 у Holarch за навчальним посібником SysML v2 Requirements на невеликому проєкті Hybrid Car: іменовані межі, визначення вимог із номером, формулюванням, суб’єктом і require constraint, «Вставити», специфікація з вкладеними вимогами, satisfy, вимога, яку седан більше не виконує, таблиця вимог, подання вимог і перевірка якості. SysML є зареєстрованою торговельною маркою Object Management Group, Inc.
Файли проєкту
- Готовий проєкт (.holarch.json; Керування проєктами → Файли проєкту ▾ → Імпортувати проєкт (.json)…)
Відео відтворюється з holarch.app; див. Політику конфіденційності.
Практика
Виконайте це самі в Holarch на демопроєкті Hybrid Car (SysML v2).
- Відкрийте свій демопроєкт Hybrid Car (за потреби створіть його: Керування проєктами → Файли проєкту ▾ → Новий демопроєкт → Hybrid Car (SysML v2)), відкрийте Модель → Редактор і пакет
VehicleRequirements. - Після
attribute minElectricRangeдодайтеattribute minTopSpeed : SpeedValue = 180 [km/h];. - Під
requirement def <'VR-5'> ChargeTimeоберіть Вставити ▾ → Визначення вимоги і напишіть<'VR-8'> TopSpeedз формулюваннямThe sports car shall reach at least the minimum top speed., суб’єктомcar : SportCarіrequire constraint { car.topSpeed >= minTopSpeed }. - Після інших рядків
satisfyдодайтеsatisfy requirement roadsterSpeed : TopSpeed by fleet.roadster;. - Змініть
minTopSpeedна220 [km/h]. Наведіть вказівник на позначку, яку Редактор ставить на satisfy, щоб прочитати порівняні значення, потім натисніть ⌘Z / Ctrl+Z. - Відкрийте Потреби та вимоги → Вимоги і знайдіть VR-8, потім відкрийте Потреби та вимоги → Якість і натисніть Перевірити якість.
Завдання виконано, коли VR-8 є в таблиці вимог, satisfy не має позначки при 180 km/h, а «Перевірити якість» оцінила її формулювання.
Перевірте себе
- Чому варто зберігати межі, як-от
maxCurbMass, як іменовані атрибути, а не писати число в кожному обмеженні? - Що робить
:>>уrequirement <'VR-1.1'> sedanMass : CurbMass { attribute :>> limit = maxCurbMass; }? - Що дає змогу перевірити Holarch рядок
satisfy carSpec by fleet.sedan;? - Ви встановлюєте Статус і Пріоритет вимоги на сторінці «Вимоги». Чи змінюється текст SysML?
Показати відповіді
Чому варто зберігати межі, як-от
maxCurbMass, як іменовані атрибути, а не писати число в кожному обмеженні?Кожна вимога, що використовує це ім’я, змінюється однією правкою, а межа несе свою одиницю, тож засіб перевірки порівнює значення з одиницями.
Що робить
:>>уrequirement <'VR-1.1'> sedanMass : CurbMass { attribute :>> limit = maxCurbMass; }?Він перевизначає атрибут
limit, який sedanMass успадковує від CurbMass, і дає цьому використанню власне значення.Що дає змогу перевірити Holarch рядок
satisfy carSpec by fleet.sedan;?Чи відповідають значення седана обмеженням carSpec. Якщо споряджена маса седана перевищує межу, Редактор позначає satisfy й показує порівняні значення.
Ви встановлюєте Статус і Пріоритет вимоги на сторінці «Вимоги». Чи змінюється текст SysML?
Ні. Статус, пріоритет і метод верифікації — це дані Holarch, які зберігаються поруч із моделлю; вони ніколи не змінюють текст.
Докладніше
Стенограма
Показати стенограму (озвучення і те, що на екрані)
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.