# PLECS

PLECS (Piecewise Linear Electrical Circuit Simulation) is a software tool for system-level simulations of electrical circuits developed by Plexim. It is especially designed for power electronics but can be used for any electrical network. PLECS includes the possibility to model controls and different physical domains (thermal, magnetic and mechanical) besides the electrical system.
Most circuit simulation programs model switches as highly nonlinear elements. Due to steep voltage and current transient, the simulation becomes slow when switches are commutated. In most simplistic applications, switches are modelled as variable resistors that alternate between a very small and a very large resistance. In other cases, they are represented by a sophisticated semiconductor model.
When simulating complex power electronic systems, however, the processes during switching are of little interest. In these situations it is more appropriate to use ideal switches that toggle instantaneously between a closed and an open circuit. This approach, which is implemented in PLECS, has two major advantages: Firstly, it yields systems that are piecewise-linear across switching instants, thus resolving the otherwise difficult problem of simulating the non-linear discontinuity that occurs in the equivalent-circuit at the switching instant. Secondly, to handle discontinuities at the switching instants, only two integration steps are required (one for before the instant, and one after). Both of these advantages speed up the simulation considerably, without sacrificing accuracy. Thus the software is ideally suited for modelling and simulation of complex drive systems and modular multilevel converters, for example.
In recent years, PLECS has been extended to also support model-based development of controls with automatic code generation. In addition to software, the PLECS product family includes real-time simulation hardware for both hardware-in-the-loop (HIL) testing and rapid control prototyping.

## Integration with MATLAB/Simulink or Standalone

The PLECS software is available in two editions: PLECS Blockset for integration with MATLAB®/Simulink®, and PLECS Standalone, a completely independent product.
When using PLECS Blockset, the control loops are usually created in Simulink, while the electrical circuits are modelled in PLECS. PLECS Standalone on the other hand can be operated independently from other software and offers an all-in-one solution for modelling electrical circuits and controls in a single environment. Both editions are interoperable with each other.
The main difference between the two versions is that PLECS Standalone runs faster than PLECS Blockset due to its optimised engine.

## Add-on PLECS Coder

A code generator usually converts some intermediate representation of source code into machine code. The PLECS Coder is an add-on to PLECS Blockset and PLECS Standalone. It generates ANSI-C code from a PLECS model which can be compiled to execute on the simulation host or a separate target. The target can be an embedded control platform or a real-time digital simulator. The PLECS Coder can also produce embedded code for specific hardware targets.

## Add-on PLECS PIL

In the Model-based design of control loops, Processor-in-the-Loop (PIL) simulation can accelerate the development process. It allows engineers to test their control algorithms on the real hardware inside a virtual circuit simulator. As an add-on to PLECS Blockset and PLECS Standalone, PLECS PIL provides that solution.

## Hardware for Real-Time Simulations

The PLECS RT Box is a real-time simulator specially designed for power electronics applications. It is a processing unit for both real-time hardware-in-the-loop (HIL) testing and rapid control prototyping. A PLECS RT Box can be programmed and operated from PLECS. Thus, a software license of PLECS (Blockset or Standalone) and a PLECS Coder license are required to operate the hardware.