by all2 · 1y ago · 0 comments
I'm in the process of writing a golang library, if you're interested in seeing some raw development (IE, I'm in the middle of designing dev UX, and the guts of the lib have yet to be implemented).
You may also consider n8n for your uses. As workflow management goes, it is quite robust.
For embedded work, I honestly don't know. I do know that golang can be transpiled into C (https://tinygo.org/) and tinygo + qmuntal/stateless might work really well for your use-case.
Here's an example I had Claude throw together for states/substates for a door with a lock
https://mermaidchart.com/play?utm_source=mermaid_live_editor...
Wow. That's a lot of link. Here's the raw chart:
stateDiagram-v2
[*] --> Closed
state Closed {
[*] --> Locked
Locked --> Unlocked: unlock / disengageBolt()
Unlocked --> Locked: lock / engageBolt()
}
Closed --> Open: open [unlocked] / swing()
Open --> Closed: close / checkSensors()
note right of Closed
Composite state with
two substates
end note
note left of Open
Simple state
end note
Locked: entry / engageBolt()
Unlocked: entry / disengageBolt()
Open: entry / startTimer()
Open: exit / stopTimer()
The syntax in the text labels is written the same way the Harel paper proposes: <State>: <entry/exit> / <action>()I definitely don't need super sophisticated functionality, but I'm trying learn a little more about formal system specification, modeling and verification like in https://mitpress.mit.edu/9780262548922/principles-of-cyber-p... and https://ptolemy.berkeley.edu/books/leeseshia/ while I'm working on this project(it might be a stretch, i'm trying to pack a lot of outcomes into one project in finite time).
I want to be able to do things like prove certain bad states are unreachable or that a certain state of the system will eventually be reached, stuff like that. I'm intrigued by the idea of analyzing/enumerating traces and the dynamical systems perspectives of trajectories through state space (background in physics- statistical mechanics).
My thinking is that the more formal and precise I am with specifying the state machine to begin with, the easier the analyses/modeling will be. I'm following a configuration-driven approach where the whole system is specified/composed from YAML/JSON, so I was planning in this iteration to come up with like a pydantic model to specify state machine behavior.
I'll have to think about testing methods more. There are a few things I would want to know about a single FSM: does it exit (various exit states, either error final state or valid final state), are there unreachable states, does it loop in places it shouldn't, does it enter states it shouldn't for a given stimuli (Events + Guards are the params for this test). I think there's also a place for event fuzzing to try and break the machine.
[0] https://www.linkedin.com/pulse/verification-testing-fsms-too...