Components

Copying a Component into a Schematic

You can copy a new component into a schematic in different ways:

  • Drag a component from the Library Browser into the schematic.

  • Click into the schematic and start typing the type name of the desired component. This will open a mini browser in a popup window. To insert a component, use the up/down cursor keys and press Enter, or click and drag the component to the desired location. To close the mini browser without inserting a component, press the Esc key.

  • Press and hold the Ctrl (on macOS: Cmd) key, then drag an existing component from the same or a different schematic.

Moving a Component

To move a component, click it with the left mouse button and drag it to the desired location. If the component has connected terminals, the connections are automatically rerouted to the new location so that the terminals remain connected. To cut any existing connections when moving a component, hold the Shift key while dragging the component.

Specifying Component Parameters

Every component has a dialog box to view and modify the component parameters. To open the parameter dialog, double-click on a component or select the component and choose Parameters… from the Edit menu or the component’s context menu. You can also select the component and press the Enter key.

../../_images/diode_dialog.png

Most component parameters accept MATLAB expressions as values, provided that they evaluate to an acceptable result. Parameter expressions are evaluated when you start a simulation or update the Simulink model. In case an error occurs during evaluation of the parameters, an error dialog appears and the corresponding component is highlighted.

An exception to this behavior are parameters that affect the appearance of the component such as the parameter Number of windings of the Mutual Inductor or the parameter Width of the Wire Multiplexer. Such parameters must be literal values and are evaluated immediately.

Integer values may be specified as decimal, binary or hexadecimal values. Hexadecimal integers are prefixed by 0x, binary integers are prefixed by 0b. The expressions 0xfa and 0b11111010, for example, both evaluate to 250.

Using Workspace Variables in Parameter Expressions

Parameter expressions that are not evaluated immediately can include workspace variables. Expressions are evaluated as a whole in one workspace. By default, the evaluation workspace is the base Octave or MATLAB workspace. Notice that in PLECS Standalone every model has its own base Octave workspace that is populated by the model initialization commands that can be configured in the Simulation Parameters dialog, see Model Initialization Commands.

However, you can define local mask workspaces for subsystems that will then be used for the parameter evaluation in the underlying schematics. For information on subsystem mask workspaces see Mask Dialog.

In PLECS Blockset you can also mask the Circuit block as a whole. This is necessary e.g. if you want parameter expressions to be evaluated in the Simulink model workspace instead of the MATLAB base workspace, or when you use the sim command from within a MATLAB function and want to access the function workspace. For more information see Customizing the Circuit Block.

Displaying Parameters in the Schematic

You can cause PLECS to display any component parameter beneath the component name in the schematic. To specify which parameter should be displayed in the schematic, open the dialog box and check the check box next to the parameter edit field. Parameter values can be edited in the schematic directly by double-clicking them.

Changing Parameters of Multiple Components

You can simultaneously change the parameters of multiple components of the same type. To do so, select the components, then double-click any of them or choose Parameters… from the Edit menu or the components’ context menu.

Parameters that have different values for the selected components show a placeholder text <multiple values>. If you leave this placeholder as is, the components retain their individual values for this parameter when you apply any other changes that you have made.

Changing Parameters During a Simulation

Parameters are evaluated once a new simulation is started. Their values remain constant throughout the simulation. Certain parameters can be changed during the simulation, their value is used as soon as the change is applied. Depending on the parameter type it may be necessary to reevaluate other parts of the model, which may take some extra computation time.

Parameters are changeable during the simulation if they do not change the structure of the model. If, for example, a parameter value is a vector, the elements of the vector may be changed, whereas the size of the vector must remain the same. Parameters that influence the number of terminals of a component or the width of a signal cannot be changed during simulation.

Changing Component Names

To edit a component name, double-click it in the schematic. Press Enter or click anywhere outside the label to finish editing. Press Shift+Enter to enter a line break for component names that span multiple lines. To show or hide a component name, toggle Show name in the Format menu.

All component names in the same schematic must be unique and must contain at least one non-space character. Trailing spaces are removed from the names.

Placing the Component Label

The label of a component can be placed at any of the following 16 positions along the component frame: at the four corners, at the center of the four edges and at two off-center positions of each of the four edges. The label of a Subsystem block can additionally be placed at the center of the component frame.

To change the placement of a label, drag it with the middle mouse button to a new location. Alternatively, use the left mouse button while holding the Shift key. While you hold down the mouse button, small dots mark the possible positions, and a dashed rectangle indicates the new label position. When you release the mouse button, the label is moved. The horizontal and vertical alignment of the label text is automatically adjusted to the label position.

../../_images/arrange_label.png

Changing the Orientation of Components

You can change the orientation of a component by choosing one of these commands from the Format menu:

  • The Rotate command (Ctrl+R (on macOS: Cmd+R)) rotates a component clockwise 90 degrees.

  • The Flip left/right command (Ctrl+F (on macOS: Cmd+F)) flips a component horizontally.

  • The Flip up/down command (Ctrl+I (on macOS: Cmd+I)) flips a component vertically.

Disabling Components

If you would like to disable one or more components temporarily so that they do not affect the behavior of a model, you can do so by commenting them. The term “commenting” is inspired by the programming pattern of disabling lines of code by commenting them. There are two possibilities to comment a component:

Comment Out

Commenting out a component has the same effect on the model as deleting the component, leaving the connections that lead to and from the component unconnected.

Comment Through

For certain types of components it is useful to “close the gap” when they are commented. For instance, you may want to replace a commented resistor with a short circuit rather than an open circuit.

A commented component is drawn with dimmed colors, and the connections leading to and from it are also dimmed. If a component is commented through, solid lines indicate the terminals that are connected with each other, and the corresponding external connections are not dimmed. This is demonstrated in the figure below.

../../_images/comment_components.svg

To comment or uncomment a component interactively, select it and toggle Comment out or Comment through in the Edit menu or the component’s context menu. To comment or uncomment a component programmatically, use the command:

plecs('set', 'componentPath', 'CommentStatus', 'status')

where status is one of CommentedOut, CommentedThrough or Active.

Getting Component Help

Press the Help button in the dialog box to view the documentation for the component.