This example shows how to use data dictionaries to manage the data for a fuel rate control system designed using Simulink® and Stateflow®. To familiarize yourself with the fuel rate control model see sldemo_fuelsys.
The sldemo_fuelsys_dd model is a closed-loop system containing a "plant" and "controller". The plant is used to validate the design of the controller. In this example, the plant and controller are represented by separate models that are referenced from the test harness model. Let's take a look at these models.
Double-click on the Engine Gas Dynamics block to open the plant model.
Double-click on the Fuel Rate Controller block to open the controller model.
The global design data for the controller model is defined in a data dictionary. Using data dictionaries has many advantages over defining data in the base workspace. To learn about data dictionaries see the documentation for Simulink Data Dictionary.
The controller model is explicitly linked to a data dictionary. This link is set up on the Data tab of the Model Properties dialog.
The icon in the lower-left corner of the model window shows that this model is linked to a data dictionary. You can open the data dictionary in the Model Explorer by clicking on this icon.
This data dictionary contains parameter and signal objects that are used to configure the controller algorithm for simulation and code generation. It also contains a reference to another data dictionary that defines the data type objects used by this model.
Initially, this data dictionary is configured for a float-point controller, as is seen by the data type display on the signal lines in the controller model. You can easily switch between floating-point and fixed-point controllers by changing the types dictionary (sldemo_fuelsys_dd_types.sldd) to reference the appropriate dictionary:
Floating-point types: sldemo_fuelsys_dd_float.sldd
Fixed-point types: sldemo_fuelsys_dd_fixpt.sldd
The test harness model is also linked to a data dictionary (sldemo_fuelsys_dd.sldd). This data dictionary contains references to the data dictionaries for the plant and controller models but it does not contain any additional data.
Simulate the test harness model to validate the behavior of the controller in either the floating-point or fixed-point configuration.
Close the models and data dictionaries from this example
Refer to other examples related to sldemo_fuelsys: