Replace Matlab FCN with Stateflow Chart - Error
2 views (last 30 days)
Show older comments
Hi Guys,
i replaced a working matlab fcn with a stateflow chart. To be honest i didnt expected any errors because it is very simple.
The Model looks like this:
This is the Matlab fcn:
function [w_r,theta_r,iq_ref,motor_state] = fcn(ramp_endspeed,w_r_ramp,theta_r_ramp,w_r_foc,theta_r_foc,Iq_ref_foc,Iq_ramp,pre_motor_state)
if pre_motor_state == 1
w_e = w_e_ramp;
theta_e = theta_e_ramp;
Iq_ref = Iq_ramp;
if w_e_ramp >= ramp_endspeed
motor_state = 2;
else
motor_state = 1;
end
elseif pre_motor_state == 2
w_e = w_e_foc;
theta_e = theta_e_foc;
Iq_ref = Iq_ref_foc;
motor_state = 2;
else
w_e = 0;
theta_e = 0;
Iq_ref = 0;
motor_state = 1;
end
and then i build the statflow with the "classic" setting. But Simulink recommended me to use the "moore" setting.
So this is how it looks like:
in classic like this:
But the moore stateflow generates this error:
And im not understanding it.
Maby this input and output definitions could help u to understand my problem:
Inputs and outputs are the same in the Matlab fcn and stateflow. and the logic should be the same.
Thanks in advance.
Best regards
0 Comments
Answers (1)
See Also
Categories
Find more on Complex Logic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!