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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed

Modelica definition

model BinaryVariableGeneration "Test model for binary variable generation function" extends Modelica.Icons.Example; parameter Integer localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; Boolean r "Return value of random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); r = false; equation p = time; when sample(0, 0.1) then (r, state) = Buildings.Occupants.BaseClasses.binaryVariableGeneration(p, pre(state)); if r 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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed

Modelica definition

model ExponentialVariableGeneration "Test model for exponential variable generation function" extends Modelica.Icons.Example; parameter Integer localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); equation mu = 10*time; when sample(0, 0.1) then (y, state) = Buildings.Occupants.BaseClasses.exponentialVariableGeneration(mu, pre(state)); 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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed
RealA0.9Parameter A
RealB0Parameter B

Modelica definition

model Linear1D "Test model for 1D binary variable generation function" extends Modelica.Icons.Example; parameter Integer localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; Boolean r "Return value of random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); r = false; equation x = time; when sample(0, 0.1) then (r, state) = Buildings.Occupants.BaseClasses.linear1D(x, A, B, pre(state)); if r 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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed
RealA0.9Parameter A
RealB0Parameter B

Modelica definition

model Logit1D "Test model for 1D binary variable generation function" extends Modelica.Icons.Example; parameter Integer localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; Boolean r "Return value of random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); r = false; equation x = time; when sample(0, 0.1) then (r, state) = Buildings.Occupants.BaseClasses.logit1D(x, A, B, pre(state)); if r 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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed
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 localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; Boolean r "Return value of random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); r = false; equation x = time+1; when sample(0, 0.1) then (r, state) = Buildings.Occupants.BaseClasses.logit1DQuadratic(x, A, B, C, D, pre(state)); if r 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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed
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 localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; Boolean r "Return value of random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); r = false; equation x1 = time; x2 = 0.7*time; when sample(0, 0.1) then (r, state) = Buildings.Occupants.BaseClasses.logit2D(x1, x2, A, B, C, pre(state)); if r 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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed
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 localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; Boolean r "Return value of random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); r = false; equation x = time; when sample(0, 0.1) then (r, state) = Buildings.Occupants.BaseClasses.weibull1DOFF(x, u, L, k, dt, pre(state)); if r 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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed
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 localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; Boolean r "Return value of random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); r = false; equation x = time; when sample(0, 0.1) then (r, state) = Buildings.Occupants.BaseClasses.weibull1DON(x, u, L, k, dt, pre(state)); if r 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
IntegerlocalSeed10Local seed to be used to generate the initial state of the random number generator
IntegerglobalSeed30129Global seed to be combined with the local seed
Reallambda10Time step length

Modelica definition

model WeibullVariableGeneration "Test model for real variable generation function" extends Modelica.Icons.Example; parameter Integer localSeed = 10 "Local seed to be used to generate the initial state of the random number generator"; parameter Integer globalSeed = 30129 "Global seed to be combined with the local seed"; 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"; Integer state[Modelica.Math.Random.Generators.Xorshift1024star.nState] "State of the random number generator"; initial equation y = 0; t0 = time; state = Modelica.Math.Random.Generators.Xorshift1024star.initialState( localSeed = localSeed, globalSeed = globalSeed); equation k = (time+1); when sample(0, 0.1) then (y, state) = Buildings.Occupants.BaseClasses.weibullVariableGeneration(lambda, k, pre(state)); end when; end WeibullVariableGeneration;