Join the conversation

Sign in to join this conversation, and others like it, in the communities you care about.

Statecharts

Statecharts are a precise way of modeling the behaviour of complex reactive systems. They describe how things work, and can help you get your code doing exactly what you want.

Statecharts / General

Statechart Autocoding for the Mars Science Laboratory Mission

Statechart Autocoding for the Mars Science Laboratory Mission

Statecharts/General · September 9, 2018 at 3:24pm

Statechart Autocoding for the Mars Science Laboratory Mission

Statecharts / General · September 9, 2018 at 3:24pm
I want to share an interesting talk I found about statecharts in production in NASA: https://www.youtube.com/watch?v=VvssxOP95s0

September 9, 2018 at 3:58pm

Yes, in which they discuss how they use Magicdraw statechart diagrams (!) and generate (C, C++) code. Their statechart autocoder is now open sourced: https://github.com/JPLOpenSource/SCA

like-fill
2
  • reply
  • like

Yes, in which they discuss how they use Magicdraw statechart diagrams (!) and generate (C, C++) code. Their statechart autocoder is now open sourced: https://github.com/JPLOpenSource/SCA

Great!

  • reply
  • like

September 9, 2018 at 6:29pm

nice find!

like-fill
1
  • reply
  • like

I summarize the key take-aways (for me) :

- 10 statecharts *intercommunicating*, 100 states (that seems to validate away the idea of one global statechart for everything)

- every transition must be started by an event (that seems to reject eventless transitions)

- no nesting orthogonal regions

- no same event on multiple transitions from the same state (that seems to reject event propagation)

- UML timers can be implemented with entry and exit actions

- avoid orthogonal regions

- cover every path through the statecharts

- what looks like a simple state machine grows larger when off-nominal behaviour is added (he probably means off-the-happy-path, so stuff like error flows and such)

like-fill
3
  • reply
  • like

September 9, 2018 at 7:50pm

Funny enough, timers are implemented with entry/exit actions in xstate as well. Thanks for the summary @brucou - seems like some good best practices in general.

like-fill
1
  • reply
  • like

September 9, 2018 at 10:46pm

Absolutely. To nuance slightly, their context has safety-critical requirements, which obviously influence their set of practices. My feeling here is they avoid ambiguity like a plague and restrict the formalism in exchange for better safety properties. That might not translate as is to the UI domain (for instance, testing every path through the statecharts is a endless nightmare for any reasonably sized UI).

like-fill
2
  • reply
  • like

September 11, 2018 at 4:06pm

Great find! This is super interesting.

like-fill
1
  • reply
  • like
Your message here...

*bold*_italic_`code````codeblock```