How to call Stateflow charts in a sequence
1 view (last 30 days)
I'm looking to set up a simulink/stateflow simulation to replicate a program that we currently are using, and I was wondering if it was possible to call a stateflow chart like a function. I know there is the Function Call option on the chart itself, but I'm not entirily sure if the way I want to set this up is compatible. Basically, I would like to recreate a simple main() while 1 loop that calls on a handful of flowcharts, something like this:
% The main project I am working with is coded with C++ so if there are
% minor syntax problems I apologize
% Program initialization
Ideally, I would like to be able to take the simulation and convert it BACK into C++ code and return with that structure as well, and I haven't been able to find a good way to go about that. I have my charts, and now I just would like to enter and run them once each in a sequence in a never ending loop.
Would it be benificial to create a main() chart, that outputs a function call, and each of these Chart_X() functions output the next function in the list? Or could I have 1 function block that contains that code above and it runs that chart without using the Function Call event?
In the photo, ideally the event() would be replaced with the Chart_X() function.
Another way of tackling it that I've tried, but am unsure of how to do, is having main() function block have one signal just used for the function call. It would connect to each chart and only activate teh one that is called in the main function sequence.
Thank you for the help!