Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Use one RT-BOX to realize control and plant parts with different Discretization step size

0 votes
235 views

Although I have known that I can use two RT-BOXes to realize plant and controller and I have four boxes,but I still want to know whether I can use one RT-BOX to simulate plant and controller with different discretization step size.

asked Jul 21, 2020 by shichenseu (299 points)

1 Answer

0 votes

There are two approaches here:

1) With the RT Box 2 and 3 hardware and PLECS 4.4 you can generate multi-tasking code and assign the code to different processor cores.  For an example, refer to the H-Bridge Converter demo model included with the latest RT Box Target Support Package (2.0.2).  The demo model has the controller defined as a separate task by using a Task Frame component.

By default the model is configured for Single-tasking.  You can change this from the Coder Options window.  First, select the target as an RT Box 2 or RT Box 3 and click the Scheduling tab.  If you change the Tasking Mode setting to Multi-tasking, you will see that the controller and plant are defined as separate tasks, each with their own sample time, and assigned to separate cores.

2) If you do not have access to an RT Box 2 or 3, you can achieve a discrete controller operating at a different discrete time step than the plant.  This would be done by placing your controller in an Atomic Subsystem with a defined sample time or a Triggered Subsystem.  The sample time will have to be an integer multiple of the discretization step size.  All target IO blocks must remain at the top-level of the code generation subsystem.

answered Jul 21, 2020 by Bryan Lieblick (1,853 points)
edited Jul 22, 2020 by Bryan Lieblick
Thank U so much!
...