matlab - How do i program this function switch in simulink? -
i trying make switching function simulink function block. , faulty:
function y = switch(soc,input,launch,charge,a) %#codegen y = a; if ((launch == 1), (soc ~= input)) y = charge; else y = a; end
i want output y same unless launch 1 , soc different input, in case want y = charge. block takes care of comparing soc , input driving charge current.
how modify code correct switching. addon y = charge should hold until soc = input , reset y = a;
i guess want:
function y = switch(soc,input,launch,charge,a) %#codegen y = a; if (launch == 1) && (soc ~= input) y = charge; else y = a; end
Comments
Post a Comment