Buildings.Controls.OBC.CDL.Continuous.Validation

Collection of models that validate the continuous blocks of the CDL

Information

This package contains models that validate the blocks in Buildings.Controls.OBC.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
Buildings.Controls.OBC.CDL.Continuous.Validation.Abs Abs Validation model for the absolute block
Buildings.Controls.OBC.CDL.Continuous.Validation.Add Add Validation model for the add block
Buildings.Controls.OBC.CDL.Continuous.Validation.AddParameter AddParameter Validation model for the AddParameter block
Buildings.Controls.OBC.CDL.Continuous.Validation.Atan Atan Validation model for the Atan block
Buildings.Controls.OBC.CDL.Continuous.Validation.Atan2 Atan2 Validation model for the Atan2 block
Buildings.Controls.OBC.CDL.Continuous.Validation.Average Average Validation model for the Average block
Buildings.Controls.OBC.CDL.Continuous.Validation.Cos Cos Validation model for the Cos block
Buildings.Controls.OBC.CDL.Continuous.Validation.Division Division Validation model for the Division block
Buildings.Controls.OBC.CDL.Continuous.Validation.Exp Exp Validation model for the Exp block
Buildings.Controls.OBC.CDL.Continuous.Validation.Feedback Feedback Validation model for the Feedback block
Buildings.Controls.OBC.CDL.Continuous.Validation.Gain Gain Validation model for the Gain block
Buildings.Controls.OBC.CDL.Continuous.Validation.Greater Greater Validation model for the Greater block
Buildings.Controls.OBC.CDL.Continuous.Validation.GreaterThreshold GreaterThreshold Validation model for the GreaterThreshold block
Buildings.Controls.OBC.CDL.Continuous.Validation.Hysteresis Hysteresis Validation model for the Hysteresis block
Buildings.Controls.OBC.CDL.Continuous.Validation.IntegratorWithReset IntegratorWithReset Test model for integrator with reset
Buildings.Controls.OBC.CDL.Continuous.Validation.Less Less Validation model for the Less block
Buildings.Controls.OBC.CDL.Continuous.Validation.LessThreshold LessThreshold Validation model for the LessThreshold block
Buildings.Controls.OBC.CDL.Continuous.Validation.Limiter Limiter Validation model for the Limiter block
Buildings.Controls.OBC.CDL.Continuous.Validation.Line Line Validation model for the Line block
Buildings.Controls.OBC.CDL.Continuous.Validation.Log Log Validation model for the Log block
Buildings.Controls.OBC.CDL.Continuous.Validation.Log10 Log10 Validation model for the Log10 block
Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixGain MatrixGain Validation model for the MatrixGain block
Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixMax MatrixMax Validation model for the MatrixMax block
Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixMin MatrixMin Validation model for the MatrixMin block
Buildings.Controls.OBC.CDL.Continuous.Validation.Max Max Validation model for the Max block
Buildings.Controls.OBC.CDL.Continuous.Validation.Min Min Validation model for the Min block
Buildings.Controls.OBC.CDL.Continuous.Validation.Modulo Modulo Validation model for the Modulo block
Buildings.Controls.OBC.CDL.Continuous.Validation.MovingMean MovingMean Validation model for the MovingMean block
Buildings.Controls.OBC.CDL.Continuous.Validation.MovingMean_nonZeroStart MovingMean_nonZeroStart Validation model for the MovingMean block
Buildings.Controls.OBC.CDL.Continuous.Validation.MultiMax MultiMax Validation model for the MultiMax block
Buildings.Controls.OBC.CDL.Continuous.Validation.MultiMin MultiMin Validation model for the MultiMin block
Buildings.Controls.OBC.CDL.Continuous.Validation.MultiSum MultiSum Model to validate the application of MultiSum block
Buildings.Controls.OBC.CDL.Continuous.Validation.PID PID Test model for PID controller
Buildings.Controls.OBC.CDL.Continuous.Validation.PIDInitialDerivativeOutput PIDInitialDerivativeOutput Test model for LimPID controller with initial output of the derivative term specified
Buildings.Controls.OBC.CDL.Continuous.Validation.PIDInitialState PIDInitialState Test model for LimPID controller with initial state specified
Buildings.Controls.OBC.CDL.Continuous.Validation.PIDScale PIDScale Test model for PID controller with scaling of the control error
Buildings.Controls.OBC.CDL.Continuous.Validation.PIDWithReset PIDWithReset Test model for LimPID controller with reset trigger
Buildings.Controls.OBC.CDL.Continuous.Validation.PIDWithResetScale PIDWithResetScale Test model for PID controller with reset and scaling of the control error
Buildings.Controls.OBC.CDL.Continuous.Validation.Product Product Validation model for the Product block
Buildings.Controls.OBC.CDL.Continuous.Validation.Round Round Validation model for the Round block
Buildings.Controls.OBC.CDL.Continuous.Validation.Sin Sin Validation model for the Sin block
Buildings.Controls.OBC.CDL.Continuous.Validation.SlewRateLimiter SlewRateLimiter Validation model for the SlewRateLimiter block
Buildings.Controls.OBC.CDL.Continuous.Validation.Sort Sort Validation model for the Sort block
Buildings.Controls.OBC.CDL.Continuous.Validation.Sqrt Sqrt Validation model for the Sqrt block
Buildings.Controls.OBC.CDL.Continuous.Validation.Tan Tan Validation model for the Tan block

Buildings.Controls.OBC.CDL.Continuous.Validation.Abs Buildings.Controls.OBC.CDL.Continuous.Validation.Abs

Validation model for the absolute block

Buildings.Controls.OBC.CDL.Continuous.Validation.Abs

Information

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

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.Add Buildings.Controls.OBC.CDL.Continuous.Validation.Add

Validation model for the add block

Buildings.Controls.OBC.CDL.Continuous.Validation.Add

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Add add1 "Block that outputs the sum of the two inputs"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.AddParameter Buildings.Controls.OBC.CDL.Continuous.Validation.AddParameter

Validation model for the AddParameter block

Buildings.Controls.OBC.CDL.Continuous.Validation.AddParameter

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.AddParameter.

The input u varies from -2 to +2.

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.Atan Buildings.Controls.OBC.CDL.Continuous.Validation.Atan

Validation model for the Atan block

Buildings.Controls.OBC.CDL.Continuous.Validation.Atan

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Atan.

The input u varies from -2 to +2.

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.Atan2 Buildings.Controls.OBC.CDL.Continuous.Validation.Atan2

Validation model for the Atan2 block

Buildings.Controls.OBC.CDL.Continuous.Validation.Atan2

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Atan2 atan2_1 "Block that outputs atan(u1/u2) of the inputs u1 and u2"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Average Buildings.Controls.OBC.CDL.Continuous.Validation.Average

Validation model for the Average block

Buildings.Controls.OBC.CDL.Continuous.Validation.Average

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Average avg1 "Block that outputs the average of its two inputs"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=6) "Block that generates ramp signal"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Cos Buildings.Controls.OBC.CDL.Continuous.Validation.Cos

Validation model for the Cos block

Buildings.Controls.OBC.CDL.Continuous.Validation.Cos

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Cos.

The input u varies from 0.0 to +6.283.

Modelica definition

model Cos "Validation model for the Cos block" Buildings.Controls.OBC.CDL.Continuous.Cos cos1 "Block that outputs the cosine of the input"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Division Buildings.Controls.OBC.CDL.Continuous.Validation.Division

Validation model for the Division block

Buildings.Controls.OBC.CDL.Continuous.Validation.Division

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Division.

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

Modelica definition

model Division "Validation model for the Division block" Buildings.Controls.OBC.CDL.Continuous.Division div1 "Block that outputs first input divided by second input: u1/u2"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.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 Division;

Buildings.Controls.OBC.CDL.Continuous.Validation.Exp Buildings.Controls.OBC.CDL.Continuous.Validation.Exp

Validation model for the Exp block

Buildings.Controls.OBC.CDL.Continuous.Validation.Exp

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Exp.

The input u varies from 0.0 to +2.

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.Feedback Buildings.Controls.OBC.CDL.Continuous.Validation.Feedback

Validation model for the Feedback block

Buildings.Controls.OBC.CDL.Continuous.Validation.Feedback

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Feedback.

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

Modelica definition

model Feedback "Validation model for the Feedback block" Buildings.Controls.OBC.CDL.Continuous.Feedback feedback1 "Block that outputs difference between commanded and feedback input"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-1, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2( height=2, duration=1, offset=-1) "Block that generates ramp signal"; equation connect(ramp1.y,feedback1.u1); connect(ramp2.y,feedback1.u2); end Feedback;

Buildings.Controls.OBC.CDL.Continuous.Validation.Gain Buildings.Controls.OBC.CDL.Continuous.Validation.Gain

Validation model for the Gain block

Buildings.Controls.OBC.CDL.Continuous.Validation.Gain

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Gain.

The input u varies from 0.0 to +2.

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.Greater Buildings.Controls.OBC.CDL.Continuous.Validation.Greater

Validation model for the Greater block

Buildings.Controls.OBC.CDL.Continuous.Validation.Greater

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Greater gre "Greater block, without hysteresis"; Buildings.Controls.OBC.CDL.Continuous.Greater greHys( h=0.2) "Greater block, with hysteresis"; Sources.TimeTable ram( table=[ 0,0; 1,0; 2,1; 3,1; 4,0; 5,0]) "Ramp signal"; Sources.Constant con( k=0.5) "Constant signal"; equation connect(con.y,greHys.u2); connect(con.y,gre.u2); connect(ram.y[1],gre.u1); connect(ram.y[1],greHys.u1); end Greater;

Buildings.Controls.OBC.CDL.Continuous.Validation.GreaterThreshold Buildings.Controls.OBC.CDL.Continuous.Validation.GreaterThreshold

Validation model for the GreaterThreshold block

Buildings.Controls.OBC.CDL.Continuous.Validation.GreaterThreshold

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold gre( t=0.5) "Greater block, without hysteresis"; Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greHys( t=0.5, h=0.2) "Greater block, with hysteresis"; Sources.TimeTable ram( table=[ 0,0; 1,0; 2,1; 3,1; 4,0; 5,0]) "Ramp signal"; equation connect(ram.y[1],gre.u); connect(ram.y[1],greHys.u); end GreaterThreshold;

Buildings.Controls.OBC.CDL.Continuous.Validation.Hysteresis Buildings.Controls.OBC.CDL.Continuous.Validation.Hysteresis

Validation model for the Hysteresis block

Buildings.Controls.OBC.CDL.Continuous.Validation.Hysteresis

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Hysteresis.

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.IntegratorWithReset Buildings.Controls.OBC.CDL.Continuous.Validation.IntegratorWithReset

Test model for integrator with reset

Buildings.Controls.OBC.CDL.Continuous.Validation.IntegratorWithReset

Information

This model tests the implementation of Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intDef "Integrator with default values"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intWitRes1( final y_start=5, final k=0.5) "Integrator with reset"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intWitRes2( final y_start=-5, final k=0.5) "Integrator with reset and y_reset = 2"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant cons( final k=10) "Constant as source term"; Buildings.Controls.OBC.CDL.Logical.Sources.Pulse booleanPulse( final width=0.5, final period=0.2) "Boolean pulse"; Buildings.Controls.OBC.CDL.Logical.Sources.SampleTrigger sampleTrigger( final period=0.2) "Sample trigger"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Less Buildings.Controls.OBC.CDL.Continuous.Validation.Less

Validation model for the Less block

Buildings.Controls.OBC.CDL.Continuous.Validation.Less

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Less les "Less block, without hysteresis"; Buildings.Controls.OBC.CDL.Continuous.Less lesHys( h=0.2) "Less block, with hysteresis"; Sources.TimeTable ram( table=[ 0,0; 1,0; 2,1; 3,1; 4,0; 5,0]) "Ramp signal"; Sources.Constant con( k=0.5) "Constant signal"; equation connect(con.y,lesHys.u2); connect(con.y,les.u2); connect(ram.y[1],les.u1); connect(ram.y[1],lesHys.u1); end Less;

Buildings.Controls.OBC.CDL.Continuous.Validation.LessThreshold Buildings.Controls.OBC.CDL.Continuous.Validation.LessThreshold

Validation model for the LessThreshold block

Buildings.Controls.OBC.CDL.Continuous.Validation.LessThreshold

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.LessThreshold les( t=0.5) "Less block, without hysteresis"; Buildings.Controls.OBC.CDL.Continuous.LessThreshold lesHys( t=0.5, h=0.2) "Less block, with hysteresis"; Sources.TimeTable ram( table=[ 0,0; 1,0; 2,1; 3,1; 4,0; 5,0]) "Ramp signal"; equation connect(ram.y[1],les.u); connect(ram.y[1],lesHys.u); end LessThreshold;

Buildings.Controls.OBC.CDL.Continuous.Validation.Limiter Buildings.Controls.OBC.CDL.Continuous.Validation.Limiter

Validation model for the Limiter block

Buildings.Controls.OBC.CDL.Continuous.Validation.Limiter

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Limiter.

The input u varies from 0.0 to +2.

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.Line Buildings.Controls.OBC.CDL.Continuous.Validation.Line

Validation model for the Line block

Buildings.Controls.OBC.CDL.Continuous.Validation.Line

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Line line1 "Block that out the value of the input x along a line specified by two points"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant x1( k=1.0) "Block that generate x1"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant f1( k=0.5) "Block that generate f(x1)"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant x2( k=2.0) "Block that generate x2"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant f2( k=1.5) "Block that generate f(x2)"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( offset=0, duration=0.5, startTime=0.25, height=3) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Line line2( limitAbove=true, limitBelow=false) "Block that out the value of the input x along a line specified by two points"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Log Buildings.Controls.OBC.CDL.Continuous.Validation.Log

Validation model for the Log block

Buildings.Controls.OBC.CDL.Continuous.Validation.Log

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Log.

The input u varies from +1 to +6.

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.Log10 Buildings.Controls.OBC.CDL.Continuous.Validation.Log10

Validation model for the Log10 block

Buildings.Controls.OBC.CDL.Continuous.Validation.Log10

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Log10.

The input u varies from +1 to +10.

Modelica definition

model Log10 "Validation model for the Log10 block" Buildings.Controls.OBC.CDL.Continuous.Log10 log10_1 "Block that outputs the base 10 logarithm of the input (input > 0 required)"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixGain Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixGain

Validation model for the MatrixGain block

Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixGain

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.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"; Buildings.Controls.OBC.CDL.Continuous.MatrixGain matGai1( K=[ 1,2; 3,4]) "Block that outputs the product of a matrix gain value with the input signal"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixMax Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixMax

Validation model for the MatrixMax block

Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixMax

Information

Validation test for the block Buildings.Controls.OBC.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"; Buildings.Controls.OBC.CDL.Continuous.MatrixMax matMax( rowMax=false, nRow=3, nCol=3) "Matrix maximum"; Buildings.Controls.OBC.CDL.Continuous.MatrixMax matMax1( nCol=3, nRow=2) "Matrix maximum"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixMin Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixMin

Validation model for the MatrixMin block

Buildings.Controls.OBC.CDL.Continuous.Validation.MatrixMin

Information

Validation test for the block Buildings.Controls.OBC.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"; Buildings.Controls.OBC.CDL.Continuous.MatrixMin matMin( nRow=3, nCol=3, rowMin=false) "Matrix minimum"; Buildings.Controls.OBC.CDL.Continuous.MatrixMin matMin1( nCol=3, rowMin=false, nRow=2) "Matrix minimum"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Max Buildings.Controls.OBC.CDL.Continuous.Validation.Max

Validation model for the Max block

Buildings.Controls.OBC.CDL.Continuous.Validation.Max

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Max max1 "Block that pass through the largest signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Min Buildings.Controls.OBC.CDL.Continuous.Validation.Min

Validation model for the Min block

Buildings.Controls.OBC.CDL.Continuous.Validation.Min

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Min min1 "Block that pass through the smallest signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Modulo Buildings.Controls.OBC.CDL.Continuous.Validation.Modulo

Validation model for the Modulo block

Buildings.Controls.OBC.CDL.Continuous.Validation.Modulo

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Modulo mod1 "Block that outputs the remainder of first input divided by second input (~=0)"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=6) "Block that generates ramp signal"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.MovingMean Buildings.Controls.OBC.CDL.Continuous.Validation.MovingMean

Validation model for the MovingMean block

Buildings.Controls.OBC.CDL.Continuous.Validation.MovingMean

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.MovingMean.

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 MovingMean "Validation model for the MovingMean block" Modelica.Blocks.Sources.Sine sinInpNoDel( freqHz=1/80) "Start from zero second"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_1( delta=100) "Moving average with 100 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_2( delta=200) "Moving average with 200 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_3( delta=300) "Moving average with 300 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_4( delta=400) "Moving average with 400 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_5( delta=500) "Moving average with 500 s sliding window"; Modelica.Blocks.Sources.Sine sinInp50sDel( freqHz=1/80, startTime=50) "Start from 50 seconds"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_6( delta=100) "Moving average with 100 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_7( delta=200) "Moving average with 200 s sliding window"; Modelica.Blocks.Sources.Sine sinInp100sDel( freqHz=1/80, startTime=100) "Start from 100 seconds"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_8( delta=100) "Moving average with 100 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_9( delta=200) "Moving average with 200 s sliding window"; equation connect(sinInpNoDel.y,movingMean_3.u); connect(sinInpNoDel.y,movingMean_1.u); connect(sinInpNoDel.y,movingMean_2.u); connect(sinInpNoDel.y,movingMean_5.u); connect(sinInpNoDel.y,movingMean_4.u); connect(sinInp50sDel.y,movingMean_6.u); connect(sinInp50sDel.y,movingMean_7.u); connect(sinInp100sDel.y,movingMean_9.u); connect(sinInp100sDel.y,movingMean_8.u); end MovingMean;

Buildings.Controls.OBC.CDL.Continuous.Validation.MovingMean_nonZeroStart Buildings.Controls.OBC.CDL.Continuous.Validation.MovingMean_nonZeroStart

Validation model for the MovingMean block

Buildings.Controls.OBC.CDL.Continuous.Validation.MovingMean_nonZeroStart

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.MovingMean.

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 MovingMean_nonZeroStart "Validation model for the MovingMean block" Modelica.Blocks.Sources.Sine sinInpNoDel( freqHz=1/80) "Start from zero second"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_1( delta=100) "Moving average with 100 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_2( delta=200) "Moving average with 200 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_3( delta=300) "Moving average with 300 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_4( delta=400) "Moving average with 400 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_5( delta=500) "Moving average with 500 s sliding window"; Modelica.Blocks.Sources.Sine sinInp50sDel( freqHz=1/80, startTime=50) "Start from 50 seconds"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_6( delta=100) "Moving average with 100 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_7( delta=200) "Moving average with 200 s sliding window"; Modelica.Blocks.Sources.Sine sinInp100sDel( freqHz=1/80, startTime=100) "Start from 100 seconds"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_8( delta=100) "Moving average with 100 s sliding window"; Buildings.Controls.OBC.CDL.Continuous.MovingMean movingMean_9( delta=200) "Moving average with 200 s sliding window"; equation connect(sinInpNoDel.y,movingMean_3.u); connect(sinInpNoDel.y,movingMean_1.u); connect(sinInpNoDel.y,movingMean_2.u); connect(sinInpNoDel.y,movingMean_5.u); connect(sinInpNoDel.y,movingMean_4.u); connect(sinInp50sDel.y,movingMean_6.u); connect(sinInp50sDel.y,movingMean_7.u); connect(sinInp100sDel.y,movingMean_9.u); connect(sinInp100sDel.y,movingMean_8.u); end MovingMean_nonZeroStart;

Buildings.Controls.OBC.CDL.Continuous.Validation.MultiMax Buildings.Controls.OBC.CDL.Continuous.Validation.MultiMax

Validation model for the MultiMax block

Buildings.Controls.OBC.CDL.Continuous.Validation.MultiMax

Information

Validation test for the block Buildings.Controls.OBC.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"; Buildings.Controls.OBC.CDL.Continuous.MultiMax maxVal( nin=sizOfVec) "Block that outputs the maximum element of the input vector"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.MultiMin Buildings.Controls.OBC.CDL.Continuous.Validation.MultiMin

Validation model for the MultiMin block

Buildings.Controls.OBC.CDL.Continuous.Validation.MultiMin

Information

Validation test for the block Buildings.Controls.OBC.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"; Buildings.Controls.OBC.CDL.Continuous.MultiMin minVal( nin=sizOfVec) "Block that outputs the minimum element of the input vector"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.MultiSum Buildings.Controls.OBC.CDL.Continuous.Validation.MultiSum

Model to validate the application of MultiSum block

Buildings.Controls.OBC.CDL.Continuous.Validation.MultiSum

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.MultiSum.

The inputs and gains are configured as follows:

Modelica definition

model MultiSum "Model to validate the application of MultiSum block" Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2( height=2, duration=1, offset=-1) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp3( height=3, duration=1, offset=-1) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp4( height=3, duration=1, offset=-2) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp5( height=3, duration=1, offset=-3) "Block that generates ramp signal"; Buildings.Controls.OBC.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]"; Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum_2( nin=2, k={1,0.5}) "Sum of Reals, y = k[1]*u[1] + k[2]*u[2]"; Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum_1( nin=1, k={1}) "Sum of Reals, y = k[1]*u[1]"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.PID Buildings.Controls.OBC.CDL.Continuous.Validation.PID

Test model for PID controller

Buildings.Controls.OBC.CDL.Continuous.Validation.PID

Information

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

Modelica definition

model PID "Test model for PID controller" Buildings.Controls.OBC.CDL.Continuous.Sources.Pulse pulse( period=0.25) "Setpoint"; Buildings.Controls.OBC.CDL.Continuous.PID limPID( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, Ti=1, Td=1, yMin=-1) "PID controller"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant const( k=0.5) "Measurement data"; Buildings.Controls.OBC.CDL.Continuous.PID limPI( Ti=1, Td=1, yMin=-1, controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI) "PI controller"; Buildings.Controls.OBC.CDL.Continuous.PID limPD( Ti=1, Td=1, yMin=-1, controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PD) "PD controller"; Buildings.Controls.OBC.CDL.Continuous.PID limP( Ti=1, Td=1, yMin=-1, controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.P) "P controller"; Buildings.Controls.OBC.CDL.Continuous.PID noLimPID( Ti=1, Td=1, yMax=1e15, yMin=-1e15, controllerType=Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDInitialDerivativeOutput Buildings.Controls.OBC.CDL.Continuous.Validation.PIDInitialDerivativeOutput

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

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDInitialDerivativeOutput

Information

Validation test for the block Buildings.Controls.OBC.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 Buildings.Controls.OBC.CDL.Continuous.PID.

Modelica definition

model PIDInitialDerivativeOutput "Test model for LimPID controller with initial output of the derivative term specified" Buildings.Controls.OBC.CDL.Continuous.Sources.Constant ySet( k=0.75) "Set point"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant yMea( k=0.75) "Measured value"; Buildings.Controls.OBC.CDL.Continuous.PID limPID( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, k=3, yd_start=0.2) "PID controller"; Buildings.Controls.OBC.CDL.Continuous.PID limPD( controllerType=Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDInitialState Buildings.Controls.OBC.CDL.Continuous.Validation.PIDInitialState

Test model for LimPID controller with initial state specified

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDInitialState

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Sources.Constant ySet( k=0.75) "Set point"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant yMea( k=0.5) "Measured value"; Buildings.Controls.OBC.CDL.Continuous.PID limPID( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, k=3, xi_start=0.25) "PID controller"; Buildings.Controls.OBC.CDL.Continuous.PID limPI( controllerType=Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDScale Buildings.Controls.OBC.CDL.Continuous.Validation.PIDScale

Test model for PID controller with scaling of the control error

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDScale

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Sources.Pulse pulse( amplitude=1000, period=50) "Setpoint"; Buildings.Controls.OBC.CDL.Continuous.PID pidSca( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, k=2, Ti=1, Td=2, r=1000, yMin=-1) "PID controller with scaling of control input"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset pla1( k=1000) "Plant model"; Sources.Constant resVal( k=0) "Reset value"; Logical.Sources.Constant resSig( k=false) "Reset signal"; Buildings.Controls.OBC.CDL.Continuous.PID pidNoSca( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, k=2, Ti=1, Td=2, yMin=-1) "PID controller without scaling of control input"; Buildings.Controls.OBC.CDL.Continuous.Gain gai( k=1/1000) "Gain to scale setpoint"; Buildings.Controls.OBC.CDL.Continuous.Gain gai1( k=1/1000) "Gain to scale measured value"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDWithReset Buildings.Controls.OBC.CDL.Continuous.Validation.PIDWithReset

Test model for LimPID controller with reset trigger

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDWithReset

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Conversions.BooleanToReal setPoi "Set point"; Buildings.Controls.OBC.CDL.Continuous.Sources.ModelTime modTim "Model time"; Buildings.Controls.OBC.CDL.Continuous.GreaterThreshold greEquThr( t=1) "Outputs true after t=1"; Buildings.Controls.OBC.CDL.Continuous.PIDWithReset limPIDPar( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, k=1, Ti=1, Td=1, yMin=-1, y_reset=0.5) "Controller, reset to parameter value"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intWitRes1 "Integrator whose output should be brought to the set point"; Buildings.Controls.OBC.CDL.Continuous.PIDWithReset limPIDInp( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, k=1, Ti=1, Td=1, yMin=-1, y_reset=0.75) "Controller, reset to input value"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intWitRes2 "Integrator whose output should be brought to the set point"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant resVal( k=0) "Reset value"; Buildings.Controls.OBC.CDL.Continuous.PIDWithReset limPIPar( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI, k=1, Ti=1, Td=1, yMin=-1, y_reset=0.5) "Controller, reset to parameter value"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intWitRes3 "Integrator whose output should be brought to the set point"; Buildings.Controls.OBC.CDL.Continuous.PIDWithReset limPIInp( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI, k=1, Ti=1, Td=1, yMin=-1, y_reset=0.75) "Controller, reset to input value"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset intWitRes4 "Integrator whose output should be brought to the set point"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDWithResetScale Buildings.Controls.OBC.CDL.Continuous.Validation.PIDWithResetScale

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

Buildings.Controls.OBC.CDL.Continuous.Validation.PIDWithResetScale

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Sources.Pulse pulse( amplitude=1000, period=50) "Setpoint"; Buildings.Controls.OBC.CDL.Continuous.PIDWithReset pidSca( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, k=2, Ti=1, Td=2, r=1000, yMin=-1, y_reset=0) "PID controller with scaling of control input"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset pla1( k=1000) "Plant model"; Sources.Constant resVal( k=0) "Reset value"; Logical.Sources.Constant resSig( k=false) "Reset signal"; Buildings.Controls.OBC.CDL.Continuous.PIDWithReset pidNoSca( controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PID, k=2, Ti=1, Td=2, yMin=-1, y_reset=0) "PID controller without scaling of control input"; Buildings.Controls.OBC.CDL.Continuous.Gain gai( k=1/1000) "Gain to scale setpoint"; Buildings.Controls.OBC.CDL.Continuous.Gain gai1( k=1/1000) "Gain to scale measured value"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Product Buildings.Controls.OBC.CDL.Continuous.Validation.Product

Validation model for the Product block

Buildings.Controls.OBC.CDL.Continuous.Validation.Product

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Product.

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

Modelica definition

model Product "Validation model for the Product block" Buildings.Controls.OBC.CDL.Continuous.Product product1 "Block that outputs product of the two inputs"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.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 Product;

Buildings.Controls.OBC.CDL.Continuous.Validation.Round Buildings.Controls.OBC.CDL.Continuous.Validation.Round

Validation model for the Round block

Buildings.Controls.OBC.CDL.Continuous.Validation.Round

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Round.

The input u varies from -3.5 to +3.5.

Modelica definition

model Round "Validation model for the Round block" Buildings.Controls.OBC.CDL.Continuous.Round round1( n=0) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-3.5, height=7.0) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Round round2( n=1) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Continuous.Round round3( n=-1) "Round real number to given digits"; Buildings.Controls.OBC.CDL.Continuous.Gain gai( k=0.1) "Gain"; Buildings.Controls.OBC.CDL.Continuous.Gain 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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Sin Buildings.Controls.OBC.CDL.Continuous.Validation.Sin

Validation model for the Sin block

Buildings.Controls.OBC.CDL.Continuous.Validation.Sin

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Sin.

The input u varies from 0.0 to +2π.

Modelica definition

model Sin "Validation model for the Sin block" Buildings.Controls.OBC.CDL.Continuous.Sin sin1 "Block that outputs the sine of the input"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.SlewRateLimiter Buildings.Controls.OBC.CDL.Continuous.Validation.SlewRateLimiter

Validation model for the SlewRateLimiter block

Buildings.Controls.OBC.CDL.Continuous.Validation.SlewRateLimiter

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.SlewRateLimiter.

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 SlewRateLimiter "Validation model for the SlewRateLimiter block" Buildings.Controls.OBC.CDL.Continuous.SlewRateLimiter sleRatLim( raisingSlewRate=1/30) "Block that limit the increase or decrease rate of input"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( offset=0, height=1.5, duration=20, startTime=10) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2( offset=0, height=-1.5, startTime=60, duration=20) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Add add "Signal adder"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp3( offset=0, height=-1.5, duration=30, startTime=120+60) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp4( offset=0, height=1.5, duration=30, startTime=120) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp5( offset=0, height=-1.5, startTime=240+60, duration=40) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp6( offset=0, height=1.5, startTime=240, duration=40) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Add add1 "Signal adder"; Buildings.Controls.OBC.CDL.Continuous.Add add2 "Signal adder"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp7( offset=0, height=-1.5, duration=50, startTime=360+60) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp8( offset=0, height=1.5, duration=50, startTime=360) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Add add3 "Signal adder"; Buildings.Controls.OBC.CDL.Continuous.Add add4 "Signal adder"; Buildings.Controls.OBC.CDL.Continuous.Add add5 "Signal adder"; Buildings.Controls.OBC.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 SlewRateLimiter;

Buildings.Controls.OBC.CDL.Continuous.Validation.Sort Buildings.Controls.OBC.CDL.Continuous.Validation.Sort

Validation model for the Sort block

Buildings.Controls.OBC.CDL.Continuous.Validation.Sort

Information

Validation test for the block Buildings.Controls.OBC.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" Buildings.Controls.OBC.CDL.Continuous.Sort sorAsc( nin=5) "Block that sorts signals in ascending order"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp1( duration=1, offset=-2, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp2( duration=1, offset=-1, height=3) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp3( duration=1, offset=2, height=-4) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp4( duration=1, offset=3, height=-1) "Block that generates ramp signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Ramp ramp5( duration=1, offset=0, height=4) "Block that generates ramp signal"; Buildings.Controls.OBC.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;

Buildings.Controls.OBC.CDL.Continuous.Validation.Sqrt Buildings.Controls.OBC.CDL.Continuous.Validation.Sqrt

Validation model for the Sqrt block

Buildings.Controls.OBC.CDL.Continuous.Validation.Sqrt

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Sqrt.

The input u varies from 0.0 to +9.0.

Modelica definition

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

Buildings.Controls.OBC.CDL.Continuous.Validation.Tan Buildings.Controls.OBC.CDL.Continuous.Validation.Tan

Validation model for the Tan block

Buildings.Controls.OBC.CDL.Continuous.Validation.Tan

Information

Validation test for the block Buildings.Controls.OBC.CDL.Continuous.Tan.

The input u varies from -1.5 to +1.5.

Modelica definition

model Tan "Validation model for the Tan block" Buildings.Controls.OBC.CDL.Continuous.Tan tan1 "Block that outputs the sine of the input"; Buildings.Controls.OBC.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;