Below are the control strategy of hydraulic hybrid vehicle. Howcan I modify code below to include the torque of motor of hydraulichybrid vehicle? and How can I improve this
function [SOC,k,T_engine,S_engine,T_brake,T_pump] =strategy(duration,gamma,P,V,Pmin,Pmax,Vmin,Vmax,SOC,Disp,T_wheel,S_wheel,gearratio,S_map,Te_max,T_engine,S_engine,T_pm,k,eff_mech,eff_hyd)
S_flywheel = S_wheel*gearratio;
T_flywheel = T_wheel/gearratio;
T_brake = 0;
if SOC < 0.1
k=1; %Engine on
elseif SOC > 0.7
k=0; %Engine off
end
%T_pump +ve = charging
%T-pump -ve = discharging
if k==1
if T_engine*eff_mech < T_flywheel
 Â
%Engine provides full torque when hydraulic is insufficient tosupport
if SOC < 0.1
T_engine = T_flywheel/eff_mech;
Tmax = interp1(S_map,Te_max,S_engine);
if T_engine > Tmax
T_engine = Tmax;
end
end
 Â
T_pump = T_engine*eff_mech-T_flywheel;
 Â
elseif T_engine*eff_mech >= T_flywheel && T_flywheel>= 0
T_pump = T_engine-T_flywheel/eff_mech;
 Â
elseif T_engine*eff_mech >= T_flywheel && T_flywheel< 0
T_pump = T_engine-T_flywheel;
end
 Â
elseif k==0
T_pump = -T_flywheel;
T_engine = 0;
S_engine = 0;
end
%Stop charging when accumulator is full
if SOC >= 1 && T_pump > 0
T_pump = 0;
T_brake = -T_wheel;
end
%Including hydraulic efficiency
if T_pump > 0 %Charging thus real torque is smaller
T_pump = T_pump*eff_hyd;
elseif T_pump < 0 %Discharging thus requires higher realtorque
T_pump = T_pump/eff_hyd;
end
%Torque of pump does not exceed its limit
if T_pump >= T_pm
T_brake = (T_pump-T_pm)*gearratio/eff_hyd;
T_pump = T_pm;
elseif T_pump <= -T_pm
T_pump = -T_pm;
T_brake = nan;
end
%Accumulator will charge to full
if SOC > 0.6
Qmax = (V-Vmin)/duration;
x_max = Qmax/(S_flywheel*Disp);
Tmax = P*Disp*x_max;
if T_pump > Tmax
T_pump = Tmax;
if T_brake == 0
T_brake =(T_engine*eff_hyd-T_pump)*gearratio/eff_hyd-T_wheel;
elseif T_brake > 0
T_brake =T_brake+(T_engine*eff_hyd-T_pump)*gearratio/eff_hyd-T_wheel;
end
end
end
x = T_pump/(P*Disp);
Q = S_flywheel*Disp*x*duration;
if Q == 0
SOC = SOC;
else
%V is volume of nitrogen gas; Q is rate of change of fluidpumped
V = V-Q;
SOC = (0.9*((Vmax/V)^gamma)-1)*Pmin/(Pmax-Pmin);
end