Click here to Skip to main content
15,790,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there, i have a c++ embedded system project with a main EFSM (PCOXS Central pumps) with other objects to control: n production pumps (0, max 8), n distribution pumps (0, max 8).
The topic is oenology.
Each sub object (production pump or distribution pump) has an EFSM too.

What I have tried:

I saw only the case with 1 EFSM machine using switch and enum states. One state graph function. There is also a timer class to perform action when the timer isOver.
How can i solve that problem with multiple EFSM ? Using threads ?

I'm thinking about c++ composition but i can't imagine the problem with more than 1 EFSM.

Thanks in advance
Francesco (Italy)
Updated 5-Jan-17 21:26pm
nv3 6-Jan-17 4:42am    
Can you post the code of your EFSM or at least the essential parts of it? Much depends on how your EFSM is organized. Depending on that you can just interleave the operation of multiple EFSM by calling their execute functions in a loop, or you will have to organize them in separate threads of fibers.

1 solution

At first you get multiple instances of the EFSM. You may solve that via structs or class objects in an array.

I think threads would be the clearest way, but you may need some syncronization. Another way is to write a queque with timely sorted actions, so you know which action on which object can be done.

A big issue will be the time tolerances or differences in called action and their real time behavior.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900