PLECS 3.5 Online Help

Getting Started

Let us have a quick tour and see how PLECS is used. Our aim is to show the essential elements of PLECS in real applications without regarding all the details, rules, and exceptions. At this stage, we are not trying to be complete. We want to get you as soon as possible to the point where you can set up useful applications. Many of the details are not necessary at the beginning and can be studied later.

The following section addresses users of the PLECS Blockset for Simulink. If you are using the stand-alone version of PLECS please continue with section Getting Started with PLECS Standalone.

Getting Started with the PLECS Blockset

To access PLECS you simply need to enter plecslib in the MATLAB command line. This will bring up a Simulink model that contains a generic PLECS block named "Circuit" and various component libraries. In the libraries you find electrical components, from which you can create your circuits. Alternatively, you may access the PLECS toolbox by opening it in the Simulink library browser.

A Simple Passive Network

The only way to become familiar with a new program is by using it. For this reason we are presenting here two example circuits that you can reconstruct on your computer. The examples are based on each other, since the features of PLECS will be explained step by step.

The first electrical system we are going to model is a simple RLC network as shown in Fig. 1.1. A capacitor is charged by a DC voltage source via an RL-branch and its voltage is monitored with a voltmeter.

pict

Figure 1.1: Simple RLC network

In order to enter the circuit in PLECS we have to open a new Simulink model. Into the model window we copy the block "Circuit" from the PLECS library by dragging it with the mouse. Our Simulink model should now look like Fig. 1.2.

[Picture]

Figure 1.2: Simulink model

Components

A double-click on the PLECS block will open an empty schematic window with a menu bar quite similar to the one of a Simulink window. The components required for our circuit must be copied into this window from the components libraries. Like in Simulink, this is done by dragging them with the mouse. If you want to copy components already placed in the window hold down the Ctrl control key or use the right mouse button. The components that you need for the RLC network can be found in in the library "Electrical" in the sub-libraries "Sources", "Meters" and "Passive Components".

After you have copied all components the schematic window should look like Fig. 1.3. If not, move the components with the left mouse button. To rotate selected components press Ctrl-R, to flip them horizontally press Ctrl-F. All these functions can also be accessed via the menu bar.

[Picture]

Figure 1.3: PLECS schematic


Note  You cannot place Simulink objects in a PLECS schematic and vice versa since both programs do not share the same Graphical User Interface.
Connections

The unconnected electrical terminals of a component are marked with little hollow circles. If we bring the mouse pointer close to such a terminal the pointer shape changes from an arrow to a cross. We now can drag a connection to another component by holding the left mouse button down. When we approach another terminal or an existing connection the pointer shape changes into a double cross. As soon as we release the mouse button an electrical connection will be created.

For drawing a branch connection place the mouse pointer on an existing connection where you want the branch to start. With the right mouse button or with the left mouse button while holding down the Ctrl key you can create a connection from there to the desired destination.

Component Properties

Each component is identified by a unique name, which is chosen automatically. You may change it as you wish by double-clicking on it in the schematic. The name is intended only for documentation purposes and does not affect the simulation. Of greater importance are the parameters that determine, for example, the inductance of an inductor, the capacity of an capacitor, or the voltage of a DC voltage source. A double-click on the component icon opens a dialog box in which you can set these parameters. Fig. 1.4 shows the dialog box for an inductor.

[Picture]

Figure 1.4: Inductor dialog box

If you want selected parameters to be displayed in the schematic, you must check the check box on the right side of the edit field. For reasons of clarity we prefer to display only the most important parameters of a component.

Units

Like Simulink PLECS does not know anything about units. It is your responsibility that variables are scaled correctly. For power electronics we recommend the use of SI quantities. However, if you want to employ PLECS for the simulation of power systems it may be more appropriate to work with "per unit" quantities.

For every component enter the values according to the schematic in Fig. 1.1. In the dialog boxes of the inductor and the capacitor you can additionally set the initial current resp. the initial voltage. Please leave both values at zero.

Signals

Up to now our electrical circuit lacks a connection with the Simulink environment. You will notice this from the fact that the PLECS block in Simulink does not have inputs or outputs. In order to add inputs and outputs we must copy the respective port blocks from the library "System" into the schematic. In our case we want to access in Simulink the voltage measured by the voltmeter. Therefore, we need the "Signal Outport" block that exports a signal into the parent system.

Signals in PLECS correspond to the connections between Simulink blocks. They provide unidirectional information interchange between components and with Simulink.

Connect the output of the voltmeter with the input of the port block. In Simulink, connect a Scope to the output of the PLECS block and start the simulation. In order to see something of the more interesting part of the simulation you probably need to set the stop time to 0.1. By this time you should have something like Fig. 1.5 and Fig. 1.6 on your screen.

[Picture] [Picture]

Figure 1.5: Complete model

[Picture]

Figure 1.6: Simulation result

Adding More Measurements

If you want to measure other quantities in the circuit, simply add the required voltmeters and ammeters. The measured signals can be exported to Simulink with additional port blocks. Alternatively you can bundle the measured signals into a vector by using the multiplexer for signals "Signal Multiplexer" from the library "System".

You can also add scopes in the PLECS schematic directly. The "Scope" block can be found in the library "System".

Importing Signals

You have already learned how to export signals from the electrical circuit to Simulink via the output block. In the same manner you can also import signals from Simulink into your circuit, usually to control sources.

Let us see how the capacitor in our example charges and discharges if we apply a pulsed voltage. In the schematic we replace the DC voltage source by a controlled one. Copy the input block "Signal Inport" into the schematic and connect it to the voltage source. The PLECS block in Simulink now also has an input terminal. Any Simulink signal that you connect to this terminal will be translated into a voltage in the electrical circuit. In Fig. 1.7 we used a pulse generator with a period of 0.04 sec and an amplitude of 10.

[Picture] [Picture]

Figure 1.7: RLC network with a pulsed voltage source

The signal generated by the pulse generator is discrete, i.e. its value changes abruptly. Normally, the PLECS Scope would determine the signal type automatically and display vertical slopes. In this case, however, the discrete signal coming from the pulse generator is multiplexed with a continuous signal before reaching the Scope. In order to avoid trapezoidal curves, the signal type must be set manually to "discrete" in the Data window of the Scope (see Fig. 1.8).

[Picture]

Figure 1.8: Data window of the PLECS Scope

Buck Converter

In the next example we will introduce the concept of ideal switches, which distinguishes PLECS from other simulation programs. It will be shown how switches are controlled, i.e. either by voltages and currents in the system or by external signals.

pict

Figure 1.9: Schematic of buck converter

Switches

In the buck converter outlined in Fig. 1.9 we will model the transistor as an entirely controllable switch and bear in mind that it may conduct current only in one direction. We also need a free-wheeling diode. The diode is a switch that closes as the voltage across it becomes positive, and opens as the current through it becomes negative.

The diode can be found in the library "Electrical / Power Semiconductors" and the switch in the library "Electrical / Switches". All components in these libraries are based on ideal switches that have zero on-resistance and infinite off-resistance. They open and close instantaneously. In some components like the diode you may add a forward voltage or a non-zero on-resistance. If you are unsure about these values leave them at zero.

In order to control the switch in our buck converter we import another signal from Simulink and connect it to the switch. The switch will close upon a non-zero signal and open when the signal goes back to zero.

[Picture]

Figure 1.10: Electrical part of buck converter

By now you should be able to model the electrical part of the buck converter as shown in Fig. 1.10. For the buck converter we will implement a hysteresis type control that keeps the capacitor voltage roughly in a ± 0.2 V band around 6 V. To make things a bit more interesting we apply a step change from 12 V down to 8 V to the input voltage during the simulation.

[Picture] [Picture]

Figure 1.11: Simulation of buck converter with hysteresis control

Getting Started with PLECS Standalone

The only way to become familiar with a new program is by using it. For this reason we are presenting here two example circuits that you can reconstruct on your computer. The examples are based on each other, since the features of PLECS will be explained step by step.

After starting PLECS the PLECS Library browser is displayed. In the libraries you find various components from which you can create your circuits. You can browse through the available libraries and see which components are available.

A Simple Passive Network

The first electrical system we are going to model is a simple RLC network as shown in Fig. 1.12. A capacitor is charged by a DC voltage source via an RL-branch and its voltage is monitored with a voltmeter.

pict

Figure 1.12: Simple RLC network

In order to enter the circuit in PLECS we have to open a new PLECS model. This is done by selecting "New Model" from the "File" Menu in the Library Browser.

Components

The components required for our circuit must be copied into this window from the Library Browser. This is done by dragging them with the mouse. If you want to copy components already placed in the window hold down the Ctrl control key or use the right mouse button.

The electrical components that you need for the RLC network can be found in in the library "Electrical" in the sub-libraries "Sources", "Meters" and "Passive Components". The scope is located in the library "System". Instead of browsing for the components you can also search for them by entering the first letters of the component you need in the search bar. For example, typing sc shows you the scope, res all available resistors etc.

After you have copied all components the schematic window should look like Fig. 1.13. If not, move the components with the left mouse button. To rotate selected components press Ctrl-R, to flip them horizontally press Ctrl-F. All these functions can also be accessed via the menu bar.

[Picture]

Figure 1.13: PLECS schematic

Connections

The unconnected electrical terminals of a component are marked with little hollow circles. If we bring the mouse pointer close to such a terminal the pointer shape changes from an arrow to a cross. We now can drag a connection to another component by holding the left mouse button down. When we approach another terminal or an existing connection the pointer shape changes into a double cross. As soon as we release the mouse button an electrical connection will be created.

For drawing a branch connection place the mouse pointer on an existing connection where you want the branch to start. With the right mouse button or with the left mouse button while holding down the Ctrl key you can create a connection from there to the desired destination.

Component Properties

Each component is identified by a unique name, which is chosen automatically. You may change it as you wish by double-clicking on it in the schematic. The name is intended only for documentation purposes and does not affect the simulation. Of greater importance are the parameters that determine, for example, the inductance of an inductor, the capacity of an capacitor, or the voltage of a DC voltage source. A double-click on the component icon opens a dialog box in which you can set these parameters. Fig. 1.14 shows the dialog box for an inductor.

[Picture]

Figure 1.14: Inductor dialog box

If you want selected parameters to be displayed in the schematic, you must check the check box on the right side of the edit field. For reasons of clarity we prefer to display only the most important parameters of a component.

Units

PLECS does not know anything about units. It is your responsibility that variables are scaled correctly. For power electronics we recommend the use of SI quantities. However, if you want to employ PLECS for the simulation of power systems it may be more appropriate to work with "per unit" quantities.

For every component enter the values according to the schematic in Fig. 1.12. In the dialog boxes of the inductor and the capacitor you can additionally set the initial current resp. the initial voltage. Please leave both values at zero.

Signals

In addition to the electrical connections (wires) that are used to connect electrical components PLECS also makes use of unidirectional signals. The signals are painted in green and have an arrowhead to indicate their direction. In the RLC example a signal connects the output terminal of the voltmeter to the input terminal of the scope.

PLECS uses signals to carry non-electrical information like measurement values or triggering pulses for switches. Signals can be used in calculations and displayed in a scope. Electrical connections cannot be fed into a scope directly, you always have to use a volt- or ammeter to convert the electrical quantities into a signal first.

By this time your model should look similar to Fig. 1.15. To start the simulation, press Ctrl-T or select "Start" from the "Simulation" menu. In order to see something of the more interesting part of the simulation you need to set the stop time to 0.1. To do this, open the Simulation Parameters dialog by clicking the corresponding menu entry in the "Simulation" menu or press Ctrl-E.

You should now get the simulation results shown in below.

[Picture] [Picture]

Figure 1.15: Complete model and simulation result

Adding Control Blocks

To enhance our model we would like to add some dynamic behavior into our static electrical model. Let us see how the capacitor in our example charges and discharges if we apply a pulsed voltage. In the schematic we replace the DC voltage source by a controlled one. The input of the voltage source can be any signal generated from one of the control blocks in PLECS. In Fig. 1.16 we used a pulse generator with a period of 0.04 sec and an amplitude of 10 to control the voltage source.

[Picture] [Picture]

Figure 1.16: RLC network with a pulsed voltage source

Buck Converter

In the next example we will introduce the concept of ideal switches, which distinguishes PLECS from other simulation programs. It will be shown how switches are controlled, i.e. either by voltages and currents in the system or by external signals.

pict

Figure 1.17: Schematic of buck converter

Switches

In the buck converter outlined in Fig. 1.17 we will model the transistor as an entirely controllable switch and bear in mind that it may conduct current only in one direction. We also need a free-wheeling diode. The diode is a switch that closes as the voltage across it becomes positive, and opens as the current through it becomes negative.

The diode can be found in the library "Electrical / Power Semiconductors" and the switch in the library "Electrical / Switches". All components in these libraries are based on ideal switches that have zero on-resistance and infinite off-resistance. They open and close instantaneously. In some components like the diode you may add a forward voltage or a non-zero on-resistance. If you are unsure about these values leave them at zero.

The switch is controlled by an external signal. It will close upon a non-zero input and open when the signal goes back to zero.

We start with the electrical part of the buck converter first. By now you should be able to model it as shown in Fig. 1.18.

[Picture]

Figure 1.18: Electrical part of buck converter

Subsystems

We'd also like to separate the electrical part from the control part. This has no effect on the simulation result but makes the whole system more structured. Once you have completed the circuit from Fig. 1.18, select all components (either by clicking on an empty space in the upper left corner of the schematic and dragging a frame to the lower right corner, or by pressing Ctrl-A). Now create a new subsystem by selecting "Create Subsystem" from the "Edit" menu or by pressing Ctrl-G. The electrical components are now in a new subsystem "Sub". You can rename it to something more meaningful, e.g. "Circuit" and change the icon size by dragging one of the selected corners. You can also move the name label to another position by clicking and dragging it to the borders or the corners of the icon. Now your system should look similar to Fig. 1.19.

[Picture] [Picture]

Figure 1.19: Electrical Subsystem

To connect the subsystem to the outer schematic we need to place ports into it. Drag two Signal Inports and two Signal Outports into the subsystem schematic and connect them to the voltage source, the switch, the volt- and the ammeter respectively. Note that a new terminal appears in the subsystem icon for each port that you drag into the subsystem schematic.

For the buck converter we will implement a hysteresis type control that keeps the capacitor voltage roughly in a ± 0.2 V band around 6 V. To make things a bit more interesting we apply a step change from 12 V down to 8 V to the input voltage during the simulation.

[Picture] [Picture]

Figure 1.20: Simulation of buck converter with hysteresis control

Demo Models

Now that you've built your first own models in PLECS it may be worthwile to take a look at the demo models that come with PLECS.