Holarch
Capitoli del corso

Formazione · Percorso 9. Fondamenti di SysML v2 · Capitolo 9.3 di 8

9.3 Actions and Flows 4:31

Scrivere funzioni e un ciclo di guida come action e vederli come Action Flow View e come FFBD.

Mostra Holarch 2.22.

← 9.2 Ports and Interfaces · Tutti i capitoli · 9.4 States and Transitions →

Che cosa si impara

  • Definire una action con parametri di input e di output e un numero di funzione come nome breve
  • Scrivere una action con un fork, un join, successioni e flussi di item
  • Ottenere le corsie di una Action Flow View da `perform`
  • Scegliere la funzione di livello più alto in Analisi funzionale
  • Costruire i passi di un’action nel FFBD e ritrovarli nel testo

Scrivere action SysML v2 in Holarch, seguendo il tutorial SysML v2 Actions and Flows su un piccolo progetto Hybrid Car: definizioni di action con parametri e nomi brevi, un ciclo di guida con un fork, flussi e un join, una Action Flow View con corsie ottenute da perform, l’Analisi funzionale sul modello e passi costruiti nel FFBD che Holarch scrive nel testo. SysML è un marchio registrato di Object Management Group, Inc.

File di progetto

  • Progetto completato (.holarch.json; Gestisci progetti → File di progetto ▾ → Importa progetto (.json)…)

Il video viene riprodotto da holarch.app; vedere l’Informativa sulla privacy.

Esercitazione

Provare in prima persona in Holarch, sul progetto demo Hybrid Car (SysML v2).

  1. Aprire il progetto demo Hybrid Car (crearlo se necessario: Gestisci progetti → File di progetto ▾ → Nuovo progetto demo → Hybrid Car (SysML v2)), aprire Modello → Editor e il package VehicleBehavior.
  2. Sotto action def <'F.3'> DriveWheels, aggiungere action def <'F.4'> Refuel { in attribute fuelDemand : Real; out item fuel : Fuel; }.
  3. Aprire Comportamento → FFBD, fare clic su + Nuovo diagramma, scegliere Refuel e fare clic su Crea. Nel pannello Aggiungi, digitare Open Filler Door e premere Invio, poi Pump Fuel e Close Filler Door.
  4. Aprire Modello → Editor e trovare Refuel: il FFBD ha scritto i suoi tre passi e le successioni tra di essi.
  5. Aprire Comportamento → Flussi di action e la vista driveCycleFlow. Trovare la corsia che contiene brake, poi trovare la riga perform in DrivenCar che lo colloca lì.
  6. Aprire Comportamento → Analisi funzionale, fare clic su Scegli… e selezionare DriveCycle. Verificare che le sue funzioni siano numerate in base ai loro nomi brevi.

L’esercizio è completato quando Refuel mostra nell’Editor i suoi parametri, tre passi e le relative successioni, e si sa indicare la part la cui corsia contiene brake.

Verifica

  1. In first start then split; fork split; then supply; then produce;, quali passi vengono eseguiti in parallelo e che cosa li riunisce?
  2. Qual è la differenza tra first supply then ready; e flow of Fuel from supply.fuel to produce.fuel;?
  3. Da dove provengono le corsie di una Action Flow View?
Mostra le risposte
  1. In first start then split; fork split; then supply; then produce;, quali passi vengono eseguiti in parallelo e che cosa li riunisce?

    Dopo il fork split, supply e produce partono come rami paralleli; ogni then dopo un fork avvia un ramo. Il join ready attende entrambi prima del passo successivo.

  2. Qual è la differenza tra first supply then ready; e flow of Fuel from supply.fuel to produce.fuel;?

    Il primo è una successione: ordina i passi nel tempo. Il secondo è un flusso: porta un item Fuel dal parametro di output di un passo all’input di un altro passo e da solo non ordina i passi.

  3. Da dove provengono le corsie di una Action Flow View?

    Da perform: ogni part che esegue un passo, come part redefines tank { perform trip.supply; }, riceve una corsia con i passi che esegue.

Per saperne di più

Trascrizione

Mostra la trascrizione (narrazione e contenuto dello schermo)

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.