2

I'm trying to control a grid connected photovoltaic system based on the grid voltage. The idea is this: when the grid voltage rises above VMax, I want to switch off the system for timeOff. When timeOff has passed, i want to switch on again, but only when the grid voltage is lower than VMax.

I currently have two implementations; both are creating many events and i wonder if there's a more efficient way. This is how it is implemented now:

package Foo
model PVControl1 "Generating most events"

parameter Real VMax=253;
parameter Real timeOff=60;

input Real P_init "uncontrolled power";
input Real VGrid;
Real P_final "controlled power";
Boolean switch (start = true) "if true, system is producing";
discrete Real restartTime (start=-1, fixed=true) 
  "system is off until time>restartTime";

equation
when {VGrid > VMax, time > pre(restartTime)} then
  if VGrid > VMax then
    switch = false;
    restartTime = time + timeOff;
  else
    switch = true;
    restartTime = -1;
  end if;
end when;

if pre(switch) then
  P_final = P_init;
else
  P_final = 0;
end if;
end PVControl1;

model PVControl2;
  "Generating less events, but off-time is no multiple of timeOff"

parameter Real VMax=253;
parameter Real timeOff=60;

input Real P_init "uncontrolled power";
input Real VGrid;
Real P_final "controlled power";
discrete Real stopTime( start=-1-timeOff, fixed=true) 
  "system is off until time > stopTime + timeOff";

equation 
when VGrid > VMax then
  stopTime=time;
end when;

if noEvent(VGrid > VMax) or noEvent(time < stopTime + timeOff) then
  P_final = 0;
else
  P_final = P_init;
end if;
end PVControl2;

model TestPVControl;
  "Simulate 1000s to get an idea"

PVControl pvControl2(P_init=4000, VGrid = 300*sin(time/100));
end TestPVControl;

end foo;

When run, I get 8 events with PVControl1, and 4 events with PVControl2. Looking at PVControl2, I actually need only an event at the moment where VGrid becomes larger than VMax. This would give only 2 events. The other 2 events are generated when VGrid drops below VMax again.

Is there a way to improve my model further?
Thanks, Roel

4

2 回答 2

2

我有几点意见。我认为您正在查看一个事件,因为当子句中的方程式被激活时。但这并不完全正确。当离散变量的值发生变化时会发生事件。关键是连续积分器必须在该点停止,方程与新值积分。

要了解在这种情况下这对您有何影响,您应该考虑匿名表达式(如您的 when 子句中的表达式)可能被视为匿名离散变量。换句话说,你可以认为它等价于:

Boolean c1 = VGrid > VMax;

when c1 then
  ...
end when;

...并且要注意的重要一点是,c1VGrid变得大于VMax和小于时都会发生事件(即 的值的变化) VMax。现在考虑一下:

Boolean c1 = VGrid > VMax;
Boolean c2 = time > pre(restartTime);

when {c1, c2} then
  ...
end when;

现在您有更多的事件,因为涉及两个条件,并且每次其中任何一个更改值时您都会生成事件。

说了这么多,你真的有性能问题吗?通常,此类事件仅在您有“喋喋不休”时才会成为问题(由于积分过程中的数字噪声,条件值改变符号的情况)。您是否有任何数字表明这些事件真正造成了多大的问题?了解您使用什么工具来模拟这些事情也可能会有所帮助。

最后,我从你的逻辑中不明白的一件事是,如果 VGrid>VMax 然后在 timeOff 之后,VGrid 仍然大于 VMax,会发生什么?

假设它正确处理了最后一种情况,我认为 PVControl2 实际上是您想要的(并且生成的事件数量正是我所期望的,并且出于我所期望的原因)。

于 2011-04-01T17:42:52.527 回答
1

可能我的答案是 1/2 一年太晚了,但在这种情况下,系统似乎有可能并不僵硬,在这种情况下,显式积分器(如 Dymola 中的 CERK 积分器)将使您的模拟运行时间快多了。

于 2011-09-05T20:10:42.527 回答