LBL logo

Buildings.Controls.Sources

Package with models for source signals that are used with controllers

Information

This package contains components models for sources that are used with controllers. For additional models, see also Modelica.Blocks.Sources.

Extends from Modelica.Icons.SourcesPackage (Icon for packages containing sources).

Package Content

Name Description
Buildings.Controls.Sources.DayType DayType Block that outputs a signal that indicates week-day or week-end
Buildings.Controls.Sources.Examples Examples Collection of models that illustrate model use and test models

Buildings.Controls.Sources.DayType Buildings.Controls.Sources.DayType

Block that outputs a signal that indicates week-day or week-end

Buildings.Controls.Sources.DayType

Information

This block outputs a periodic signal that indicates the type of the day. It can for example be used to generate a signal that indicates whether the current time is a work day or a non-working day. The output signal is of type Buildings.Controls.Types.Day.

The parameter nout determines how many days should be sent to the output. For applications in which only the current day is of interest, set nout=1. For applications in which the load is predicted for the next 24 hours, set nout=2 in order to output the type of day for today and for tomorrow.

The transition from one day type to another always happens when the simulation time is a multiple of 1 day. Hence, if the simulation starts for example at t=-3600 seconds, then the first transition to another day will be at t=0.

Extends from Modelica.Blocks.Icons.DiscreteBlock (Graphical layout of discrete block component icon).

Parameters

TypeNameDefaultDescription
Integernout2Number of days to output. Set to two for one day predictions
Daydays[:]{Buildings.Controls.Types.Da...Array where each element is a day indicator
IntegeriStart1Index of element in days at simulation start

Connectors

TypeNameDescription
output DayTypeOutputy[nout]Type of the day for the current and the next (nout-1) days

Modelica definition

model DayType "Block that outputs a signal that indicates week-day or week-end" extends Modelica.Blocks.Icons.DiscreteBlock; parameter Integer nout = 2 "Number of days to output. Set to two for one day predictions"; parameter Buildings.Controls.Types.Day[:] days={ Buildings.Controls.Types.Day.WorkingDay, Buildings.Controls.Types.Day.WorkingDay, Buildings.Controls.Types.Day.WorkingDay, Buildings.Controls.Types.Day.WorkingDay, Buildings.Controls.Types.Day.WorkingDay, Buildings.Controls.Types.Day.NonWorkingDay, Buildings.Controls.Types.Day.NonWorkingDay} "Array where each element is a day indicator"; parameter Integer iStart(min=1, max=size(days, 1)) = 1 "Index of element in days at simulation start"; Interfaces.DayTypeOutput y[nout] "Type of the day for the current and the next (nout-1) days"; protected parameter Modelica.SIunits.Time samplePeriod=86400 "Sample period of the component"; output Integer iDay(min=1, max=size(days, 1)) "Pointer to days that determines what day type is sent to the output"; parameter Modelica.SIunits.Time firstSample(fixed=false) "Time when the sampling starts"; output Boolean sampleTrigger "True, if sample time instant"; output Boolean skipIDayIncrement "If true, don't increment iDay in first sample"; initial equation iDay = iStart; firstSample = ceil(time/86400)*86400; // skipIDayIncrement is true if the simulation starts at midnight. skipIDayIncrement = abs(firstSample-time) < 1E-8; equation for i in 1:nout loop y[i] = days[ mod(iDay+i-2, size(days, 1))+1]; end for; sampleTrigger = sample(firstSample, samplePeriod); when sampleTrigger then skipIDayIncrement = false; if pre(skipIDayIncrement) then iDay = pre(iDay); else iDay = mod(pre(iDay), size(days, 1))+1; end if; end when; end DayType;

Automatically generated Mon May 4 10:18:40 2015.