menu

Statecharts

Statecharts are a precise, visual 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.

Channels
Team

Statechart Autocoding for the Mars Science Laboratory Mission

September 9, 2018 at 3:24pm

Statechart Autocoding for the Mars Science Laboratory Mission

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

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

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

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