Description: "This package contais tests for check the correctness of the models"

- Home > Modelica

## Buildings.Electrical.Utilities.Examples

This package contais tests for check the correctness of the models

### Information

This package contains examples for the use of models that can be found in Buildings.Electrical.Utilities.

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

### Package Content

Name | Description
--- | ---
TestVoltageCTRL | This test check the correctness of the voltage controller model

## Buildings.Electrical.Utilities.Examples.TestVoltageCTRL

This test check the correctness of the voltage controller model

### Information

This example shows the use of the voltage controller.

The voltage controller is connected to a variable voltage source that oscillates between 140 and 100 V. The nominal voltage is Vnom = 120 V. The controller has the following settings:

- Nominal voltage Vnom = 120 V,
- Threshold Vtr = 0.1 (10%),
- tdelay Tdelay = 2 s.

Therefore, when the voltage controller measures a voltage that is 10% higher that 120 V (that is 132 V), it sets its output signal `y` to zero. The output signal stays at zero for Tdelay, after which it expires. Then, the controllers check again if the voltage is within the accepted thresholds.

The image below shows how the signal becomes equal to zero when the measured voltage exceeds the threshold.

The figure shows that the signal `y` becomes zero around t = 1 s. After Tdelay the voltage is still higher that 123 V and thus the controller waits until t = 5 s to change the signal to one.

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

### Modelica definition

model TestVoltageCTRL "This test check the correctness of the voltage controller model" extends Modelica.Icons.Example; VoltageControl voltageControl( redeclare Buildings.Electrical.DC.Interfaces.Terminal_p terminal, redeclare package PhaseSystem = Buildings.Electrical.PhaseSystems.TwoConductor, V_nominal=120, tDelay=2) "Voltage controller"; DC.Sources.VoltageSource sou "Varriable voltage source"; Modelica.Electrical.Analog.Basic.Ground ground; Modelica.Blocks.Sources.Sine cosine( amplitude=20, freqHz=0.1, phase=0, offset=120) "Variable voltage signal"; Modelica.Blocks.Sources.Constant Vtr_high(k=120*(1 + 0.1)) "Voltage threshold high"; equation connect(sou.terminal, voltageControl.terminal); connect(ground.p, sou.n); connect(cosine.y, sou.V_in); end TestVoltageCTRL;