
How to run PLECS Standalone from MATLAB Workspace
Here is Anatolii
Overview
This video demonstrates how to run PLECS simulations directly from MATLAB using a custom class called MLEX. This approach offers significant speed advantages over running simulations within Simulink and allows for seamless integration of PLECS results into the MATLAB workspace for further analysis and manipulation. The tutorial covers initializing the MLEX class, running simulations, plotting results with customizable axes, modifying simulation parameters on the fly, and accessing raw simulation data for use with standard MATLAB functions. This method enhances efficiency and flexibility for power electronics engineers working with PLECS.
Save this permanently with flashcards, quizzes, and AI chat
Chapters
- Simulink with PLECS blockset can be slow for simulations.
- PLECS Standalone runs simulations significantly faster.
- Users often prefer Simulink for pre-developed blocks and MATLAB integration.
- This video introduces a method to control PLECS Standalone from MATLAB.
- A custom MATLAB class, MLEX, is introduced to interface with PLECS Standalone.
- MLEX uses JSON communication between MATLAB and PLECS.
- To use MLEX, create an object (e.g., 'P6') and specify the PLECS model name.
- The MLEX object connects MATLAB to the running PLECS Standalone instance.
- The `simulate` function within MLEX executes the PLECS model.
- Specify output signals as a vector (e.g., VDC, duty cycles, phase voltages).
- Results can be plotted directly after simulation by setting `plot` to `true`.
- The simulation results are transferred back to the MATLAB workspace.
- Simulation parameters (e.g., VDC, switching frequency, inductance) can be changed dynamically using the `set_param` function.
- Modified parameters take effect in the next simulation run.
- This enables rapid iteration and sensitivity analysis by changing variables and re-simulating.
- Advanced analysis like FFT can be performed on simulation results.
- Simulation results can be plotted with customized axis limits using `plot_results` and attributes like `x_link` and `y_link`.
- This allows for focused visualization of specific regions of interest in the data.
- Raw simulation data (time, signals) is accessible directly in the MATLAB workspace via the `results` structure.
- Standard MATLAB plotting functions can be used on this raw data for maximum flexibility.
Key takeaways
- Running PLECS simulations in Standalone mode from MATLAB via the MLEX class is significantly faster than using the Simulink blockset.
- The MLEX class facilitates seamless communication between MATLAB and PLECS Standalone using JSON.
- Users can initiate simulations, specify outputs, and retrieve results directly into the MATLAB workspace.
- Simulation parameters can be modified dynamically within MATLAB, allowing for rapid design iteration and analysis.
- Customizable plotting options and direct access to raw simulation data provide powerful tools for in-depth analysis.
- This integrated approach leverages the speed of PLECS Standalone and the analytical capabilities of MATLAB.
Key terms
Test your understanding
- What are the primary advantages of running PLECS simulations via the MLEX class in MATLAB compared to using the Simulink blockset?
- How does the MLEX class enable communication between MATLAB and PLECS Standalone?
- Explain the process of running a simulation and retrieving its results using the MLEX class.
- How can you modify simulation parameters dynamically using MLEX, and why is this capability important for design engineers?
- What methods are available for visualizing simulation results, and how can you customize these visualizations?