Generate Global Variables from Signals in Model
If you want to generate a global variable in your code, use a global Data Store
Memory block based on a
Simulink.Signal object in your
Set up a data store in your model by using a Data Store Memory block.
Simulink.Signalobject with the data store.
In the base workspace, define a
Simulink.Signalobject with the same name as the data store. Set the storage class of the object to
Use the Model Data Editor to enable the Data store name must resolve to Simulink signal object parameter of the Data Store Memory block. To use the Model Data Editor in a model, on the Modeling tab, select Model Data Editor under the Design category. On the Data Stores tab, set the Change View drop-down to
Design. Enable Resolve for the Data Store Memory block. For more information, see Model Data Editor.
To utilize Data Store Read and
Data Store Writeblocks, attach the signals in your model that you want to read from or write to the data store.
Simulink.Signal object that is associated with the
global Data Store Memory block appears as a global variable in generated
If you follow this workflow for Rockwell Automation RSLogix
5000 AOIs, the generated code uses
for the global data.