> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/get-started/change-circuit-parameters.md).

# Change Circuit Parameters

## Introduction

Each time that you change a parameter of the SPS Software library blocks, you have to restart the simulation to evaluate the state-space model and update the parameters of the nonlinear models. However, you can change any source parameter (Magnitude, Frequency, or Phase) during the simulation. The modification takes place as soon as you apply the modification or close the source block menu.

For the Simulink® blocks, all the SPS Software library block parameters that you specify in the dialog box can contain MATLAB® expressions using symbolic variable names. Before running the simulation, you must assign a value to each of these variables in your MATLAB workspace. This assignment allows you to perform parametric studies by changing the parameter values in a MATLAB script.

## Example of MATLAB script performing a parametric study

Suppose that you want to perform a parametric study in a circuit named *my\_circuit* to find the impact of varying an inductance on switching transients. You want to find the highest overvoltage and the inductance value for which it occurred.

The inductance value of one of the blocks contains variable L1, which you must define in your workspace. L1 is varied in 10 steps from 10 mH to 100 mH and the values to be tested are saved in a vector, L1\_vec. The voltage waveform to be analyzed is stored in a **ToWorkspace** block in array format with v1 variable name.

You can write a MATLAB script that loops on the 10 inductance values and displays the worst case scenario.

{% code lineNumbers="true" %}

```matlab
L1_vec = (10:10:100) * 1e-3; % 10 inductance values 10/100 mH
V1_max = 0;
for i = 1:10
    L1 = L1_vec(i);
    fprintf('Test No %d L1= %g H\n', i, L1);
    sim('my_circuit'); % performs simulation
    % memorize worst case
    if max(abs(V1)) > V1_max
        imax = i;
        V1_max = max(abs(V1));
    end
end

fprintf('Maximum overvoltage= %g V occurred for L1=%g H\n', V1_max, L1_vec(imax));
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/smart-power-simulation-software-sps/get-started/change-circuit-parameters.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
