0
ModelC에서 다단식 정전류 배터리 충전을 수행하고 싶습니다.Modelica 프로그래밍 : 'for 루프'의 고정 제약 - 다단계 정전류 배터리 충전
아무도 도와 줄 수 있습니까? 미리 감사드립니다.
model BatteryCharge
constant Real Voltage0 = 3;
parameter Real Current_vec[5] = {0.01,0.005,0.004,0.003,0.002};
Real Voltage;
Real Current;
// Integer k;
// algorithm
// k := 1;
// Current := Current_vec[k];
// Voltage := Voltage0 + Current * time;
//
// if Voltage > 4 then
// k := k+1;
// end if;
algorithm
for k in 1:5 loop
Current := Current_vec[k];
Voltage := Voltage0 + Current * time;
if Voltage > 4 then
break;
end if;
end for;
end BatteryCharge
정말 도움이 필요합니다.
내 프로그래밍 코드의 일부분에 불과하기 때문에 Pls에서 matlab에이 작업을 요청하지 않습니다.