Main Content

Resistor

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

  • Resistor block

Libraries:
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 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 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 and randn 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

To model a fault in the Resistor block, in the Faults section, click the Add fault hyperlink in the parameter that corresponds to the specific fault that you want to model. When the Create Fault window opens, you use it to specify the fault properties. For more information about fault modeling, see Fault Behavior Modeling and Fault Triggering.

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 the current exceeds the maximum permissible value for longer than a specific time interval.

If you want to trigger a fault at a specific time, in the Fault Inspector window, set Trigger type to Timed. If you want to determine whether a system fails and, if so, when it fails, in the Fault Inspector window, set Trigger type to Behavioral.

When the resistor fails, its resistance changes to the value you specify for the Faulted zero-voltage resistance parameter.

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+iN

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

iN=2kT/RN(0,1)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

To set the priority and initial target values for the block variables before simulation, use the Initial Targets section in the block dialog box or Property Inspector. For more information, see Set Priority and Initial Target for Block Variables.

Use nominal values to specify the expected magnitude of a variable in a model. Using system scaling based on nominal values increases the simulation robustness. Nominal values can come from different sources. One of these sources is the Nominal Values section in the block dialog box or Property Inspector. For more information, see System Scaling by Nominal Values.

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.

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.

Ports

Conserving

expand all

Electrical conserving port associated with the resistor positive terminal.

Electrical conserving port associated with the resistor negative terminal.

Thermal conserving port that represents the resistor thermal mass.

Dependencies

To enable this port, set Modeling option to Show thermal port.

Parameters

expand all

Whether to enable the thermal port of the block and specify how the resistance value changes with temperature and to set the thermal mass.

Main

Nominal resistance value. Resistance value must be greater than zero.

Resistor tolerance as defined on the manufacturer datasheet.

Select how to apply tolerance during simulation:

  • None — use nominal value — The block does not apply tolerance. The block uses the nominal resistance value.

  • 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.

Select the distribution type for random tolerance:

  • Uniform — Uniform distribution

  • Gaussian — Gaussian distribution

Dependencies

To enable this parameter, set Tolerance application to Random tolerance.

Number of standard deviations for calculating the Gaussian random number.

Dependencies

To enable this parameter, set Tolerance distribution to Gaussian.

Operating Limits

Select Yes to enable reporting when the operational limits are exceeded. The associated parameters in the Operating Limits section become visible 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 an exposed thermal port (see Model Thermal Effects). The default value is No.

Select what happens when an operating limit is exceeded:

  • Warn — The block issues a warning.

  • Error — Simulation stops with an error.

Dependencies

To enable this parameter, set Enable operating limits to Yes.

Maximum voltage magnitude allowed for normal block operation.

Dependencies

To enable this parameter, set Enable operating limits to Yes.

Maximum power allowed for normal block operation.

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.

Dependencies

To enable this parameter, set Enable operating limits to Yes.

Maximum temperature where full power rating, specified by the Power rating parameter value, still applies.

Dependencies

To enable this parameter, set Modeling option to Show thermal port.

Temperature where power rating becomes 0. Above this temperature, the simulation always issues an assertion regardless of dissipated power. This parameter value must be higher than Temperature below which full power rating is available.

Dependencies

To enable this parameter, set Modeling option to Show thermal port.

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.

Dependencies

To enable this parameter, set Modeling option to Show thermal port.

Faults

Option to add a resistance fault in the Resistor block.

To add a fault, click the Add fault hyperlink.

Resistance between the + and – ports when the block is in the faulted state.

Dependencies

To enable this parameter, add a fault to the Resistor block by clicking the Add fault hyperlink in the Resistance fault parameter.

After you create the fault, you can change the properties in the Fault Inspector window. When you open a block that has a fault, the Open Fault Inspector hyperlink appears instead of the Add fault hyperlink. For an example that shows how to include faults, see Analyze a DC Armature Winding Fault.

Simulation time at which the block enters the faulted state.

Dependencies

To enable this parameter, in the Fault Inspector window, set Trigger Type to Timed.

This parameter appears in the Trigger section of the Fault Inspector window. For more information, see Set Fault Triggers.

Current threshold to a fault transition. 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 faulted state.

Dependencies

To enable this parameter, in the Fault Inspector window, set Trigger Type to Behavioral.

This parameter appears in the Trigger section of the Fault Inspector window. For more information, see Set Fault Triggers.

Maximum length of time that the current can exceed the maximum permissible value without triggering the fault.

Dependencies

To enable this parameter, in the Fault Inspector window, set Trigger Type to Behavioral.

This parameter appears in the Trigger section of the Fault Inspector window. For more information, see Set Fault Triggers.

Noise

Select whether to model thermal noise current:

  • Disabled — No noise is produced by the resistor.

  • Enabled — Resistor generates thermal noise current, and the associated parameters become visible in the Noise section.

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.

Dependencies

To enable this parameter, set Noise mode to Enabled.

Select the noise control option:

  • Not repeatable — The random sequence used for noise generation is not repeatable.

  • 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.

Dependencies

To enable this parameter, set Noise mode to Enabled.

Random number seed stored inside the block to make the random sequence repeatable. 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.

Dependencies

To enable this parameter, set Repeatability to Repeatable.

Seed used by the noise random number generator.

Dependencies

To enable this parameter, set Repeatability to Specify seed.

Temperature of the resistor at the start of the simulation.

Dependencies

To enable this parameter, set Noise mode to Enabled.

For blocks with an exposed thermal port, this parameter is disabled. Instead, use the Variables tab to set the initial temperature target. For more information, see Variables.

Thermal

To enable these parameters, set Modeling option to Show thermal port.

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

Temperature T0, for which the nominal resistance R is specified.

Thermal mass associated with the thermal port H. It represents the energy required to raise the temperature of the thermal port by one degree.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2009a

expand all

See Also