Buildings.Occupants.BaseClasses.Validation

Package with examples to validate functions in BaseClasses package

Information

This package contains examples to validate models in the Windows package.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

Name Description
Buildings.Occupants.BaseClasses.Validation.BinaryVariableGeneration BinaryVariableGeneration Test model for binary variable generation function
Buildings.Occupants.BaseClasses.Validation.ExponentialVariableGeneration ExponentialVariableGeneration Test model for exponential variable generation function
Buildings.Occupants.BaseClasses.Validation.Linear1D Linear1D Test model for 1D binary variable generation function
Buildings.Occupants.BaseClasses.Validation.Logit1D Logit1D Test model for 1D binary variable generation function
Buildings.Occupants.BaseClasses.Validation.Logit1DQuadratic Logit1DQuadratic Test model for 1D binary variable generation function
Buildings.Occupants.BaseClasses.Validation.Logit2D Logit2D Test model for 2D binary variable generation function
Buildings.Occupants.BaseClasses.Validation.Weibull1DOFF Weibull1DOFF Test model for 1D binary variable generation function
Buildings.Occupants.BaseClasses.Validation.Weibull1DON Weibull1DON Test model for 1D binary variable generation function
Buildings.Occupants.BaseClasses.Validation.WeibullVariableGeneration WeibullVariableGeneration Test model for real variable generation function

Buildings.Occupants.BaseClasses.Validation.BinaryVariableGeneration Buildings.Occupants.BaseClasses.Validation.BinaryVariableGeneration

Test model for binary variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.binaryVariableGeneration.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator

Modelica definition

model BinaryVariableGeneration "Test model for binary variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; Real p "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation p = time; when sample(0, 0.1) then curSeed = seed*1E6*time; if Buildings.Occupants.BaseClasses.binaryVariableGeneration(p, globalSeed=integer(curSeed)) then y = 1; else y = 0; end if; end when; end BinaryVariableGeneration;

Buildings.Occupants.BaseClasses.Validation.ExponentialVariableGeneration Buildings.Occupants.BaseClasses.Validation.ExponentialVariableGeneration

Test model for exponential variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.exponentialVariableGeneration.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator

Modelica definition

model ExponentialVariableGeneration "Test model for exponential variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; Real mu "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation mu = 10*time; when sample(0, 0.1) then curSeed = seed*1E6*time; y = Buildings.Occupants.BaseClasses.exponentialVariableGeneration(mu, globalSeed=integer(curSeed)); end when; end ExponentialVariableGeneration;

Buildings.Occupants.BaseClasses.Validation.Linear1D Buildings.Occupants.BaseClasses.Validation.Linear1D

Test model for 1D binary variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.linear1D.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator
RealA0.9Parameter A
RealB0Parameter B

Modelica definition

model Linear1D "Test model for 1D binary variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; parameter Real A = 0.9 "Parameter A"; parameter Real B = 0 "Parameter B"; Real x "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation x = time; when sample(0, 0.1) then curSeed = seed*1E6*time; if Buildings.Occupants.BaseClasses.linear1D(x,A,B,globalSeed=integer(curSeed)) then y = 1; else y = 0; end if; end when; end Linear1D;

Buildings.Occupants.BaseClasses.Validation.Logit1D Buildings.Occupants.BaseClasses.Validation.Logit1D

Test model for 1D binary variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.logit1D.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator
RealA0.9Parameter A
RealB0Parameter B

Modelica definition

model Logit1D "Test model for 1D binary variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; parameter Real A = 0.9 "Parameter A"; parameter Real B = 0 "Parameter B"; Real x "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation x = time; when sample(0, 0.1) then curSeed = seed*1E6*time; if Buildings.Occupants.BaseClasses.logit1D(x,A,B,globalSeed=integer(curSeed)) then y = 1; else y = 0; end if; end when; end Logit1D;

Buildings.Occupants.BaseClasses.Validation.Logit1DQuadratic Buildings.Occupants.BaseClasses.Validation.Logit1DQuadratic

Test model for 1D binary variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.logit1DQuadratic.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator
RealA0.1Parameter A
RealB0.5Parameter B
RealC1.3Parameter A
RealD1.5Parameter B

Modelica definition

model Logit1DQuadratic "Test model for 1D binary variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; parameter Real A = 0.1 "Parameter A"; parameter Real B = 0.5 "Parameter B"; parameter Real C = 1.3 "Parameter A"; parameter Real D = 1.5 "Parameter B"; Real x "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation x = time+1; when sample(0, 0.1) then curSeed = seed*1E6*time; if Buildings.Occupants.BaseClasses.logit1DQuadratic(x,A,B,C,D,globalSeed=integer(curSeed)) then y = 1; else y = 0; end if; end when; end Logit1DQuadratic;

Buildings.Occupants.BaseClasses.Validation.Logit2D Buildings.Occupants.BaseClasses.Validation.Logit2D

Test model for 2D binary variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.logit2D.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator
RealA0.9Parameter A
RealB1.3Parameter B
RealC0Parameter C

Modelica definition

model Logit2D "Test model for 2D binary variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; parameter Real A = 0.9 "Parameter A"; parameter Real B = 1.3 "Parameter B"; parameter Real C = 0 "Parameter C"; Real x1 "Time-varying real number as input"; Real x2 "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation x1 = time; x2 = 0.7*time; when sample(0, 0.1) then curSeed = seed*1E6*time; if Buildings.Occupants.BaseClasses.logit2D(x1,x2,A,B,C,globalSeed=integer(curSeed)) then y = 1; else y = 0; end if; end when; end Logit2D;

Buildings.Occupants.BaseClasses.Validation.Weibull1DOFF Buildings.Occupants.BaseClasses.Validation.Weibull1DOFF

Test model for 1D binary variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.weibull1DOFF.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator
Realu1.0Parameter defining the Weibull distribution threshold
RealL0.5Parameter defining the Weibull distribution normalization factor
Realk1.0Parameter defining the Weibull distribution shape factor
Realdt0.2Time step length

Modelica definition

model Weibull1DOFF "Test model for 1D binary variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; parameter Real u=1.0 "Parameter defining the Weibull distribution threshold"; parameter Real L=0.5 "Parameter defining the Weibull distribution normalization factor"; parameter Real k=1.0 "Parameter defining the Weibull distribution shape factor"; parameter Real dt=0.2 "Time step length"; Real x "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation x = time; when sample(0, 0.1) then curSeed = seed*1E6*time; if Buildings.Occupants.BaseClasses.weibull1DOFF(x,u,L,k,dt,globalSeed=integer(curSeed)) then y = 1; else y = 0; end if; end when; end Weibull1DOFF;

Buildings.Occupants.BaseClasses.Validation.Weibull1DON Buildings.Occupants.BaseClasses.Validation.Weibull1DON

Test model for 1D binary variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.weibull1DON.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator
Realu0.2Parameter defining the Weibull distribution threshold
RealL0.1Parameter defining the Weibull distribution normalization factor
Realk1.0Parameter defining the Weibull distribution shape factor
Realdt0.2Time step length

Modelica definition

model Weibull1DON "Test model for 1D binary variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; parameter Real u=0.2 "Parameter defining the Weibull distribution threshold"; parameter Real L=0.1 "Parameter defining the Weibull distribution normalization factor"; parameter Real k=1.0 "Parameter defining the Weibull distribution shape factor"; parameter Real dt=0.2 "Time step length"; Real x "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation x = time; when sample(0, 0.1) then curSeed = seed*1E6*time; if Buildings.Occupants.BaseClasses.weibull1DON(x,u,L,k,dt,globalSeed=integer(curSeed)) then y = 1; else y = 0; end if; end when; end Weibull1DON;

Buildings.Occupants.BaseClasses.Validation.WeibullVariableGeneration Buildings.Occupants.BaseClasses.Validation.WeibullVariableGeneration

Test model for real variable generation function

Information

This model tests the implementation of Buildings.Occupants.BaseClasses.weibullVariableGeneration.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
Integerseed5Seed for the random number generator
Reallambda10Time step length

Modelica definition

model WeibullVariableGeneration "Test model for real variable generation function" extends Modelica.Icons.Example; parameter Integer seed = 5 "Seed for the random number generator"; parameter Real lambda=10 "Time step length"; Real k "Time-varying real number as input"; output Real y "Output"; protected parameter Modelica.Units.SI.Time t0(final fixed=false) "First sample time instant"; Real curSeed "Current value for seed as a real-valued variable"; initial equation y = 0; t0 = time; curSeed = t0*seed; equation k = (time+1); when sample(0, 0.1) then curSeed = seed*1E6*time; y = Buildings.Occupants.BaseClasses.weibullVariableGeneration(lambda,k,globalSeed=integer(curSeed)); end when; end WeibullVariableGeneration;