State Machines - Inputs and Outputs

70 views
Skip to first unread message

avi-mak

unread,
Oct 29, 2021, 11:10:35 AM10/29/21
to SysML Forum
Hi,
I have for the first time started using State Machines in UML/SysML.

The only material I have at the momeent about the sytem I am doicumenting is a spec, which seems to describe the system as one object that is changing state depending on inputs.  

I want to know how to show explicit Inputs and Outputs  -- since the system definition has an external I/O interface with the outside world. 

I understand that inputs are the state transitions and are labeled on the transiiion line between two states, but:
 
1. Suppose you need two or more triggers to cause the state transition. How do you show this?

2.  How do you show the outputs of the statt machine? These can be outputs of any of the states, or the 'final outputs' when the final state is reached. 

Thanks
Avi


 how to  



James Towers

unread,
Nov 2, 2021, 10:19:12 PM11/2/21
to SysML Forum
Hi Avi, I hope you are well.

You can only have one trigger per transition, so the worst case scenario is you would need two transitions* starting and finishing on the same states. There are however two additionally pseudo-states, choice and join, which allow you to split or combine transitions thus making the language slightly more compact. 

Outputs are defined using SysML behaviours and typically consist of either setting a Value Property (of the owning block) or sending a Signal (via a port). You can do both of these within an Activity, and this Activity can be called either on a transition as the effect (The syntax of a transition is - Trigger [Guard] / Effect) or as one of the Entry, Do or Exit behaviours of a State.

If you are a devotee of classical State Machine theory you will know that a State Machine where all the outputs are set on the transitions is called a Mealy Machine, and one who’s outputs are set in the states is called a Moore Machine.

UML / SysML allows you to combine Mealy & Moore Machines which again makes the language more compact. 

Thanks
James

*This is not strictly true, since if your trigger is a change event e.g. when(count > 10) then as this is a Boolean expression, you can add more clause with an OR operator e.g. when((count > 10) OR (total == 0))

--
--
You received this message because you are subscribed to the Google
Groups "SysML Forum" group.
Public website: http://www.SysMLforum.com
To post to this group, send email to sysml...@googlegroups.com
To unsubscribe from this group, send email to
sysmlforum+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sysmlforum?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "SysML Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sysmlforum+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sysmlforum/b171bb97-0d93-42b8-9dde-b10bdc3506dcn%40googlegroups.com.

avi-mak

unread,
Nov 2, 2021, 10:20:06 PM11/2/21
to SysML Forum
Hi,

I have found the answer to my own question - I think. The platform I am using is EA, and EA allows you to add ports on the diagram border with information flow lines to connect to state elements.

Avi

James Towers

unread,
Nov 3, 2021, 11:06:11 PM11/3/21
to sysml...@googlegroups.com
Avi, can you share a nonproprietary example? It sounds like this is not SysML compliment (the concept of ports do not exist on State Machine diagrams) 

Sent from my iPhone

On 3 Nov 2021, at 02:20, avi-mak <amak...@gmail.com> wrote:

Hi,
--
--
You received this message because you are subscribed to the Google
Groups "SysML Forum" group.
Public website: http://www.SysMLforum.com
To post to this group, send email to sysml...@googlegroups.com
To unsubscribe from this group, send email to
sysmlforum+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sysmlforum?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "SysML Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sysmlforum+...@googlegroups.com.

avi-mak

unread,
Jul 8, 2022, 11:04:19 PM7/8/22
to SysML Forum
HI James,
Sorry I did not get back to you on this and great thanks for your time. Got busy doing "real work"... and had to stop learning...
I mean, what is the standard way that system input parameter values enter a state machine diagram from "outside"? (i.e., "values" that control the way the state machine operates.)
Regards
Avi 

James Towers

unread,
Jul 20, 2022, 10:50:36 PM7/20/22
to SysML Forum
Hi Avi,
Wow - that was a delay between messages!

State Machines are behaviours and so can be ‘called’ from anywhere that allows a behaviour, e.g. the classifier behaviour of a Block, the Method of an Operation, or the Type of a CallBehaviourAction as examples.
Unlike Activities, they don’t have parameter nodes, but instead are ’triggered’ by events in their owning Namespace. The types of triggers are:

SignalEvents - The arrival of a signal in their owning namespace
ChangeEvents - A change (false to true) of a Boolean expression whose variables are within the owning namespace (usually these are ValueProperties of the owning Block)
CallEvents - The calling of an Operation (owned by the Block)
TimeEvents - Absolute and Relative Time Events 

For the first three, a sending Block may update a receiving Block via the flow properties on a Port 

Regards
James


--
--
You received this message because you are subscribed to the Google
Groups "SysML Forum" group.
Public website: http://www.SysMLforum.com
To post to this group, send email to sysml...@googlegroups.com
To unsubscribe from this group, send email to
sysmlforum+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sysmlforum?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "SysML Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sysmlforum+...@googlegroups.com.

Lawrence Mcgovern

unread,
Jul 21, 2022, 9:55:13 AM7/21/22
to sysml...@googlegroups.com

avi-mak

unread,
Aug 7, 2022, 10:01:42 AM8/7/22
to SysML Forum
Hi James,
Now getting back to you faster than last time. 
   >> Unlike Activities, they don’t have parameter nodes, but instead are ’triggered’ by events in their owning Namespace. 
There are a number of things here. I understand that a state machine is for showing the states of a block during its lifetime.  However in addition, each state can show the block's processing (i) on  entry, (ii) after entry, which is its main processing, and (ii) on exit.  
So if I want to show that the state machine outputs a certain value on completion (i.e., on exit of an 'end' state, I suppose), then I supoose I would add something like:
    exit / send (<struct containing outputs value(s)> 

Correct?
Thanks
Avi


avi-mak

unread,
Aug 7, 2022, 10:01:53 AM8/7/22
to SysML Forum

James , I am back on this*.

 

First, thanks again for your responses, your patience, and the very useful and spot-on information.

 

>> can you share a nonproprietary example? It sounds like this is not SysML compliment (the concept of ports do not exist on State Machine diagrams) 

Ok - I see that I made a mistake back then.  

 

I was looking for a way to enter 'configuration set-up data' to the state machine, and for some reason I could not get my head around doing it by using signals, which I guess is the correct way. Signals was new to me. So I used something that was familiar to me, i.e., ports. 

 

So I understand that correct solutions could be as follows:

 

 

(1)   So if I want to set up a state machine by sending it data and then running it, I guess that  I must supply the data as properties within the signal.

 

Correct? 

 

(2) Also, if I want to get the state machine to send output data when it reaches its 'End' state,  I understand that the best thing is to include some OutputData() operation in the 'Do /' clause of the final state.

 

Correct?

 

(3) Also could I do a 'send signal' from the final state and this could be picked up by a reception input to an activity diagram.

 

Correct?

 

(*Excuse me that I didn't open with the usual salutation 'Hi (James)', but today is a mourning day in my religion – and one of our traditions is that we don't say 'Hi'.)

 

Thanks

Avi

avi-mak

unread,
Aug 7, 2022, 10:02:04 AM8/7/22
to SysML Forum

And with regards to your final comment:


 >> For the first three, a sending Block may update a receiving Block via the flow properties on a Port 

 

This is not yet something I have learned about. But I saw somewhere that you can associate a signal with a port. 

Or maybe that it is not what you meant.


Thanks

Avi




James Towers

unread,
Sep 11, 2022, 3:51:47 AM9/11/22
to SysML Forum
Answers below

On 7 Aug 2022, at 13:54, avi-mak <amak...@gmail.com> wrote:

James , I am back on this*.

 

First, thanks again for your responses, your patience, and the very useful and spot-on information.

 

>> can you share a nonproprietary example? It sounds like this is not SysML compliment (the concept of ports do not exist on State Machine diagrams) 

Ok - I see that I made a mistake back then.  

 

I was looking for a way to enter 'configuration set-up data' to the state machine, and for some reason I could not get my head around doing it by using signals, which I guess is the correct way. Signals was new to me. So I used something that was familiar to me, i.e., ports. 

 

So I understand that correct solutions could be as follows:

 
 

(1)   So if I want to set up a state machine by sending it data and then running it, I guess that  I must supply the data as properties within the signal. 



Correct? - This is one way you could do it, the State Machine can also access the value properties of the owning Block so you could just store the configuration data in those.

 

(2) Also, if I want to get the state machine to send output data when it reaches its 'End' state,  I understand that the best thing is to include some OutputData() operation in the 'Do /' clause of the final state.

 

Correct? - The Final State can’t have any behaviour so you would need to do this as the effect of the transition going to the final state. Alternatively you could put the whole thing inside a single composite (nesting) state and have the exit behaviour at that level.

 

(3) Also could I do a 'send signal' from the final state and this could be picked up by a reception input to an activity diagram.

 

Correct? - Not from the Final State (see above) but yes you could send a signal and use it to trigger an Accept Event Action in an Activity (NB the Activity will have to be already executing at the time, you can’t ‘start’ an Activity with a Signal)

 

(*Excuse me that I didn't open with the usual salutation 'Hi (James)', but today is a mourning day in my religion – and one of our traditions is that we don't say 'Hi'.)

 

Thanks

Avi

--
--
You received this message because you are subscribed to the Google
Groups "SysML Forum" group.
Public website: http://www.SysMLforum.com
To post to this group, send email to sysml...@googlegroups.com
To unsubscribe from this group, send email to
sysmlforum+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sysmlforum?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "SysML Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sysmlforum+...@googlegroups.com.

James Towers

unread,
Sep 11, 2022, 3:52:27 AM9/11/22
to SysML Forum
Hi Avi, sorry I missed this thread hence I didn’t reply straight away.

It’s actually uncommon for State Machines to end; usually, they execute for the entire lifetime of the object. Anyway, they can end and there is something called a Final State. However, this can’t have any behaviour, so if you want to ‘output’ something on exit, you would need to call another behaviour on the transition (this is called an effect) going into the Final State.

On 5 Aug 2022, at 14:50, avi-mak <amak...@gmail.com> wrote:usually

--
--
You received this message because you are subscribed to the Google
Groups "SysML Forum" group.
Public website: http://www.SysMLforum.com
To post to this group, send email to sysml...@googlegroups.com
To unsubscribe from this group, send email to
sysmlforum+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sysmlforum?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "SysML Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sysmlforum+...@googlegroups.com.

avi-mak

unread,
Dec 9, 2022, 10:10:38 AM12/9/22
to SysML Forum
Hi James,
Sorry for not responding to your reply on time. (And I keep doing this...). 
Thank you very much for your response.  
Avi

Michael Campbell

unread,
Dec 9, 2022, 12:14:39 PM12/9/22
to sysml...@googlegroups.com
I am sorry and I usually don't reply to this, but I have to suggest something here. 

A state machine diagram shows how a "block" changes as the system changes over time. The block can show how it changes over time with inputs and generate outputs that will eventually create another state, correct?

The other issue is, state machines can end, i.e., the final state. They have a beginning state, so why not a final state. Take water for instance. Starting state might be ice. Leave it out overnight, its now water. Add heat, it becomes vapor. Water vapor then evaporates in air. In that state, the final state is Water Vapor for water. But yes, the final state will not have an output, because the final state is the last output or state in which the system or "block" is composed of. 

But in between states, there has to be activities that physically change the state of the "block". In describing a state of a "block" after the block has physically changed, the new state is now a characteristic of the previous block. Take Crude Oil for instance. Crude Oil gets heated and cooled to provide many different forms of gas and oil to provide different functions. Crude Oil as the starting state can have many final states like propane, butane, ethanol, etc..., and these are all just characteristics of what oil used to be after an activity like heating or cooling takes place to change the state of Crude Oil to the specific state needed for a specific function. 

I hope that makes sense and its something I have consistently battles with about state machine diagrams in sysML. 

--
--
You received this message because you are subscribed to the Google
Groups "SysML Forum" group.
Public website: http://www.SysMLforum.com
To post to this group, send email to sysml...@googlegroups.com
To unsubscribe from this group, send email to
sysmlforum+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sysmlforum?hl=en_US?hl=en
---
You received this message because you are subscribed to the Google Groups "SysML Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sysmlforum+...@googlegroups.com.


--
-Michael
Reply all
Reply to author
Forward
0 new messages