Description: "Package with models for demand response controllers"

- Home > Modelica

## Buildings.Controls.DemandResponse

Package with models for demand response controllers

### Information

This package contains components models for demand response controllers.

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

### Package Content

Name | Description
--- | ---
Client | Demand response client
Examples | Collection of models that illustrate model use and test models
BaseClasses | Package with base classes

## Buildings.Controls.DemandResponse.Client

Demand response client

### Information

Model for a data-driven demand response client that predicts the future load and allows to apply a load shedding factor.

This model takes as a parameter the number of samples in a day, which is generally 24 for one hour sampling or 96 for 15 minute sampling. Input to the model are the consumed energy up to the current time instant, the current temperature, the type of the day, which may be a working day, non-working day or holiday as defined in Buildings.Controls.Types.Day, a boolean signal that indicates whether it is an event day, and a signal that if `true`, causes the load to be shed. The input signal `yShed` determines how much of the load will be shed if `shed=true`. If `shed=false`, then this signal is ignored.

Output of the model is the prediction of the power that will be consumed in the current sampling interval, i.e., generally in the next 1 hour or the next 15 minutes. If the parameter `nPre > 1`, then the prediction is done for multiple time intervals. All of these predictions can be obtained from the output `PPreNoShe`. This output does not take into account `yShed`. The output `PPre` is `PPre = yShed * PPreNoShe[1]` if `shed=true`, otherwise it is `PPre = PPreNoShe[1]`.

The baseline prediction is computed in Buildings.Controls.Predictors.ElectricalLoad.

Extends from Modelica.Blocks.Interfaces.BlockIcon (This icon will be removed in future Modelica versions, use Modelica.Blocks.Icons.Block instead.).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Integer | nSam |  | Number of samples in a day. For 1 hour sampling, set to 24
Integer | nPre | 1 | Number of intervals for which future load need to be predicted (set to one to only predict current time, or to nSam to predict one day)
Integer | nHis | 10 | Number of history terms to be stored for baseline computation
PredictionModel | predictionModel | Buildings.Controls.Predictor... | Load prediction model

### Connectors

Type | Name | Description
--- | --- | ---
input DayTypeInput | typeOfDay[integer((nPre - 1)/nSam) + 2] | Type of day for the current and the future days for which a prediction is to be made. Typically, this has dimension 2 for predictions up to and including 24 hours, and 2+n for any additional day
input BooleanInput | isEventDay | If true, this day remains an event day until midnight
input RealInput | ECon | Consumed electrical power [J]
input BooleanInput | shed | Signal, true if load needs to be shed at the current time
input RealInput | yShed | Amount of load to shed. Set to 0.5 to shed 50% of load [1]
input RealInput | TOut | Outside air temperature [K]
input RealInput | TOutFut[nPre - 1] | Future outside air temperatures [K]
output RealOutput | PPre | Predicted power consumption for the current time interval, taking into account yShed [W]
output RealOutput | PPreNoShe[nPre] | Predicted power consumption for the current and future time intervals, not taking into account yShed [W]

### Modelica definition

model Client "Demand response client" extends Modelica.Blocks.Interfaces.BlockIcon; final parameter Modelica.SIunits.Time tPeriod = 24*3600 "Period, generally one day"; final parameter Modelica.SIunits.Time tSample=tPeriod/nSam "Sample period, generally 900 or 3600 seconds"; parameter Integer nSam "Number of samples in a day. For 1 hour sampling, set to 24"; parameter Integer nPre(min=1) = 1 "Number of intervals for which future load need to be predicted (set to one to only predict current time, or to nSam to predict one day)"; parameter Integer nHis(min=1) = 10 "Number of history terms to be stored for baseline computation"; parameter Buildings.Controls.Predictors.Types.PredictionModel predictionModel= Buildings.Controls.Predictors.Types.PredictionModel.WeatherRegression "Load prediction model"; Buildings.Controls.Interfaces.DayTypeInput typeOfDay[integer((nPre-1)/nSam)+2] "Type of day for the current and the future days for which a prediction is to be made. Typically, this has dimension 2 for predictions up to and including 24 hours, and 2+n for any additional day"; Modelica.Blocks.Interfaces.BooleanInput isEventDay "If true, this day remains an event day until midnight"; Modelica.Blocks.Interfaces.RealInput ECon(unit="J") "Consumed electrical power"; Modelica.Blocks.Interfaces.BooleanInput shed "Signal, true if load needs to be shed at the current time"; Modelica.Blocks.Interfaces.RealInput yShed(min=-1, max=1, unit="1") "Amount of load to shed. Set to 0.5 to shed 50% of load"; Modelica.Blocks.Interfaces.RealInput TOut(unit="K", displayUnit="degC") if (predictionModel == Buildings.Controls.Predictors.Types.PredictionModel.WeatherRegression) "Outside air temperature"; Modelica.Blocks.Interfaces.RealInput TOutFut[nPre-1](each unit="K") if (predictionModel == Buildings.Controls.Predictors.Types.PredictionModel.WeatherRegression) "Future outside air temperatures"; Modelica.Blocks.Interfaces.RealOutput PPre(unit="W") "Predicted power consumption for the current time interval, taking into account yShed"; Modelica.Blocks.Interfaces.RealOutput PPreNoShe[nPre](each unit="W") "Predicted power consumption for the current and future time intervals, not taking into account yShed"; protected Modelica.StateGraph.InitialStep initialStep; inner Modelica.StateGraph.StateGraphRoot stateGraphRoot; Modelica.StateGraph.Transition transition; BaseClasses.BaselinePrediction comBasLin( final nSam=nSam, final nHis=nHis, final nPre=nPre, final predictionModel=predictionModel, nIn=3) "Baseline prediction"; Modelica.StateGraph.Transition t1 "State transition"; BaseClasses.NormalOperation norOpe(nOut=2) "Normal operation"; Modelica.StateGraph.TransitionWithSignal t2(enableTimer=false) "State transition"; Modelica.StateGraph.TransitionWithSignal t3 "State transition"; BaseClasses.ShedOperation she "Operation during load shedding"; Modelica.StateGraph.TransitionWithSignal t4(enableTimer=false) "State transition"; Modelica.Blocks.Sources.SampleTrigger tri(period=tSample) "Sample trigger"; Modelica.Blocks.Logical.Switch switch "Switch to select normal or shedded load"; equation connect(initialStep.outPort[1], transition.inPort); connect(transition.outPort, comBasLin.inPort[1]); connect(t1.inPort, comBasLin.outPort[1]); connect(t1.outPort, norOpe.inPort[1]); connect(comBasLin.ECon, ECon); connect(comBasLin.PPre[1], norOpe.PCon); connect(t2.outPort, comBasLin.inPort[2]); connect(t3.outPort, she.inPort[1]); connect(t4.inPort, she.outPort[1]); connect(t4.outPort, comBasLin.inPort[3]); connect(t4.condition, tri.y); connect(t2.condition, tri.y); connect(norOpe.PPre, she.PCon); connect(norOpe.active, switch.u2); connect(norOpe.outPort[1], t2.inPort); connect(norOpe.outPort[2], t3.inPort); connect(shed, t3.condition); connect(switch.u1, she.PCon); connect(switch.u3, she.PPre); connect(isEventDay, comBasLin.isEventDay); connect(comBasLin.TOut, TOut); connect(typeOfDay, comBasLin.typeOfDay); connect(comBasLin.TOutFut, TOutFut); connect(yShed, she.yShed); // Only PPre[1] will take into account the shedded load. connect(switch.y, PPre); connect(comBasLin.PPre, PPreNoShe); end Client;