State flow General question

Hi,

I have question on stateflow. In PLECS, state flow has 3 sub states (Enter, During and Exit).

(1) Do these substates run in parallel or one after the other. I mean when input condition is true, then logic inside “Enter” section executes and when condition is no longer satisifed, control exists the state flow, during this time logic inside “Exit” section executes ??

(2) Is there a way to find gradient of a input signal in these substates ,like “During” substate. I want to find (input(i+1)-input(i)) for each and every iteration.

(3) Is it possible to define a timer inside these substates.

Any help is appreciated.

Thanks

> Do these substates run in parallel or one after the other…

From the PLECS Manual:

"During each execution, the following steps are performed:

The triggers and conditions of all transitions leaving the currently active state are evaluated.If a transition “fires”, i.e. if both trigger and condition are true, the State Machine executes the Exit action of the current state followed by the transition action and the Enter action of the target state.If no transition fires, the During action of the current state is executed."> Is there a way to find gradient of a input signal in these substates ,like “During” substate. I want to find (input(i+1)-input(i)) for each and every iteration.> Is it possible to define a timer inside these substates. C programming language is used for the Enter, Exit, and During actions. Therefore you have the flexibility to implement the algorithms described. Refer to the manual, especially the “State Machine Configuration” section if you want to add variables or functions accessible from multiple states.

One more comment, for integration and timers you should be cognizant of the sample time for the State Machine and should likely use a Discrete-Periodic sample time.