如何确定SimulationX中混合时间连续时间离散信号的最大值? [英] How to determine the maximum of a mixed time-continuous time-discrete signal in SimulationX?
问题描述
有问题如何确定用Modelica传递的时间上连续时间离散和时间离散的混合信号x(t)的最大值,即
There are questions how to determine the maximum of a mixed time-continuous and time-discrete signal x(t) over passed time with Modelica, i.e.,
y(t)= max {x(s),[startTime,t]}中带有s.
y(t) = max{ x(s) with s in [startTime,t] }.
这是Modelica错误跟踪器中的未解决问题(请参见 https://trac.modelica .org/Modelica/ticket/109 ).
This is an open issue in the Modelica bug tracker (see https://trac.modelica.org/Modelica/ticket/109).
我将提供特定于SimultionX的解决方案.
I will give a SimultionX-specific solution.
推荐答案
SimulationX通过last
运算符扩展了Modelica,该运算符返回参数的最后一个接受值.在事件时间点,它返回在事件迭代之前积分停止的值.
last
运算符可用于计算当前x
值的最大值和最后一个最大值.请参阅以下工作示例.
SimulationX extends Modelica by the last
-operator which returns the last accepted value of the argument. At event-time points it returns the value at which the integration stopped before the event iteration.
The last
-operator can be used to calculate the maximum of the current x
value and the last maximum. See the following working example.
model test "test.ism"
extends SimModel;
Real x=2*sin(2*pi*time)+sin(20*pi*time)+(if time < 0.5 then 0 else 3) "some input signal with jump";
Real y=if noEvent( time > time.start ) then max(x,last(y)) else x "Calculate the maximum with the help of the last-operator";
Real z(start=0,fixed=true)=-der(z)+y "Just any dymanics.";
end test;
输入信号x
和相应的输出信号y
如下图所示.
The input signal x
and the corresponding output signal y
are depicted in the following Figure.
这篇关于如何确定SimulationX中混合时间连续时间离散信号的最大值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!