Modelica.Blocks.Sources.RealExpression Modelica.Blocks.Sources.RealExpression

Set output signal to a time varying Real expression

Modelica.Blocks.Sources.RealExpression

Information

The (time varying) Real output signal of this block can be defined in its parameter menu via variable y. The purpose is to support the easy definition of Real expressions in a block diagram. For example, in the y-menu the definition "if time < 1 then 0 else 1" can be given in order to define that the output signal is one, if time ≥ 1 and otherwise it is zero. Note, that "time" is a built-in variable that is always accessible and represents the "model time" and that Variable y is both a variable and a connector.

Parameters

TypeNameDefaultDescription
Time varying output signal
RealOutputy0.0Value of Real output

Connectors

TypeNameDescription
Time varying output signal
output RealOutputyValue of Real output

Modelica definition

block RealExpression "Set output signal to a time varying Real expression" Modelica.Blocks.Interfaces.RealOutput y=0.0 "Value of Real output"; end RealExpression;

Modelica.Blocks.Sources.Sine Modelica.Blocks.Sources.Sine

Generate sine signal

Modelica.Blocks.Sources.Sine

Information

The Real output y is a sine signal:

Sine.png

Extends from Interfaces.SO (Single Output continuous control block).

Parameters

TypeNameDefaultDescription
Realamplitude1Amplitude of sine wave
FrequencyfreqHz Frequency of sine wave [Hz]
Anglephase0Phase of sine wave [rad]
Realoffset0Offset of output signal
TimestartTime0Output = offset for time < startTime [s]

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal

Modelica definition

block Sine "Generate sine signal" import Modelica.Constants.pi; parameter Real amplitude=1 "Amplitude of sine wave"; parameter SIunits.Frequency freqHz(start=1) "Frequency of sine wave"; parameter SIunits.Angle phase=0 "Phase of sine wave"; parameter Real offset=0 "Offset of output signal"; parameter SIunits.Time startTime=0 "Output = offset for time < startTime"; extends Interfaces.SO; equation y = offset + (if time < startTime then 0 else amplitude*Modelica.Math.sin(2 *pi*freqHz*(time - startTime) + phase)); end Sine;

Modelica.Blocks.Sources.Constant Modelica.Blocks.Sources.Constant

Generate constant signal of type Real

Modelica.Blocks.Sources.Constant

Information

The Real output y is a constant signal:

Constant.png

Extends from Interfaces.SO (Single Output continuous control block).

Parameters

TypeNameDefaultDescription
Realk Constant output value

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal

Modelica definition

block Constant "Generate constant signal of type Real" parameter Real k(start=1) "Constant output value"; extends Interfaces.SO; equation y = k; end Constant;

Modelica.Blocks.Sources.Step Modelica.Blocks.Sources.Step

Generate step signal of type Real

Modelica.Blocks.Sources.Step

Information

The Real output y is a step signal:

Step.png

Extends from Interfaces.SignalSource (Base class for continuous signal source).

Parameters

TypeNameDefaultDescription
Realheight1Height of step
Realoffset0Offset of output signal y
TimestartTime0Output y = offset for time < startTime [s]

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal

Modelica definition

block Step "Generate step signal of type Real" parameter Real height=1 "Height of step"; extends Interfaces.SignalSource; equation y = offset + (if time < startTime then 0 else height); end Step;

Modelica.Blocks.Sources.SawTooth Modelica.Blocks.Sources.SawTooth

Generate saw tooth signal

Modelica.Blocks.Sources.SawTooth

Information

The Real output y is a saw tooth signal:

SawTooth.png

Extends from Interfaces.SO (Single Output continuous control block).

Parameters

TypeNameDefaultDescription
Realamplitude1Amplitude of saw tooth
Timeperiod Time for one period [s]
Integernperiod-1Number of periods (< 0 means infinite number of periods)
Realoffset0Offset of output signals
TimestartTime0Output = offset for time < startTime [s]

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal

Modelica definition

block SawTooth "Generate saw tooth signal" parameter Real amplitude=1 "Amplitude of saw tooth"; parameter SIunits.Time period(final min=Modelica.Constants.small,start=1) "Time for one period"; parameter Integer nperiod=-1 "Number of periods (< 0 means infinite number of periods)"; parameter Real offset=0 "Offset of output signals"; parameter SIunits.Time startTime=0 "Output = offset for time < startTime"; extends Interfaces.SO; protected SIunits.Time T_start(final start=startTime) "Start time of current period"; Integer count "Period count"; initial algorithm count := integer((time - startTime)/period); T_start := startTime + count*period; equation when integer((time - startTime)/period) > pre(count) then count = pre(count) + 1; T_start = time; end when; y = offset + (if (time < startTime or nperiod == 0 or (nperiod > 0 and count >= nperiod)) then 0 else amplitude*(time - T_start)/period); end SawTooth;

Modelica.Blocks.Sources.Cosine Modelica.Blocks.Sources.Cosine

Generate cosine signal

Modelica.Blocks.Sources.Cosine

Information

The Real output y is a cosine signal:

Cosine.png

Extends from Interfaces.SO (Single Output continuous control block).

Parameters

TypeNameDefaultDescription
Realamplitude1Amplitude of cosine wave
FrequencyfreqHz Frequency of cosine wave [Hz]
Anglephase0Phase of cosine wave [rad]
Realoffset0Offset of output signal
TimestartTime0Output = offset for time < startTime [s]

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal

Modelica definition

block Cosine "Generate cosine signal" import Modelica.Constants.pi; parameter Real amplitude=1 "Amplitude of cosine wave"; parameter SIunits.Frequency freqHz(start=1) "Frequency of cosine wave"; parameter SIunits.Angle phase=0 "Phase of cosine wave"; parameter Real offset=0 "Offset of output signal"; parameter SIunits.Time startTime=0 "Output = offset for time < startTime"; extends Interfaces.SO; equation y = offset + (if time < startTime then 0 else amplitude*Modelica.Math.cos(2 *pi*freqHz*(time - startTime) + phase)); end Cosine;

Modelica.Blocks.Sources.Ramp Modelica.Blocks.Sources.Ramp

Generate ramp signal

Modelica.Blocks.Sources.Ramp

Information

The Real output y is a ramp signal:

Ramp.png

If parameter duration is set to 0.0, the limiting case of a Step signal is achieved.

Extends from Interfaces.SO (Single Output continuous control block).

Parameters

TypeNameDefaultDescription
Realheight1Height of ramps
Timeduration Duration of ramp (= 0.0 gives a Step) [s]
Realoffset0Offset of output signal
TimestartTime0Output = offset for time < startTime [s]

Connectors

TypeNameDescription
output RealOutputyConnector of Real output signal

Modelica definition

block Ramp "Generate ramp signal" parameter Real height=1 "Height of ramps"; parameter Modelica.SIunits.Time duration(min=0.0, start=2) "Duration of ramp (= 0.0 gives a Step)"; parameter Real offset=0 "Offset of output signal"; parameter Modelica.SIunits.Time startTime=0 "Output = offset for time < startTime"; extends Interfaces.SO; equation y = offset + (if time < startTime then 0 else if time < (startTime + duration) then (time - startTime)*height/duration else height); end Ramp;

Modelica.Blocks.Sources.BooleanExpression Modelica.Blocks.Sources.BooleanExpression

Set output signal to a time varying Boolean expression

Modelica.Blocks.Sources.BooleanExpression

Information

The (time varying) Boolean output signal of this block can be defined in its parameter menu via variable y. The purpose is to support the easy definition of Boolean expressions in a block diagram. For example, in the y-menu the definition "time >= 1 and time <= 2" can be given in order to define that the output signal is true in the time interval 1 ≤ time ≤ 2 and otherwise it is false. Note, that "time" is a built-in variable that is always accessible and represents the "model time" and that Variable y is both a variable and a connector.

Parameters

TypeNameDefaultDescription
Time varying output signal
BooleanOutputyfalseValue of Boolean output

Connectors

TypeNameDescription
Time varying output signal
output BooleanOutputyValue of Boolean output

Modelica definition

block BooleanExpression "Set output signal to a time varying Boolean expression" Modelica.Blocks.Interfaces.BooleanOutput y=false "Value of Boolean output"; end BooleanExpression;

Modelica.Blocks.Sources.BooleanStep Modelica.Blocks.Sources.BooleanStep

Generate step signal of type Boolean

Modelica.Blocks.Sources.BooleanStep

Information

The Boolean output y is a step signal:

BooleanStep.png

Extends from Interfaces.partialBooleanSource (Partial source block (has 1 output Boolean signal and an appropriate default icon)).

Parameters

TypeNameDefaultDescription
TimestartTime0Time instant of step start [s]
BooleanstartValuefalseOutput before startTime

Connectors

TypeNameDescription
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block BooleanStep "Generate step signal of type Boolean" parameter Modelica.SIunits.Time startTime=0 "Time instant of step start"; parameter Boolean startValue=false "Output before startTime"; extends Interfaces.partialBooleanSource; equation y = if time >= startTime then not startValue else startValue; end BooleanStep;

Modelica.Blocks.Sources.BooleanPulse Modelica.Blocks.Sources.BooleanPulse

Generate pulse signal of type Boolean

Modelica.Blocks.Sources.BooleanPulse

Information

The Boolean output y is a pulse signal:

Pulse.png

Extends from Modelica.Blocks.Interfaces.partialBooleanSource (Partial source block (has 1 output Boolean signal and an appropriate default icon)).

Parameters

TypeNameDefaultDescription
Realwidth50Width of pulse in % of period
Timeperiod Time for one period [s]
TimestartTime0Time instant of first pulse [s]

Connectors

TypeNameDescription
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block BooleanPulse "Generate pulse signal of type Boolean" parameter Real width( final min=Modelica.Constants.small, final max=100) = 50 "Width of pulse in % of period"; parameter Modelica.SIunits.Time period(final min=Modelica.Constants.small, start=1) "Time for one period"; parameter Modelica.SIunits.Time startTime=0 "Time instant of first pulse"; extends Modelica.Blocks.Interfaces.partialBooleanSource; protected parameter Modelica.SIunits.Time Twidth=period*width/100 "width of one pulse"; discrete Modelica.SIunits.Time pulsStart "Start time of pulse"; initial equation pulsStart = startTime; equation when sample(startTime, period) then pulsStart = time; end when; y = time >= pulsStart and time < pulsStart + Twidth; end BooleanPulse;

Automatically generated Mon Sep 11 16:11:51 2017.