> 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/blocks-functions-tools/basics/passives/nonlinear-resistor.md).

# Nonlinear Resistor

## Description

<figure><img src="https://799605156-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdlNg8IbOdahCpFCyzxSN%2Fuploads%2Fgit-blob-372069ee0e30f9611ea6000b2f4e9e88d8744f70%2Fnonlinear_resistor_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **Nonlinear Resistor** block, located in the **OPAL-RT SPS Software/Passives** library, represents a time-varying resistor. It implements a discrete variable resistor as a current source or a voltage source. The resistance is specified by a monotonically increasing or decreasing voltage-current characteristic.

## Equations

When the nonlinear resistor is implemented as a voltage source, the block uses the following equation for the relationship between the voltage, v, across the device and the current through the resistor, i, for the resistance characteristic specified by R:

$$
v=R\*i
$$

When the nonlinear resistor is implemented as a current source, the block uses the following equation for the relationship:

$$
i=\frac{1}{R}\*v
$$

When you use a Nonlinear Resistor block in your model, set the powergui block **Simulation type** to `Discrete` and select the **Automatically handle Discrete solver and Advanced tab solver settings of blocks** parameter in the **Preferences** tab. The robust discrete solver is used to discretize the electrical model. Simulink® signals an error if the robust discrete solver is not used.

## Ports

### Conserving

<table><thead><tr><th width="318.7999267578125">Port</th><th>Description</th></tr></thead><tbody><tr><td><strong>+</strong> — Positive terminal (SPS electrical)</td><td>SPS electrical conserving port associated with the resistor positive voltage.</td></tr><tr><td><strong>-</strong> — Negative terminal (SPS electrical)</td><td>SPS electrical conserving port associated with the resistor negative voltage.</td></tr></tbody></table>

## Parameters

<table><thead><tr><th width="210.79998779296875">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Type</strong> — Source type</td><td>Current source (default) | Voltage source — Whether the nonlinear resistor is implemented as a current source or a voltage source.</td></tr><tr><td><strong>Voltage-Current characteristics [(V);(A)]</strong> — Resistance characteristic, R</td><td>[0,0 ; 1,1] (default) | 2-by-n matrix — Resistance specified by a monotonically increasing or decreasing voltage-current characteristic, specified as a 2-by-n matrix where n ≥ 2.</td></tr></tbody></table>


---

# 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/blocks-functions-tools/basics/passives/nonlinear-resistor.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.
