This package contains time-dependend and controlled voltage and current sources.
Modelica.Electrical.Analog.Sources.TrapezoidVoltage
| Name | Default | Description |
|---|---|---|
| V | 1 | Amplitude of trapezoid [V] |
| rising | 0 | Rising duration of trapezoid [s] |
| width | 0.5 | Width duration of trapezoid [s] |
| falling | 0 | Falling duration of trapezoid [s] |
| period | 1 | Time for one period [s] |
| nperiod | -1 | Number of periods (< 0 means infinite number of periods) |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model TrapezoidVoltage "Trapezoidal voltage source"
parameter SI.Voltage V=1 "Amplitude of trapezoid";
parameter SI.Time rising(final min=0) = 0 "Rising duration of trapezoid";
parameter SI.Time width(final min=0) = 0.5 "Width duration of trapezoid";
parameter SI.Time falling(final min=0) = 0 "Falling duration of trapezoid";
parameter SI.Time period(final min=Modelica.Constants.small) = 1
"Time for one period";
parameter Integer nperiod=-1
"Number of periods (< 0 means infinite number of periods)";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Trapezoid signalSource(
amplitude={V},
rising={rising},
width={width},
falling={falling},
period={period},
nperiod={nperiod}));
end TrapezoidVoltage;
Modelica.Electrical.Analog.Sources.ExpSineVoltage
| Name | Default | Description |
|---|---|---|
| V | 1 | Amplitude of sine wave [V] |
| freqHz | 2 | Frequency of sine wave [Hz] |
| phase | 0 | Phase of sine wave [rad] |
| damping | 1 | Damping coefficient of sine wave [s-1] |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model ExpSineVoltage "Exponentially damped sine voltage source"
parameter SI.Voltage V=1 "Amplitude of sine wave";
parameter SI.Frequency freqHz=2 "Frequency of sine wave";
parameter SI.Angle phase=0 "Phase of sine wave";
parameter SI.Damping damping=1 "Damping coefficient of sine wave";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.ExpSine signalSource(
amplitude={V},
freqHz={freqHz},
phase={phase},
damping={damping}));
end ExpSineVoltage;
Modelica.Electrical.Analog.Sources.RampVoltage
| Name | Default | Description |
|---|---|---|
| V | 1 | Height of ramp [V] |
| duration | 2 | Duration of ramp [s] |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model RampVoltage "Ramp voltage source"
parameter SI.Voltage V=1 "Height of ramp";
parameter SI.Time duration(min=Modelica.Constants.small) = 2 "Duration of ramp";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Ramp signalSource(final height={V}, final duration
={duration}));
end RampVoltage;
Modelica.Electrical.Analog.Sources.RampCurrent
| Name | Default | Description |
|---|---|---|
| I | 1 | Height of ramp [A] |
| duration | 2 | Duration of ramp [s] |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model RampCurrent "Ramp current source"
parameter SI.Current I=1 "Height of ramp";
parameter SI.Time duration(min=Modelica.Constants.small) = 2 "Duration of ramp";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Ramp signalSource(final height={I}, final duration
={duration}));
end RampCurrent;
Modelica.Electrical.Analog.Sources.SignalVoltage
model SignalVoltage "Generic voltage source using the input signal as source voltage" extends Interfaces.OnePort; Modelica.Blocks.Interfaces.InPort inPort(final n=1); equation inPort.signal[1] = v; end SignalVoltage;
Modelica.Electrical.Analog.Sources.ConstantVoltage
| Name | Default | Description |
|---|---|---|
| V | 1 | Value of constant voltage [V] |
model ConstantVoltage "Source for constant voltage" parameter SI.Voltage V=1 "Value of constant voltage"; extends Interfaces.OnePort; equation v = V; end ConstantVoltage;
Modelica.Electrical.Analog.Sources.StepVoltage
| Name | Default | Description |
|---|---|---|
| V | 1 | Height of step [V] |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model StepVoltage "Step voltage source"
parameter SI.Voltage V=1 "Height of step";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Step signalSource(height={V}));
end StepVoltage;
Modelica.Electrical.Analog.Sources.SineVoltage
| Name | Default | Description |
|---|---|---|
| V | 1 | Amplitude of sine wave [V] |
| phase | 0 | Phase of sine wave [rad] |
| freqHz | 1 | Frequency of sine wave [Hz] |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model SineVoltage "Sine voltage source"
parameter SI.Voltage V=1 "Amplitude of sine wave";
parameter SI.Angle phase=0 "Phase of sine wave";
parameter SI.Frequency freqHz=1 "Frequency of sine wave";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Sine signalSource(
amplitude={V},
freqHz={freqHz},
phase={phase}));
end SineVoltage;
Modelica.Electrical.Analog.Sources.ExponentialsVoltage
| Name | Default | Description |
|---|---|---|
| vMax | 1 | Upper bound for rising edge |
| riseTime | 0.5 | Rise time [s] |
| riseTimeConst | 0.1 | Rise time constant [s] |
| fallTimeConst | riseTimeConst | Fall time constant [s] |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model ExponentialsVoltage
" Rising and falling exponential voltage source"
parameter Real vMax=1 "Upper bound for rising edge";
parameter SI.Time riseTime(min=0) = 0.5 "Rise time";
parameter SI.Time riseTimeConst(min=Modelica.Constants.small) = 0.1
"Rise time constant";
parameter SI.Time fallTimeConst(min=Modelica.Constants.small) = riseTimeConst
"Fall time constant";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Exponentials signalSource(
outMax={vMax},
riseTime={riseTime},
riseTimeConst={riseTimeConst},
fallTimeConst={fallTimeConst}));
end ExponentialsVoltage;
Modelica.Electrical.Analog.Sources.PulseVoltage
| Name | Default | Description |
|---|---|---|
| V | 1 | Amplitude of pulse [V] |
| width | 50 | Width of pulse in % of period |
| period | 1 | Time for one period [s] |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model PulseVoltage "Pulse voltage source"
parameter SI.Voltage V=1 "Amplitude of pulse";
parameter Real width(
final min=Modelica.Constants.small,
final max=100) = 50 "Width of pulse in % of period";
parameter SI.Time period(final min=Modelica.Constants.small) = 1
"Time for one period";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Pulse signalSource(
amplitude={V},
width={width},
period={period}));
end PulseVoltage;
Modelica.Electrical.Analog.Sources.SawToothVoltage
| Name | Default | Description |
|---|---|---|
| V | 1 | Amplitude of saw tooth [V] |
| period | 1 | Time for one period [s] |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model SawToothVoltage "Saw tooth voltage source"
parameter SI.Voltage V=1 "Amplitude of saw tooth";
parameter SI.Time period=1 "Time for one period";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.SawTooth signalSource(amplitude={V}, period={
period}));
end SawToothVoltage;
Modelica.Electrical.Analog.Sources.TableVoltage
This block generates a voltage source by linear interpolation in a table. The time points and voltage values are stored in a matrix table[i,j], where the first column table[:,1] contains the time points and the second column contains the voltage to be interpolated. The table interpolation has the following proporties:
Example:
table = [0 0
1 0
1 1
2 4
3 9
4 16]
If, e.g., time = 1.0, the voltage v = 0.0 (before event), 1.0 (after event)
e.g., time = 1.5, the voltage v = 2.5,
e.g., time = 2.0, the voltage v = 4.0,
e.g., time = 5.0, the voltage v = 23.0 (i.e. extrapolation).
| Name | Default | Description |
|---|---|---|
| table[:, :] | [0, 0; 1, 1; 2, 4] | Table matrix (time = first column, voltage = second column) |
| offset | 0 | Voltage offset [V] |
| startTime | 0 | Time offset [s] |
model TableVoltage
"Voltage source by linear interpolation in a table"
parameter Real table[:, :]=[0, 0; 1, 1; 2, 4]
"Table matrix (time = first column, voltage = second column)";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.TimeTable signalSource(table=table));
end TableVoltage;
Modelica.Electrical.Analog.Sources.SignalCurrent
model SignalCurrent "Generic current source using the input signal as source current" extends Interfaces.OnePort; Modelica.Blocks.Interfaces.InPort inPort(final n=1); equation i = inPort.signal[1]; end SignalCurrent;
Modelica.Electrical.Analog.Sources.ConstantCurrent
| Name | Default | Description |
|---|---|---|
| I | 1 | Value of constant current [A] |
model ConstantCurrent "Source for constant current" parameter SI.Current I=1 "Value of constant current"; extends Interfaces.OnePort; equation i = I; end ConstantCurrent;
Modelica.Electrical.Analog.Sources.StepCurrent
| Name | Default | Description |
|---|---|---|
| I | 1 | Height of step [A] |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model StepCurrent "Step current source"
parameter SI.Current I=1 "Height of step";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Step signalSource(height={I}));
end StepCurrent;
Modelica.Electrical.Analog.Sources.SineCurrent
| Name | Default | Description |
|---|---|---|
| I | 1 | Amplitude of sine wave [A] |
| phase | 0 | Phase of sine wave [rad] |
| freqHz | 1 | Frequency of sine wave [Hz] |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model SineCurrent "Sine current source"
parameter SI.Current I=1 "Amplitude of sine wave";
parameter SI.Angle phase=0 "Phase of sine wave";
parameter SI.Frequency freqHz=1 "Frequency of sine wave";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Sine signalSource(
amplitude={I},
freqHz={freqHz},
phase={phase}));
end SineCurrent;
Modelica.Electrical.Analog.Sources.ExpSineCurrent
| Name | Default | Description |
|---|---|---|
| I | 1 | Amplitude of sine wave |
| freqHz | 2 | Frequency of sine wave [Hz] |
| phase | 0 | Phase of sine wave [rad] |
| damping | 1 | Damping coefficient of sine wave [s-1] |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model ExpSineCurrent "Exponentially damped sine current source"
parameter Real I=1 "Amplitude of sine wave";
parameter SI.Frequency freqHz=2 "Frequency of sine wave";
parameter SI.Angle phase=0 "Phase of sine wave";
parameter SI.Damping damping=1 "Damping coefficient of sine wave";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.ExpSine signalSource(
amplitude={I},
freqHz={freqHz},
phase={phase},
damping={damping}));
end ExpSineCurrent;
Modelica.Electrical.Analog.Sources.ExponentialsCurrent
| Name | Default | Description |
|---|---|---|
| iMax | 1 | Upper bound for rising edge |
| riseTime | 0.5 | Rise time [s] |
| riseTimeConst | 0.1 | Rise time constant [s] |
| fallTimeConst | riseTimeConst | Fall time constant [s] |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model ExponentialsCurrent
" Rising and falling exponential current source"
parameter Real iMax=1 "Upper bound for rising edge";
parameter SI.Time riseTime(min=0) = 0.5 "Rise time";
parameter SI.Time riseTimeConst(min=Modelica.Constants.small) = 0.1
"Rise time constant";
parameter SI.Time fallTimeConst(min=Modelica.Constants.small) = riseTimeConst
"Fall time constant";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Exponentials signalSource(
outMax={iMax},
riseTime={riseTime},
riseTimeConst={riseTimeConst},
fallTimeConst={fallTimeConst}));
end ExponentialsCurrent;
Modelica.Electrical.Analog.Sources.PulseCurrent
| Name | Default | Description |
|---|---|---|
| I | 1 | Amplitude of pulse [A] |
| width | 50 | Width of pulse in % of period |
| period | 1 | Time for one period [s] |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model PulseCurrent "Pulse current source"
parameter SI.Current I=1 "Amplitude of pulse";
parameter Real width(
final min=Modelica.Constants.small,
final max=100) = 50 "Width of pulse in % of period";
parameter SI.Time period(final min=Modelica.Constants.small) = 1
"Time for one period";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Pulse signalSource(
amplitude={I},
width={width},
period={period}));
end PulseCurrent;
Modelica.Electrical.Analog.Sources.SawToothCurrent
| Name | Default | Description |
|---|---|---|
| I | 1 | Amplitude of saw tooth [A] |
| period | 1 | Time for one period [s] |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model SawToothCurrent "Saw tooth current source"
parameter SI.Current I=1 "Amplitude of saw tooth";
parameter SI.Time period=1 "Time for one period";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.SawTooth signalSource(amplitude={I}, period={
period}));
end SawToothCurrent;
Modelica.Electrical.Analog.Sources.TrapezoidCurrent
| Name | Default | Description |
|---|---|---|
| I | 1 | Amplitude of trapezoid [A] |
| rising | 0 | Rising duration of trapezoid [s] |
| width | 0.5 | Width duration of trapezoid [s] |
| falling | 0 | Falling duration of trapezoid [s] |
| period | 1 | Time for one period [s] |
| nperiod | -1 | Number of periods (< 0 means infinite number of periods) |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model TrapezoidCurrent "Trapezoidal current source"
parameter SI.Current I=1 "Amplitude of trapezoid";
parameter SI.Time rising(final min=0) = 0 "Rising duration of trapezoid";
parameter SI.Time width(final min=0) = 0.5 "Width duration of trapezoid";
parameter SI.Time falling(final min=0) = 0 "Falling duration of trapezoid";
parameter SI.Time period(final min=Modelica.Constants.small) = 1
"Time for one period";
parameter Integer nperiod=-1
"Number of periods (< 0 means infinite number of periods)";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Trapezoid signalSource(
amplitude={I},
rising={rising},
width={width},
falling={falling},
period={period},
nperiod={nperiod}));
end TrapezoidCurrent;
Modelica.Electrical.Analog.Sources.TableCurrent
This block generates a current source by linear interpolation in a table. The time points and current values are stored in a matrix table[i,j], where the first column table[:,1] contains the time points and the second column contains the current to be interpolated. The table interpolation has the following proporties:
Example:
table = [0 0
1 0
1 1
2 4
3 9
4 16]
If, e.g., time = 1.0, the current i = 0.0 (before event), 1.0 (after event)
e.g., time = 1.5, the current i = 2.5,
e.g., time = 2.0, the current i = 4.0,
e.g., time = 5.0, the current i = 23.0 (i.e. extrapolation).
| Name | Default | Description |
|---|---|---|
| table[:, :] | [0, 0; 1, 1; 2, 4] | Table matrix (time = first column, current = second column) |
| offset | 0 | Current offset [A] |
| startTime | 0 | Time offset [s] |
model TableCurrent
"Current source by linear interpolation in a table"
parameter Real table[:, :]=[0, 0; 1, 1; 2, 4]
"Table matrix (time = first column, current = second column)";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.TimeTable signalSource(table=table));
end TableCurrent;