# Operating Point RLC Transient Response

This example shows the response of a DC power supply connected to a series RLC load. The goal is to plot the output voltage response when a load is suddenly attached to the fully powered-up supply. This is done using a Simscape operating point.

First, the power supply is connected to an open circuit and simulated until it reaches steady state. An operating point object is extracted from the resultant Simscape log. This operating point is used to initialize the model and verify that it is in steady state. Next, the load is changed to the series RLC circuit and the responses are compared with and without the operating point. Finally, a parameter sweep is done to compare the results with different values of the load inductance.

### Model

The power supply consists of a DC voltage connected to an inductor, resistor, and capacitor. The values are chosen to demonstrate an underdamped open circuit response when powering up the supply. The load is a variant subsystem with an open circuit and a series RLC circuit.

```model = 'OperatingPointRLCTransientResponse'; ``` ### Transient Open Circuit Response

First, simulate to obtain the open circuit response of the power supply. The simulation is run long enough for the power supply to reach steady-state. This is the state that we want to start in when we experiment with different loads.

```set_param('OperatingPointRLCTransientResponse/Load', 'LabelModeActiveChoice', 'OpenCircuit'); sim(model); ``` ### Create Operating Point from Simscape Log

Extract a steady-state Simscape operating point for the model by using the simscape.op.create function and the Simscape log that resulted from the previous simulation. Use '10' as the time because the simulation had reached an approximate steady state by that time.

```op_steadystate = simscape.op.create(simlog_OperatingPointRLCTransientResponse, 10); ```

Remove the operating point for the Load block since it will be irrelevant in subsequent experiments.

```op_steadystate = remove(op_steadystate, 'Load') ```
```op_steadystate = OperatingPoint with children: OperatingPoints: ChildId Size ______________________ ____ 'Capacitor' 1x1 'DC Voltage' 1x1 'Electrical Reference' 1x1 'Inductor' 1x1 'Series Resistance' 1x1 'Step Input' 1x1 'Switch' 1x1 'Vout' 1x1 ```

### Open Circuit Response with Operating Point

Validate the operating point by initializing the open circuit model with the operating point. The result is a flat line representing the fully energized power supply.

```set_param(model, 'SimscapeUseOperatingPoints', 'on', 'SimscapeOperatingPoint', 'op_steadystate'); sim(model); ``` ### Transient RLC Response Without Operating Point

Change the load to the RLC series circuit and analyze the results. First, simulate without the operating point to show the combined response of the supply powering up and the load attached after 1 second. The results show what would happen if the load was attached while the supply was still powering up.

```L_load = 1e-1; set_param('OperatingPointRLCTransientResponse/Load', 'LabelModeActiveChoice', 'RLC'); set_param(model, 'SimscapeUseOperatingPoints', 'off'); sim(model); ``` ### Transient RLC Response with Operating Point

Next, enable operating point initialization to see the desired response. The circuit is in steady state until we attach the load at 1 second.

```set_param(model, 'SimscapeUseOperatingPoints','on'); sim(model); ``` ### Perform Parameter Sweep over Range of Load-Inductance Values

Reuse the operating point in a series of simulations to compare the results across a range of load inductance values. Since the inductance load is run-to-run tunable, simulate the model in fast restart mode to avoid recompilation.

```set_param(model,'FastRestart', 'on'); lValues = linspace(1e-2, 2e-1, 5); hold on; for idx = 1:numel(lValues) L_load = lValues(idx); out = sim(model); t = out.simlog_OperatingPointRLCTransientResponse.Vout.Vs.V.series.time; Vout = out.simlog_OperatingPointRLCTransientResponse.Vout.Vs.V.series.values('V'); plot(t, Vout, 'LineWidth', 1); end hold off; ``` 