Capítulos do curso
Treinamento · Trilha 9. Fundamentos do SysML v2 · Capítulo 9.3 de 8
9.3 Ações e fluxos 4:31
Escreva funções e um ciclo de condução como ações e veja-os como uma Action Flow View e um FFBD.
Mostra o Holarch 2.22.
O que você vai aprender
- Definir uma ação com parâmetros de entrada e de saída e um número de função como nome curto
- Escrever uma ação com um fork, um join, sucessões e fluxos de itens
- Obter raias em uma Action Flow View a partir de `perform`
- Escolher a função de nível superior em Análise funcional
- Montar os passos de uma ação no FFBD e encontrá-los no texto
Escreva ações SysML v2 no Holarch, seguindo o tutorial de SysML v2 Actions and Flows em um pequeno projeto Hybrid Car: definições de ação com parâmetros e nomes curtos, um ciclo de condução com um fork, fluxos e um join, uma Action Flow View com raias a partir de perform, Análise funcional sobre o modelo e passos montados no FFBD que o Holarch escreve no texto. SysML é uma marca registrada da Object Management Group, Inc.
Arquivos de projeto
- Projeto concluído (.holarch.json; Gerenciar projetos → Arquivos de projeto ▾ → Importar projeto (.json)…)
O vídeo é reproduzido a partir de holarch.app; veja a Política de Privacidade.
Prática
Faça isto você mesmo no Holarch, no projeto de demonstração Hybrid Car (SysML v2).
- Abra seu projeto de demonstração Hybrid Car (crie-o se necessário: Gerenciar projetos → Arquivos de projeto ▾ → Novo projeto de demonstração → Hybrid Car (SysML v2)), abra Modelo → Editor e o pacote
VehicleBehavior. - Abaixo de
action def <'F.3'> DriveWheels, adicioneaction def <'F.4'> Refuel { in attribute fuelDemand : Real; out item fuel : Fuel; }. - Abra Comportamento → FFBD, clique em + Novo diagrama, escolha
Refuele clique em Criar. No painel Adicionar, digiteOpen Filler Doore pressione Enter, depoisPump FueleClose Filler Door. - Abra Modelo → Editor e encontre
Refuel: o FFBD escreveu seus três passos e as sucessões entre eles. - Abra Comportamento → Fluxos de ações e a visão
driveCycleFlow. Encontre a raia que contémbrakee depois encontre a linhaperformemDrivenCarque o coloca ali. - Abra Comportamento → Análise funcional, clique em Escolher… e escolha
DriveCycle. Confira que suas funções estão numeradas pelos nomes curtos.
Você terminou quando Refuel mostrar seus parâmetros, três passos e as sucessões entre eles no Editor, e você souber dizer qual parte tem a raia que contém brake.
Teste-se
- Em
first start then split; fork split; then supply; then produce;, quais passos são executados em paralelo, e o que os reúne de novo? - Qual é a diferença entre
first supply then ready;eflow of Fuel from supply.fuel to produce.fuel;? - De onde vêm as raias de uma Action Flow View?
Mostrar as respostas
Em
first start then split; fork split; then supply; then produce;, quais passos são executados em paralelo, e o que os reúne de novo?Depois do fork
split,supplyeproducecomeçam como ramos paralelos; cadathendepois de um fork inicia um ramo. O joinreadyespera pelos dois antes do próximo passo.Qual é a diferença entre
first supply then ready;eflow of Fuel from supply.fuel to produce.fuel;?O primeiro é uma sucessão: ordena os passos no tempo. O segundo é um fluxo: transporta um item Fuel do parâmetro de saída de um passo para a entrada de outro passo, e não ordena os passos por si só.
De onde vêm as raias de uma Action Flow View?
De
perform: cada parte que executa um passo, comopart redefines tank { perform trip.supply; }, recebe uma raia com os passos que executa.
Saiba mais
Transcrição
Mostrar a transcrição (narração e o que aparece na tela)
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.