Главы курса
Обучение · Курс 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.