Your model file includes the information to describe the dynamics of your design, but it needs some other information — parameters and initial values of variables — to function correctly and remain flexible for future alterations and additions to its design. There are two types files that are used for this:
A text file which holds information about the variables you have set up in your design model that you will want to inspect on the physical system with the calibration tool. We created three variables in this model, whose initial conditions, ranges and types must be recorded in the data dictionary;
A text file which tells the model where to find the blocks and data dictionaries that are to be used by the model. In this case, there is only 1 data dictionary used.
Draft versions of these resource files were created by the oe_create_model
command.
The data dictionary for this model will consist of 4 lines (1 for the column labels, and 3 others for the variables in our model). Each line needs to have 10 tab-delimited fields entered, which are used to tell the model about the type and structure of each of the 3 variables. As the data dictionary is a tab-delimited text file, it is often simpler to use a spreadsheet application (e.g. Microsoft Excel) to create or edit the file, although you can, of course, use any text editor. It is not recommended that you use MATLAB's own text editor for editing data dictionary files, as tab characters are handled poorly.
To edit the data dictionary for your model:
Use your spreadsheet application or text-editing application to open the
file called stp_dd.txt
in the directory called
stp
in the directory you created at the start of this
exercise.
The file has three lines — the top line always contains the column labels for reference, and the other two lines contain dummy variables to be replaced by variables from our model.
Copy and paste the line that starts with stp_dummy
so that the
file looks like:
Name Value Units Type Accuracy Min Max Description stp_dummy NA real_T 0.01 0 0 Dummy measurable, delete t ... stp_dummy NA real_T 0.01 0 0 Dummy measurable, delete t ... stpc_dummy_cal 0 NA real_T 0.01 0 0 Dummy calibratable, delete ...
Then change each line, making sure not to delete or add any TAB characters, so that the file looks like:
Name Value Units Type Accuracy Min Max Description stp_ect degC real_T 0.01 -40 140 Temperature of engine stp_ect_state state BOOL 1 0 1 1 if over temperature, 0 if not stpc_ect_limit 90 degC real_T 0.01 -40 140 Temperature threshold
Save the file — if you're using a spreadsheet application to edit the data dictionary file, save in a tab-delimited text format.
At MATLAB's command prompt, issue the command:
oe_read_build_list
which deletes the dummy workspace variables and replaces them with the
set of variables entered into the stp_dd.txt
file.
If any errors or warnings are displayed, go back and edit the file
until it matches the above (a complete list of error and warning messages
are given in Appendix 8, Data dictionary tool errors).
Once read without errors, the workspace will have been updated and look something like:
Optionally, in R2015a and later, a Simulink based data dictionary can be used in place of a text based data dictionary by issuing the following command, at MATLAB's command prompt:
oe_config_using_sim_ddThis will convert the text based data dictionary to a Simulink data dictionary which can then be edited within Simulink in Model Explorer.
More detailed information on the structure of the data dictionary can be found in Section 4.2.2.2, “Data dictionary files”.