How to create an Instance Data Block using Simulink and Simulink PLC Coder (STEP 7 IDE)

8 views (last 30 days)
I have a question with regards to Simulink PLC Coder.
Using Data Store Memory blocks I have been able to create global variables inside of my Simulink model. In the generated PLC code these show up as Data Blocks, which is exactly what I want. However I would also like to define Instance Data Blocks; Data Blocks that are associated with a function call. I want to use these in order to save variables between two specific function calls. As the same function is called for different physical systems (so with their own input signals), it is necessary to separately save the static variables associated with a function call. In STEP 7 this would be done using the aforementioned Instance Data Blocks.
In SCL format, this would look like this:
FUNCTION_BLOCK FB1
...
END_FUNCTION_BLOCK
DATA_BLOCK DB1 FB1
BEGIN
END_DATA_BLOCK
Is it possible to construct such functionality in Simulink? And how would this translate to the generated PLC code?

Answers (0)

Categories

Find more on Simulink PLC Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!