# Resistor

Resistor model including tolerance, operational limits, fault behavior, and noise

Passive Devices

## Description

The Resistor block represents a linear resistor, while letting you model the following effects:

You can turn these modeling options on and off independently of each other. When all the additional options are turned off, the component behavior is identical to the Simscape™ Foundation library Resistor block.

In its simplest form, the Resistor block models a linear resistor, described with the following equation:

`$i=v/R$`

where:

• i is the current.

• v is the voltage.

• R is the resistance.

If you set the Noise mode parameter to `Enabled`, then the defining equations are augmented by a discrete variable iN to represent thermal noise, as described in Thermal Noise.

### Tolerances

You can apply tolerances to the nominal value you provide for the Resistance parameter. Datasheets typically provide a tolerance percentage for a given resistor type. The table shows how the block applies tolerances and calculates resistance based on the selected Tolerance application option.

OptionResistance Value

`None — use nominal value`

R

`Random tolerance`

Uniform distribution: R · (1 – tol + 2· tol· `rand`)

Gaussian distribution: R · (1 + tol · `randn` / nSigma)

`Apply maximum tolerance value`

R · (1 + tol )

`Apply minimum tolerance value`

R · (1 – tol )

In the table,

• R is the Resistance parameter value, nominal resistance.

• tol is the fractional tolerance, Tolerance (%) /100.

• nSigma is the value you provide for the Number of standard deviations for quoted tolerance parameter.

• `rand` and `randn` are standard MATLAB® functions for generating uniform and normal distribution random numbers.

### Operating Limits

You can specify operating limits in terms of power and maximum working voltage. For the thermal variant of the block (see Thermal Port), you can also specify operating limits in terms of temperature.

When an operating limit is exceeded, the block can either generate a warning or stop the simulation with an error. For more information, see Operating Limits Tab.

### Faults

The Resistor block allows you to model an electrical fault as an instantaneous change in resistance. The block can trigger fault events:

• At a specific time

• When a current limit is exceeded for longer than a specific time interval

You can enable or disable these trigger mechanisms separately, or use them together if more than one trigger mechanism is required in a simulation. When more than one mechanism is enabled, the first mechanism to trigger the fault takes precedence. In other words, component fails no more than once per simulation.

When the resistor fails, its resistance is changed to the value you specify for the Faulted resistance parameter. You can also choose whether to issue an assertion when a fault occurs, by using the Reporting when a fault occurs parameter. The assertion can take the form of a warning or an error. By default, the block does not issue an assertion.

### Thermal Noise

The Resistor block can generate thermal noise current. If you set the Noise mode parameter to `Enabled`, then the defining equations are augmented by a discrete variable iN to represent thermal noise:

`$i=v/R+{i}_{N}$`

If the sampling time is h, then the thermal noise is given by:

`${i}_{N}=\sqrt{2kT/R}\frac{N\left(0,1\right)}{\sqrt{h}}$`

where:

• k is the Boltzmann constant, 1.3806504e-23 J/K.

• T is the temperature.

• R is the resistance.

• N is a Gaussian random number with zero mean and standard deviation of one.

• 2kT/R is the double-sided thermal noise power distribution (the single-sided equivalent is 4kT/R).

The block generates Gaussian noise by using the Random Number source in the Simscape Foundation library. You can control the random number seed by setting the Repeatability parameter:

• `Not repeatable` — Every time you simulate your model, the block resets the random seed using the MATLAB random number generator:

`seed = randi(2^32-1);`
• `Repeatable` — The block automatically generates a seed value and stores it inside the block, to always start the simulation with the same random number. This auto-generated seed value is set when you add a Resistor block from the block library to the model. When you make a new copy of the Resistor block from an existing one in a model, a new seed value is generated. The block sets the value using the MATLAB random number generator command shown above.

• `Specify seed` — If you select this option, the additional Seed parameter lets you directly specify the random number seed value.

### Thermal Port

The block has an optional thermal port, hidden by default. To expose the thermal port, right-click the block in your model, and then from the context menu select Simscape > Block choices > Show thermal port. This action displays the thermal port H on the block icon, and adds the Temperature Dependence and Thermal Port tabs to the block dialog box.

Use the Temperature Dependence tab to specify how the resistance value changes with temperature. Use the Thermal Port tab to set the initial temperature and the thermal mass.

With the thermal port exposed, the generated noise uses the temperature at the thermal port when determining the instantaneous noise value. Exposing the thermal port also extends the options on the Operating Limits tab as follows:

• The Power rating parameter becomes temperature dependent. You define a temperature up to which the full power rating is available, plus a higher temperature for which the power rating is reduced to zero. It is assumed that the power rating decreases linearly with temperature between these two values.

• An additional parameter, Operating temperature range, [Tmin Tmax], lets you define the valid temperature range for block operation.

If you enable operating limits modeling for the thermal variant of the block, then additional parameters on the Operating Limits tab let you specify operating limits in terms of temperature.

## Basic Assumptions and Limitations

Simulating with noise enabled slows down simulation. Choose the sample time (h) so that noise is generated only at frequencies of interest, and not higher.

## Dialog Box and Parameters

### Main Tab

Resistance

The nominal resistance value. The default value is `1` Ω.

Tolerance (%)

The resistor tolerance as defined on the manufacturer datasheet. The default value is `5`%.

Tolerance application

Select how to apply tolerance during simulation:

• `None — use nominal value` — The block does not apply tolerance, uses the nominal resistance value. This is the default.

• `Random tolerance` — The block applies random offset to the resistance value, within the tolerance value limit. You can choose Uniform or Gaussian distribution for calculating the random number by using the Tolerance distribution parameter.

• `Apply maximum tolerance value` — The resistance is increased by the specified tolerance percent value.

• `Apply minimum tolerance value` — The resistance is decreased by the specified tolerance percent value.

Tolerance distribution

This parameter is visible only if you select ```Random tolerance``` for the Tolerance application parameter. Select the distribution type:

• `Uniform` — Uniform distribution. This is the default.

• `Gaussian` — Gaussian distribution.

Number of standard deviations for quoted tolerance

Number of standard deviations for calculating the Gaussian random number. This parameter is visible only if you select `Gaussian` for the Tolerance distribution parameter. The default value is `4`.

### Operating Limits Tab

Enable operating limits

Select `Yes` to enable reporting when the operational limits are exceeded. The associated parameters become visible on the Operating Limits tab to let you select the reporting method and specify the operating limits in terms of power and maximum working voltage. Parameters that specify operating limits in terms of temperature are visible only for blocks with exposed thermal port (see Thermal Port). The default value is `No`.

Reporting when operating limits exceeded

Select what happens when an operating limit is exceeded:

• `Warn` — The block issues a warning. This is the default.

• `Error` — Simulation stops with an error.

Maximum working voltage

Maximum voltage magnitude allowed for normal block operation. The default value is `100` V.

Power rating

Maximum power allowed for normal block operation. The default value is `1` W.

If you expose the thermal port of the block, this parameter becomes temperature dependent. The value you specify for the Power rating parameter applies up to the temperature specified by the Temperature below which full power rating is available parameter value. Then the power rating decreases linearly with temperature, until it becomes 0 at temperature specified by the Temperature above which power rating is reduced to zero parameter value.

Temperature below which full power rating is available

Maximum temperature where full power rating, specified by the Power rating parameter value, still applies. This parameter is visible only if you expose the thermal port of the block. The default value is `70` °C.

Temperature above which power rating is reduced to zero

Temperature where power rating becomes 0. Above this temperature, the simulation always issues an assertion regardless of dissipated power. This parameter is visible only if you expose the thermal port of the block. This parameter value must be higher than Temperature below which full power rating is available. The default value is `155` °C.

Operating temperature range, [Tmin Tmax]

A row vector of length 2 specifying minimum and maximum temperature values allowed for normal block operation. The first element is the lowest allowable operating temperature, and the second element is the largest allowable operating temperature. This parameter is visible only if you expose the thermal port of the block. The default value is `[-50 150]` °C.

### Faults Tab

Enable faults

Select `Yes` to enable faults modeling. The associated parameters become visible on the Faults tab to let you select the reporting method and specify the trigger mechanism (temporal or behavioral). You can enable these trigger mechanisms separately or use them together. The default value is `No`.

Reporting when a fault occurs

Choose whether to issue an assertion when a fault occurs:

• `None` — The block does not issue an assertion. This is the default.

• `Warn` — The block issues a warning.

• `Error` — Simulation stops with an error.

Faulted resistance

Resistance between the + and – ports when the block is in the faulted state. The default value is `inf` Ω.

Enable temporal fault trigger

Select `Yes` to enable time-based fault triggering. The default value is `No`.

Simulation time for fault event

Set the simulation time at which you want the block to enter the fault state. This parameter is visible only if the Enable temporal fault trigger parameter is set to `Yes`. The default value is `1` s.

Enable behavioral fault trigger

Select `Yes` to enable behavioral fault triggering. The default value is `No`.

Maximum permissible current

Specify the maximum permissible current value. If the current exceeds this value for longer than the Time to fail when exceeding maximum permissible current parameter value, then the block enters the fault state. This parameter is visible only if the Enable behavioral fault trigger parameter is set to `Yes`. The default value is `1` A.

Time to fail when exceeding maximum permissible current

Set the maximum length of time that the current can exceed the maximum permissible current without triggering the fault. This parameter is visible only if the Enable behavioral fault trigger parameter is set to `Yes`. The default value is `1` s.

### Noise Tab

Noise mode

Select the noise option:

• `Disabled` — No noise is produced by the resistor. This is the default.

• `Enabled` — Resistor generates thermal noise current, and the associated parameters become visible on the Noise tab.

Sample time

Defines the rate at which the noise source is sampled. Choose it to reflect the frequencies of interest in your model. Making the sample time too small will unnecessarily slow down your simulation. The default value is `1e-3` s.

Repeatability

Select the noise control option:

• `Not repeatable` — The random sequence used for noise generation is not repeatable. This is the default.

• `Repeatable` — The random sequence used for noise generation is repeatable, with a system-generated seed.

• `Specify seed` — The random sequence used for noise generation is repeatable, and you control the seed by using the Seed parameter.

Auto-generated seed used for repeatable option

Random number seed stored inside the block to make the random sequence repeatable. This parameter is visible only if you select `Repeatable` for the Repeatability parameter. The parameter value is automatically generated using the MATLAB random number generator command. You can modify this parameter value, but it gets overwritten by a new random value if you copy the block to another block in the model. Therefore, if you want to control the seed of the random sequence, use the `Specify seed` option for the Repeatability parameter and specify the desired seed value using the Seed parameter.

Seed

Random number seed used by the noise random number generator. This parameter is visible only if you select ```Specify seed``` for the Repeatability parameter. The default value is `0`.

Device simulation temperature

The temperature of the resistor at the start of the simulation. The default value is `25` °C.

For blocks with an exposed thermal port, this parameter is not visible. Use the Initial temperature parameter on the Thermal Port tab instead.

### Temperature Dependence Tab

This tab appears only for blocks with exposed thermal port. For more information, see Thermal Port.

Resistance temperature coefficient

The coefficient α in the equation that describes resistance as a function of temperature, RT = R (1+α(TT0)). The default value is for copper, `0.00393` 1/K.

Measurement temperature

The temperature T0, for which the nominal resistance R is specified. The default value is `25` °C.

### Thermal Port Tab

This tab appears only for blocks with exposed thermal port. For more information, see Thermal Port.

Thermal mass

Thermal mass associated with the thermal port H. It represents the energy required to raise the temperature of the thermal port by one degree. The default value is `100` J/K.

Initial temperature

The temperature of the thermal port at the start of simulation. The default value is `25` °C.

## Ports

The block has the following ports:

`+`

Positive electrical port

`-`

Negative electrical port