Description: "Package that contains state machines and control models used by the utilities"

- Home > Modelica

## Buildings.Electrical.Utilities.Controllers

Package that contains state machines and control models used by the utilities

### Information

This package contains state machines and controller models used by the utilities.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

### Package Content

Name | Description
--- | ---
StateMachineVoltCtrl | This model represents a simple voltage controller that unplug a load when there is a voltage fluctuation higher that a given threshold.

## Buildings.Electrical.Utilities.Controllers.StateMachineVoltCtrl

This model represents a simple voltage controller that unplug a load when there is a voltage fluctuation higher that a given threshold.

### Information

Function that implements a state machine 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` becones zero for a period equal to `tDelay`.

A signal `y = 0` can be used to turn off a load.

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Voltage | V_nominal |  | Nominal voltage of the node to be controlled [V]
Real | vThresh | 0.1 | Threshold that activates voltage ctrl (ratio of nominal voltage)
Time | tDelay | 300 | Time to wait before plugging the load back [s]

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | V | Voltage of the node to be controlled

### Modelica definition

model StateMachineVoltCtrl "This model represents a simple voltage controller that unplug a load when there is a voltage fluctuation higher that a given threshold." Modelica.Blocks.Interfaces.RealInput V "Voltage of the node to be controlled"; 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"; output Real y "Output signal that represents whether the load should be connected to the grid or not"; protected discrete Boolean connected "Boolean variable that indicates when the load is connected"; discrete Real tSwitch "Time instant when the last event occured"; initial algorithm // Initialize with load connected and last event at t = 0 connected := true; tSwitch := 0; equation // Output for every state, connected or not if connected then y = 1.0; else y = 0.0; end if; algorithm // Detect an overshoot in the voltage when (connected and (V > V_nominal*(1+vThresh))) then tSwitch := time; connected := false; end when; // Transition between not connected and connected again after the delay time has been elapsed when (not connected and time >= tSwitch + tDelay) then connected := true; end when; end StateMachineVoltCtrl;