2014-06-18 4 views
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에이 작업을 요청하지 않습니다.

답변

0

전류, 전압 및 시간 단위가 혼합되어있는 것처럼 보입니다. 따라서, 당신이 달성하고자하는 것은 분명하지 않습니다.
그러나 전압을 시간의 함수로 생성하려는 경우 Modelica.Blocks.Sources.TimeTable을 사용하여 전압을 줄 수 있습니다.