modelI_pwl
Piece-wise linear current source
Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n).
Information
This model generates a current by linear interpolation in a given 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 properties:
- The time points need to be monotonically increasing.
- Discontinuities are allowed, by providing the same time point twice in the table.
- Values outside of the table range, are computed by extrapolation through the last or first two points of the table.
- If the table has only one row, no interpolation is performed and the current value is just returned independently of the actual time instant, i.e., this is a constant current source.
- The table is implemented in a numerically sound way by generating time events at interval boundaries. This generates continuously differentiable values for the integrator.
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).
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Real[:,:] | table | [0, 0; 1, 1; 2, 4] | Table matrix (time = first column, current = second column) |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| PositivePin | p (from TwoPin) | Positive electrical pin | |
| NegativePin | n (from TwoPin) | Negative electrical pin |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| SI.Voltage | v (from TwoPin) | Voltage drop of the two pins (= p.v - n.v) | |
| SI.Current | i (from OnePort) | Current flowing from pin p to pin n |