CDL.Continuous.Validation

Collection of models that validate the continuous blocks of the CDL

Information

This package contains models that validate the blocks in CDL.Continuous.

The examples plot various outputs, which have been verified against analytical solutions. These model outputs are stored as reference data to allow continuous validation whenever models in the library change.

Package Content

Name Description
CDL.Continuous.Validation.Abs Abs Validation model for the absolute block
CDL.Continuous.Validation.Acos Acos Validation model for the Acos block
CDL.Continuous.Validation.Add Add Validation model for the add block
CDL.Continuous.Validation.AddParameter AddParameter Validation model for the AddParameter block
CDL.Continuous.Validation.Asin Asin Validation model for the Asin block
CDL.Continuous.Validation.Atan Atan Validation model for the Atan block
CDL.Continuous.Validation.Atan2 Atan2 Validation model for the Atan2 block
CDL.Continuous.Validation.Average Average Validation model for the Average block
CDL.Continuous.Validation.Cos Cos Validation model for the Cos block
CDL.Continuous.Validation.Derivative Derivative Test model for the derivative block
CDL.Continuous.Validation.Divide Divide Validation model for the Divide block
CDL.Continuous.Validation.Exp Exp Validation model for the Exp block
CDL.Continuous.Validation.Greater Greater Validation model for the Greater block
CDL.Continuous.Validation.GreaterThreshold GreaterThreshold Validation model for the GreaterThreshold block
CDL.Continuous.Validation.Hysteresis Hysteresis Validation model for the Hysteresis block
CDL.Continuous.Validation.IntegratorWithReset IntegratorWithReset Test model for integrator with reset
CDL.Continuous.Validation.Less Less Validation model for the Less block
CDL.Continuous.Validation.LessThreshold LessThreshold Validation model for the LessThreshold block
CDL.Continuous.Validation.LimitSlewRate LimitSlewRate Validation model for the LimitSlewRate block
CDL.Continuous.Validation.Limiter Limiter Validation model for the Limiter block
CDL.Continuous.Validation.Line Line Validation model for the Line block
CDL.Continuous.Validation.Log Log Validation model for the Log block
CDL.Continuous.Validation.Log10 Log10 Validation model for the Log10 block
CDL.Continuous.Validation.MatrixGain MatrixGain Validation model for the MatrixGain block
CDL.Continuous.Validation.MatrixMax MatrixMax Validation model for the MatrixMax block
CDL.Continuous.Validation.MatrixMin MatrixMin Validation model for the MatrixMin block
CDL.Continuous.Validation.Max Max Validation model for the Max block
CDL.Continuous.Validation.Min Min Validation model for the Min block
CDL.Continuous.Validation.Modulo Modulo Validation model for the Modulo block
CDL.Continuous.Validation.MovingAverage MovingAverage Validation model for the MovingAverage block
CDL.Continuous.Validation.MovingAverage_nonZeroStart MovingAverage_nonZeroStart Validation model for the MovingAverage block
CDL.Continuous.Validation.MultiMax MultiMax Validation model for the MultiMax block
CDL.Continuous.Validation.MultiMin MultiMin Validation model for the MultiMin block
CDL.Continuous.Validation.MultiSum MultiSum Model to validate the application of MultiSum block
CDL.Continuous.Validation.Multiply Multiply Validation model for the Multiply block
CDL.Continuous.Validation.MultiplyByParameter MultiplyByParameter Validation model for the Gain block
CDL.Continuous.Validation.PID PID Test model for PID controller
CDL.Continuous.Validation.PIDInitialDerivativeOutput PIDInitialDerivativeOutput Test model for LimPID controller with initial output of the derivative term specified
CDL.Continuous.Validation.PIDInitialState PIDInitialState Test model for LimPID controller with initial state specified
CDL.Continuous.Validation.PIDScale PIDScale Test model for PID controller with scaling of the control error
CDL.Continuous.Validation.PIDWithReset PIDWithReset Test model for LimPID controller with reset trigger
CDL.Continuous.Validation.PIDWithResetScale PIDWithResetScale Test model for PID controller with reset and scaling of the control error
CDL.Continuous.Validation.Ramp Ramp Validation model for the Ramp block
CDL.Continuous.Validation.Round Round Validation model for the Round block
CDL.Continuous.Validation.Sin Sin Validation model for the Sin block
CDL.Continuous.Validation.Sort Sort Validation model for the Sort block
CDL.Continuous.Validation.Sqrt Sqrt Validation model for the Sqrt block
CDL.Continuous.Validation.Subtract Subtract Validation model for the Subtract block
CDL.Continuous.Validation.Switch Switch Validation model for the Switch block
CDL.Continuous.Validation.Tan Tan Validation model for the Tan block

CDL.Continuous.Validation.Abs CDL.Continuous.Validation.Abs

Validation model for the absolute block

CDL.Continuous.Validation.Abs

Information

Validation test for the block CDL.Continuous.Abs. The input varies from -1 to +1.

Modelica definition

model Abs "Validation model for the absolute block" CDL.Continuous.Abs abs1 "Block that outputs the absolute value of the input"; CDL.Continuous.Sources.Ramp ramp( height=2, duration=1, offset=-1) "Block that generates ramp signal"; equation connect(ramp.y,abs1.u); end Abs;

CDL.Continuous.Validation.Acos CDL.Continuous.Validation.Acos

Validation model for the Acos block

CDL.Continuous.Validation.Acos

Information

Validation test for the block CDL.Continuous.Acos.

The input u varies from -1 to +1.

Modelica definition

model Acos "Validation model for the Acos block" CDL.Continuous.Acos arcCos "Block that outputs the arc tangent of the input"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-1, height=2) "Block that generates ramp signal"; equation connect(ramp1.y, arcCos.u); end Acos;

CDL.Continuous.Validation.Add CDL.Continuous.Validation.Add

Validation model for the add block

CDL.Continuous.Validation.Add

Information

Validation test for the block CDL.Continuous.Add.

The input u1 varies from -2 to +2, input u2 varies from -1 to +1.

Modelica definition

model Add "Validation model for the add block" CDL.Continuous.Add add1 "Block that outputs the sum of the two inputs"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( height=2, duration=1, offset=-1) "Block that generates ramp signal"; equation connect(ramp1.y,add1.u1); connect(ramp2.y,add1.u2); end Add;

CDL.Continuous.Validation.AddParameter CDL.Continuous.Validation.AddParameter

Validation model for the AddParameter block

CDL.Continuous.Validation.AddParameter

Information

Validation test for the block CDL.Continuous.AddParameter.

The input u varies from -2 to +2.

Modelica definition

model AddParameter "Validation model for the AddParameter block" CDL.Continuous.AddParameter addPar( p=0.5) "Block that outputs the sum of an input plus a parameter"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; equation connect(ramp1.y,addPar.u); end AddParameter;

CDL.Continuous.Validation.Asin CDL.Continuous.Validation.Asin

Validation model for the Asin block

CDL.Continuous.Validation.Asin

Information

Validation test for the block CDL.Continuous.Asin.

The input u varies from -1 to +1.

Modelica definition

model Asin "Validation model for the Asin block" CDL.Continuous.Asin arcSin "Block that outputs the arc tangent of the input"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-1, height=2) "Block that generates ramp signal"; equation connect(ramp1.y, arcSin.u); end Asin;

CDL.Continuous.Validation.Atan CDL.Continuous.Validation.Atan

Validation model for the Atan block

CDL.Continuous.Validation.Atan

Information

Validation test for the block CDL.Continuous.Atan.

The input u varies from -2 to +2.

Modelica definition

model Atan "Validation model for the Atan block" CDL.Continuous.Atan atan1 "Block that outputs the arc tangent of the input"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; equation connect(ramp1.y,atan1.u); end Atan;

CDL.Continuous.Validation.Atan2 CDL.Continuous.Validation.Atan2

Validation model for the Atan2 block

CDL.Continuous.Validation.Atan2

Information

Validation test for the block CDL.Continuous.Atan2.

The input u1 varies from -2 to +2, The input u2 varies from +1 to +3.

Modelica definition

model Atan2 "Validation model for the Atan2 block" CDL.Continuous.Atan2 atan2_1 "Block that outputs atan(u1/u2) of the inputs u1 and u2"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( duration=1, offset=1, height=2) "Block that generates ramp signal"; equation connect(ramp1.y,atan2_1.u1); connect(ramp2.y,atan2_1.u2); end Atan2;

CDL.Continuous.Validation.Average CDL.Continuous.Validation.Average

Validation model for the Average block

CDL.Continuous.Validation.Average

Information

Validation test for the block CDL.Continuous.Average.

The input u1 varies from -2.0 to +6.0, input u2 varies from +1.5 to +4.5

Modelica definition

model Average "Validation model for the Average block" CDL.Continuous.Average avg1 "Block that outputs the average of its two inputs"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=6) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( duration=1, offset=1.5, height=3.0) "Block that generates ramp signal"; equation connect(ramp1.y,avg1.u1); connect(ramp2.y,avg1.u2); end Average;

CDL.Continuous.Validation.Cos CDL.Continuous.Validation.Cos

Validation model for the Cos block

CDL.Continuous.Validation.Cos

Information

Validation test for the block CDL.Continuous.Cos.

The input u varies from 0.0 to +6.283.

Modelica definition

model Cos "Validation model for the Cos block" CDL.Continuous.Cos cos1 "Block that outputs the cosine of the input"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=6.283) "Block that generates ramp signal"; equation connect(ramp1.y,cos1.u); end Cos;

CDL.Continuous.Validation.Derivative CDL.Continuous.Validation.Derivative

Test model for the derivative block

CDL.Continuous.Validation.Derivative

Information

Validation test for the block CDL.Continuous.Derivative. The model integrates a time varying signal, and the differentiates this integrated signal. Hence, the output der1.y matches the non-integrated signal intWitRes.u, within a small approximation tolerance.

The instance der1 uses a varying input for T which controls the accuracy of the derivative approximation. At the start of the simulation, T is small and hence the output der1.y matches the signal intWitRes.u well. As expected, the approximation error increases with increasing der1.T.

The instance der2 uses a gain of 2, and it initializes the output to 0. Hence, there is a fast transient at the beginning, and afterwards the output matches der1.y = der2.y / 2.

Modelica definition

model Derivative "Test model for the derivative block" CDL.Continuous.Derivative der1(y_start=1) "Derivative block with input gains"; Sources.Constant con(k=1) "Outputs 1"; Sources.Ramp ram( height=0.09, duration=10, offset=0.01, startTime=5) "Ramp for time constant used in approximating derivative"; Sources.ModelTime modTim "Model time"; CDL.Continuous.IntegratorWithReset intWitRes(y_start=1) "Integration of input"; Logical.Sources.Constant booSig(k=false) "Contant boolean signal"; CDL.Continuous.Cos cos "Cosine of model time"; CDL.Continuous.Derivative der2(y_start=0) "Derivative block with input gains"; Sources.Constant con2(k=2) "Outputs 2"; Sources.Constant T(k=0.1) "Time constant for derivative approximation"; Utilities.Assert assMes(message="Differentiated value differs more than threshold") "Issue an error if results differ more than a threshold"; CDL.Continuous.Subtract sub "Difference between original signal, and differentiated integral of that signal"; CDL.Continuous.Abs abs "Absolute difference"; CDL.Continuous.LessThreshold lesThr(t=0.1, h=0.01) "Output true if difference is within expected accuracy"; CDL.Continuous.MultiplyByParameter gai(final k=1) "Dummy gain to avoid unit difference error"; equation connect(con.y, der1.k); connect(ram.y, der1.T); connect(intWitRes.y, der1.u); connect(booSig.y, intWitRes.trigger); connect(intWitRes.u, cos.y); connect(intWitRes.y_reset_in, cos.y); connect(intWitRes.y, der2.u); connect(con2.y, der2.k); connect(T.y, der2.T); connect(der1.y, sub.u1); connect(cos.y, sub.u2); connect(sub.y, abs.u); connect(abs.y, lesThr.u); connect(lesThr.y, assMes.u); connect(modTim.y, gai.u); connect(gai.y, cos.u); end Derivative;

CDL.Continuous.Validation.Divide CDL.Continuous.Validation.Divide

Validation model for the Divide block

CDL.Continuous.Validation.Divide

Information

Validation test for the block CDL.Continuous.Divide.

The input u1 varies from -2 to +2, input u2 varies from +1 to +3.

Modelica definition

model Divide "Validation model for the Divide block" CDL.Continuous.Divide div1 "Block that outputs first input divided by second input: u1/u2"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( height=2, duration=1, offset=1) "Block that generates ramp signal"; equation connect(ramp1.y,div1.u1); connect(ramp2.y,div1.u2); end Divide;

CDL.Continuous.Validation.Exp CDL.Continuous.Validation.Exp

Validation model for the Exp block

CDL.Continuous.Validation.Exp

Information

Validation test for the block CDL.Continuous.Exp.

The input u varies from 0.0 to +2.

Modelica definition

model Exp "Validation model for the Exp block" CDL.Continuous.Exp Exp1 "Block that outputs the exponential (base e) of the input"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=2) "Block that generates ramp signal"; equation connect(ramp1.y,Exp1.u); end Exp;

CDL.Continuous.Validation.Greater CDL.Continuous.Validation.Greater

Validation model for the Greater block

CDL.Continuous.Validation.Greater

Information

Validation test for the block CDL.Continuous.Greater. The instance gre has no hysteresis, and the instance greHys has a hysteresis.

Modelica definition

model Greater "Validation model for the Greater block" CDL.Continuous.Greater gre "Greater block, without hysteresis"; CDL.Continuous.Greater greHys(h=1) "Greater block, with hysteresis"; CDL.Continuous.Sources.Ramp ram1( height=5, duration=10, offset=-1.5) "Ramp source"; CDL.Continuous.Sources.Sin sin( amplitude=3, freqHz=1/10, offset=-2, startTime=1) "Sine source"; equation connect(ram1.y, gre.u2); connect(ram1.y, greHys.u2); connect(sin.y, gre.u1); connect(sin.y, greHys.u1); end Greater;

CDL.Continuous.Validation.GreaterThreshold CDL.Continuous.Validation.GreaterThreshold

Validation model for the GreaterThreshold block

CDL.Continuous.Validation.GreaterThreshold

Information

Validation test for the block CDL.Continuous.GreaterThreshold. The instance gre has no hysteresis, and the instance greHys has a hysteresis.

Modelica definition

model GreaterThreshold "Validation model for the GreaterThreshold block" CDL.Continuous.GreaterThreshold gre(t=2) "Greater block, without hysteresis"; CDL.Continuous.GreaterThreshold greHys(t=2, h=1) "Greater block, with hysteresis"; CDL.Continuous.Sources.Sin sin( amplitude=8, freqHz=1/10, offset=-2, startTime=1) "Sine source"; equation connect(sin.y, gre.u); connect(sin.y, greHys.u); end GreaterThreshold;

CDL.Continuous.Validation.Hysteresis CDL.Continuous.Validation.Hysteresis

Validation model for the Hysteresis block

CDL.Continuous.Validation.Hysteresis

Information

Validation test for the block CDL.Continuous.Hysteresis.

Modelica definition

model Hysteresis "Validation model for the Hysteresis block" CDL.Continuous.Hysteresis hysteresis( final uLow=0, final uHigh=1) "Transform Real to Boolean signal with Hysteresis"; CDL.Continuous.Hysteresis hysteresis1( final uLow=0, final uHigh=1, final pre_y_start=true) "Transform Real to Boolean signal with Hysteresis"; CDL.Continuous.Hysteresis hysteresis2( final uLow=0+0.01, final uHigh=1-0.01) "Transform Real to Boolean signal with Hysteresis"; protected CDL.Continuous.Sources.Ramp ramp1( final duration=1, final offset=0, final height=6.2831852) "Block that generates ramp signal"; CDL.Continuous.Sin sin1 "Block that outputs the sine of the input"; CDL.Continuous.MultiplyByParameter gain1( final k=2.5) "Block that outputs the product of a gain value with the input signal"; CDL.Continuous.Sources.Sin sin( final amplitude=1, final freqHz=10) "Sine signal"; CDL.Continuous.Sources.Sin sin2( final amplitude=1, final freqHz=5) "Sine signal"; equation connect(ramp1.y,sin1.u); connect(sin1.y,gain1.u); connect(gain1.y,hysteresis.u); connect(hysteresis2.u,sin2.y); connect(sin.y,hysteresis1.u); end Hysteresis;

CDL.Continuous.Validation.IntegratorWithReset CDL.Continuous.Validation.IntegratorWithReset

Test model for integrator with reset

CDL.Continuous.Validation.IntegratorWithReset

Information

This model tests the implementation of CDL.Continuous.IntegratorWithReset with and without reset, and with different start values and reset values.

The integrator intWitRes1 is triggered by a sample trigger which becomes true at t=0, while intWitRes2 is triggered by a boolean pulse with is true at t=0. Hence, intWitRes1 starts with y(0)=y_reset while intWitRes2 starts with y(0)=y_start.

Modelica definition

model IntegratorWithReset "Test model for integrator with reset" CDL.Continuous.IntegratorWithReset intDef(final y_start=-2) "Integrator with default values"; CDL.Continuous.IntegratorWithReset intWitRes1(final y_start=-2, final k=0.5) "Integrator with reset"; CDL.Continuous.IntegratorWithReset intWitRes2( final y_start=-5, final k=0.5) "Integrator with reset and y_reset = 2"; CDL.Continuous.Sources.Constant cons( final k=10) "Constant as source term"; CDL.Logical.Sources.Pulse booleanPulse( final width=0.5, final period=0.2) "Boolean pulse"; CDL.Logical.Sources.SampleTrigger sampleTrigger( final period=0.2) "Sample trigger"; CDL.Continuous.Sources.Ramp ramp( final height=-1, final duration=1, final offset=-2) "Ramp as a source term"; equation connect(cons.y,intWitRes1.u); connect(cons.y,intWitRes2.u); connect(sampleTrigger.y,intWitRes1.trigger); connect(booleanPulse.y,intWitRes2.trigger); connect(ramp.y,intWitRes2.y_reset_in); connect(cons.y,intDef.u); connect(ramp.y,intWitRes1.y_reset_in); connect(ramp.y,intDef.y_reset_in); connect(sampleTrigger.y,intDef.trigger); end IntegratorWithReset;

CDL.Continuous.Validation.Less CDL.Continuous.Validation.Less

Validation model for the Less block

CDL.Continuous.Validation.Less

Information

Validation test for the block CDL.Continuous.Less. The instance les has no hysteresis, and the instance lesHys has a hysteresis.

Modelica definition

model Less "Validation model for the Less block" CDL.Continuous.Less les "Less block, without hysteresis"; CDL.Continuous.Less lesHys( h=1) "Less block, with hysteresis"; CDL.Continuous.Sources.Sin sin( amplitude=3, freqHz=1/10, offset=-2, startTime=1) "Sine source"; CDL.Continuous.Sources.Ramp ram1( height=5, duration=10, offset=-2) "Ramp source"; equation connect(sin.y, les.u1); connect(sin.y, lesHys.u1); connect(ram1.y, les.u2); connect(ram1.y, lesHys.u2); end Less;

CDL.Continuous.Validation.LessThreshold CDL.Continuous.Validation.LessThreshold

Validation model for the LessThreshold block

CDL.Continuous.Validation.LessThreshold

Information

Validation test for the block CDL.Continuous.LessThreshold. The instance les has no hysteresis, and the instance lesHys has a hysteresis.

Modelica definition

model LessThreshold "Validation model for the LessThreshold block" CDL.Continuous.LessThreshold les(t=2) "Less block, without hysteresis"; CDL.Continuous.LessThreshold lesHys(t=2, h=1) "Less block, with hysteresis"; CDL.Continuous.Sources.Sin sin( amplitude=8, freqHz=1/10, offset=-2, startTime=1) "Sine source"; equation connect(sin.y, les.u); connect(sin.y, lesHys.u); end LessThreshold;

CDL.Continuous.Validation.LimitSlewRate CDL.Continuous.Validation.LimitSlewRate

Validation model for the LimitSlewRate block

CDL.Continuous.Validation.LimitSlewRate

Information

Validation test for the block CDL.Continuous.LimitSlewRate.

The input ramp1.u varies from 0 to +1.5, in 1 s.

The increase and decrease rate limits are [increase/incDt, -decrease/decDt] , which is [1, -1] here.

Modelica definition

model LimitSlewRate "Validation model for the LimitSlewRate block" CDL.Continuous.LimitSlewRate sleRatLim( raisingSlewRate=1/30) "Block that limit the increase or decrease rate of input"; CDL.Continuous.Sources.Ramp ramp1( offset=0, height=1.5, duration=20, startTime=10) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( offset=0, height=-1.5, startTime=60, duration=20) "Block that generates ramp signal"; CDL.Continuous.Add add "Signal adder"; CDL.Continuous.Sources.Ramp ramp3( offset=0, height=-1.5, duration=30, startTime=120+60) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp4( offset=0, height=1.5, duration=30, startTime=120) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp5( offset=0, height=-1.5, startTime=240+60, duration=40) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp6( offset=0, height=1.5, startTime=240, duration=40) "Block that generates ramp signal"; CDL.Continuous.Add add1 "Signal adder"; CDL.Continuous.Add add2 "Signal adder"; CDL.Continuous.Sources.Ramp ramp7( offset=0, height=-1.5, duration=50, startTime=360+60) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp8( offset=0, height=1.5, duration=50, startTime=360) "Block that generates ramp signal"; CDL.Continuous.Add add3 "Signal adder"; CDL.Continuous.Add add4 "Signal adder"; CDL.Continuous.Add add5 "Signal adder"; CDL.Continuous.Add add6 "Signal adder"; equation connect(ramp1.y,add.u1); connect(ramp2.y,add.u2); connect(ramp4.y,add1.u1); connect(ramp3.y,add1.u2); connect(ramp6.y,add2.u1); connect(ramp5.y,add2.u2); connect(ramp8.y,add3.u1); connect(ramp7.y,add3.u2); connect(add.y,add4.u1); connect(add1.y,add4.u2); connect(add2.y,add5.u1); connect(add3.y,add5.u2); connect(add4.y,add6.u1); connect(add5.y,add6.u2); connect(sleRatLim.u,add6.y); end LimitSlewRate;

CDL.Continuous.Validation.Limiter CDL.Continuous.Validation.Limiter

Validation model for the Limiter block

CDL.Continuous.Validation.Limiter

Information

Validation test for the block CDL.Continuous.Limiter.

The input u varies from 0.0 to +2.

Modelica definition

model Limiter "Validation model for the Limiter block" CDL.Continuous.Limiter limiter1( uMax=2.5, uMin=1.2) "Block that limit the range of a signal"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=4) "Block that generates ramp signal"; equation connect(ramp1.y,limiter1.u); end Limiter;

CDL.Continuous.Validation.Line CDL.Continuous.Validation.Line

Validation model for the Line block

CDL.Continuous.Validation.Line

Information

Validation test for the block CDL.Continuous.Line.

The input u varies from 0.0 to +2.

The block outputs y = a + b u, where u is an input and the coefficients a and b are determined so that the line intercepts the two input points specified by the two points x1 and f1, and x2 and f2.

The parameters limitBelow and limitAbove determine whether x1 and x2 are also used to limit the input u.

Modelica definition

model Line "Validation model for the Line block" CDL.Continuous.Line line1 "Block that out the value of the input x along a line specified by two points"; CDL.Continuous.Sources.Constant x1( k=1.0) "Block that generate x1"; CDL.Continuous.Sources.Constant f1( k=0.5) "Block that generate f(x1)"; CDL.Continuous.Sources.Constant x2( k=2.0) "Block that generate x2"; CDL.Continuous.Sources.Constant f2( k=1.5) "Block that generate f(x2)"; CDL.Continuous.Sources.Ramp ramp1( offset=0, duration=0.5, startTime=0.25, height=3) "Block that generates ramp signal"; CDL.Continuous.Line line2( limitAbove=true, limitBelow=false) "Block that out the value of the input x along a line specified by two points"; CDL.Continuous.Line line3( limitBelow=true, limitAbove=false) "Block that out the value of the input x along a line specified by two points"; equation connect(ramp1.y,line1.u); connect(f1.y,line1.f1); connect(x1.y,line1.x1); connect(x2.y,line1.x2); connect(f2.y,line1.f2); connect(ramp1.y,line2.u); connect(f1.y,line2.f1); connect(x1.y,line2.x1); connect(x2.y,line2.x2); connect(f2.y,line2.f2); connect(ramp1.y,line3.u); connect(f1.y,line3.f1); connect(x1.y,line3.x1); connect(x2.y,line3.x2); connect(f2.y,line3.f2); end Line;

CDL.Continuous.Validation.Log CDL.Continuous.Validation.Log

Validation model for the Log block

CDL.Continuous.Validation.Log

Information

Validation test for the block CDL.Continuous.Log.

The input u varies from +1 to +6.

Modelica definition

model Log "Validation model for the Log block" CDL.Continuous.Log log1 "Block that outputs the natural (base e) logarithm of the input (input > 0 required)"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=1, height=5) "Block that generates ramp signal"; equation connect(ramp1.y,log1.u); end Log;

CDL.Continuous.Validation.Log10 CDL.Continuous.Validation.Log10

Validation model for the Log10 block

CDL.Continuous.Validation.Log10

Information

Validation test for the block CDL.Continuous.Log10.

The input u varies from +1 to +10.

Modelica definition

model Log10 "Validation model for the Log10 block" CDL.Continuous.Log10 log10_1 "Block that outputs the base 10 logarithm of the input (input > 0 required)"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=1, height=9) "Block that generates ramp signal"; equation connect(ramp1.y,log10_1.u); end Log10;

CDL.Continuous.Validation.MatrixGain CDL.Continuous.Validation.MatrixGain

Validation model for the MatrixGain block

CDL.Continuous.Validation.MatrixGain

Information

Validation test for the block CDL.Continuous.MatrixGain.

The input vector output two identical values u[1] and u[2] that vary from 0.0 to +2.

Modelica definition

model MatrixGain "Validation model for the MatrixGain block" CDL.Continuous.MatrixGain matGai( K=[ 1,0; 1,1; 1,2]) "Block that outputs the product of a matrix gain value with the input signal"; CDL.Continuous.MatrixGain matGai1( K=[ 1,2; 3,4]) "Block that outputs the product of a matrix gain value with the input signal"; CDL.Continuous.Sources.Ramp ramp( duration=1, offset=0, height=2) "Block that generates ramp signal"; Sources.Ramp ramp1( duration=1, offset=0, height=1) "Block that generates ramp signal"; Sources.Ramp ramp2( duration=1, offset=0, height=2) "Block that generates ramp signal"; equation connect(ramp2.y,matGai1.u[2]); connect(ramp1.y,matGai1.u[1]); connect(ramp.y,matGai.u[1]); connect(ramp.y,matGai.u[2]); end MatrixGain;

CDL.Continuous.Validation.MatrixMax CDL.Continuous.Validation.MatrixMax

Validation model for the MatrixMax block

CDL.Continuous.Validation.MatrixMax

Information

Validation test for the block CDL.Continuous.MatrixMax.

Modelica definition

model MatrixMax "Validation model for the MatrixMax block" Sources.Constant con[3,3]( k={{1,2,3},{6,4,2},{3,9,6}}) "Block that generates ramp signal"; Sources.Constant con1[2,3]( k={{1,4,3},{2,2,6}}) "Block that generates ramp signal"; Sources.Constant con2[2,3]( k={{1,2,3},{6,4,2}}) "Block that generates ramp signal"; CDL.Continuous.MatrixMax matMax( rowMax=false, nRow=3, nCol=3) "Matrix maximum"; CDL.Continuous.MatrixMax matMax1( nCol=3, nRow=2) "Matrix maximum"; CDL.Continuous.MatrixMax matMax2( nCol=3, nRow=2) "Matrix maximum"; equation connect(con.y,matMax.u); connect(con1.y,matMax1.u); connect(con2.y,matMax2.u); end MatrixMax;

CDL.Continuous.Validation.MatrixMin CDL.Continuous.Validation.MatrixMin

Validation model for the MatrixMin block

CDL.Continuous.Validation.MatrixMin

Information

Validation test for the block CDL.Continuous.MatrixMin.

Modelica definition

model MatrixMin "Validation model for the MatrixMin block" Sources.Constant con[3,3]( k={{-1,-2,-3},{-6,-4,-2},{-3,-9,-6}}) "Block that generates ramp signal"; Sources.Constant con1[2,3]( k={{-1,-4,-3},{-2,-2,-6}}) "Block that generates ramp signal"; Sources.Constant con2[2,3]( k={{-1,-2,-3},{-6,-4,-2}}) "Block that generates ramp signal"; CDL.Continuous.MatrixMin matMin( nRow=3, nCol=3, rowMin=false) "Matrix minimum"; CDL.Continuous.MatrixMin matMin1( nCol=3, rowMin=false, nRow=2) "Matrix minimum"; CDL.Continuous.MatrixMin matMin2( nCol=3, rowMin=true, nRow=2) "Matrix minimum"; equation connect(con.y,matMin.u); connect(con1.y,matMin1.u); connect(con2.y,matMin2.u); end MatrixMin;

CDL.Continuous.Validation.Max CDL.Continuous.Validation.Max

Validation model for the Max block

CDL.Continuous.Validation.Max

Information

Validation test for the block CDL.Continuous.Max.

The input u1 varies from -2 to +2, input u2 varies from -1 to +1.

Modelica definition

model Max "Validation model for the Max block" CDL.Continuous.Max max1 "Block that pass through the largest signal"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( duration=1, offset=-1, height=2) "Block that generates ramp signal"; equation connect(ramp1.y,max1.u1); connect(ramp2.y,max1.u2); end Max;

CDL.Continuous.Validation.Min CDL.Continuous.Validation.Min

Validation model for the Min block

CDL.Continuous.Validation.Min

Information

Validation test for the block CDL.Continuous.Min.

The input u1 varies from -2 to +2, input u2 varies from -1 to +1.

Modelica definition

model Min "Validation model for the Min block" CDL.Continuous.Min min1 "Block that pass through the smallest signal"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( duration=1, offset=-1, height=2) "Block that generates ramp signal"; equation connect(ramp1.y,min1.u1); connect(ramp2.y,min1.u2); end Min;

CDL.Continuous.Validation.Modulo CDL.Continuous.Validation.Modulo

Validation model for the Modulo block

CDL.Continuous.Validation.Modulo

Information

Validation test for the block CDL.Continuous.Modulo.

The input u1 varies from -2.0 to +6.0, input u2 varies from +1.5 to +4.5

Modelica definition

model Modulo "Validation model for the Modulo block" CDL.Continuous.Modulo mod1 "Block that outputs the remainder of first input divided by second input (~=0)"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=6) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( duration=1, offset=1.5, height=3.0) "Block that generates ramp signal"; equation connect(ramp1.y,mod1.u1); connect(ramp2.y,mod1.u2); end Modulo;

CDL.Continuous.Validation.MovingAverage CDL.Continuous.Validation.MovingAverage

Validation model for the MovingAverage block

CDL.Continuous.Validation.MovingAverage

Information

Validation test for the block CDL.Continuous.MovingAverage.

The input sinInpNoDel, sinInp50sDel, sinInp100sDel, generate sine outputs with same frequency of 1/80 Hz, but different start times of 0 second, 50 second, 100 second.

Modelica definition

model MovingAverage "Validation model for the MovingAverage block" CDL.Continuous.Sources.Sin sinInpNoDel( freqHz=1/80) "Start from zero second"; CDL.Continuous.MovingAverage movAve1(delta=100) "Moving average with 100 s sliding window"; CDL.Continuous.MovingAverage movAve2(delta=200) "Moving average with 200 s sliding window"; CDL.Continuous.MovingAverage movAve3(delta=300) "Moving average with 300 s sliding window"; CDL.Continuous.MovingAverage movAve4(delta=400) "Moving average with 400 s sliding window"; CDL.Continuous.MovingAverage movAve5(delta=500) "Moving average with 500 s sliding window"; CDL.Continuous.Sources.Sin sinInp50sDel( freqHz=1/80, startTime=50) "Start from 50 seconds"; CDL.Continuous.MovingAverage movAve6(delta=100) "Moving average with 100 s sliding window"; CDL.Continuous.MovingAverage movAve7(delta=200) "Moving average with 200 s sliding window"; CDL.Continuous.Sources.Sin sinInp100sDel( freqHz=1/80, startTime=100) "Start from 100 seconds"; CDL.Continuous.MovingAverage movAve8(delta=100) "Moving average with 100 s sliding window"; CDL.Continuous.MovingAverage movAve9(delta=200) "Moving average with 200 s sliding window"; equation connect(sinInpNoDel.y,movAve3.u); connect(sinInpNoDel.y,movAve1.u); connect(sinInpNoDel.y,movAve2.u); connect(sinInpNoDel.y,movAve5.u); connect(sinInpNoDel.y,movAve4.u); connect(sinInp50sDel.y,movAve6.u); connect(sinInp50sDel.y,movAve7.u); connect(sinInp100sDel.y,movAve9.u); connect(sinInp100sDel.y,movAve8.u); end MovingAverage;

CDL.Continuous.Validation.MovingAverage_nonZeroStart CDL.Continuous.Validation.MovingAverage_nonZeroStart

Validation model for the MovingAverage block

CDL.Continuous.Validation.MovingAverage_nonZeroStart

Information

Validation test for the block CDL.Continuous.MovingAverage.

The inputs sinInpNoDel, sinInp50sDel and sinInp100sDel generate sine outputs with the same frequency of 1/80 Hertz, but different start times of 0 seconds, 50 seconds and 100 seconds.

Modelica definition

model MovingAverage_nonZeroStart "Validation model for the MovingAverage block" Modelica.Blocks.Sources.Sine sinInpNoDel(f=1/80) "Start from zero second"; CDL.Continuous.MovingAverage movAve1(delta=100) "Moving average with 100 s sliding window"; CDL.Continuous.MovingAverage movAve2(delta=200) "Moving average with 200 s sliding window"; CDL.Continuous.MovingAverage movAve3(delta=300) "Moving average with 300 s sliding window"; CDL.Continuous.MovingAverage movAve4(delta=400) "Moving average with 400 s sliding window"; CDL.Continuous.MovingAverage movAve5(delta=500) "Moving average with 500 s sliding window"; Modelica.Blocks.Sources.Sine sinInp50sDel(f=1/80, startTime=50) "Start from 50 seconds"; CDL.Continuous.MovingAverage movAve6(delta=100) "Moving average with 100 s sliding window"; CDL.Continuous.MovingAverage movAve7(delta=200) "Moving average with 200 s sliding window"; Modelica.Blocks.Sources.Sine sinInp100sDel(f=1/80, startTime=100) "Start from 100 seconds"; CDL.Continuous.MovingAverage movAve8(delta=100) "Moving average with 100 s sliding window"; CDL.Continuous.MovingAverage movAve9(delta=200) "Moving average with 200 s sliding window"; equation connect(sinInpNoDel.y,movAve3.u); connect(sinInpNoDel.y,movAve1.u); connect(sinInpNoDel.y,movAve2.u); connect(sinInpNoDel.y,movAve5.u); connect(sinInpNoDel.y,movAve4.u); connect(sinInp50sDel.y,movAve6.u); connect(sinInp50sDel.y,movAve7.u); connect(sinInp100sDel.y,movAve9.u); connect(sinInp100sDel.y,movAve8.u); end MovingAverage_nonZeroStart;

CDL.Continuous.Validation.MultiMax CDL.Continuous.Validation.MultiMax

Validation model for the MultiMax block

CDL.Continuous.Validation.MultiMax

Information

Validation test for the block CDL.Continuous.MultiMax.

The input vectorcon has size 5 and its element values are {1,2,3,4,5}.

Parameters

TypeNameDefaultDescription
IntegersizOfVec5Size of the input vector

Modelica definition

model MultiMax "Validation model for the MultiMax block" parameter Integer sizOfVec=5 "Size of the input vector"; CDL.Continuous.MultiMax maxVal( nin=sizOfVec) "Block that outputs the maximum element of the input vector"; CDL.Continuous.Sources.Constant con[sizOfVec]( k={1,2,3,4,5}) "Block that generates ramp signal"; equation connect(con.y,maxVal.u); end MultiMax;

CDL.Continuous.Validation.MultiMin CDL.Continuous.Validation.MultiMin

Validation model for the MultiMin block

CDL.Continuous.Validation.MultiMin

Information

Validation test for the block CDL.Continuous.MultiMin.

The input vectorcon has size 5 and its element values are {1,2,3,4,5}.

Parameters

TypeNameDefaultDescription
IntegersizOfVec5Size of the input vector

Modelica definition

model MultiMin "Validation model for the MultiMin block" parameter Integer sizOfVec=5 "Size of the input vector"; CDL.Continuous.MultiMin minVal( nin=sizOfVec) "Block that outputs the minimum element of the input vector"; CDL.Continuous.Sources.Constant con[sizOfVec]( k={1,2,3,4,5}) "Block that generates ramp signal"; equation for i in 1:sizOfVec loop connect(con[i].y,minVal.u[i]); end for; end MultiMin;

CDL.Continuous.Validation.MultiSum CDL.Continuous.Validation.MultiSum

Model to validate the application of MultiSum block

CDL.Continuous.Validation.MultiSum

Information

Validation test for the block CDL.Continuous.MultiSum.

The inputs and gains are configured as follows:

Modelica definition

model MultiSum "Model to validate the application of MultiSum block" CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( height=2, duration=1, offset=-1) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp3( height=3, duration=1, offset=-1) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp4( height=3, duration=1, offset=-2) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp5( height=3, duration=1, offset=-3) "Block that generates ramp signal"; CDL.Continuous.MultiSum mulSum_5( nin=5, k={1,0.5,0.1,1,2}) "Sum of Reals, y = k[1]*u[1] + k[2]*u[2] + ... + k[5]*u[5]"; CDL.Continuous.MultiSum mulSum_2( nin=2, k={1,0.5}) "Sum of Reals, y = k[1]*u[1] + k[2]*u[2]"; CDL.Continuous.MultiSum mulSum_1( nin=1, k={1}) "Sum of Reals, y = k[1]*u[1]"; CDL.Continuous.MultiSum mulSum_3( nin=3) "Sum of Reals, y = k[1]*u[1] + k[2]*u[2]"; equation connect(ramp1.y,mulSum_5.u[1]); connect(ramp2.y,mulSum_5.u[2]); connect(ramp3.y,mulSum_5.u[3]); connect(ramp4.y,mulSum_5.u[4]); connect(ramp5.y,mulSum_5.u[5]); connect(ramp1.y,mulSum_1.u[1]); connect(ramp1.y,mulSum_2.u[1]); connect(ramp2.y,mulSum_2.u[2]); connect(ramp4.y,mulSum_3.u[1]); connect(ramp5.y,mulSum_3.u[2]); connect(ramp5.y,mulSum_3.u[3]); end MultiSum;

CDL.Continuous.Validation.Multiply CDL.Continuous.Validation.Multiply

Validation model for the Multiply block

CDL.Continuous.Validation.Multiply

Information

Validation test for the block CDL.Continuous.Multiply.

The input u1 varies from -2 to +2, input u2 varies from -1 to +2.

Modelica definition

model Multiply "Validation model for the Multiply block" CDL.Continuous.Multiply product1 "Block that outputs product of the two inputs"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( duration=1, offset=-1, height=3) "Block that generates ramp signal"; equation connect(ramp1.y,product1.u1); connect(ramp2.y,product1.u2); end Multiply;

CDL.Continuous.Validation.MultiplyByParameter CDL.Continuous.Validation.MultiplyByParameter

Validation model for the Gain block

CDL.Continuous.Validation.MultiplyByParameter

Information

Validation test for the block CDL.Continuous.MultiplyByParameter.

The input u varies from 0.0 to +2.

Modelica definition

model MultiplyByParameter "Validation model for the Gain block" CDL.Continuous.MultiplyByParameter gain1(k=2.5) "Block that outputs the product of a gain value with the input signal"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=2) "Block that generates ramp signal"; equation connect(ramp1.y,gain1.u); end MultiplyByParameter;

CDL.Continuous.Validation.PID CDL.Continuous.Validation.PID

Test model for PID controller

CDL.Continuous.Validation.PID

Information

Validation test for the block CDL.Continuous.PID. This tests the different settings for the controller types.

Modelica definition

model PID "Test model for PID controller" CDL.Continuous.Sources.Pulse pulse( period=0.25) "Setpoint"; CDL.Continuous.PID limPID( controllerType=CDL.Types.SimpleController.PID, Ti=1, Td=1, yMin=-1) "PID controller"; CDL.Continuous.Sources.Constant const( k=0.5) "Measurement data"; CDL.Continuous.PID limPI( Ti=1, Td=1, yMin=-1, controllerType=CDL.Types.SimpleController.PI) "PI controller"; CDL.Continuous.PID limPD( Ti=1, Td=1, yMin=-1, controllerType=CDL.Types.SimpleController.PD) "PD controller"; CDL.Continuous.PID limP( Ti=1, Td=1, yMin=-1, controllerType=CDL.Types.SimpleController.P) "P controller"; CDL.Continuous.PID noLimPID( Ti=1, Td=1, yMax=1e15, yMin=-1e15, controllerType=CDL.Types.SimpleController.PID) "PID controller with no output limit"; equation connect(pulse.y,limPID.u_s); connect(const.y,limPID.u_m); connect(const.y,limPI.u_m); connect(const.y,limPD.u_m); connect(pulse.y,limPI.u_s); connect(pulse.y,limPD.u_s); connect(pulse.y,limP.u_s); connect(pulse.y,noLimPID.u_s); connect(const.y,limP.u_m); connect(const.y,noLimPID.u_m); end PID;

CDL.Continuous.Validation.PIDInitialDerivativeOutput CDL.Continuous.Validation.PIDInitialDerivativeOutput

Test model for LimPID controller with initial output of the derivative term specified

CDL.Continuous.Validation.PIDInitialDerivativeOutput

Information

Validation test for the block CDL.Continuous.PID.

This model validates setting the initial output of the controller to a specified value. Note that the control error must be zero for the initial output to be at the specified value. See the description of CDL.Continuous.PID.

Modelica definition

model PIDInitialDerivativeOutput "Test model for LimPID controller with initial output of the derivative term specified" CDL.Continuous.Sources.Constant ySet( k=0.75) "Set point"; CDL.Continuous.Sources.Constant yMea( k=0.75) "Measured value"; CDL.Continuous.PID limPID( controllerType=CDL.Types.SimpleController.PID, k=3, yd_start=0.2) "PID controller"; CDL.Continuous.PID limPD( controllerType=CDL.Types.SimpleController.PD, k=3, yd_start=0.2) "PD controller"; equation connect(ySet.y,limPID.u_s); connect(ySet.y,limPD.u_s); connect(yMea.y,limPID.u_m); connect(yMea.y,limPD.u_m); end PIDInitialDerivativeOutput;

CDL.Continuous.Validation.PIDInitialState CDL.Continuous.Validation.PIDInitialState

Test model for LimPID controller with initial state specified

CDL.Continuous.Validation.PIDInitialState

Information

Validation test for the block CDL.Continuous.PID.

This model validates setting the initial state of the controller to a specified value.

The model sets the initial values xi_start=0.25 of the integrator for both instances of the controller. For the instance limPID, it also sets the initial value of the state of the derivative block xd_start=-0.5. The derivative block obtains as an input signal the value u=-0.5 because the set point weight for the derivative action is wd=0. Therefore, an initial state of x(t0)=-0.5 causes the state of the derivative block to be at steady-state, because dx(t)/dt = (u - x)/T.

Modelica definition

model PIDInitialState "Test model for LimPID controller with initial state specified" CDL.Continuous.Sources.Constant ySet( k=0.75) "Set point"; CDL.Continuous.Sources.Constant yMea( k=0.5) "Measured value"; CDL.Continuous.PID limPID( controllerType=CDL.Types.SimpleController.PID, k=3, xi_start=0.25) "PID controller"; CDL.Continuous.PID limPI( controllerType=CDL.Types.SimpleController.PI, k=3, xi_start=0.25) "PI controller"; equation connect(ySet.y,limPID.u_s); connect(ySet.y,limPI.u_s); connect(yMea.y,limPID.u_m); connect(yMea.y,limPI.u_m); end PIDInitialState;

CDL.Continuous.Validation.PIDScale CDL.Continuous.Validation.PIDScale

Test model for PID controller with scaling of the control error

CDL.Continuous.Validation.PIDScale

Information

Validation test for the block CDL.Continuous.PID with and without setting of the parameter that scales the control error.

The test has two combinations of a PID controller and a plant. In PIDSca, the control error is scaled inside the controller, whereas in the configuration that has PIDNoSca, the setpoint signal and the measurement signal is scaled outside of the controller. Both controllers and plants have the same trajectory, thereby validating that the scaling is implemented correctly.

Modelica definition

model PIDScale "Test model for PID controller with scaling of the control error" CDL.Continuous.Sources.Pulse pulse( amplitude=1000, period=50) "Setpoint"; CDL.Continuous.PID pidSca( controllerType=CDL.Types.SimpleController.PID, k=2, Ti=1, Td=2, r=1000, yMin=-1) "PID controller with scaling of control input"; CDL.Continuous.IntegratorWithReset pla1( k=1000) "Plant model"; Sources.Constant resVal( k=0) "Reset value"; Logical.Sources.Constant resSig( k=false) "Reset signal"; CDL.Continuous.PID pidNoSca( controllerType=CDL.Types.SimpleController.PID, k=2, Ti=1, Td=2, yMin=-1) "PID controller without scaling of control input"; CDL.Continuous.MultiplyByParameter gai(k=1/1000) "Gain to scale setpoint"; CDL.Continuous.MultiplyByParameter gai1(k=1/1000) "Gain to scale measured value"; CDL.Continuous.IntegratorWithReset pla2( k=1000) "Plant model"; equation connect(pulse.y,pidSca.u_s); connect(pla1.u,pidSca.y); connect(pla1.y,pidSca.u_m); connect(resVal.y,pla1.y_reset_in); connect(resSig.y,pla1.trigger); connect(gai.y,pidNoSca.u_s); connect(gai.u,pulse.y); connect(pidNoSca.y,pla2.u); connect(pla2.y,gai1.u); connect(gai1.y,pidNoSca.u_m); connect(pla2.y_reset_in,resVal.y); connect(resSig.y,pla2.trigger); end PIDScale;

CDL.Continuous.Validation.PIDWithReset CDL.Continuous.Validation.PIDWithReset

Test model for LimPID controller with reset trigger

CDL.Continuous.Validation.PIDWithReset

Information

Validation test for the block CDL.Continuous.PID.

This model validates the controller for different settings of the control output reset.

Modelica definition

model PIDWithReset "Test model for LimPID controller with reset trigger" CDL.Conversions.BooleanToReal setPoi "Set point"; CDL.Continuous.Sources.ModelTime modTim "Model time"; CDL.Continuous.GreaterThreshold greEquThr( t=1) "Outputs true after t=1"; CDL.Continuous.PIDWithReset limPIDPar( controllerType=CDL.Types.SimpleController.PID, k=1, Ti=1, Td=1, yMin=-1, y_reset=0.5) "Controller, reset to parameter value"; CDL.Continuous.IntegratorWithReset intWitRes1 "Integrator whose output should be brought to the set point"; CDL.Continuous.PIDWithReset limPIDInp( controllerType=CDL.Types.SimpleController.PID, k=1, Ti=1, Td=1, yMin=-1, y_reset=0.75) "Controller, reset to input value"; CDL.Continuous.IntegratorWithReset intWitRes2 "Integrator whose output should be brought to the set point"; CDL.Continuous.Sources.Constant resVal( k=0) "Reset value"; CDL.Continuous.PIDWithReset limPIPar( controllerType=CDL.Types.SimpleController.PI, k=1, Ti=1, Td=1, yMin=-1, y_reset=0.5) "Controller, reset to parameter value"; CDL.Continuous.IntegratorWithReset intWitRes3 "Integrator whose output should be brought to the set point"; CDL.Continuous.PIDWithReset limPIInp( controllerType=CDL.Types.SimpleController.PI, k=1, Ti=1, Td=1, yMin=-1, y_reset=0.75) "Controller, reset to input value"; CDL.Continuous.IntegratorWithReset intWitRes4 "Integrator whose output should be brought to the set point"; CDL.Logical.Sources.Constant con( final k=false) "Constant false"; equation connect(limPIDPar.u_s,setPoi.y); connect(intWitRes1.u,limPIDPar.y); connect(intWitRes1.y,limPIDPar.u_m); connect(modTim.y,greEquThr.u); connect(greEquThr.y,setPoi.u); connect(greEquThr.y,limPIDPar.trigger); connect(intWitRes2.u,limPIDInp.y); connect(intWitRes2.y,limPIDInp.u_m); connect(limPIDInp.u_s,setPoi.y); connect(limPIPar.u_s,setPoi.y); connect(intWitRes3.u,limPIPar.y); connect(intWitRes3.y,limPIPar.u_m); connect(greEquThr.y,limPIPar.trigger); connect(intWitRes4.u,limPIInp.y); connect(intWitRes4.y,limPIInp.u_m); connect(limPIInp.u_s,setPoi.y); connect(greEquThr.y,limPIInp.trigger); connect(limPIDInp.trigger,greEquThr.y); connect(resVal.y,intWitRes1.y_reset_in); connect(resVal.y,intWitRes2.y_reset_in); connect(resVal.y,intWitRes3.y_reset_in); connect(resVal.y,intWitRes4.y_reset_in); connect(con.y,intWitRes1.trigger); connect(con.y,intWitRes2.trigger); connect(con.y,intWitRes3.trigger); connect(con.y,intWitRes4.trigger); end PIDWithReset;

CDL.Continuous.Validation.PIDWithResetScale CDL.Continuous.Validation.PIDWithResetScale

Test model for PID controller with reset and scaling of the control error

CDL.Continuous.Validation.PIDWithResetScale

Information

Validation test for the block CDL.Continuous.PIDWithReset with and without setting of the parameter that scales the control error.

The test has two combinations of a PID controller and a plant. In PIDSca, the control error is scaled inside the controller, whereas in the configuration that has PIDNoSca, the setpoint signal and the measurement signal is scaled outside of the controller. Both controllers and plants have the same trajectory, thereby validating that the scaling is implemented correctly.

Modelica definition

model PIDWithResetScale "Test model for PID controller with reset and scaling of the control error" CDL.Continuous.Sources.Pulse pulse( amplitude=1000, period=50) "Setpoint"; CDL.Continuous.PIDWithReset pidSca( controllerType=CDL.Types.SimpleController.PID, k=2, Ti=1, Td=2, r=1000, yMin=-1, y_reset=0) "PID controller with scaling of control input"; CDL.Continuous.IntegratorWithReset pla1( k=1000) "Plant model"; Sources.Constant resVal( k=0) "Reset value"; Logical.Sources.Constant resSig( k=false) "Reset signal"; CDL.Continuous.PIDWithReset pidNoSca( controllerType=CDL.Types.SimpleController.PID, k=2, Ti=1, Td=2, yMin=-1, y_reset=0) "PID controller without scaling of control input"; CDL.Continuous.MultiplyByParameter gai(k=1/1000) "Gain to scale setpoint"; CDL.Continuous.MultiplyByParameter gai1(k=1/1000) "Gain to scale measured value"; CDL.Continuous.IntegratorWithReset pla2( k=1000) "Plant model"; Logical.Sources.Pulse booPul( period=30) "Pulse for controller reset"; equation connect(pulse.y,pidSca.u_s); connect(pla1.u,pidSca.y); connect(pla1.y,pidSca.u_m); connect(resVal.y,pla1.y_reset_in); connect(resSig.y,pla1.trigger); connect(gai.y,pidNoSca.u_s); connect(gai.u,pulse.y); connect(pidNoSca.y,pla2.u); connect(pla2.y,gai1.u); connect(gai1.y,pidNoSca.u_m); connect(pla2.y_reset_in,resVal.y); connect(resSig.y,pla2.trigger); connect(booPul.y,pidSca.trigger); connect(booPul.y,pidNoSca.trigger); end PIDWithResetScale;

CDL.Continuous.Validation.Ramp CDL.Continuous.Validation.Ramp

Validation model for the Ramp block

CDL.Continuous.Validation.Ramp

Information

Validation test for the block CDL.Continuous.Ramp.

Modelica definition

model Ramp "Validation model for the Ramp block" CDL.Continuous.Ramp ramUp( final raisingSlewRate=1/20) "Ramp the input increasing"; CDL.Continuous.Ramp ramUp1( final raisingSlewRate=1/10) "Ramp the input increasing in different speed"; CDL.Continuous.Ramp ramUpDow( final raisingSlewRate=1/5) "Limit the increase and decrease of the input if the active is true"; CDL.Continuous.Ramp ramUpDow1( final raisingSlewRate=1/5, final fallingSlewRate=-1/2) "Different increase and decrease slew rate limits"; CDL.Logical.Sources.Pulse booPul1( final width=0.9, final period=12, final shift=1) "Boolean pulse"; CDL.Continuous.Sources.Pulse pul( final width=0.8, final period=12.0, final shift=2.0) "Boolean pulse"; CDL.Logical.Sources.Pulse booPul2( final width=0.9, final period=12, final shift=2) "Boolean pulse"; CDL.Continuous.Sources.Pulse pul1( final width=0.2, final period=12.0, final shift=1.5) "Boolean pulse"; CDL.Continuous.Sources.Pulse pul2( final width=0.3, final period=12.0, final shift=3.0) "Boolean pulse"; CDL.Logical.Sources.Pulse booPul5( final width=0.9, final period=12, final shift=1) "Boolean pulse"; equation connect(booPul2.y, ramUpDow.active); connect(booPul5.y, ramUpDow1.active); connect(pul.y, ramUp.u); connect(pul.y, ramUp1.u); connect(booPul1.y, ramUp.active); connect(booPul1.y, ramUp1.active); connect(pul1.y, ramUpDow.u); connect(pul2.y, ramUpDow1.u); end Ramp;

CDL.Continuous.Validation.Round CDL.Continuous.Validation.Round

Validation model for the Round block

CDL.Continuous.Validation.Round

Information

Validation test for the block CDL.Continuous.Round.

The input u varies from -3.5 to +3.5.

Modelica definition

model Round "Validation model for the Round block" CDL.Continuous.Round round1( n=0) "Round real number to given digits"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-3.5, height=7.0) "Block that generates ramp signal"; CDL.Continuous.Round round2( n=1) "Round real number to given digits"; CDL.Continuous.Round round3( n=-1) "Round real number to given digits"; CDL.Continuous.MultiplyByParameter gai(k=0.1) "Gain"; CDL.Continuous.MultiplyByParameter gai1(k=10) "Gain"; equation connect(ramp1.y,round1.u); connect(ramp1.y,gai.u); connect(round2.u,gai.y); connect(ramp1.y,gai1.u); connect(round3.u,gai1.y); end Round;

CDL.Continuous.Validation.Sin CDL.Continuous.Validation.Sin

Validation model for the Sin block

CDL.Continuous.Validation.Sin

Information

Validation test for the block CDL.Continuous.Sin.

The input u varies from 0.0 to +2π.

Modelica definition

model Sin "Validation model for the Sin block" CDL.Continuous.Sin sin1 "Block that outputs the sine of the input"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=6.2831852) "Block that generates ramp signal"; equation connect(ramp1.y,sin1.u); end Sin;

CDL.Continuous.Validation.Sort CDL.Continuous.Validation.Sort

Validation model for the Sort block

CDL.Continuous.Validation.Sort

Information

Validation test for the block CDL.Continuous.Sort.

The input u1 varies from -2 to +2, input u2 varies from -1 to +2, input u3 varies from +2 to -2, input u4 varies from +3 to +2, input u5 varies from 0 to +4,

Modelica definition

model Sort "Validation model for the Sort block" CDL.Continuous.Sort sorAsc( nin=5) "Block that sorts signals in ascending order"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( duration=1, offset=-1, height=3) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp3( duration=1, offset=2, height=-4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp4( duration=1, offset=3, height=-1) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp5( duration=1, offset=0, height=4) "Block that generates ramp signal"; CDL.Continuous.Sort sorDes( nin=5, ascending=false) "Block that sorts signals in ascending order"; equation connect(ramp1.y,sorAsc.u[1]); connect(ramp2.y,sorAsc.u[2]); connect(ramp3.y,sorAsc.u[3]); connect(ramp4.y,sorAsc.u[4]); connect(ramp5.y,sorAsc.u[5]); connect(ramp1.y,sorDes.u[1]); connect(ramp2.y,sorDes.u[2]); connect(ramp3.y,sorDes.u[3]); connect(ramp4.y,sorDes.u[4]); connect(ramp5.y,sorDes.u[5]); end Sort;

CDL.Continuous.Validation.Sqrt CDL.Continuous.Validation.Sqrt

Validation model for the Sqrt block

CDL.Continuous.Validation.Sqrt

Information

Validation test for the block CDL.Continuous.Sqrt.

The input u varies from 0.0 to +9.0.

Modelica definition

model Sqrt "Validation model for the Sqrt block" CDL.Continuous.Sqrt sqrt1 "Block that outputs the square root of the input (input >= 0 required)"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=0, height=9) "Block that generates ramp signal"; equation connect(ramp1.y,sqrt1.u); end Sqrt;

CDL.Continuous.Validation.Subtract CDL.Continuous.Validation.Subtract

Validation model for the Subtract block

CDL.Continuous.Validation.Subtract

Information

Validation test for the block CDL.Continuous.Subtract.

The input u1 varies from -2 to +2, input u2 varies from -1 to +1.

Modelica definition

model Subtract "Validation model for the Subtract block" CDL.Continuous.Subtract sub "Block that outputs the difference of the two inputs"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( height=2, duration=1, offset=-0.5) "Block that generates ramp signal"; equation connect(ramp1.y, sub.u1); connect(ramp2.y, sub.u2); end Subtract;

CDL.Continuous.Validation.Switch CDL.Continuous.Validation.Switch

Validation model for the Switch block

CDL.Continuous.Validation.Switch

Information

Validation test for the block CDL.Continuous.Switch.

Modelica definition

model Switch "Validation model for the Switch block" CDL.Continuous.Sources.Ramp ramp1( duration=5, offset=-1, height=6) "Block that generates ramp signal"; CDL.Continuous.Sources.Ramp ramp2( duration=5, offset=-1, height=2) "Block that generates ramp signal"; CDL.Logical.Sources.Pulse booPul( width=0.5, period=2) "Block that outputs cyclic on and off"; CDL.Continuous.Switch switch1 "Switch between two real inputs"; equation connect(booPul.y,switch1.u2); connect(ramp2.y,switch1.u3); connect(ramp1.y,switch1.u1); end Switch;

CDL.Continuous.Validation.Tan CDL.Continuous.Validation.Tan

Validation model for the Tan block

CDL.Continuous.Validation.Tan

Information

Validation test for the block CDL.Continuous.Tan.

The input u varies from -1.5 to +1.5.

Modelica definition

model Tan "Validation model for the Tan block" CDL.Continuous.Tan tan1 "Block that outputs the sine of the input"; CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-1.5, height=3.0) "Block that generates ramp signal"; equation connect(ramp1.y,tan1.u); end Tan;