Holarch
Главы курса

Обучение · Курс 9. Основы SysML v2 · Глава 9.3 из 8

9.3 Действия и потоки 4:31

Запишите функции и ездовой цикл как действия и посмотрите на них в представлении Action Flow и на FFBD.

Показан Holarch 2.22.

← 9.2 Порты и интерфейсы · Все главы · 9.4 Состояния и переходы →

Чему вы научитесь

  • Определять действие с входными и выходными параметрами и номером функции в качестве короткого имени
  • Записывать действие с разветвлением (fork), слиянием (join), последовательностями (succession) и потоками предметов
  • Получать дорожки в представлении Action Flow из `perform`
  • Выбирать функцию верхнего уровня в функциональном анализе
  • Строить шаги действия на FFBD и находить их в тексте

Запишите действия SysML v2 в Holarch по учебному материалу SysML v2 «Actions and Flows» на небольшом проекте Hybrid Car: определения действий с параметрами и короткими именами, ездовой цикл с разветвлением, потоками и слиянием, представление Action Flow с дорожками из perform, функциональный анализ на модели и шаги, построенные на FFBD, которые Holarch записывает в текст. SysML является зарегистрированным товарным знаком Object Management Group, Inc.

Файлы проектов

  • Готовый проект (.holarch.json; Управление проектами → Файлы проекта ▾ → Импортировать проект (.json)…)

Видео воспроизводится с holarch.app; см. Политику конфиденциальности.

Практика

Выполните это сами в Holarch на демо-проекте Hybrid Car (SysML v2).

  1. Откройте свой демо-проект Hybrid Car (при необходимости создайте его: Управление проектами → Файлы проекта ▾ → Новый демо-проект → Hybrid Car (SysML v2)), откройте Модель → Редактор и пакет VehicleBehavior.
  2. Под action def <'F.3'> DriveWheels добавьте action def <'F.4'> Refuel { in attribute fuelDemand : Real; out item fuel : Fuel; }.
  3. Откройте Поведение → FFBD, нажмите + Новая диаграмма, выберите Refuel и нажмите Создать. На панели Добавить введите Open Filler Door и нажмите Enter, затем Pump Fuel и Close Filler Door.
  4. Откройте Модель → Редактор и найдите Refuel: FFBD записала три шага и последовательности (succession) между ними.
  5. Откройте Поведение → Потоки действий и представление driveCycleFlow. Найдите дорожку, в которой находится brake, затем найдите строку perform в DrivenCar, которая помещает его туда.
  6. Откройте Поведение → Функциональный анализ, нажмите Выбрать… и выберите DriveCycle. Проверьте, что его функции пронумерованы по их коротким именам.

Готово, когда Refuel показывает в редакторе свои параметры, три шага и последовательности между ними, и вы можете назвать часть, на дорожке которой находится brake.

Проверьте себя

  1. Какие шаги в first start then split; fork split; then supply; then produce; выполняются параллельно и что снова сводит их вместе?
  2. Чем отличаются first supply then ready; и flow of Fuel from supply.fuel to produce.fuel;?
  3. Откуда берутся дорожки представления Action Flow?
Показать ответы
  1. Какие шаги в first start then split; fork split; then supply; then produce; выполняются параллельно и что снова сводит их вместе?

    После разветвления split шаги supply и produce начинаются как параллельные ветви; каждое then после fork начинает ветвь. Слияние ready ждёт обе ветви перед следующим шагом.

  2. Чем отличаются first supply then ready; и flow of Fuel from supply.fuel to produce.fuel;?

    Первое — последовательность (succession): она упорядочивает шаги во времени. Второе — поток (flow): он переносит предмет Fuel из выходного параметра одного шага во входной параметр другого и сам по себе шаги не упорядочивает.

  3. Откуда берутся дорожки представления Action Flow?

    Из perform: каждая часть, выполняющая шаг, например part redefines tank { perform trip.supply; }, получает дорожку с шагами, которые она выполняет.

Подробнее

Расшифровка

Показать расшифровку (дикторский текст и то, что на экране)

Introduction

Chapter three: actions and flows. Actions describe what the system does, in what order, and what passes between the steps.

In this chapter you define functions with parameters, write a drive cycle with a fork, flows and a join, see it as an Action Flow View with swim lanes, and build steps in the FFBD.

Start the tutorial

Start the tutorial Actions and Flows from Project Files, Start a Tutorial. Its starter project holds the fuel and torque items, two of the car's three functions, and the parts that will perform them.

On screen: Project Files ▾ → Start a Tutorial… → SysML v2: Actions and Flows → Start; Model → Editor.

Functions

An action definition describes something the system does, and its parameters say what goes in and out. Below the torque item, define Supply Fuel. The short name in angle brackets, F one, is its function number.

On screen: Below item def Torque; type action def <'F.1'> SupplyFuel.

The drive cycle

Now the drive cycle, at the end of the package. Its action usages are the steps, each typed by a function. First start, then split, begins with a fork, and each then after the fork starts a parallel branch.

On screen: After DriveWheels; type action def <'F'> DriveCycle with the fork and two steps.

A flow carries an item from one step's output to another step's input. After the two steps, add a flow that carries the fuel from the supply step to the torque step.

On screen: After action produce: flow of Fuel from supply.fuel to produce.fuel;

Both branches end at a join named ready. Then the car drives the wheels, and the trip is done. A second flow carries the torque to the drive step.

On screen: After the flow: successions to the join ready, then action drive, then done; flow of torque.

The Action Flow View

Now see the drive cycle as a view. Open Behavior, then Action Flows, and click New Diagram. Keep Action Flow View, choose the drive cycle under Shows, and click Create.

On screen: Behavior → Action Flows → + New Diagram; Shows: VehicleBehavior::DriveCycle; Create.

Steps are rounded boxes, with their parameters as pins. The fork and the join are bars, and the flows are arrows between pins.

On screen: The view.

Swim lanes come from perform. Back in the Editor, at the end of the package, add a driven car. It performs the drive cycle as its trip, and its parts perform the steps.

On screen: Model → Editor; after DriveCycle: part def DrivenCar with perform.

Open the Action Flow View again. It now has a lane for each part that performs a step.

On screen: Behavior → Action Flows → the view; lanes tank, engine, transmission.

Functional Analysis and the FFBD

The same model drives Functional Analysis. Open it under Behavior, click Choose, and pick the drive cycle. Its functions are the steps, numbered by their short names.

On screen: Behavior → Functional Analysis; Choose… → DriveCycle.

Back in the Editor, at the end of the package, declare one more action: emergency shutdown. You build its steps in the FFBD.

On screen: Model → Editor; after DrivenCar: action def EmergencyShutdown;

Open Behavior, then FFBD, and click New Diagram. Type the start of emergency shutdown, pick it from the list, and click Create.

On screen: Behavior → FFBD → + New Diagram; Diagram of: EmergencyShutdown; Create.

In the Add panel, type Open Contactors and press Enter, then Cut Fuel. Each step is written into the model with its succession, one undo step each.

On screen: Add panel: Open Contactors ↵, Cut Fuel ↵.

Open the Editor and find emergency shutdown. The FFBD wrote its steps, and the successions between them.

On screen: Model → Editor: EmergencyShutdown with two steps and successions.

Recap

Every step is ticked off. Click Mark as Done.

On screen: Step panel → Mark as Done.

Let's recap. You defined functions with parameters and short names, wrote a drive cycle with a fork, flows and a join, saw it as an Action Flow View with lanes from perform, and built steps in the FFBD that Holarch wrote into the text.

Next, states and transitions describe how the car reacts to events.