Capitoli del corso
Formazione · Percorso 3. Comportamento e architettura · Capitolo 3.2 di 6
3.2 Diagrammi di Action 2:55
Scomporre una funzione in passi con rami paralleli, una decisione e l’elemento che attiva un passo.
Mostra Holarch 1.27.
Che cosa si impara
- Aprire una funzione come diagramma di Action e aggiungere passi trascinando Action sulla linea
- Aggiungere rami paralleli e una decisione con probabilità dei rami che sommano al 100%
- Creare un Input/Output che un passo genera e un altro passo riceve come trigger
- Spiegare come i passi del diagramma diventano Action nel modello
Aprire Rent a Bike come diagramma di Action e costruirne i passi sulla tela: azioni in serie, un ramo parallelo, una decisione con probabilità dei rami e un elemento di input/output che un passo produce e un altro passo riceve.
File di progetto
- Progetto iniziale (.holarch.json; Gestisci progetti → File di progetto ▾ → Importa progetto (.json)…)
- 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 CubeSat EO-1.
- Aprire il proprio progetto demo EO-1, oppure crearlo: Gestisci progetti → File di progetto ▾ → Nuovo progetto demo → CubeSat (ingegneria dei sistemi guidata).
- Nel Database, selezionare F10 Enter Safe Mode e scegliere Apri in ▾ → Diagramma di Action.
- Trascinare Azione dal pannello Aggiungi sulla linea e chiamarla
Detect Undervoltage. Poi trascinare un Parallelo sulla linea dopo di essa, conShed Payload Loadssu un ramo ePoint Arrays to Sunsull’altro. - Trascinare un O sulla linea dopo il Parallelo e chiamarlo
Battery recovered?. Nell’ispettore, impostare le probabilità dei rami a 80 e 20, e mettereResume Nominal Modesul primo ramo eKeep Chargingsul secondo. - Trascinare Input/Output su Detect Undervoltage e chiamarlo
Undervoltage Flag. Trascinare la maniglia sotto l’I/O su Shed Payload Loads e scegliere Input (trigger).
L’esercizio è completato quando il diagramma di F10 mostra i cinque passi, i rami paralleli, l’OR con Totale 100% e Undervoltage Flag che passa da Detect Undervoltage a Shed Payload Loads.
Verifica
- Che cosa aggiunge al modello il rilascio di un’Action sulla linea?
- Qual è la differenza tra un input di attivazione e un input facoltativo?
- Perché le probabilità dei rami di un OR devono sommare al 100%?
Mostra le risposte
Che cosa aggiunge al modello il rilascio di un’Action sulla linea?
Una nuova Action, decomposta sotto la funzione a cui appartiene il diagramma, in quel punto del suo flusso. Compare nel Database e in ogni vista che la mostra.
Qual è la differenza tra un input di attivazione e un input facoltativo?
Un passo con un input di attivazione non inizia finché quell’elemento non arriva. Un input facoltativo viene ricevuto ma non trattiene il passo.
Perché le probabilità dei rami di un OR devono sommare al 100%?
Il Simulatore sceglie un ramo in base alla sua probabilità. Se i numeri non sommano al 100%, l’ispettore lo segnala. Se le probabilità non sono note, scegliere Nessuna: il Simulatore lo chiede allora durante l’esecuzione, e Monte Carlo usa probabilità uguali.
Per saperne di più
Trascrizione
Mostra la trascrizione (narrazione e contenuto dello schermo)
Introduction
Welcome back. This chapter takes one function, Rent a Bike, and draws what happens inside it, step by step.
You will build an action diagram on the canvas, from the Add panel.
The canvas
Open the Database, select Rent a Bike, and choose Open in, then Action Diagram. The canvas starts with a start, an end, and the line between them. The Add panel on the left holds the building blocks.
On screen: Database → F.1 → Open in ▾ → Action Diagram.
Steps in order
Drag an Action onto the line, and name it Identify Rider. The rider taps a card or a phone at the kiosk.
On screen: Action → line → Identify Rider.
The next step drops onto the line after it: Check Account. The back office confirms the rider can rent. Each new step is joined to the last for you.
On screen: Action → Check Account.
Parallel branches and a decision
Two things happen at once next: the bay unlocks, and the kiosk shows the rider which bay it is. Drag a Parallel onto the line. It opens two branches that start together and join when both finish.
On screen: Parallel → line.
Drop an action onto each branch: Unlock Bay on the first, Show Bay Number on the second.
On screen: An action on each branch.
Then a decision: does the rider take the bike within thirty seconds? Drag an Or onto the line, and put the question in its name.
On screen: Or → line → name.
Each branch of a decision has a probability, for simulation later. Most riders take the bike: ninety-five percent for yes, five for no. The panel checks that they add up to one hundred.
On screen: Branch probabilities 95 / 5.
On the yes branch the rental starts: Start Rental. On the no branch the bay locks again: Relock Bay.
On screen: An action on each branch.
Inputs and outputs
Steps also pass items to each other. Drag an Input/Output onto Check Account: the step now produces it. Name it Unlock Code, the approval the back office sends.
On screen: I/O → Check Account → Unlock Code.
Unlock Bay receives the code, and receiving it is what starts that step. Drag from the handle on Unlock Code onto Unlock Bay, and choose Input, trigger. An optional input would not start the step.
On screen: Handle on Unlock Code → Unlock Bay → Input (trigger).
The diagram is part of the model. The steps are actions under Rent a Bike, and the item and its links appear in the Database and on every view that shows them.
On screen: The completed action diagram.
Recap
Let's recap. You opened a function as an action diagram, dropped steps onto the line, added parallel branches and a decision with probabilities, and connected an item that triggers a step.
Next, you decide which part of the dock performs each function: allocation.