This package contains time-dependend and controlled voltage and current sources.
Extends from Modelica.Icons.Library (Icon for library).
| Name | Description |
|---|---|
| Generic voltage source using the input signal as source voltage | |
| Source for constant voltage | |
| Step voltage source | |
| Ramp voltage source | |
| Sine voltage source | |
| Exponentially damped sine voltage source | |
| Rising and falling exponential voltage source | |
| Pulse voltage source | |
| Saw tooth voltage source | |
| Trapezoidal voltage source | |
| Voltage source by linear interpolation in a table | |
| Generic current source using the input signal as source current | |
| Source for constant current | |
| Step current source | |
| Ramp current source | |
| Sine current source | |
| Exponentially damped sine current source | |
| Rising and falling exponential current source | |
| Pulse current source | |
| Saw tooth current source | |
| Trapezoidal current source | |
| Current source by linear interpolation in a table |
Modelica.Electrical.Analog.Sources.SignalVoltage
| Type | Name | Description |
|---|---|---|
| PositivePin | p | |
| NegativePin | n | |
| input RealInput | v | Voltage between pin p and n (= p.v - n.v) as input signal |
model SignalVoltage "Generic voltage source using the input signal as source voltage"Interfaces.PositivePin p; Interfaces.NegativePin n; Modelica.Blocks.Interfaces.RealInput v "Voltage between pin p and n (= p.v - n.v) as input signal"; SI.Current i "Current flowing from pin p to pin n"; equation v = p.v - n.v; 0 = p.i + n.i; i = p.i;end SignalVoltage;
Modelica.Electrical.Analog.Sources.ConstantVoltage
| Type | Name | Default | Description |
|---|---|---|---|
| Voltage | V | Value of constant voltage [V] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model ConstantVoltage "Source for constant voltage" parameter SI.Voltage V(start=1) "Value of constant voltage"; extends Interfaces.OnePort; equation v = V;end ConstantVoltage;
Modelica.Electrical.Analog.Sources.StepVoltage
| Type | Name | Default | Description |
|---|---|---|---|
| Voltage | V | Height of step [V] | |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model StepVoltage "Step voltage source"
parameter SI.Voltage V(start=1) "Height of step";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.Step
signalSource(height=V));
end StepVoltage;
Modelica.Electrical.Analog.Sources.RampVoltage
| Type | Name | Default | Description |
|---|---|---|---|
| Voltage | V | Height of ramp [V] | |
| Time | duration | Duration of ramp [s] | |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model RampVoltage "Ramp voltage source"
parameter SI.Voltage V(start=1) "Height of ramp";
parameter SI.Time duration(min=Modelica.Constants.small, start=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.SineVoltage
| Type | Name | Default | Description |
|---|---|---|---|
| Voltage | V | Amplitude of sine wave [V] | |
| Angle | phase | 0 | Phase of sine wave [rad] |
| Frequency | freqHz | Frequency of sine wave [Hz] | |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model SineVoltage "Sine voltage source"
parameter SI.Voltage V(start=1) "Amplitude of sine wave";
parameter SI.Angle phase=0 "Phase of sine wave";
parameter SI.Frequency freqHz(start=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.ExpSineVoltage
| Type | Name | Default | Description |
|---|---|---|---|
| Voltage | V | Amplitude of sine wave [V] | |
| Frequency | freqHz | Frequency of sine wave [Hz] | |
| Angle | phase | 0 | Phase of sine wave [rad] |
| Damping | damping | Damping coefficient of sine wave [s-1] | |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model ExpSineVoltage "Exponentially damped sine voltage source"
parameter SI.Voltage V(start=1) "Amplitude of sine wave";
parameter SI.Frequency freqHz(start=2) "Frequency of sine wave";
parameter SI.Angle phase=0 "Phase of sine wave";
parameter SI.Damping damping(start=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.ExponentialsVoltage
| Type | Name | Default | Description |
|---|---|---|---|
| Real | vMax | Upper bound for rising edge | |
| Time | riseTime | Rise time [s] | |
| Time | riseTimeConst | Rise time constant [s] | |
| Time | fallTimeConst | Fall time constant [s] | |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model ExponentialsVoltage
" Rising and falling exponential voltage source"
parameter Real vMax(start=1) "Upper bound for rising edge";
parameter SI.Time riseTime(min=0, start=0.5) "Rise time";
parameter SI.Time riseTimeConst(min=Modelica.Constants.small, start=0.1)
"Rise time constant";
parameter SI.Time fallTimeConst(min=Modelica.Constants.small, start=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
| Type | Name | Default | Description |
|---|---|---|---|
| Voltage | V | Amplitude of pulse [V] | |
| Real | width | Width of pulse in % of period | |
| Time | period | Time for one period [s] | |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model PulseVoltage "Pulse voltage source"
parameter SI.Voltage V(start=1) "Amplitude of pulse";
parameter Real width(
final min=Modelica.Constants.small,
final max=100, start=50) "Width of pulse in % of period";
parameter SI.Time period(final min=Modelica.Constants.small, start=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
| Type | Name | Default | Description |
|---|---|---|---|
| Voltage | V | Amplitude of saw tooth [V] | |
| Time | period | Time for one period [s] | |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model SawToothVoltage "Saw tooth voltage source"
parameter SI.Voltage V(start=1) "Amplitude of saw tooth";
parameter SI.Time period(start=1) "Time for one period";
extends Interfaces.VoltageSource(redeclare Modelica.Blocks.Sources.SawTooth
signalSource(
amplitude=V, period=period));
end SawToothVoltage;
Modelica.Electrical.Analog.Sources.TrapezoidVoltage
| Type | Name | Default | Description |
|---|---|---|---|
| Voltage | V | Amplitude of trapezoid [V] | |
| Time | rising | Rising duration of trapezoid [s] | |
| Time | width | Width duration of trapezoid [s] | |
| Time | falling | Falling duration of trapezoid [s] | |
| Time | period | Time for one period [s] | |
| Integer | nperiod | Number of periods (< 0 means infinite number of periods) | |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model TrapezoidVoltage "Trapezoidal voltage source"
parameter SI.Voltage V(start=1) "Amplitude of trapezoid";
parameter SI.Time rising(final min=0, start=0) "Rising duration of trapezoid";
parameter SI.Time width(final min=0, start=0.5) "Width duration of trapezoid";
parameter SI.Time falling(final min=0, start=0)
"Falling duration of trapezoid";
parameter SI.Time period(final min=Modelica.Constants.small, start=1)
"Time for one period";
parameter Integer nperiod(start=-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.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).
Extends from Interfaces.VoltageSource (Interface for voltage sources).
| Type | Name | Default | Description |
|---|---|---|---|
| Real | table[:, :] | [0, 0; 1, 1; 2, 4] | Table matrix (time = first column, voltage = second column) |
| Voltage | offset | 0 | Voltage offset [V] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
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
| Type | Name | Description |
|---|---|---|
| PositivePin | p | |
| NegativePin | n | |
| input RealInput | i | Current flowing from pin p to pin n as input signal |
model SignalCurrent "Generic current source using the input signal as source current"Interfaces.PositivePin p; Interfaces.NegativePin n; SI.Voltage v "Voltage drop between the two pins (= p.v - n.v)";Modelica.Blocks.Interfaces.RealInput i "Current flowing from pin p to pin n as input signal"; equation v = p.v - n.v; 0 = p.i + n.i; i = p.i;end SignalCurrent;
Modelica.Electrical.Analog.Sources.ConstantCurrent
| Type | Name | Default | Description |
|---|---|---|---|
| Current | I | Value of constant current [A] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model ConstantCurrent "Source for constant current" parameter SI.Current I(start=1) "Value of constant current"; extends Interfaces.OnePort; equation i = I;end ConstantCurrent;
Modelica.Electrical.Analog.Sources.StepCurrent
| Type | Name | Default | Description |
|---|---|---|---|
| Current | I | Height of step [A] | |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model StepCurrent "Step current source"
parameter SI.Current I(start=1) "Height of step";
extends Interfaces.CurrentSource(redeclare Modelica.Blocks.Sources.Step
signalSource( height=I));
end StepCurrent;
Modelica.Electrical.Analog.Sources.RampCurrent
| Type | Name | Default | Description |
|---|---|---|---|
| Current | I | Height of ramp [A] | |
| Time | duration | Duration of ramp [s] | |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model RampCurrent "Ramp current source"
parameter SI.Current I(start=1) "Height of ramp";
parameter SI.Time duration(min=Modelica.Constants.small, start=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.SineCurrent
| Type | Name | Default | Description |
|---|---|---|---|
| Current | I | Amplitude of sine wave [A] | |
| Angle | phase | 0 | Phase of sine wave [rad] |
| Frequency | freqHz | Frequency of sine wave [Hz] | |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model SineCurrent "Sine current source"
parameter SI.Current I(start=1) "Amplitude of sine wave";
parameter SI.Angle phase=0 "Phase of sine wave";
parameter SI.Frequency freqHz(start=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
| Type | Name | Default | Description |
|---|---|---|---|
| Real | I | Amplitude of sine wave | |
| Frequency | freqHz | Frequency of sine wave [Hz] | |
| Angle | phase | 0 | Phase of sine wave [rad] |
| Damping | damping | Damping coefficient of sine wave [s-1] | |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model ExpSineCurrent "Exponentially damped sine current source"
parameter Real I(start=1) "Amplitude of sine wave";
parameter SI.Frequency freqHz(start=2) "Frequency of sine wave";
parameter SI.Angle phase=0 "Phase of sine wave";
parameter SI.Damping damping(start=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
| Type | Name | Default | Description |
|---|---|---|---|
| Real | iMax | Upper bound for rising edge | |
| Time | riseTime | Rise time [s] | |
| Time | riseTimeConst | Rise time constant [s] | |
| Time | fallTimeConst | Fall time constant [s] | |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model ExponentialsCurrent
" Rising and falling exponential current source"
parameter Real iMax(start=1) "Upper bound for rising edge";
parameter SI.Time riseTime(min=0, start=0.5) "Rise time";
parameter SI.Time riseTimeConst(min=Modelica.Constants.small, start=0.1)
"Rise time constant";
parameter SI.Time fallTimeConst(min=Modelica.Constants.small, start=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
| Type | Name | Default | Description |
|---|---|---|---|
| Current | I | Amplitude of pulse [A] | |
| Real | width | Width of pulse in % of period | |
| Time | period | Time for one period [s] | |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model PulseCurrent "Pulse current source"
parameter SI.Current I(start=1) "Amplitude of pulse";
parameter Real width(
final min=Modelica.Constants.small,
final max=100, start=50) "Width of pulse in % of period";
parameter SI.Time period(final min=Modelica.Constants.small, start=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
| Type | Name | Default | Description |
|---|---|---|---|
| Current | I | Amplitude of saw tooth [A] | |
| Time | period | Time for one period [s] | |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model SawToothCurrent "Saw tooth current source"
parameter SI.Current I(start=1) "Amplitude of saw tooth";
parameter SI.Time period(start=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
| Type | Name | Default | Description |
|---|---|---|---|
| Current | I | Amplitude of trapezoid [A] | |
| Time | rising | Rising duration of trapezoid [s] | |
| Time | width | Width duration of trapezoid [s] | |
| Time | falling | Falling duration of trapezoid [s] | |
| Time | period | Time for one period [s] | |
| Integer | nperiod | Number of periods (< 0 means infinite number of periods) | |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
model TrapezoidCurrent "Trapezoidal current source"
parameter SI.Current I(start=1) "Amplitude of trapezoid";
parameter SI.Time rising(final min=0, start=0) "Rising duration of trapezoid";
parameter SI.Time width(final min=0, start=0.5) "Width duration of trapezoid";
parameter SI.Time falling(final min=0, start=0)
"Falling duration of trapezoid";
parameter SI.Time period(final min=Modelica.Constants.small, start=1)
"Time for one period";
parameter Integer nperiod(start=-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).
Extends from Interfaces.CurrentSource (Interface for current sources).
| Type | Name | Default | Description |
|---|---|---|---|
| Real | table[:, :] | [0, 0; 1, 1; 2, 4] | Table matrix (time = first column, current = second column) |
| Current | offset | 0 | Current offset [A] |
| Time | startTime | 0 | Time offset [s] |
| Type | Name | Description |
|---|---|---|
| PositivePin | p | Positive pin (potential p.v > n.v for positive voltage drop v) |
| NegativePin | n | Negative pin |
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;