LBL logo


Package with models and functions that are used by other models


This package contains utility models and functions.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Buildings.Electrical.Utilities.VoltageControl VoltageControl Voltage controller
Buildings.Electrical.Utilities.Controllers Controllers Package that contains state machines and control models used by the utilities
Buildings.Electrical.Utilities.Examples Examples This package contais tests for check the correctness of the models

Buildings.Electrical.Utilities.VoltageControl Buildings.Electrical.Utilities.VoltageControl

Voltage controller



Model representing a voltage controller that unplugs a load when its voltage is outside of the accepted thresholds.

The model contains a finite state machine controller that detects voltage deviations. If the voltage input V exceeds the nominal value V_nominal by more than 1+Vtr then the control signal y becomes zero for a period t = tDelay. If after this period the voltage is still higher than the thresholds the output remains equal to zero. The model has a parameter T that represents the time constant associated to the electrical switch. This time constant is used to parametrize a first order filter that represents such a dynamic effect. The presence of the first order filter avoids that the output of the finite state machine controller are differentiated (causing runtime errors).


replaceable package PhaseSystemBuildings.Electrical.PhaseSy...Phase system
VoltageV_nominal Nominal voltage of the node to be controlled [V]
RealvThresh0.1Threshold that activates voltage ctrl (ratio of nominal voltage)
TimetDelay300Time to wait before plugging the load back [s]
TimeT0.01Time constant representing the switching time [s]
Realy_start1.0Initial value of the control output signal
Terminalterminalredeclare Buildings.Electric...Generalized terminal


replaceable package PhaseSystemPhase system
output RealOutputyControl signal
TerminalterminalGeneralized terminal

Modelica definition

model VoltageControl "Voltage controller" replaceable package PhaseSystem = Buildings.Electrical.PhaseSystems.PartialPhaseSystem constrainedby Buildings.Electrical.PhaseSystems.PartialPhaseSystem "Phase system"; parameter Modelica.SIunits.Voltage V_nominal "Nominal voltage of the node to be controlled"; parameter Real vThresh(min=0.0, max=1.0) = 0.1 "Threshold that activates voltage ctrl (ratio of nominal voltage)"; parameter Modelica.SIunits.Time tDelay = 300 "Time to wait before plugging the load back"; parameter Modelica.SIunits.Time T = 0.01 "Time constant representing the switching time"; parameter Real y_start = 1.0 "Initial value of the control output signal"; final parameter Modelica.SIunits.Voltage Vmin = V_nominal*(1-vThresh) "Low threshold"; final parameter Modelica.SIunits.Voltage Vmax = V_nominal*(1+vThresh) "High threshold"; Modelica.Blocks.Interfaces.RealOutput y(start = y_start, stateSelect = StateSelect.prefer) "Control signal"; replaceable Buildings.Electrical.Interfaces.Terminal terminal( redeclare replaceable package PhaseSystem = PhaseSystem) "Generalized terminal"; Buildings.Electrical.Utilities.Controllers.StateMachineVoltCtrl ctrl( V_nominal=V_nominal, vThresh=vThresh, tDelay=tDelay) "Model that implements the state machines voltage controller"; initial equation y = y_start; equation // Output of the control block y + T*der(y) = ctrl.y; // Voltage measurements ctrl.V = terminal.PhaseSystem.systemVoltage(terminal.v); // The controller does not consume current terminal.i = zeros(PhaseSystem.n); end VoltageControl;

Automatically generated Mon Jul 13 14:23:43 2015.