Stateflow controller guard conditions
Show older comments
I'm attempting to build a simulink model of a hybrid electric drivetrain for a college course. I was wondering, when creating the guards for transitions between different states in a stateflow controller, what's the proper way to define a range of values for which you want the transition to happen?
For example, I want to transition from state 1 to state 2 if the variable Driver_Torque_Request falls between 0 and 0.7. I wrote the guard as such: [0<Driver_Torque_Request<=0.7], but I get unexpected behavior from the controller, eg constant looping between states 1 and 2 despite the fact that Driver_Torque_Request stays constant at zero.
I've also tried several permutations of the guard but haven't had any luck. Any ideas what might be the problem? I appreciate any guidance. Project due this Thursday!
Answers (1)
Fangjun Jiang
on 5 Dec 2011
0 votes
"[0<Driver_Torque_Request<=0.7]" is not a valid condition. It should be "[0<Driver_Torque_Request && Driver_Torque_Request<=0.7]"
Categories
Find more on Stateflow in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!