Action statements with no effect, such as,
Output1==6;typically result from an unintentional typographical error. These statements caused unexpected behavior. Stateflow now detects these statements and generates a warning.
In the previous release, if Stateflow text (such as a transition label) that contained blank lines was in editable mode, and you removed focus by clicking outside the text, the blank lines disappeared. In this release, the blank lines are retained.
The Property dialog for TruthTable/EM Functions provides an option for changing the Function-inline setting (Function Inline Option) for the generated code. In a previous release, this option could not retain any setting you made; it always reverted back to Auto after a change. This problem no longer occurs.
Charts that contained local events and bound their output events to states generated an internal assertion error when trying to simulate. This problem no longer occurs.
Multiple data/events that have the same name at different levels of the Stateflow hierarchy (machine, chart, states) caused shadowing. In other words, the lowest level data/event shadowed the data/event with a higher parent. Unintentional shadowing caused unexpected behavior in the model. This is now detected and a warning is generated at simulation time.
In the previous release, user configured properties for Stateflow testpointed signals got cleared out after saving the model in certain circumstances. This problem has now been fixed.
In a previous release, calls to MATLAB functions that did not return any outputs, such as
ml.plot (x,y), were erroneously removed during optimization in Stateflow charts. This occurred only when debugging was turned off. This no longer occurs.
In a previous release, models containing Stateflow charts unnecessarily tried to check out a Stateflow Coder license for model reference simulation. In the absence of a Stateflow Coder license, the model reference simulation returned an error. The problem no longer occurs.
The Stateflow RTW target object is now integrated with the Simulink/RTW configuration object. If you have existing M- file scripts that use the Stateflow programmatic API to set up custom-code settings on the Stateflow RTW target, you must modify these M-file scripts to use the Simulink/RTW configuration set. The following example illustrates how the properties on the old RTW target object map to the new configuration set object.
Sample old script modifying custom code properties of Stateflow's RTW target in Release 13 and earlier:
rt = sfroot; trgt_sfmachine = rt.find('-isa', 'Stateflow.Machine', '-and', 'Name', bdroot); rtw_target = trgt_sfmachine.find('-isa', 'Stateflow.Target', '-and', 'Name', 'rtw'); rtw_target.set('UserSources',foo.c'); rtw_target.set('CustomCode','#include "myhdr.h"') ; rtw_target.set('UserIncludeDirs','./myincludedir'); rtw_target.set('UserLibraries','mylib.lib') ; rtw_target.set('CustomInitializer','call_my_init_fcn();') ; rtw_target.set('CustomTerminator','call_my_term_fcn();') ;Use the following format for M-file scripts in Release 14 and beyond. Modify all appropriate scripts to use this updated convention.
configset = getActiveConfigSet(bdroot); set_param(configset,'CustomSource','foo.c'); set_param(configset,'CustomHeaderCode','#include "myhdr.h"') ; set_param(configset,'CustomInclude','./myincludedir') ; set_param(configset,'CustomLibrary','mylib.lib') ; set_param(configset,'CustomInitializer','call_my_init_fcn();') ; set_param(configset,'CustomTerminator','call_my_term_fcn();') ;
The operator ^ used for exponentiation in the Stateflow Action Language now has the correct precedence rules. This operator is interpreted as C-style exclusive OR when the Enable C-bit operations checkbox is selected, and as Matlab-style exponentiation otherwise. In previous releases, the precedence rule was too low for exponentiation, resulting in an expression such as x^5 + y being evaluated as x^(5+y) rather than (x^5)+y.
In the previous release, if you double clicked on text within a Stateflow diagram to make it editable and then right clicked on the text, the context menu for editing did not appear. In Version 6.1, you get the context menu.
Simulating a model on Japanese machines caused a crash if the model contained a chart with katakana characters in its full pathname. This problem no longer occurs.
Stateflow charts with the following characteristics:
Export chart level functions value set to true
Parameter data, or any other data, initialized from workspace
failed to simulate because they generated uncompilable code. This problem no longer occurs.
In a previous release, Stateflow parameters were not tunable in external mode simulation. This problem no longer occurs.
In previous release, Stateflow signal logging did not work in model reference. This release fixed this issue, with the following limitation. In the context of model reference signal logging, the Stateflow fixpoint data gets logged by its stored integer value.
In a previous release, if a system had charts with calls to exported graphical functions from other charts, using Stateflow Debugger to step through function-calls from one chart to the other caused a crash. In particular, the crash happened if the calling chart had more chart events (input/local) than the called chart. This was because the Debugger tried to interpret the calling chart event in the called chart. This problem no longer occurs. In the event that you are unable to update to a later release, you can use the following workaround:
Create a set of dummy events in the called chart so that the number of events in the calling chart and called chart are the same. These dummy events have no code-generation impact and circumvent the problem.
Due to limitations in MATLAB's internationalization scheme, Stateflow state names might be translated into their Japanese equivalents after editing. This might happen when the state name is one of the strings in the Japanese translation table file $matlabroot/xlate. In this release, many common names that might be used for state names (such as "State" and "Ready") have been eliminated. However, you might still see unintended translations.
If you experience an unintended translation, the workaround is to edit the state label again and use a slightly different state name (for example, add an extra character) to prevent the translator from noticing it.
In a previous release, the operands of bit-wise operators (>>,<<,~,|,&, %%) were erroneously cast to int16_T type when the target wordsize was 16. This happened even when the operands were 32 bit quantities resulting in truncation. This is no longer a problem. In the event that you are unable to update to a later release, you can use the following workaround:
In the Model Explorer for your model, select the sfun target and click on Target Options. Under the tab Include Code add the following four lines:
#define BIT_OR(x,y) ((x) | (y)) #define BIT_XOR(x,y) ((x) ^ (y)) #define BIT_AND(x,y) ((x) & (y)) #define BIT_NOT(x) (~(x))Now add the same four lines under your model’s active configuration.
1. From the Model Explorer, select the active configuration.
2. In the third pane, select Real-Time Workshop, and the Custom Code tab.
3. Select header file and paste in the same four lines as before.4. Modify your model to use these C macros instead of the bit-wise operators (| & ^ ~).
A crash occurred during RTW code generation if the model contained a chart with the Execute-At-Initialization property turned on and if the chart called an exported graphical function from another chart. This is no longer a problem.
Stateflow charts can drive function-call subsystems via function-call output events. In a previous release, if the function call subsystem outputs were directly connected to the inputs of the driving chart, the code generated for RTW might have been incorrect in some cases. For example, consider the following code in a transition or state action.
xis the chart input data,yis the chart output data, andEis a function-call output event.y = x+1; E; y = y+x;If the chart is connected to a function call subsystem whose output is connected back to the chart input data
x, the value ofxmight change after callingE. This is because one of the optimizations (expression-folding) erroneously assumes thatEwill not change the value ofx. This might result in the following incorrect code for Real-Time Workshop:E; y = (x+1)+x;This problem no longer occurs.
In a previous release, the enumerations that corresponded to active states and active events were replaced by their numerical values in the generated code for RTW. This problem no longer occurs.
In a previous release, the Model Explorer allowed the creation of Stateflow events for graphical functions, eML functions, and truth tables. However, Stateflow events for these stateless blocks served no purpose. In this release, you can no longer create events for these blocks.