Generating Simulink PLC Coder Structured Text Code for Multirate Models
Multirate Model Requirements for PLC Code Generation
At the MATLAB command prompt type in
plcdemo_multirate. Once the demo
model opens up follow the instructions below to configure the model for Structured Text code
Model Configuration Parameters
Before generating Structured Text from a multirate model, you must configure the model as follows:
Solver options that are recommended or required for PLC code generation:
Discrete(no continuous states). Other fixed-step solvers could be selected, but this option is usually best for simulating discrete systems.
Tasking mode: Must be explicitly set to
Single Tasking. Do not set Tasking modeto
Change any continuous time input signals in the top level subsystem to use discrete fixed sample times.
In the top-level model, right-click the Subsystem block and select Block Parameters (Subsystem).
In the resulting block dialog box, select Treat as atomic unit.
When you deploy code generated from a multirate model, you must run the code at the fundamental sample rate.
The B&R Automation Studio® does not support structured text code generation from multirate models.
You are now ready to: