Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

State flow General question

0 votes
314 views
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
asked Jan 29, 2021 by Samk (16 points)

1 Answer

0 votes

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

From the PLECS Manual:

"During each execution, the following steps are performed:

  1. The triggers and conditions of all transitions leaving the currently active state are evaluated.
  2. 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.
  3. 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.
 
 
answered Feb 5, 2021 by Bryan Lieblick (1,853 points)
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.
...