Simulink: Output argument 'mot_trq_dem' is not assigned on some execution paths
조회 수: 2(최근 30일)
I am actually running a Matlab code related to Energy management strategy in Hybrid Electric Vehicle. I have a matlab function block in simulink which is showing this as error. I am trying for past 2days to debug this error as which condition of 'mot_trq_dem' I am missing but unable to debug it and because of this I am also gettig error as Errors occurred during parsing of MATLAB function 'XYZ'
Can anybody Kindly help me in this regard ??
I am posting my part of the code below:
%trq_demand : instantaneous torque demand
%spd_demand : instantaneous speed demand
%soc : SOC measurement
%clutch1_pos: Clutch1 position either 1 (on) or 0(off)
%mot_trq_dem: motor torque demand
%eng_trq_dem: engine torque demand
%% CASE 1 : Net Torque demand is negative (trq_demand<0)
if ((trq_demand <=0) && (abs(trq_demand)<abs(mot_trq_min)))
if ((trq_demand <=0)&& (abs(trq_demand)>=abs(mot_trq_min)))
%% CASE 2 : Net Torque demand is positive (trq_demand>0)
if(trq_demand >0 && clutch1_pos==0)
elseif(trq_demand < mot_trq_max)
if(trq_demand >0 && clutch1_pos==1)
mot_trq_dem=mot_trq_vec(x) ; %corresponding motor torque demand for min fuel consumption
eng_trq_dem=eng_trq_vec(x) ; %corresponding engine torque demand for min fuel consumption
Kindly Help me at the earliest as to which condition I have missed.