Piecewise Linear Current Source
Time-dependent current source using lookup table
Simscape / Electrical / Sources
Simscape / Electrical / Additional Components / SPICE Sources
The Piecewise Linear Current Source block represents a current source that you specify in lookup table form using a vector of time values and a vector of the corresponding current values. You must specify at least two time-current value pairs. The block generates a time-dependent current based on these time-current values using the selected interpolation and extrapolation methods. You have a choice of two interpolation methods and extrapolation methods. The output current is independent of the voltage across the terminals of the source.
The block uses a small conductance internally to prevent numerical simulation issues. The conductance connects the + and - ports of the device and has a conductance GMIN:
By default, GMIN matches the GMIN parameter of the Environment Parameters block, whose default value is
To change GMIN, add an Environment Parameters block to your model and set the GMIN parameter to the desired value.
+ — Positive terminal
Electrical conserving port associated with the piecewise linear current source positive terminal.
- — Negative terminal
Electrical conserving port associated with the piecewise linear current source negative terminal.
Time specification — Vector of time values
[0, 1, 2, 3, 4]
Vector of time values as a tabulated 1-by-n array. The time values vector must be strictly monotonically increasing.
Current at specified time — Vector of current values
[0, 0, 0, 0, 0]
Vector of current values as a tabulated 1-by-n array. The current values vector must be the same size as the time values vector.
Interpolation method — Interpolation method
Linear (default) |
Select the method that the block uses to determine the output current values at intermediate time points that are not specified in the preceding vectors:
Linear— Prioritize performance by using a linear function.
Smooth— Prioritize accuracy by producing a continuous curve with continuous first-order derivatives.
Extrapolation method — Extrapolation method
Nearest (default) |
Select the method that the block uses to determine the output current values at time points that are outside the time range specified in the preceding vectors:
Nearest— Select this option to use the nearest input value for extrapolation.
Linear— Select this option to use a linear function.
Include parallel conductance, GMIN — Whether to include parallel conductance
Yes (default) |
Specify if the current source includes a parallel conductance. The value of the parallel conductance, GMIN, depends on whether your model contains an Environment Parameters block.
This table shows the possible values of the parallel conductance, GMIN:
Values of parallel conductance, GMIN
|Include parallel conductance, GMIN
|Model contains Environment Parameters block
|Model does not contain Environment Parameters block
|Parallel conductance, GMIN, is not included and it does not affect the current source.
|GMIN is equal to the value of the GMIN parameter in the Environment Parameters block.
 D. Kahaner, Cleve Moler, and Stephen Nash Numerical Methods and Software. Prentice Hall, 1988.
 W.H. Press, B.P. Flannery, S.A. Teulkolsky, and W.T. Wetterling. Numerical Recipes in C: The Art of Scientific Computing. Cambridge University Press, 1992.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Introduced in R2008a