Course chapters
Training · Track 9. SysML v2 Fundamentals · Chapter 9.3 of 8
9.3 Actions and Flows 4:31
Write functions and a drive cycle as actions, and see them as an Action Flow View and an FFBD.
Shows Holarch 2.22.
What you’ll learn
- Define an action with input and output parameters and a function number as its short name
- Write an action with a fork, a join, successions and item flows
- Get swim lanes in an Action Flow View from `perform`
- Pick the top-level function in Functional Analysis
- Build an action's steps in the FFBD and find them in the text
Write SysML v2 actions in Holarch, following the SysML v2 tutorial Actions and Flows on a small Hybrid Car project: action definitions with parameters and short names, a drive cycle with a fork, flows and a join, an Action Flow View with swim lanes from perform, Functional Analysis on the model, and steps built in the FFBD that Holarch writes into the text. SysML is a registered trademark of Object Management Group, Inc.
Project files
- Finished project (.holarch.json; Manage Projects → Project Files ▾ → Import Project (.json)…)
The video plays from holarch.app; see the Privacy Policy.
Practice
Do this yourself in Holarch, on the Hybrid Car demo project (SysML v2).
- Open your Hybrid Car demo project (create it if needed: Manage Projects → Project Files ▾ → New Demo Project → Hybrid Car (SysML v2)), open Model → Editor and the package
VehicleBehavior. - Below
action def <'F.3'> DriveWheels, addaction def <'F.4'> Refuel { in attribute fuelDemand : Real; out item fuel : Fuel; }. - Open Behavior → FFBD, click + New Diagram, choose
Refueland click Create. In the Add panel, typeOpen Filler Doorand press Enter, thenPump FuelandClose Filler Door. - Open Model → Editor and find
Refuel: the FFBD wrote its three steps and the successions between them. - Open Behavior → Action Flows and the view
driveCycleFlow. Find the lane that holdsbrake, then find theperformline inDrivenCarthat puts it there. - Open Behavior → Functional Analysis, click Choose… and pick
DriveCycle. Check that its functions are numbered by their short names.
You're done when Refuel shows its parameters, three steps and their successions in the Editor, and you can name the part whose lane holds brake.
Check yourself
- In
first start then split; fork split; then supply; then produce;, which steps run in parallel, and what brings them back together? - What is the difference between
first supply then ready;andflow of Fuel from supply.fuel to produce.fuel;? - Where do the swim lanes of an Action Flow View come from?
Show the answers
In
first start then split; fork split; then supply; then produce;, which steps run in parallel, and what brings them back together?After the fork
split,supplyandproducestart as parallel branches; eachthenafter a fork starts a branch. The joinreadywaits for both before the next step.What is the difference between
first supply then ready;andflow of Fuel from supply.fuel to produce.fuel;?The first is a succession: it orders the steps in time. The second is a flow: it carries a Fuel item from one step's output parameter to another step's input, and does not order the steps by itself.
Where do the swim lanes of an Action Flow View come from?
From
perform: each part that performs a step, such aspart redefines tank { perform trip.supply; }, gets a lane with the steps it performs.
Read more
Transcript
Show the transcript (narration and what is on screen)
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.