Tutorials

This page gives an overview on all available tutorials for PLECS, RT Box and Embedded Code Generation. Please note that only the PLECS Standalone files are provided for download. However, these can be easily imported into PLECS Blockset, by opening a new empty PLECS Circuit block inside a Simulink model and clicking File → Import from Standalone.

A complete list of PLECS-related videos can be found on the Plexim Youtube page.

The filters below will help you navigate through the collection of application examples. By clicking on the column headings in the table, the results are sorted in ascending or descending order.

Title Description Files PDF Video No.
PLECS: Introduction to PLECS Standalone

This tutorial introduces the basic concepts of PLECS Standalone by having the user build up a simple passive network and a buck converter circuit. The instructions explain how to use the component libraries to model a system in the PLECS workspace, as well as how to interconnect components and parameterize them. Then a simulation can be run and resulting schematics and waveforms are provided for comparison. The user will also learn how to create a subsystem for organizing the model, implement controls for a multi-domain system, and use the Probe block to monitor component signals as an alternative to using meters and sensors.

101
PLECS: Introduction to PLECS Blockset

This tutorial introduces the basic concepts of PLECS Blockset by having the user build up a simple passive network and a buck converter circuit in a PLECS Circuit block within a Simulink model. The instructions explain how to use the component libraries to model a system in the PLECS workspace, as well as how to interconnect components and parameterize them. Then a simulation can be run and resulting schematics and waveforms are provided for comparison. A further iteration demonstrates that the PLECS environment can be directly interfaced to the Simulink one so that the complete model can be comprised of blocks in both. The user will also learn how to create a subsystem for organizing the model, implement controls for a multi-domain system, and use the Probe block to monitor component signals as an alternative to using meters and sensors.

102
PLECS: Modeling a Switched-Mode Power Supply

This tutorial introduces the user to the basic working principles of PLECS including the top-down modelling approach and basic user interface interaction. During the exercise the user creates a detailed model of a two-stage power electronic converter including a single-phase input rectifier and an output forward converter. Since the focus of this exercise is on modeling the switching converter rather than the control system, the forward converter is operated in open-loop control mode with a fixed duty cycle.

- 103
PLECS: Thermal Simulation of a Buck-Converter

This tutorial instructs the user on how to use the thermal modeling features of PLECS to create a combined electrical-thermal simulation of a buck converter. A thermal simulation in PLECS comprises both losses from semiconductors and the thermal circuit to model the propagation of heat flow. In this tutorial we analyze the behavior of the MOSFET junction temperature, individual and total losses of the switches, and the overall system efficiency.

104
PLECS: Introduction to the PLECS Magnetic Domain

In PLECS, the user can build complex inductors and transformers in a special magnetic circuit domain based on the permeance-capacitance analogy. Primitives such as windings, cores, and air gaps are provided in the component library. The aim of this exercise is to use PLECS Magnetic domain components to design a transformer for a forward converter. The user will start with an idealized, fully-electrical converter model and incrementally add more realistic effects, including leakage inductance, and a magnetic circuit representation with non-linear core saturation.

- 105
PLECS: Modeling an Electric Vehicle with the Mechanical Domain

This tutorial explains how to use the mechanical modeling features of PLECS to create a combined electro-mechanical system representing an electric vehicle propelled by an electric motor. The user will get familiar with the PLECS Mechanical domain's Rotational and Translational libraries consisting of Sources, Components, and Sensors subcategories for modeling mechanical dynamics and measuring mechanical variables of interest such as speed, position, and force/torque. After developing a mechanical model for the motor and rotating driveline, the user will build a translational vehicle model to observe the effects of a lumped vehicular system experiencing a road load force and tire frictional force.

- 106
PLECS: Implicit Model Vectorization

This tutorial instructs the user on how to use the concept of vectorization in PLECS, where scalar variables and signals can be combined into a common bus, such as to reduce schematic complexity and design dynamic custom components that can be reconfigured based on variable assignments and/or settings. The user will learn how to vectorize component parameters and which auxiliary blocks are used to perform basic vectorizing functions, including to implement series and parallel connections. This feature is useful in avoiding the duplication of a part of a circuit several times and modeling circuits in a more condensed form. Finally, the concept of implementing user-defined parameters is introduced for the purpose of making variable-dimension structures.

- 107
PLECS: Creating Custom Components and Subsystem Masks

This tutorial explains how to create a custom component and component mask using the example of a photovoltaic (PV) string. Masking a subsystem allows users to define a custom interface for a Subsystem block that hides the underlying schematic, making it appear as a single component with its own icon and parameter window. This tutorial also gives a brief introduction to the programming language Lua that is used to implement dynamic component masks.

- 108
PLECS: Component Libraries (Standalone)

The aim of this tutorial is to build a PLECS model using custom components from a user-defined library. It discusses the following topics:

• How to structure a library
• How to update a library component
• How to break a library reference and customize it
• How to create a library within a library
• How to create a model reference

- 109
PLECS: Using the C-Script Block

The C-Script block is a versatile tool in the PLECS component library that can be used for implementing custom controllers and components. The advanced capabilities of the C programming language combined with the flexible sample time settings in the C-Script block allow almost any custom component model, from a simple mathematical function to a complex state machine, to be implemented. The C-Script block can also simplify the workflow when writing C code for DSP controllers since the code can be reused for the DSP. In this tutorial the user will learn how the C-Script block interfaces with the simulation engine through function calls and the different time settings available in the C-Script block. Exercises include using the C-Script block for implementing a mathematical function and for implementing both a continuous and discrete PI controller.

- 110
PLECS: Efficient PWM Generation using the C-Script Block

This material builds on the first C-Script block tutorial and demonstrates the component is not only useful for implementing mathematical and control functions, but also for implementing state machine programs. State machines are useful for generating switching patterns and for sequencing controller modes. In this exercise, the user will implement a state machine program that creates a symmetrical pulse width modulation (PWM) signal with a blanking delay between switching transitions.

- 111
PLECS: Using the DLL block

The PLECS DLL block is useful for testing custom C control code with a PLECS model. Compared with the C-Script block, C control code can be included in a model via the DLL block without having to conform to the function structure of the C-Script block and the control code can be written using the same file structure that is used for the DSP control code. In this tutorial you will learn how to link a DLL file that implements a digital PI controller to a PLECS model. This involves creating an embedded project in an IDE, writing the control logic, compiling the code and generating the DLL, and debugging the file while it is running in a PLECS model.

- 112
PLECS: Introduction to the State Machine Block

This tutorial demonstrates how to use the State Machine block for graphical definition of a constant on-time control scheme. A state machine can be used to control, model, and predict system behavior. It is also a convenient way to represent a process which evolves over time and reacts to system inputs. The alternative to using a state machine is distributing specific task-handling functions under the correct loops of the code, such as with the C-Script block. While the C-Script block is a powerful tool allowing direct interaction with the solver execution routines, the State Machine block has a very intuitive interface and workflow, and requires less coding experience.

113
PLECS: XML-RPC Interface and Controller Design in Python

The XML-RPC interface of PLECS Standalone allows you to send and receive data to and from PLECS Standalone using an external program. Many programming languages such as Python, Java, C++, or Ruby offer standard XML-RPC Libraries to set up an XML-RPC client. In this tutorial Python 3 is used to launch PLECS simulations and retrieve the simulation results to be post-processed. In this tutorial you will learn:

- how the XML-RPC interface is embedded into PLECS Standalone and the simulation workflow.
- how to design a simple current control scheme using the Python Control System Library.
- how to use the XML-RPC interface to interact with PLECS (starting a simulation and reading back data).

Please note that PLECS Blockset does not have a built-in XML-RPC interface.

- 114
PLECS: Analysis Tools

This tutorial introduces the PLECS Analysis Tools that can be used to perform steady-state and small-signal analyses. The Steady-State Analysis tool can be used to find the steady-state operating point of the system and the Small-Signal Analysis tools can be used to obtain open-loop and closed-loop transfer functions. Three types of small-signal analyses are available: AC Sweep, Impulse Response Analysis and Multitone Analysis.

- 115
PLECS: Running PLECS Standalone from MATLAB

This tutorial explains how to run a PLECS Standalone simulation using MATLAB® and JSON-RPC. With this setup one can make use of the high simulation speed and parallel simulation capabilities of PLECS Standalone while still working in the familiar MATLAB environment.
116
RT Box: Introduction to the RT Box

In this tutorial you will learn step-by-step how to run basic PLECS models on the PLECS RT Box. The tutorial is designed for users making the transition from a PLECS model to a real-time simulation on the RT Box and how best to structure a model to facilitate this transition using PLECS Standalone. The user will gain a deeper understanding of the RT Box hardware, workflow, and the RT Box Target Support library components. Further, they will learn how to update PLECS Scopes with data from a real-time simulation, change parameters during a real-time simulation, and gather information about a simulation from the RT Box's web interface.

201
RT Box: Building a Voltage Source Inverter on the RT Box

In this tutorial you will build a simple three-phase voltage source inverter (VSI) for deployment on the RT Box. The tutorial is oriented towards users making their first practical models for the RT Box using PLECS Standalone and identifies potential missteps one may make along the way.
The primary learning goal for the tutorial is to demonstrate the limitations of conventional switch models in real-time applications, motivating the use of sub-cycle averaging and specialized hybrid power modules in later tutorial exercises.

- 202
RT Box: Timing and Step-Size Selection

In this tutorial you will learn step-by-step how to build and optimize a basic power converter on the PLECS RT Box and select an appropriate simulation step size. The tutorial is designed for users making the transition from a PLECS model to a hardware-in-the-loop (HIL) simulation on the RT Box using PLECS Standalone.
While basic PLECS circuit models can run on the RT Box, there are optimizations that improve the simulation accuracy and reduce computational load of real-time simulations. One key real-time optimization is to use the PWM Capture component and hybrid power modules. These two components unlock the high sample rate of the FPGA, such that the accuracy of the sensed duty cycle is no longer strictly determined by the model time step. This is critical in selecting an appropriate simulation step size.
The specific learning goals for the tutorial are:
• Establish the importance of sub-cycle averaging and hybrid power modules for real-time simulation.
• Understand how to optimize simple power converter models for real-time applications.
• Learn the process to select an appropriate model step size using the CodeGen mode.

- 203
RT Box: Model Optimizations

As real-time simulation models increase in complexity additional optimization steps may be required to achieve the desired performance. This tutorial provides additional optimization techniques for real- time simulation on the RT Box with a focus on hardware-in-the-loop (HIL) applications.
At the end of the tutorial you should understand how to reduce the number of switching combinations in a PLECS model. You will observe how this reduces the model execution time and reduces the size of the generated code.

- 204
RT Box: Virtual Prototyping

This tutorial is an extension of the tutorial on building a simple voltage source inverter (VSI) on the PLECS RT Box. You will apply the optimization techniques learned in the previous tutorial exercises to implement closed-loop control of a three-phase VSI system. You will use a virtual prototyping setup where the controller and plant will run on separate RT Boxes connected by loopback cables. Virtual prototyping is often helpful to evaluate the performance of the real-time platform before connecting to any control or power hardware and can be used as an intermediate stage when developing real-time simulations for the RT Box.

- 205
RT Box: From Offline to Real-Time

In this tutorial you will learn various techniques and some of the necessary modifications required to make an “offline” model capable and optimized for “real time” on the RT Box. Several common modeling approaches and configurations in offline simulation that can become problematic in real-time simulation are discussed, along with the related simplifications so that the HIL simulator is able to accomplish each update within a reasonable model step size. Further focus is on the use of specialized target blocks for generating and resolving high-resolution PWM gate signals with adequate accuracy. This involves using RT Box PWM Out/Capture blocks and the electrical power module components available in the PLECS component library. This tutorial also discusses the handling of transient events, and preventing numerical overflow as state variables may accumulate as a real-time simulation continues indefinitely.

- 206
RT Box: System Splitting for Distributed Real-Time Simulation

Large power electronic systems often include many switching devices so that real-time deployment on a RT Box can be challenging. Long calculation times, the size of executable code and the number of available I/Os are typical problems.
In this tutorial you will learn where and how to split a given PLECS model into two parts. Each part is then deployed on a separate RT Box. At the end different synchronization options between RT Boxes using SFP ports is explained.

For this tutorial you will need:

• 2 RT Boxes (either of type RT Box 1, 2 or 3 not CE)
• 2 D-SUB 37-pin male-to-female loopback cables
• 1 SFP cable

207
TI C2000 Embedded Code Generation: Introduction to Embedded Code Generation for TI C2000 Series

This tutorial introduces the major functional blocks of the PLECS embedded code generation tool for the Texas Instruments (TI) C2000 processor family, the simple workflow for going from an offline model to working controller, and advanced features such as the External Mode allowing live inspection and verification of the working code. In addition to PLECS, PLECS Coder, and the target support library, a Piccolo MCU F28069 LaunchPad development kit is required for this exercise. Further, if you have access to a PLECS RT Box, it provides a virtual circuit environment for testing the generated code. In the first exercise you will create a simple program to blink an LED on the LaunchPad, followed by instructions for pulse-width modulation (PWM) signal generation, Analog-to-Digital Converter (ADC) sampling techniques, and closed-loop control design.

301