Ideal coupling between SimPowerSystems and Simscape electrical circuits
The Current-Voltage Simscape Interface block connects SimPowerSystems™ circuits with electrical elements from the Simscape™ Foundation library. This block preserves current through the block and voltage across the block, conserving electrical power.
On the SimPowerSystems side, the electrical connector ports +sps and -sps act like a controlled current source, feeding current from the Simscape side to the connected SimPowerSystems elements, while maintaining the voltage across the block.
On the Simscape side, the electrical connector ports +ssc and -ssc act like a controlled voltage source, feeding voltage from the SimPowerSystems side to the connected Simscape elements, while maintaining the current through the block.
The following figure gives an overview of the interface.
The block measures the voltage between the +sps and -sps ports and propagates it to the +ssc and -ssc ports, preserving the polarity. The block also measures the current flowing from the +ssc to the -ssc port and propagates it from the -sps to the +sps port.
You can specify a filter to break the algebraic loop between SimPowerSystems and Simscape ports. You can specify the filter as a first order continuous transfer function or as a discrete unit delay block. You can apply it on the SimPowerSystems side, to the measured voltage, or on the Simscape side, to the measured current. Depending on the measured signal where the filter is applied, the other signal is always a direct feedthrough.
If you do not specify a filter, direct feedthrough is applied on both measured signals. However, this configuration results in an algebraic loop containing the Voltage Measurement, Controlled Voltage Source, Current Sensor, and Controlled Current Source blocks, which might cause numerical issues.
If selected, direct feedthrough is applied between SimPowerSystems and Simscape ports on both sides.
Set this parameter to Low pass filter (continuous) to implement a first order continuous transfer function filter between SimPowerSystems and Simscape ports.
Set this parameter to Unit delay (discrete) to implement a discrete unit delay filter between SimPowerSystems and Simscape ports.
Set this parameter to First-order input filtering to implement a first order continuous transfer function filter with first-order filtering of the Simulink-PS Converter block that provides one derivative. You can apply this filter only on the SimPowerSystems side.
Set this parameter to Second-order input filtering to implement a first order continuous transfer function filter with second-order filtering on the Simulink-PS Converter block that provides derivatives one and two. You can apply this filter only on the SimPowerSystems side.
The Filter type parameter is not visible when the Direct feedthrough (no filter) check box is selected.
Specify the low pass filter time constant of the filter, in seconds. This parameter is visible only when the Filter type parameter is set to Low pass filter (continuous), to First-order input filtering, or to Second-order input filtering.
Specify the sample time of the unit delay filter, in seconds. This parameter is visible only when the Filter type parameter is set to Unit delay (discrete).
Specify the initial voltage value of the measured SimPowerSystems voltage.
This parameter is visible only when you apply the filter on the SimPowerSystems side.
Specify the initial current value of the measured Simscape current.
This parameter is visible only when you apply the filter on the Simscape side.
Set this parameter to SimPowerSystems side to apply the filter on the measured SimPowerSystems voltage.
Set this parameter to Simscape side to apply the filter on the measured Simscape current.
The Apply filter on parameter is not visible when the Direct feedthrough (no filter) check box is selected, when the Filter type is set to First-order input filtering, or when the Filter type is set to Second-order input filtering.
If selected, adds a Simulink® output to the block that returns the SimPowerSystems current and voltage and to the Simscape current and voltages in a bus signal.
When simulating SimPowerSystems models along with Simscape blocks, select the Simulink solver carefully.
Use ode23tb solver for solving SimPowerSystems circuits containing switches or nonlinear element. If you use other stiff solvers, SimPowerSystems software gives you the following warning:
Warning: You have required continuous-time simulation of a system containing switches or nonlinear elements. The ode23tb variable-step stiff solver with relative tolerance set to 1e-4 is recommended in order to get best accuracy and simulation performance. For some highly nonlinear models it may be necessary to set the "Solver reset method" parameter to "Robust". See "Improving Simulation Performance" chapter in SimPowerSystems documentation for additional information on how to select an appropriate integration method.
However, if you use the ode23tb solver for solving models containing Simscape blocks, Simscape software gives you the following warning:
Warning: The solver chosen is not recommended if the model is stiff, which is typical for models containing Simscape components. These solvers are typically preferred for Simscape models: ode23t, ode15s or ode14x (fixed-step). To disable this diagnostic, change the explicit solver diagnostic setting on the Simscape panel of the model Configuration Parameters.
Although the Simscape warning can be disabled, as described in the warning message, the SimPowerSystems warning cannot be disabled with regular configuration parameters. To disable the SimPowerSystems warning when you choose a solver other than ode23tb, select the Powergui block in your model, then, at the MATLAB® Command line, type:
The power_SSCmodelingpower_SSCmodeling example provides a sample of interfacing SimPowerSystems and Simscape models. The example contains two similar circuits. The top circuit model uses the SimPowerSystems Breaker block for switching off the RL loads. The circuit at the bottom is identical in all respects, but it uses a Simscape model of the circuit breaker.
The Simscape Circuit Breaker subsystem in the bottom circuit contains the Current-Voltage Simscape Interface block, which connects the + and - ports of the Simscape Circuit breaker block to the SimPowerSystems + and - ports.
For the Simscape solver, this subsystem is a simple circuit consisting of a circuit breaker connected in parallel with a Controlled Voltage Source block. The Solver Configuration block and the Simscape Electrical Reference ground blocks are both required to simulate this Simscape model. This ground block is independent of the SimPowerSystems ground block found on the top level of the block diagram, and does not connect the negative terminal of the circuit breaker to the SimPowerSystems electric ground.
For the SimPowerSystems software, this subsystem is a simple controlled current source controlled by an external signal.
By running the example, you can observe the differences between the two implementations of a circuit breaker device. The Simscape Circuit breaker block is also demonstrated in the Simscape ssc_circuitbreakerssc_circuitbreaker example model.