Replace Matlab FCN with Stateflow Chart - Error

2 views (last 30 days)
youjarr
youjarr on 14 Jun 2019
Answered: youjarr on 17 Jun 2019
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:
Stateflow_Obere_Ebene.png
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

Answers (1)

youjarr
youjarr on 17 Jun 2019
No one a hint or an idea?

Categories

Find more on Complex Logic in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!