Main Content

Switch

Switch controlled by external physical signal

  • Switch block

Libraries:
Simscape / Foundation Library / Electrical / Electrical Elements

Description

The Switch block models a switch controlled by an external physical signal. If the external physical signal at port PS is greater than the value specified in the Threshold parameter, then the switch is closed, otherwise the switch is open.

Electrical switches add discontinuities to your model, and therefore your choice of the solver can influence the model behavior. For detailed information about the solver settings, see Making Optimal Solver Choices for Physical Simulation.

Variables

To set the priority and initial target values for the block variables prior to 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.

Nominal values provide a way 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 which is the Nominal Values section in the block dialog box or Property Inspector. For more information, see Modify Nominal Values for a Block Variable.

Examples

Ports

Input

expand all

Input physical signal that controls whether the switch is open or closed.

Conserving

expand all

Electrical conserving port associated with one of the switch terminals. The block has no intrinsic directionality.

The port name is not visible in the block icon, but you can see this name in the underlying source file by clicking the Source code link in the Description tab of the block dialog box.

Electrical conserving port associated with the other switch terminal.

The port name is not visible in the block icon, but you can see this name in the underlying source file by clicking the Source code link in the Description tab of the block dialog box.

Parameters

expand all

The resistance of the switch when it is closed. The parameter value must be greater than zero.

The conductance of the switch when it is open. The parameter value must be greater than zero.

The threshold value for opening and closing the switch. If the external physical signal at port PS is greater than this value, then the switch is closed, otherwise the switch is open.

Extended Capabilities

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

Version History

Introduced in R2007a

See Also