Resistor
Resistor including optional tolerance, operational limits, fault behavior, and noise
- Library:
Simscape / Electrical / Passive
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 current.
v is voltage.
R is resistance.
If you set the Noise mode parameter to Enabled
,
then the defining equations are augmented by a discrete variable i_{N} 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.
Option | Resistance Value |
---|---|
| R |
| Uniform distribution: R · (1
– tol + 2· tol· Gaussian
distribution: R · (1 + tol · |
| R · (1 + tol ) |
| R · (1 – tol ) |
In the table,
R is the Resistance parameter value, nominal resistance.
tol is fractional tolerance, calculated from the percent-based Tolerance (%) parameter.
nSigma is the value you provide for the Number of standard deviations for quoted tolerance parameter.
rand
andrandn
are standard MATLAB^{®} functions for generating uniform and normal distribution random numbers.
Note
If you choose the Random tolerance
option and you
are in "Fast Restart" mode, the random tolerance value is updated on every
simulation if at least one between the fractional tolerance,
tol, or the Number of standard deviations for
quoted tolerance, nSigma, is set to Run-time
and is defined with a variable (even if you do not modify that variable).
Operating Limits
You can specify operating limits in terms of power and maximum working voltage. If you set the
Modeling option parameter to Show thermal
port
(see Model Thermal Effects), 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 the Operating Limits parameters section.
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, the component fails no more than once per simulation.
When the resistor fails, its resistance is changed to the value you specify for the Faulted zero-voltage 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 i_{N} 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 PS 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.
Model Thermal Effects
You can expose thermal ports to specify how the resistance value changes with temperature and to set the thermal mass. To expose the thermal ports, set the Modeling option parameter to either:
No thermal port
— The block does not contain thermal ports.Show thermal port
— The block contains one thermal conserving port.
Use the Variables tab to set the initial temperature target.
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.
Plotting and Display Option
If you expose the thermal port, you can perform plotting and display actions using the Electrical menu on the block context menu.
Right-click the block and, from the Electrical menu, select Basic characteristics to plot the resistance, measured in SI units, in a MATLAB figure window using the current resistor parameters.
Variables
Use the Variables section of the block interface to set the priority and initial target values for the block variables prior to simulation. For more information, see Set Priority and Initial Target for Block Variables.
This section appears only for the blocks with exposed thermal port. The Temperature variable lets you specify a high-priority target for the temperature at the start of simulation.
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.