Use the Simulink®Model Advisor checks to configure your model for simulation.
Simulink Coder Checks(Simulink Coder)
Simulink Check Checks(Simulink Check)
Simplified initialization mode was introduced in R2008b to improve the consistency of simulation results. This mode is especially important for models that do not specify initial conditions for conditionally executed subsystem output ports. For more information, seeSimplified Initialization ModeandClassic Initialization Mode.
Use the Model Advisor checks inMigrating to Simplified Initialization Modeto help migrate your model to simplified initialization mode.
Check ID:mathworks.design.UnconnectedLinesPorts
Check for unconnected lines or ports.
This check lists unconnected lines or ports. These can have difficulty propagating signal attributes such as data type, sample time, and dimensions.
Note
Ports connected to ground/terminator blocks will pass this test.
Condition | Recommended Action |
---|---|
Lines, input ports, or output ports are unconnected. | Connect the signals. Double-click the list of unconnected items to locate failure. |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Check™license.
Use thePortConnectivity
command to obtain an array of structures describing block input or output ports.
Common Block Propertiesfor information on thePortConnectivity
command.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.RootInportSpec
Check that root model Inport blocks fully define dimensions, sample time, and data type.
Using root model Inport blocks that do not fully define dimensions, sample time, or data type can lead to undesired simulation results. Simulink software back-propagates dimensions, sample times and data types from downstream blocks unless you explicitly assign them values.
Condition | Recommended Action |
---|---|
Root-level Inport blocks have undefined attributes. | Fully define the attributes of the root-level Inport blocks. |
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
The following configurations pass this check:
Configuration Parameters > Solver > Periodic sample time constraintis set toEnsure sample time independent
For export-function models,inherited sample timeis not flagged.
Check ID:mathworks.design.OptimizationSettings
Check for optimizations that can lead to non-optimal code generation and simulation.
This check reviews the status of optimizations that can improve code efficiency and simulation time.
Condition | Recommended Action |
---|---|
The specified optimizations are off. | Select the following optimization check boxes on theOptimizationpane in the Configuration Parameters dialog box:
Select the following optimization check boxes on theOptimizationpane in the Configuration Parameters dialog box:
Select the following optimization check boxes in the Configuration Parameters dialog box:
Select the following optimization check boxes on theOptimizationpane in the Configuration Parameters dialog box: Note Model Advisor checks these parameters only if there is a Stateflow®chart in the model.
|
Application lifespan (days)is set as infinite. This could lead to expensive 64-bit counter usage. | 如果这不是有意选择停止时间。 |
The specified diagnostics, which can increase the time it takes to simulate your model, are set towarning orerror . |
Select
|
The specified Embedded Coder®parameters are off. | If you have an Embedded Coder license and you are using an ERT-based system target file:
|
If the system containsModelblocks and the referenced model is in Accelerator mode, simulating the model requires generating and compiling code.
check
Model Configuration Parameters: Code Generation Optimization(Simulink Coder)
Check ID:mathworks.design.ModelRefSIMConfigCompliance
Checks for referenced models for which Simulink changes configuration parameter settings during accelerated simulation.
For models referenced in accelerator mode, Simulink ignores the settings of the following configuration parameters that you set to a value other thanNone
.
Array bounds exceeded
Diagnostics>Data Validity>Inf or NaN block output
Diagnostics>Data Validity>Division by singular matrix
Diagnostics>Data Validity>Wrap on overflow
Also, for models referenced in accelerator mode, Simulink ignores the followingConfiguration Parameters>Diagnostics>Data Validity>Data Store Memory blockparameters if you set them to a value other thanDisable all
. For details, seeData Store Diagnostics.
Detect read before write
发现写后读
Detect write after write
Condition | Recommended Action |
---|---|
You want to see the results of running the identified diagnostics with settings to produce warnings or errors. |
Simulate the model in Normal mode and resolve diagnostic warnings or errors. |
Check ID:mathworks.design.ParamTunabilityIgnored
Checks if parameter tunability information is included in the Model Parameter Configuration dialog box.
Simulink software ignores tunability information specified in the Model Parameter Configuration dialog box. This check identifies those models containing parameter tunability information that Simulink software will ignore if the model is referenced by other models.
Condition | Recommended Action |
---|---|
Model contains ignored parameter tunability information. | Click the links to convert to equivalent Simulink parameter objects in the MATLAB®workspace. |
Create Tunable Calibration Parameter in the Generated Code(Simulink Coder)
Check ID:mathworks.design.ImplicitSignalResolution
Identify models that attempt to resolve named signals and states toSimulink.Signal
objects.
Requiring Simulink software to resolve all named signals and states is inefficient and slows incremental code generation and model reference. This check identifies those signals and states for which you may turn off implicit signal resolution and enforce resolution.
Condition | Recommended Action |
---|---|
Not all signals and states are resolved. | Turn off implicit signal resolution and enforce resolution for each signal and state that does resolve. |
Check ID:mathworks.design.OptBusVirtuality
Identify virtual buses that could be made nonvirtual. Making these buses nonvirtual improves generated code efficiency.
This check identifies blocks incorporating virtual buses that cross a subsystem boundary. Changing these to nonvirtual improves generated code efficiency.
Condition | Recommended Action |
---|---|
Blocks that specify a virtual bus crossing a subsystem boundary. | 改变the highlighted bus to nonvirtual. |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.DiscreteTimeIntegratorInitCondition
Identify Discrete-Time Integrator blocks with state ports and initial condition ports that are fed by neither an Initial Condition nor a Constant block.
Discrete-Time Integrator blocks with state port and initial condition ports might not be suitably initialized unless they are fed from an Initial Condition or Constant block. This is more likely to happen when Discrete-Time Integrator blocks are used to model second-order or higher-order dynamic systems.
Condition | Recommended Action |
---|---|
Discrete-Time Integrator blocks are not initialized during the model initialization phase. | Add a Constant or Initial Condition block to feed the external Initial Condition port. |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
ICblock
Constantblock
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.DisabledLibLinks
Search model for disabled library links.
Disabled library links can cause unexpected simulation results. Resolve disabled links before saving a model.
Note
This check may overlap withCheck model for block upgrade issues.
Condition | Recommended Action |
---|---|
Library links are disabled. | Click theLibrary Link>Resolve linkoption in the context menu. |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
Use the Model Browser to find library links.
To enable a broken link, right-click a block in your model to display the context menu. SelectLibrary Link>Resolve link.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.CheckVirtualBusAcrossModelReferenceArgs
Checks virtual bus signals that cross model reference boundaries and flags cases where using virtual buses across a model reference boundary increases the number of function arguments significantly.
To improve the speed of the code generation process, you can use this check to reduce the number of generated function arguments. If the check finds a model that where many arguments will be generated for a function, you can clickUpdate Modelto modify the model so that it generates fewer arguments.
Methods that generate many function arguments as the result of a virtual bus signal crossing model reference boundary slow down the code generation process.
Condition | Recommended Action |
---|---|
Methods are listed that generate a large number of arguments for the current the model configuration that this check can reduce by modifying the model. | ClickUpdate Model. |
ClickingUpdate ModelresetsInportandOutportblock parameters and insertsSignal Conversionblocks, as necessary, to reduce the number of generated function arguments for the model.
Check ID:mathworks.design.ParameterizedLibLinks
Search model for parameterized library links.
Parameterized library links that are unintentional can result in unexpected parameter settings in your model. This can result in improper model operation.
Condition | Recommended Action |
---|---|
Parameterized links are listed. | Verify that the links are intended to be parameterized. |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
Right-click a block in your model to display the context menu. ChooseLink Options
and clickGo To Library Block
to see the original block from the library.
To parameterize a library link, chooseLook Under Mask
, from the context menu and select the parameter.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.UnresolvedLibLinks
Search the model for unresolved library links, where the specified library block cannot be found.
Check for unresolved library links. Models do not simulate while there are unresolved library links.
Condition | Recommended Action |
---|---|
Library links are unresolved. | Locate missing library block or an alternative. |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.CSStoVSSConvert
Search the model to identify configurable subsystem blocks at the model or subsystem level.
Condition | Recommended Action |
---|---|
Configurable subsystem blocks are identified. | Convert these blocks to variant subsystem blocks to avoid compatibility issues. SeeConfigurable Subsystem. |
You can run this check on your library models.
Check ID:mathworks.design.ConvertMdlrefVarToVSS
Search the model to identifyVariant Modelblocks.
Condition | Recommended Action |
---|---|
Variant Modelblocks available in the model are listed. |
Convert these blocks toVariant Subsystemblocks. |
Check ID:mathworks.design.emptyVariantObjects
Search the model to identify the Variant blocks or library having empty Variant objects.
Condition | Recommended Action |
---|---|
The Variant blocks in the model or library having empty Variant objects are listed. | Use valid conditions in the variant objects. |
Check ID:mathworks.design.CheckForProperFcnCallUsage
Check model diagnostic settings that apply to function-call connectivity and that might impact model execution.
Check for connectivity diagnostic settings that might lead to non-deterministic model execution.
Condition | Recommended Action |
---|---|
Diagnostic > Connectivity > Context-dependent inputsis set toDisable All orUse local settings . This might lead to non-deterministic model execution. |
SetDiagnostics > Connectivity > Context-dependent inputstoEnable all as errors . |
Check ID:mathworks.design.DataStoreMemoryBlkIssue
Look for modeling issues related toData Store Memoryblocks.
Checks for multitasking data integrity, strong typing, and shadowing of data stores of higher scope.
Condition | Recommended Action |
---|---|
TheDuplicate data store namescheck is set tonone orwarning . |
Consider setting theDuplicate data store namescheck toerror in the Configuration Parameters dialog box, on theDiagnostics > Data Validitypane. |
The data store variable names are not strongly typed in one of the following:
|
指定a data type other than auto by taking one of the following actions:
|
TheMultitask data storecheck is set tonone orwarning . |
Consider setting theMultitask data storecheck toerror in the Configuration Parameters dialog box, on theDiagnostics > Data Validitypane. |
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
Check ID:mathworks.design.DiagnosticDataStoreBlk
For data store blocks in the model, enable the read-and-write diagnostics order checking to detect run-time issues.
Check for the read-and-write diagnostics order checking. By enabling the read-and-write diagnostics, you detect potential run-time issues.
Condition | Recommended Action |
---|---|
TheDetect read before writecheck is disabled. | Consider enablingDetect read before writein the Configuration Parameter dialog boxDiagnostics> Data Validitypane. |
The发现写后读check is disabled. | Consider enabling发现写后读in the Configuration Parameter dialog boxDiagnostics> Data Validitypane. |
TheDetect write after writecheck is disabled. | Consider enablingDetect write after writein the Configuration Parameter dialog boxDiagnostics> Data Validitypane. |
Exclude blocks and charts from this check if you have aSimulink Checklicense.
.
The run-time diagnostics can slow simulations down considerably. Once you have verified that Simulink does not generate warnings or errors during simulation, set them toDisable all
.
Check ID:mathworks.design.DataStoreBlkSampleTime
Identify modeling errors due to the sample times of data store blocks.
Check data store blocks for continuous or fixed-in-minor-step sample times.
Condition | Recommended Action |
---|---|
Data store blocks in your model have continuous or fixed-in-minor-step sample times. | Consider making the listed blocks discrete or replacing them with eitherMemoryorGotoandFromblocks. |
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
Check ID:mathworks.design.OrderingDataStoreAccess
Look for read/write issues which may cause inaccuracies in the results.
During anUpdate Diagram, identify potential issues relating to read-before-write, write-after-read, and write-after-write conditions for data store blocks.
Condition | Recommended Action |
---|---|
Reading and writing (read-before-write or write-after-read condition) occur out of order. | Consider restructuring your model so that the Data Store Read block executes before the Data Store Write block. |
Multiple writes occur within a single time step. | 改变the model to write data only once per time step or refer to the following Tips section. |
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
This check performs a static analysis which might not identify every instance of improper usage. Specifically, Function-Call Subsystems, Stateflow Charts, MATLAB for code generation, For Iterator Subsystems, and For Each Subsystems can cause both missed detections and false positives. For a more comprehensive check, consider enabling the following diagnostics on theDiagnostics > Data Validitypane in the Configuration Parameters dialog box:Detect read before write,发现写后读, andDetect write after write.
Check ID:mathworks.design.MismatchedBusParams
Identify blocks andSimulink.Signal
objects that initialize bus signals by using mismatched structures.
In a model, you can use a MATLAB structure to initialize a bus signal. For example, if you pass a bus signal through aUnit Delayblock, you can set theInitial conditionparameter to a structure. For basic information about initializing buses by using structures, see指定Initial Conditions for Bus Elements.
Run this check to generate efficient and readable code by matching the shape and numeric data types of initial condition structures with those of bus signals. Matching these characteristics avoids unnecessary explicit typecasts and replaces field-by-field structure assignments with, for example, calls tomemcpy
.
This check lists blocks andSimulink.Signal
objects that initialize bus signals by using partial structures. During the iterative process of creating a model, you can use partial structures to focus on a subset of signal elements in a bus. For a mature model, use full structures to:
Generate readable and efficient code.
Support a modeling style that explicitly initializes unspecified signals. When you use partial structures, Simulink implicitly initializes unspecified signals.
For more information about full and partial structures, seeCreate Full Structures for InitializationandCreate Partial Structures for Initialization.
This check lists blocks andSimulink.Signal
objects whose initial condition structures introduce data type mismatches. The fields of these structures have numeric data types that do not match the data types of the corresponding bus signal elements.
This check does not detect a mismatch for blocks, such as theUnit Delayblock, that implicitly convert the data type of initial condition to the input signal.
When you configure an initial condition structure to appear as a tunable global structure in the generated code, avoid unnecessary explicit typecasts by matching the data types. SeeGenerate Tunable Initial Condition Structure for Bus Signal(Simulink Coder).
Condition | Recommended Action |
---|---|
Block or signal object uses partial structure |
Consider using the function |
Data types of structure fields do not match data types of corresponding signal elements |
Consider defining the structure as a |
Check ID:mathworks.design.ReplaceZOHDelayByRTB
IdentifyDelay,Unit Delay, orZero-Order Holdblocks that are used for rate transition. Replace these blocks with actualRate Transitionblocks.
If a model usesDelay,Unit Delay, orZero-Order Holdblocks to provide rate transition between input and output signals, Simulink makes a hidden replacement of these blocks with built-inRate Transitionblocks. In the compiled block diagram, a yellow symbol and the letters “RT” appear in the upper-left corner of a replacement block. This replacement can affect the behavior of the model, as follows:
These blocks lose their algorithmic design properties to delay a signal or implement zero-order hold. Instead, they acquire rate transition behavior.
This modeling technique works only in specific transition configurations (slow-to-fast forDelayandUnit Delay blocks, and fast-to-slow forZero-Order Holdblock). Set the block sample time to be equal to the slower rate (source for theDelayandUnit Delayblocks and destination for theZero-Order Holdblock).
When the block sample time of a downstream or upstream block changes, theseDelay,Unit DelayandZero-Order Holdblocks might not perform rate transition. For example, setting the source and destination sample times equal stops rate transition. The blocks then assume their original algorithmic design properties.
The block sample time shows incomplete information about sample time rates. The block code runs at two different rates to handle data transfer. However, the block sample time and sample time color show it as a single-rate block. Tools and MATLAB scripts that use sample time information base their behavior on this information.
An alternative is to replaceDelay,Unit Delay, orZero-Order Holdblocks with actualRate Transitionblocks.
The technique ensures unambiguous results in block behavior.Delay,Unit Delay, orZero-Order Holdblocks act according to their algorithmic design to delay and hold signals respectively. OnlyRate Transitionblocks perform actual rate transition.
Using an actualRate Transitionblock for rate transition offers a configurable solution to handle data transfer if you want to specify deterministic behavior or the type of memory buffers to implement.
Use this check to identify instances in your model whereDelay,Unit DelayorZero-Order Holdblocks undergo hidden replacement to provide rate transition between signals. ClickUpgrade Modelto replace these blocks with actualRate Transitionblocks.
Condition | Recommended Action |
---|---|
Model has no instances ofDelay,Unit Delay, orZero-Order Holdblocks used for rate transition. | No action required. |
Model has instances ofDelay,Unit Delay, orZero-Order Holdblocks used for rate transition. | The check identifies these instances and allows you to upgrade the model.
|
If you do not choose to replace theDelay,Unit Delay, and/orZero-Order Holdblocks with actualRate Transitionblocks, Simulink continues to perform a hidden replacement of these blocks with built-in rate transition blocks.
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
Check ID:mathworks.design.CallslDataTypeAndScale
Identify calls to the internal functionslDataTypeAndScale
.
In some previous versions of Simulink, opening a model that had been saved in an earlier version triggers an automatic upgrade to code for data type handling. The automatic upgrade inserts calls to the internal functionslDataTypeAndScale
. Although Simulink continues to support some uses of the function, if you eliminate calls to it, you get cleaner and faster code.
Simulink does not support calls toslDataTypeAndScale
when:
The first argument is aSimulink.AliasType
object.
The first argument is aSimulink.NumericType
object with propertyIsAlias
set to true.
RunningCheck for calls to slDataTypeAndScaleidentifies calls toslDataTypeAndScale
that are required or recommended for replacement. In most cases, running the check and following the recommended action removes the calls. You can ignore calls that remain. Run the check unless you are sure there are not calls toslDataTypeAndScale
.
Condition | Recommended Action |
---|---|
Required Replacement Cases | Manually or automatically replace calls toslDataTypeAndScale . Cases listed require you to replace calls toslDataTypeAndScale . |
Recommended Replacement Cases | For the listed cases, it is recommended that you manually or automatically replace calls toslDataTypeAndScale . |
Manual Inspection Cases | Inspect each listed case to determine whether it should be manually upgraded. |
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
Do not manually insert a call toslDataTypeAndScale
into a model. The function was for internal use only.
RunningCheck for calls to slDataTypeAndScalecalls the Simulink functionslRemoveDataTypeAndScale
. Calling this function directly provides a wider range of conversion options. However, you very rarely need more conversion options.
For more information about upgrading data types and scales, in the MATLAB Command Window, execute the following:
help slDataTypeAndScale
help slRemoveDataTypeAndScale
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.BusTreatedAsVector
Identify bus signals that Simulink treats as vectors.
You cannot use bus signals that the Simulink software implicitly converts to vectors. Instead, either insert aBus to Vectorconversion block between the bus signal and the block input port that it feeds, or use theSimulink.BlockDiagram.addBusToVector
command.
Condition | Recommended Action |
---|---|
Bus signals are implicitly converted to vectors. |
Use |
Model is not configured to identify bus signals that Simulink treats as vectors. |
In the Configuration Parameters dialog box, on theDiagnostics> Connectivitypane, setBus signal treated as vectorto |
ClickingModifyinserts a Bus to Vector block at the input ports of blocks that implicitly convert bus signals to vectors.
Run this check before runningCheck consistency of initialization parameters for Outport and Merge blocks.
For more information, seeIdentify Automatic Bus Conversions.
Check ID:mathworks.design.DelayedFcnCallSubsys
Identify function-call return values that might be delayed because Simulink software inserted an implicit Signal Conversion block.
So that signals reside in contiguous memory, Simulink software can automatically insert an implicit Signal Conversion block in front of function-call initiator block input ports. This can result in a one-step delay in returning signal values from calling function-call subsystems. The delay can be avoided by ensuring the signal originates from a signal block within the function-call system. Or, if the delay is acceptable, insert a Unit Delay block in front of the affected input ports.
Condition | Recommended Action |
---|---|
The listed block input ports could have an implicit Signal Conversion block. | Decide if a one-step delay in returning signal values is acceptable for the listed signals.
|
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
Signal Conversionblock
Unit Delayblock
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.OutputSignalSampleTime
Find continuous sample time, non-floating-point output signals.
Non-floating-point signals might not represent continuous variables without loss of information.
Condition | Recommended Action |
---|---|
Signals with continuous sample times have a non-floating-point data type. | On the identified signals, either change the sample time to be discrete or fixed-in-minor-step ([0 1]). |
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.MergeBlkUsage
Identify Merge blocks with parameter settings that can lead to unexpected behavior, and help migrate your model to simplified initialization mode.
Note
Run this check along with the other checks in theMigrating to Simplified Initialization Mode Overview.
Simplified initialization mode was introduced in R2008b to improve the consistency of simulation results. For more information, seeSimplified Initialization ModeandClassic Initialization Mode.
This Model Advisor check identifies settings in theMerge块在你的模型,如果你可能会导致一些问题u use classic initialization mode. It also recommends settings for consistent behavior of Merge blocks. The results of the subchecks contain two types of statements: Failed and Warning. Failed statements identify issues that you must address manually before you can migrate the model to the simplified initialization mode. Warning statements identify issues or changes in behavior that can occur after migration.
Condition | Recommended Action |
---|---|
Check the run-time diagnostic setting of the Merge block. |
|
Check for Model blocks that are using the PIL simulation mode. | The simplified initialization mode does not support the Processor-in-the-loop (PIL) simulation for model references. |
Check for library blocks with instances that cannot be migrated. | Examine the failed subcheck results for each block to determine the corrective actions. |
Check for single-input Merge blocks. | Replace both theMuxblock used to produce the input signal and theMergeblock with one multi-inputMergeblock. Single-inputMergeblocks are not supported in the simplified initialization mode. |
Check for root Merge blocks that have an unspecifiedInitial outputvalue. | If you do not specify an explicit value for theInitial outputparameter ofroot Merge blocks, then Simulink uses the default initial value of the output data type. A rootMergeblock is aMergeblock with an output port that does not connect to anotherMergeblock. For information on the default initial value, seeInitialize Signal Values. |
Check for Merge blocks with nonzero input port offsets. | Clear theAllow unequal port widthsparameter of theMergeblock. Note Consider usingMergeblocks only for signal elements that require true merging. You can combine other elements with merged elements using theConcatenateblock. |
Check for Merge blocks that have unconnected inputs or that have inputs from non-conditionally executed subsystems. |
Set theNumber of inputsparameter of theMergeblock to the number of Merge block inputs. You must connect each input to a signal. Verify that eachMergeblock input is driven by a conditionally executed subsystem.Mergeblocks cannot be driven directly by anIterator Subsystemor a block that is not a conditionally executed subsystem. |
Check for Merge blocks with inputs that are combined or reordered outside of conditionally executed subsystems. | Verify that combinations or reordering ofMergeblock input signals takes place within a conditionally executed subsystem. Such designs may useMux,Bus Creator, orSelectorblocks. |
Check for Merge blocks with inconsistent input sample times. | Verify that input signals to eachMergeblock have the sameSample time. Failure to do so could result in unpredictable behavior. Consequently, the simplified initialization mode does not allow inconsistent sample times. |
Check for Merge blocks with multiple input ports that are driven by a single source. | Verify that theMergeblock does not have multiple input signals that are driven by the same conditionally executed subsystem or conditionally executedModelblock. |
Check for Merge blocks that use signal objects to specify theInitial outputvalue. | Verify that the following behavior is acceptable. In the simplified initialization mode, signal objects cannot specify theInitial outputparameter of theMergeblock. While you can still initialize the output signal for aMergeblock using a signal object, the initialization result may be overwritten by that of theMergeblock. Note Simulink generates a warning that the initial value of the signal object has been ignored. |
Check ID:mathworks.design.InitParamOutportMergeBlk
Identify Outport blocks and conditional subsystems with parameter settings that can lead to unexpected behavior, and help migrate your model to simplified initialization mode.
Note
Run this check along with the other checks in theMigrating to Simplified Initialization Mode Overview.
Simplified initialization mode was introduced in R2008b to improve the consistency of simulation results. This mode is especially important for models that do not specify initial conditions for conditionally executed subsystem output ports. For more information, seeSimplified Initialization ModeandClassic Initialization Mode.
这个模型顾问检查标识外港块and conditional subsystems in your model that can cause problems if you use the simplified initialization mode. It also recommends settings for consistent behavior of Outport blocks. The results of the subchecks contain two types of statements: Failed and Warning. Failed statements identify issues that you must address manually before you can migrate the model to the simplified initialization mode. Warning statements identify issues or changes in behavior can occur after migration.
Condition | Recommended Action |
---|---|
Check for blocks inside of the Iterator Subsystem that require elapsed time. | Within an Iterator Subsystem hierarchy, do not use blocks that require a service that maintains the time that has elapsed between two consecutive executions. Since an Iterator Subsystem can execute multiple times at a given time step, the concept of elapsed time is not well-defined between two such executions. Using these blocks inside of an Iterator Subsystem can cause unexpected behavior. |
Check for Outport blocks that have conflicting signal buffer requirements. | TheOutport块有一个函数调用触发或函数调用data dependency signal passing through it, along with standard data signals. Some of the standard data signals require an explicit signal buffer for the initialization of the output signal of the corresponding subsystem. However, buffering function-call related signals lead to a function-call data dependency violation. Consider modifying the model to pass function-call related signals through a separateOutportblock. For examples of function-call data dependency violations, see the example model A standard data signal may require an additional signal copy for one of the following reasons:
|
Check for Outport blocks that are driven by a bus signal and whoseInitial outputvalue is not scalar. | ForOutportblocks driven by bus signals, classic initialization mode does not support Initial Condition (IC) structures, while simplified initialization mode does. Hence, when migrating a model from classic to simplified mode, specify a scalar for theInitial Outputparameter. After migration completes, to specify different initial values for different elements of the bus signal, use IC structures. For more information, seeCreate Initial Condition Structures. |
Check for Outport blocks that require an explicit signal copy. |
An explicit copy of the bus signal driving theOutportblock is required for the initialization of the output signal of the corresponding subsystem. Insert aSignal Conversionblock before theOutportblock, then set theOutputparameter of theSignal Conversionblock to A standard data signal may require an additional signal copy for one or more of the following reasons:
|
Check for merged Outport blocks that inherit theInitial Outputvalue from Outport blocks that have been configured to reset when the blocks become disabled. | WhenOutportblocks are driving a Merge block, do not set theirOutput when disabledparameters toreset . |
Check for mergedOutportblocks that are driven by nested conditionally executed subsystems. | Determine if the new behavior of theOutportblocks is acceptable. If it is not acceptable, modify the model to account for the new behavior before migrating to the simplified initialization mode. |
Check for merged Outport blocks that reset when the blocks are disabled. | Set theOutput when disabledparameter of theOutportblock to For more information, seeOutport. |
Check for Outport blocks that have an undefinedInitial outputvalue with invalid initial condition sources. | Verify that the following behavior is acceptable. When theInitial outputparameter is unspecified ( For simplified initialization mode, valid sources anOutportblocks can inherit theInitial outputvalue from are:Constant,Initial Condition,Merge(with initial output), Stateflow chart, function-call model reference, or conditionally executed subsystem blocks. |
Check Outport blocks that have automatic rate transitions. | Simulink has inserted aRate Transition块的输入Outportblock. Specify theInitial outputparameter for eachOutportblock. Otherwise, perform the following procedure:
|
Check Outport blocks that have a special signal storage requirement and have an undefinedInitial outputvalue. | Verify that the following behavior is acceptable. 指定theInitial outputparameter for theOutportblock. Set this value to |
Check theInitial outputsetting of Outport blocks that reset when they are disabled. | 指定theInitial outputparameter of theOutportblock. You must specify theInitial outputvalue for blocks that are configured to reset when they become disabled. |
Check theInitial outputsetting for Outport blocks that pass through a function-call data dependency signal. | You cannot specify anInitial outputvalue for theOutportblock because function-call data dependency signals are passing through it. To set theInitial outputvalue:
|
Check for Outport blocks that use signal objects to specify theInitial outputvalue. | Verify that the following behavior is acceptable. In the simplified initialization mode, signal objects cannot specify theInitial outputparameter of anOutportblock. You can still initialize the input or output signals for anOutportblock using signal objects, but the initialization results may be overwritten by those of theOutportblock. Note If you are working with a conditionally executed subsystemOutportblock, Simulink generates a warning that the initial value of the signal object has been ignored. |
Check for library blocks with instances that have warnings. | Examine the warning subcheck results for each block before migrating to the simplified initialization mode. |
Check for merged Outport blocks that are either unconnected or connected to a Ground block. | Verify that the following behavior is acceptable. TheOutportblock is driving aMergeblock, but its inputs are either unconnected or connected toGroundblocks. In the classic initialization mode, unconnected or grounded outports do not update the merge signal even when their parent conditionally executed subsystems are executing. In the simplified initialization mode, however, these outports will update the merge signal with a value of zero when their parent conditionally executed subsystems are executing. |
Check for Outport blocks that obtain theInitial outputvalue from an input signal when they are migrated. | Verify that the following behavior is acceptable. TheInitial outputparameter of theOutportblock is not specified. As a result, the simplified initialization mode will assume that theInitial outputvalue for theOutport块是来自输入信号。这assumption may result in different initialization behavior. If this behavior is not acceptable, modify your model before you migrate to the simplified initialization mode. |
Check for outerOutportblocks that have an explicitInitial output. | Verify that the following behavior is acceptable. In classic initialization mode, theInitial outputandOutput when disabledparameters of theOutportblock must match those of their sourceOutportblocks. In simplified initialization mode, Simulink sets theInitial outputparameter of outer Outport blocks to |
Check for blocks that read input from conditionally executed subsystems during initialization. | Verify that the following behavior is acceptable. Some blocks, such as theDiscrete-Time Integrator块,从有条件地execut读取他们的输入ed subsystems during initialization in the classic initialization mode. Simulink performs this step as an optimization technique. This optimization is not allowed in the simplified initialization mode because the output of a conditionally executed subsystem at the first time step after initialization may be different than the initial value declared in the correspondingOutportblock. In particular, this discrepancy occurs if the subsystem is active at the first time step. |
Check for a migration conflict for Outport blocks that use aDialog as theSource of initial output value. |
Other instances of Outport blocks with the same library link either cannot be migrated or are being migrated in a different manner. Review the results from theCheck for library blocks with instances that cannot be migratedto learn about the different migration paths for other instances of eachOutportblock. TheOutportblock will maintain its current settings and use its specifiedInitial outputvalue. |
Check for a migration conflict for Outport blocks that useInput signal as theSource of initial outputvalue. |
Other instances of Outport blocks with the same library link either cannot be migrated or are being migrated in a different manner. Review the results from theCheck for library blocks with instances that cannot be migratedto learn about the different migration paths for other instances of eachOutportblock. TheOutportblock currently specifies anInitial outputof After migration, the parameterSource of initial output valuewill be set to |
Check for a migration conflict for Outport blocks that have SimEvents®semantics. | Other instances of Outport blocks with the same library link either cannot be migrated or are being migrated in a different manner. Review the results from theCheck for library blocks with instances that cannot be migratedto learn about the different migration paths for other instances of eachOutportblock. TheOutportblocks will continue to use anInitial outputvalue of |
Check for a migration conflict for innermost Outport blocks with variable-size input and unspecifiedInitial output. | For these Outport blocks, the signal size varies only when the parent subsystem of the block is re-enabled. Therefore, Simulink implicitly assumes that theInitial outputparameter is equal to 0, even though the parameter is unspecified, []. Consequently, unless you specify the parameter, the Model Advisor will explicitly set the parameter to 0 when the model is migrated to the simplified initialization mode. Other instances of Outport blocks with the same library link either cannot be migrated or are being migrated in a different manner. Review the results from theCheck for library blocks with instances that cannot be migratedto learn about the different migration paths for other instances of eachOutportblock. |
Check for a migration conflict for Outport blocks that use a default ground value as the Initial output. | The parameterInitial outputis set to[] (empty matrix) and the source of theOutportis an invalid initial condition source. Thus, the block uses the default initial value as the initial output in the simplified initialization mode. Other instances of Outport blocks with the same library link either have errors or are being migrated differently. |
Check for a migration conflict for merged Outport blocks without explicit specification ofInitial output. | Review the results from the subcheckCheck for library blocks with instances that cannot be migratedto learn about different migration paths for other instances of each Outport block. For the remaining Outport blocks,Initial outputis set to[] (empty matrix) andOutput when disabledis set toheld respectively, in simplified initialization mode. |
Check ID:mathworks.design.DiscreteBlock
Identify Discrete-Time Integrator blocks with parameter settings that can lead to unexpected behavior, and help migrate your model to simplified initialization mode.
Note
Run this check along with the other checks in theMigrating to Simplified Initialization Mode Overview.
Simplified initialization mode was introduced in R2008b to improve the consistency of simulation results. For more information, seeSimplified Initialization ModeandClassic Initialization Mode.
This Model Advisor check identifies settings in Discrete-Time Integrator blocks in your model that can cause problems if you use the simplified initialization mode. It also recommends settings for consistent behavior of Discrete-Time Integrator blocks. The results of the subchecks contain two types of statements: Failed and Warning. Failed statements identify issues that you must address manually before you can migrate the model to the simplified initialization mode. Warning statements identify issues or changes in behavior that can occur after migration.
Condition | Recommended Action |
---|---|
Check for Discrete-Time Integrator blocks whose parameterInitial condition settingis set to |
Determine if the new behavior of theDiscrete-Time Integratorblocks is acceptable. If it is not acceptable, modify the model to account for the new behavior before migrating to the simplified initialization mode. |
Check for Discrete-Time Integrator blocks whoseInitial condition settingparameter is set to |
Use periodic sample time for the block, or setInitial Condition settingto |
Check for blocks inside of the Iterator Subsystem that require elapsed time. |
Within an Iterator Subsystem hierarchy, do not use blocks that require a service that maintains the time that has elapsed between two consecutive executions. Since an Iterator Subsystem can execute multiple times at a given time step, the concept of elapsed time is not well-defined between two such executions. Using these blocks inside of an Iterator Subsystem can cause unexpected behavior. |
Note
Do not run this check in isolation. Run this check along with the other checks in theMigrating to Simplified Initialization Mode Overview.
Check ID:mathworks.design.ModelLevelMessages
Identify settings in Model blocks and model configuration parameters that can lead to unexpected behavior, and help migrate your model to simplified initialization mode.
Simplified initialization mode was introduced in R2008b to improve consistency of simulation results. For more information, seeSimplified Initialization ModeandClassic Initialization Mode.
This Model Advisor check identifies issues in the model configuration parameters andModelblocks in your model that can cause problems when you migrate to simplified initialization mode. The results of the subchecks contain two types of statements: Failed and Warning. Failed statements identify issues that you must address manually before you can migrate the model to simplified initialization mode. Warning statements identify issues or changes in behavior that can occur after migration.
After running this Model Advisor consistency check, if you clickExplore Resultbutton, the messages pertain only to blocks that are not library-links.
Note
Because it is difficult to undo these changes, selectFile>Save Restore Point Asto back up your model before migrating to the simplified initialization mode.
For more information, seeModel Configuration Parameters: Connectivity Diagnostics.
Condition | Recommended Action |
---|---|
Verify that all Model blocks are using the simplified initialization mode. |
Migrate the model referenced by the Model block to the simplified initialization mode, then migrate the top model. |
Verify simplified initialization mode setting |
SetConfiguration Parameters>Underspecified initialization detectionto |
ClickingModify Settingscauses the following:
The Model parameter is set tosimplified
If an Outport block has theInitial outputparameter set to the empty character vector,[]
, then theSourceOfInitialOutputValue
parameter is set toInput signal.
If an Outport has an emptyInitial outputand a variable-size signal, then theInitial outputis set to zero.
Check ID:mathworks.design.SFuncAnalyzer
Perform quality checks on S-functions in Simulink models or subsystems.
The S-function analyzer performs quality checks on S-functions to identify improvements and potential problems in the specified model.
Condition | Recommended Action |
---|---|
Continuous states are modified inmdlOutputs method. |
Modify Continuous States at a major time step and usessSetSolverNeedsReset function in S-function code. |
Continuous states are modified in themdlUpdate method. |
Modify Continuous States only at a major time step and usessSetSolverNeedsReset function in S-function code. |
S-function discrete states are modified in themdlOutputs at a minor step. |
Modify the discrete states only at a major step guarded byssIsMajorTimeStep 函数。 |
S-function mode vector is modified in themdlOutputs method at a minor step. |
Modify the mode vector only at a major step guarded bysslsMajorTimeStep 函数。 |
S-function is using static or global variables to declare internal states. | Declare the states explicitly usingssSetNumDiscStates function orModel Global Data by Creating Data Stores. |
S-function has continuous states but sample time is not declared continuous. | 指定continuous sample time usingssSetSampleTime 函数。 |
S-function has discrete states but themdlOutputs andmdlUpdate methods are combined. |
Define themdlOutputs andmdlUpdate methods separately and modify discrete states only inmdlUpdate method. |
S-function sets theSS_OPTION_CAN_BE_CALLED_CONDITIONALLY option when having state-like data or multiple sample times. |
Remove the options when the S-function has state-like data or multiple sample times. |
MEX compilers do not exist on the machine. |
Check for the presence or installMEX compilers on the machine. |
S-function encounters errors while compiling the model. | Check theDiagnostic Vieweroutput and recompile the model. |
Check ID:mathworks.design.NonContSigDerivPort
Identify noncontinuous signals that drive derivative ports.
Noncontinuous signals that drive derivative ports cause the solver to reset every time the signal changes value, which slows down simulation.
Condition | Recommended Action |
---|---|
There are noncontinuous signals in the model driving derivative ports. |
|
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
Check ID:mathworks.design.DiagnosticSFcn
Check array bounds and solver consistency ifS-Functionblocks are in the model.
Validates whetherS-Functionblocks adhere to the ODE solver consistency rules that Simulink applies to its built-in blocks.
Condition | Recommended Action |
---|---|
Solver data inconsistencyis set tonone . |
In the Configuration Parameters dialog box, setSolver data inconsistencytowarning orerror . |
Array bounds exceededis set tonone . |
In the Configuration Parameters dialog box, setArray bounds exceededtowarning orerror |
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
Check ID:mathworks.design.characterEncoding
Check for characters that are incompatible with the current encoding
Check for characters in the model file that cannot be represented in the current encoding. These can cause errors when you try to save the model.
Condition | Recommended Action |
---|---|
Incompatible characters found | 改变the current encoding toUTF-8 by usingslCharacterEncoding . |
The Upgrade Advisor report shows the required encoding you need, or you can retrieve the encoding from the model by using the command:
get_param(modelname,'SavedCharacterEncoding')
To change the encoding, useslCharacterEncoding
. This setting applies to the current MATLAB session. If you restart MATLAB and want to save the same model again, you must make the same change to the current encoding.
For more information see:
Check ID:mathworks.design.UnitMismatches
Identify instances of unit mismatches between ports in the model.
Check for instances of unit mismatches between ports in the model.
Condition | Recommended Action |
---|---|
Unit mismatches found | 改变one of the mismatched unit settings to match the unit settings for the other port. |
Check ID:mathworks.design.AutoUnitConversions
Identify instances of automatic unit conversions in the model.
Identify instances of automatic unit conversions in the model.
Condition | Recommended Action |
---|---|
Automatic unit conversions found | Check that the converted units are expected for the model. |
Check ID:mathworks.design.DisallowedUnitSystems
确定不允许单位系统t的实例he model.
确定不允许单位系统t的实例he model.
Condition | Recommended Action |
---|---|
Disallowed unit systems found | Either choose a unit that conforms to the configured unit system, or select another unit system. For more information, seeRestricting Unit Systems. |
Check ID:mathworks.design.UndefinedUnits
Identify instances of unit specifications, not defined in the unit database, in the model.
Identify instances of unit specifications, not defined in the unit database, in the model.
Condition | Recommended Action |
---|---|
Undefined units found | 改变the unit to one that Simulink supports. |
Check ID:mathworks.design.AmbiguousUnits
Identify instances of ambiguous unit specifications, such as duplicate unit names in the unit database, in the model.
Identify instances of ambiguous unit specifications, such as duplicate unit names in the unit database, in the model.
Condition | Recommended Action |
---|---|
Ambiguous units found | You can ignore the warning or specify the unit with corresponding unit system using the formatunit_system::unit_name . |
Check ID:mathworks.design.Update
Check for common block upgrade issues.
Check blocks in the model for compatibility issues resulting from using a new version of Simulink software.
Condition | Recommended Action |
---|---|
Blocks with compatibility issues found. | ClickModifyto fix the detected block issues. |
Check update status for the Level 2 API S-functions. | Consider replacing Level 1 S-functions with Level 2. |
ClickingModifyreplaces blocks from a previous release of Simulink software with the latest versions.
Check ID:mathworks.design.UpdateRequireCompile
Check for common block upgrade issues.
Check blocks for compatibility issues resulting from upgrading to a new version of Simulink software. Some block upgrades require the collection of information or data when the model is in the compile mode. For this check, the model is set to compiled mode and then checked for upgrades.
Condition | Recommended Action |
---|---|
Model containsLookup TableorLookup Table (2-D)blocks and some of the blocks specifyUse Input NearestorUse Input Abovefor a lookup method. | ReplaceLookup Tableblocks andLookup Table (2-D)blocks withn-D Lookup Tableblocks. Do not applyUse Input NearestorUse Input Above查找方法;选择另一个选择。 |
Model containsLookup TableorLookup Table (2-D)blocks and some blocks perform multiplication first during interpolation. | ReplaceLookup Tableblocks andLookup Table (2-D)blocks withn-D Lookup Tableblocks. However, because then-D Lookup Tableblock performs division first, this replacement might cause a numerical difference in the result. |
Model containsLookup TableorLookup Table (2-D)blocks. Some of these blocks specifyInterpolation-Extrapolationas theLookup methodbut their input and output are not the same floating-point type. | ReplaceLookup Tableblocks andLookup Table (2-D)blocks withn-D Lookup Tableblocks. Then change the extrapolation method or the port data types for block replacement. |
Model containsUnit Delayblocks withSample timeset to |
ReplaceUnit Delayblocks withMemoryblocks. |
ClickingModifyreplaces blocks from a previous release of Simulink software with the latest versions.
Check ID:mathworks.design.UseSLXFile
Check that the model is saved in SLX format.
Check whether the model is saved in SLX format.
Condition | Recommended Action |
---|---|
Model not saved in SLX format | Consider upgrading to the SLX file format to use the latest features in Simulink. |
You can run this check on your library models.
Projects can help you upgrade models to SLX format and preserve file revision history in source control. SeeConvert from MDL to SLX in a Project and Preserve Revision History.
Check ID:mathworks.design.CheckSLXFileCompressionLevel
Check if SLX file compression is turned off to reduce Git™ repository size.
Check whether compression for the SLX model is turned off.
Condition | Recommended Action |
---|---|
Model, library, or subsystem is saved in SLX format. File compression is turned on. | Consider turning off file compression to optimize storage under source control. |
Model, library, or subsystem is not saved in SLX format. | Consider upgrading to the SLX file format then, turning off file compression to optimize storage under source control. |
You can run this check on models, libraries, and subsystems checked in to Git source control.
Projects can help you upgrade all the models and libraries in your project. SeeUpgrade All Project Models, Libraries, and MATLAB Code Files.
Check ID:mathworks.design.CheckSavedInCurrentVersion
Check that the model, library, or subsystem is saved in the current version of Simulink.
Check whether the model file is saved in the current Simulink release.
Condition | Recommended Action |
---|---|
Model, library, or subsystem not saved in the current version of Simulink. | Consider resaving the model file in the current version of Simulink. |
You can run this check on your models, libraries, and subsystems.
Projects can help you save all the models and libraries in your project to the current Simulink release. SeeUpgrade All Project Models, Libraries, and MATLAB Code Files.
Check ID:mathworks.simulink.SB2SL.Check
Check that the model does not have outdated SB2SL blocks.
Check if the model contains outdated SB2SL blocks.
Condition | Recommended Action |
---|---|
Model contains outdated SB2SL blocks | Consider upgrading the model to current SB2SL blocks. |
ClickingUpdate SB2SL Blocksreplaces blocks with the latest versions.
Check ID:mathworks.design.SLXModelProperties
Check for edited model history properties
Check models for edited Model History property values that could be used with source control tool keyword substitution. This keyword substitution is incompatible with SLX file format.
In the MDL file format you can configure some model properties to make use of source control tool keyword substitution. If you save your model in SLX format, source control tools cannot perform keyword substitution. Information in the model file from such keyword substitution is cached when you first save the MDL file as SLX, and is not updated again. The Model Properties History pane and Model Info blocks in your model show stale information from then on.
Condition | Recommended Action |
---|---|
Edited model history properties | Manually or automatically reset the properties to the default values. Click the button to reset, or to inspect and change these properties manually, open the Model Properties dialog and look in the History pane. |
You can run this check on your library models.
Check ID:mathworks.design.ModelInfoKeywordSubstitution
Use this check to find Model Info blocks that can be altered by external source control tools through keyword substitution.
This check searches for character vectors in the Model Info block enclosed within dollar signs that can be overwritten by an external source control tool. Using third-party source control tool keyword expansion might corrupt your model files when you submit them. Keyword substitution is not available in SLX model file format.
For a more flexible interface to source control tools, use a Simulink project instead of the Model Info block. SeeAbout Source Control with Projects.
Condition | Recommended Action |
---|---|
The Model Info block contains fields like this: |
Review the list of fields in the report, then remove the keyword character vectors from the Model Info block. |
Check ID:mathworks.design.ModelInfoConfigurationManager
Use this check to find Model Info blocks that use the Configuration Manager.
Model Info blocks using the Configuration Manager allow risky keyword substitution using external source control tools. Using third-party source control tool keyword expansion might corrupt your model files when you submit them. Keyword substitution is not available in SLX model file format. The Configuration Manager for the Model Info block will be removed in a future release.
For a more flexible interface to source control tools, use a Simulink project instead of the Model Info block. SeeAbout Source Control with Projects.
Condition | Recommended Action |
---|---|
A Model Info block is using the Configuration Manager. |
ClickRemove the Configuration Manager. |
Check ID:mathworks.design.serdesUpgrades
Lists blocks saved in a previous version of SerDes Toolbox™ that are outdated.
这张支票搜索和列表并行转换器工具箱blocks that can be upgraded for compatibility with the current release.
Condition | Recommended Action |
---|---|
Blocks saved in older versions of SerDes Toolbox are found. | ClickUpgrade SerDes Toolbox Blocksto upgrade the SerDes Toolbox blocks to be compatible with the current release. |
ClickingUpgrade SerDes Toolbox Blocksupgrades the outdated SerDes Toolbox blocks to be compatible with the current release.
Design and Simulate SerDes Systems(SerDes Toolbox)
Check ID:mathworks.design.Aeroblks.CheckDOF
Lists 3DoF and 6DoF blocks are outdated.
This check searches for 3DoF and 6DoF blocks from library versions prior to 3.13 (R2014a).
Condition | Recommended Action |
---|---|
Blocks configured with old versions of 3DoF or 6DoF blocks found. | ClickReplace 3DoF and 6DoF Blocksto replace the blocks with latest versions. |
ClickingReplace 3DoF and 6DoF Blocksreplaces blocks with the latest versions.
Equations of Motion(Aerospace Blockset)
Check ID:mathworks.design.Aeroblks.CheckNAV
Searches for Three-Axis Inertial Measurement Unit, Three-Axis Gyroscope, and Three-Axis Accelerometer blocks prior to 3.21 (R2018a).
This check searches for Three-Axis Inertial Measurement Unit, Three-Axis Gyroscope, and Three-Axis Accelerometer blocks that have been updated in R2018a.
Condition | Recommended Action |
---|---|
Three-Axis Inertial Measurement Unit, Three-Axis Gyroscope, and Three-Axis Accelerometer blocks prior to R2018a. | In R2018a or later, if you did not previously solve for steady state conditions, save the model now. If you previously solved for steady state conditions for the model, solve for these steady state conditions again, and then save the model. |
Three-axis Accelerometer(Aerospace Blockset)
Three-axis Gyroscope(Aerospace Blockset)
Three-axis Inertial Measurement Unit(Aerospace Blockset)
Check ID:mathworks.design.CheckAndUpdateOldMaskedBuiltinBlocks
Check for libraries that should be updated to use promoted parameters.
This check searches libraries created before R2011b for masked blocks that should be updated to use promoted parameters. Since R2011b, if a block parameter is not promoted, its value in the linked block is locked to its value in the library block. This check excludes blocks of type Subsystem, Model reference, S-Function and M-S-Function.
Condition | Recommended Action |
---|---|
Libraries that need to be updated are found | ClickUpdate. Once the libraries have been updated, run the check again |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.CheckMaskDisplayImageFormat
Check identifies masks using image display commands with unnecessary calls to theimread()
函数。
This check searches for the mask display commands that make unnecessary calls to theimread()
function, and updates them with mask display commands that do not call theimread()
函数。自2013年以来,一个性能和内存optimization is available for mask images specified using the image path instead of the RGB triple matrix.
Condition | Recommended Action |
---|---|
Mask display commands that make unnecessary calls to theimread() function are found. |
ClickUpdate. Once the blocks have been updated, run the check again. |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.CheckMaskRunInitFlag
Check identifies if the mask icon drawing commands have dependency on the mask workspace.
This check identifies if the mask icon drawing commands have dependency on the mask workspace and updates theRunInitForIconRedraw
property accordingly. If there is no mask workspace dependency, the value ofRunInitForIconRedraw
is set tooff
, whereas, if there is mask workspace dependency the values is set toon
.
Setting the values ofRunInitForIconRedraw
tooff
when there is no mask workspace dependency optimizes the performance by not executing the mask initialization code before drawing the block icon.
Condition | Recommended Action |
---|---|
Mask drawing commands that are dependent or independent of the mask workspace are found. |
ClickUpdate. Once the blocks have been updated, run the check again. |
You can:
Run this check on your library models.
Exclude blocks and charts from this check if you have aSimulink Checklicense.
Model Advisor Exclusion Overview(Simulink Check)
Check ID:mathworks.design.CheckAndUpdateOldMaskTabnames
This check identifies masked blocks that specify tabs in mask dialog using theMaskTabNames
parameter.
This check identifies masked blocks that use theMaskTabNames
parameter to programmatically create tabs in the mask dialog. Since R2013b, dialog controls are used to group parameters in a tab on the mask dialog.
Condition | Recommended Action |
---|---|
Masked blocks that use theMaskTabNames parameter to create tabs programmatically in the mask dialog are found. |
ClickUpgradeavailable in theActionsection. Once the blocks have been updated, run the check again. |
You can run this check on your library models.
Check ID:mathworks.design.StowawayDoubles
For a strict single-precision design, this check identifies the blocks that introduce double-precision operations, and non-optimal model settings.
For a strict single-precision design, this check identifies the blocks that introduce double-precision operations, and non-optimal model settings.
Condition | Recommended Action |
---|---|
Double-precision floating-point operations found in model. | Verify that:
|
Model uses a library standard that is not optimal for strict-single designs. |
Verify that:
|
Logic signals are not implemented as Boolean data. | Verify that:
|
If you have aSimulink Checklicense, you can exclude blocks and charts from this check.
Check ID:mathworks.design.CallsGetParamCompiledSampleTime
Use this check to identify MATLAB files in your working environment that containget_param
function calls to return the blockCompiledSampleTime
parameter.
For multi-rate blocks (including subsystems), Simulink returns the block compiled sample time as a cell array of the sample rates in the block. The return value is a cell array of pairs of doubles. MATLAB code that accepts this return value only as pairs of doubles can return an error when called with a multi-rate block. Use this check to identify such code in your environment. Modify these instances of code to accept a cell array of pairs of doubles instead.
For example, consider a variable blkTs, which has been assigned the compiled sample time of a multi-rate block.
blkTs = get_param(block,'CompiledSampleTime');
Here are some examples in which the original code works only if blkTs is a pair of doubles and the block is a single-rate block:
Example 1
if isinf(blkTs(1)) disp('found constant sample time') end
Since blkTs is now a cell array, Simulink gives this error message:
Undefined function 'isinf' for input arguments of type 'cell'
if isequal(blkTs, [inf,0]) disp('found constant sample time') end
Example 2
if all(blkTs == [-1,-1]) disp('found triggered sample time') end
For the above example, since blkTs is now a cell array, Simulink gives this error:
Undefined function 'eq' for input arguments of type 'cell'
Instead, use this code, for which blkTs can be a cell array or a pair of doubles.
if isequal(blkTs, [-1,-1]) disp('found triggered sample time') end
Example 3
if (blkTs(1) == -1) disp('found a triggered context') end
Again, since blkTs is now a cell array, Simulink gives this error:
Undefined function 'eq' for input arguments of type 'cell'
Instead, use this code.
如果~ iscell blkTs blkTs = {blkTs};对idx = 1:length(blkTs) thisTs = blkTs{idx}; if (thisTs(1) == -1) disp('found a triggered context') end end
The above code checks for a triggered type sample time (triggered or async). In cases in which a block has constant sample time ([inf,0]) in addition to triggered or async or when a block has multiple async rates, this alternative property detects the triggered type sample time.
This check scans MATLAB files in your environment. If the check finds instances of MATLAB code that containget_param
调用输出块编译ample time, Upgrade Advisor displays these results. It suggests that you modify code that accepts the block compiled sample time from multi-rate blocks.
Condition | Recommended Action |
---|---|
No MATLAB files callget_param(block,CompiledSampleTime) |
None |
Some MATLAB files callget_param(block,CompiledSampleTime) |
If files use the blockCompiledSampleTime parameter from multi-rate blocks, modify these files to accept the parameter as a cell array of pairs of doubles |
Check ID:mathworks.design.CheckSingleSimulationOutput
Use this check to identify if the simulation result is returned as a singleSimulink.SimulationOutput
object.
This check scans your model to verify if the parameterReturnWorkspaceOutputs
is enabled. Enabling this parameter, returns simulation outputs in aSimulink.SimulationOutput
when simulating interactively. Simulation outputs include signal, state, output, DSM logging, and scope andTo Workspace
block logging.
WhenReturnWorkspaceOutputs
is enabled, it provides:
Easier management of simulation data.
Automatic access toSimulationMetadata
.
Compatibility with multiple parallel simulations and batch simulations.
Condition | Recommended Action |
---|---|
Simulation outputs are not returned as a singleSimulink.SimulationOutput object |
Return all simulation outputs as a single |
Check ID:mathworks.design.ParameterTuning
Use this check to identify issues in the model that occur when you initialize parameters or tune them.
This check scans your model for parameter initialization and tuning issues like:
Rate mismatch between blocks
Divide by zero issue in conditionally executed subsystems
Invalid control port value inIndex Vectorblocks
Condition | Recommended Action |
---|---|
The model has rate transition issues. |
SelectAutomatically handle rate transition for data transferin theSolverpane of the model configuration parameters. |
The model has a divide by zero issue in a conditionally executed subsystem with a control port. |
At the command prompt, run set_param(control_port,'DisallowConstTsAndPrmTs', 'on') |
The model has an invalid control port value in a conditionally executed subsystem. |
At the command prompt, run set_param(control_port,'DisallowConstTsAndPrmTs', 'on') |
SelectUpgrade modelto resolve issues in the model related to parameter initialization and tuning.
Check ID:mathworks.design.CheckVirtualBusAcrossModelReference
Check virtual bus signals that cross model reference boundaries.
This check identifies root-levelInportandOutportblocks in referenced models and Model blocks with virtual bus outputs that require updates to change to nonvirtual bus signals.
If the check identifies issues, clickUpdate Modelto convert root-levelInportandOutportblocks configured for virtual buses to use nonvirtual buses in these situations:
For root-levelInportblocks — Enable theOutput as nonvirtual busparameter and insert aSignal Conversionblock after theInportblock. TheSignal Conversionblock is configured to output a virtual bus.
For root-levelOutportblocks — Enable theOutput as nonvirtual bus in parent modelparameter.
ForModelblocks — For ports whoseOutportblocks were updated to address issues, insert aSignal Conversionblock after the corresponding ports of theModelblock. TheSignal Conversionblock is configured to output a virtual bus.
To resolve issues, clickUpgrade Model.
Note
Run theAnalyze model hierarchy and continue upgrade sequencecheck on the top-level model and then down through the model reference hierarchy.
ClickingUpgrade Modelconverts affected root-levelInportandOutportblocks configured for virtual buses to use nonvirtual buses in models where you:
使用函数原型控制
Perform C++ code generation with theI/O arguments step method
option.
Alternatively, you can change the C++ code generation function specification setting toDefault step method
:
In theConfiguration Parameters>Code Generation>Interfacepane, clickConfigure C++ Class Interface.
In the dialog box, set theFunction specificationparameter toDefault step method
.
Use buses that have variable-dimension signals
Use an associated non-auto storage class forOutportblock signals
The conversion for non-auto storage class occurs only if you have the target generation license that the model requires. For example, an ERT target requires an Embedded Coder license.
Use Export-function models where anOutportblock is driven by a nonvirtual bus
HaveModelblocks that reference models containingOutportblocks that have been fixed — ClickingUpgrade Modelupdates Model blocks referencing the models that hadOutportblocks fixed by theAnalyze model hierarchy and continue upgrade sequencecheck.
Check ID:mathworks.design.DSPFrameUpgrade
This check identifies custom library blocks in the model that depend on the frame status of the signal.
Description
这张支票搜索自定义库blocks in a model that depend on the frame status of the signal. The check analyzes the blocks, recommends fixes, and gives reasons for the fixes. You must make the fixes manually.
Results and Recommended Actions
Condition | Recommended Action |
---|---|
The check finds custom library blocks that depend on the frame status of the signal. |
按照推荐的升级isor. |
Capabilities and Limitations
You can run this check only on custom library blocks in your model.
You must make the fixes manually.
这张支票似乎只有如果你有DSP系统Toolbox™ installed.
See Also
Frame-based processing(DSP System Toolbox)
Check ID:'mathworks.design.CheckForSFcnUpgradeIssues'
Use this check on your model to identify your S-function's upgrade compatibility issues. These issues may include the use of 32-bit APIs, compilation with incompatible options, or use of deprecated separate complex APIs. Some common issues and information related to the fixes are described in results and recommendations section below.
When upgrading your S-functions to use the features in the latest release, this check scans your model to warn against S-function upgrade incompatibility issues. If the result of this check gives a warning or error, fix your C MEX S-functions according to the description.
Condition | Recommended Action |
---|---|
Custom-built S-functions are not supported. |
Recompile your S-function with available compatible options. SeeCustom-built MEX File Not Supported In Current Releasefor more information. |
S-function is not compiled with the latest API ( |
Recompile using the latest flag ( |
S-function uses 32-bit functions. |
Modify your code according to the instructions inMEX File Calls A 32-bit Function. |
S-function is using deprecated separate complex APIs (mxGetPi, mxSetPi, mxGetImagData, mxSetImagData). |
Use interleaved complex APIs and recompile your code with the latest flag ( |
S-function is using deprecated type-unsafe data API (mxGetData, mxSetData). | Use type-safe data APIs and recompile your code. SeeMEX File Calls An Untyped Data Access Functionfor more information. |
S-function is compiled with a future release and not supported in current release. | SeeMEX File Built In MATLAB Release Not Supported In Current Releaseto recompile your files. |
Check ID:'mathworks.design.CheckSystemObjectUpdate'
Use this check to identify and update any custom MATLAB System object™ in your model that have outdated syntax.
This check scans your model to identify outdated System object syntax. If the check passes, all the syntax is up to date. If the check fails, you can update the syntax.
Condition | Recommended Action |
---|---|
System object syntax is up to date. |
None. |
System object syntax requires update. |
A report is generated for each unique System object associated with aMATLAB Systemblock. UseUpdateto update the syntax. |
Check ID:mathworks.design.CheckRapidAcceleratorSignalLogging
When simulating your model in rapid accelerator mode, use this check to find signals logged in your model that are globally disabled. Rapid accelerator mode supports signal logging. Use this check to enable signal logging globally.
This check scans your model to see if a simulation is in rapid accelerator mode and whether the model contains signals with signal logging. If the check finds an instance and signal logging is globally disabled, an option to turn on signal logging globally appears.
Condition | Recommended Action |
---|---|
Simulation mode is not rapid accelerator. |
None. You can enable signal logging in rapid accelerator mode. |
Simulation mode is rapid accelerator. Upgrade Advisor did not find signals with signal logging enabled. |
None. The model does not use signal logging. Enable signal logging for signals and globally if you want to log signals. |
Simulation mode is rapid accelerator. Upgrade Advisor found signals with signal logging enabled. However, global setting for signal logging was disabled. |
Enable signal logging globally if you want to log signals with signal logging enabled. |
Signal logging was already globally enabled. |
None. |
SelectingModifyenables signal logging globally in your model.
Check ID:mathworks.design.VirtualBusUsage
Check bus input signals for a set of blocks.
Check bus input signals for a set of blocks.
Starting in R2015b, virtual bus signal inputs to blocks that require nonbus or nonvirtual bus input can cause an error. Examples of blocks that can specify a bus object as their output data type include aBus Creatorblock and a rootInportblock. The blocks that cause an error when they have a virtual bus input in this situation are:
Assignment
Delay
TheDelayblock causes an error only if you use the Block Parameters dialog box to:
Set an initial condition that is a MATLAB structure or zero.
指定a value forState name.
Permute Dimension
Reshape
Selector
Unit Delay
TheUnit Delayblock causes an error only if you use the Block Parameters dialog box to:
Set an initial condition that is a MATLAB structure or zero.
指定a value forState name.
Vector Concatenate
Condition | Recommended Action |
---|---|
Virtual bus signal input to these blocks:
|
In the Upgrade Advisor, clickModify. The check inserts aBus to Vectorblock to attempt to convert virtual bus input signals to vector signals. For issues that the Upgrade Advisor identifies but cannot fix, modify the model manually. For details, seeIdentify Automatic Bus Conversions. |
ClickingModifyinserts aBus to Vectorblock at the input ports of blocks.
For many models, running the Upgrade Advisor modifies your model so that bus signals are not treated as vectors. However, for some models you can encounter compatibility issues even after running the check. Modify your model manually to address those issues.
After you compile the model using Upgrade Advisor, the Simulink Editor sometimes indicates that you need to save the model (the model is dirty), even though you did not make changes. To prevent this issue from reoccurring for this model, save the model.
Modeling Pattern | Issue | Solution |
---|---|---|
Data Store Memoryblock withData Typeset to |
AData Store Memoryblock whose associatedData Store ReadorData Store Writeblocks read or write bus signal data must use a bus object. |
In theData Store Memoryblock, set theData Typesignal attribute to |
Signal ConversionblockOutputparameter matches input bus type |
ASignal Conversionblock whoseOutputparameter is set to ASignal Conversionblock whoseOutputparameter is set to |
To create a copy of the input signal, setOutputto |
Merge,Switch, orMultiport Switchblock with multiple bus inputs |
Merge,Switch, orMultiport Switchblocks with multiple bus inputs require those inputs to have the same names and hierarchy. |
Reconfigure the model so that the bus inputs have the same names and hierarchy. |
RootInportblock outputting a virtual bus and specifying a value forPort dimensions |
A rootInportblock that outputs to a virtual bus must inherit the dimensions. |
Set theInportblockPort dimensionssignal attribute to |
Muxblock with nonvirtual bus inputs |
AMuxblock cannot accept nonvirtual bus signals. |
To treat the output as an array, replace theMuxblock with aVector Concatenateblock. If you want a virtual bus output, use aBus Creatorblock to combine the signals. |
Bus to Vectorblock without a virtual bus signal input |
A nonbus signal does not need aBus to Vectorblock. |
Remove theBus to Vectorblock. |
Assignmentblock with virtual bus inputs |
The Upgrade Advisor converts theAssignmentblock |
Add aBus to Vectorblock before theAssignmentblock. |
S-function using a nonvirtual bus |
An S-function that is not a Level-2 C S-function does not support nonvirtual bus signals. |
改变the S-function to be a Level-2 C S-function. Consider using anS-Function Builderblock to create a Level-2 C S-function. |
Stateflow chart with parameterized data type |
In a Stateflow chart, you cannot parameterize the data type of an input or output in terms of another input or output if the data type is a bus object. |
For the parameterized port, setData Typeto |
Subsystem with bus operations in a Stateflow chart |
AnInportblock inside a subsystem in a Stateflow chart requires a bus object data type if its signal is a bus. |
In theInportblock, setData typeto |
Groundblock used as a bus source |
The output signal of aGroundblock cannot be a source for a bus. |
Use aConstantblock withConstant valueset to 0 and theOutput data typesignal attribute set to |
RootOutportblock with a single-element bus object data type |
The input to theOutportblock must be a bus if it specifies a bus object as its data type. |
In theOutportblock, setData typeto |
Check ID:mathworks.design.CheckConstRootOutportWithInterfaceUpgrade
Use this check to identify root outports with a constant sample time used with an AUTOSAR target, Function Prototype Control, or the model C++ class interface.
Root outports with constant sample time are not supported when using an AUTOSAR target, Function Prototype Control, or the model C++ class interface. Use this check to identify root Outport blocks with this condition and modify the blocks as recommended.
Condition | Recommended Action |
---|---|
Root outport with constant sample time used with an AUTOSAR target, Function Prototype Control or the model C++ class interface. |
Consider one of the following:
|
Check ID:com.mathworks.Simulink.UpgradeAdvisor.UpgradeModelHierarchy
Check for child models and guide you through upgrade checks.
This check identifies child models of this model, and guides you through upgrade checks to run both non-compile and compile checks. The Advisor provides tools to help with these tasks:
If the check finds child models, it offers to run the Upgrade Advisor upon each child model in turn and continue the upgrade sequence. If you have a model hierarchy you need to check and update each child model in turn.
If there are no child models, you still need to continue the check sequence until you have run both non-compile and compile checks.
You must run upgrade checks in this order: first the checks that do not require compile time information and do not trigger an Update Diagram, then the compile checks.
ClickContinue Upgrade Sequenceto run the next checks. If there are child models, this will open the next model. Keep clickingContinue Upgrade Sequenceuntil the check passes.
Condition | Recommended Action |
---|---|
Child models found | ClickContinue Upgrade Sequenceto run the next checks. If there are child models, this will close the current Upgrade Advisor session, and open Upgrade Advisor for the next model in the hierarchy. |
No child models, but more checks to run | If there are no child models, clickContinue Upgrade Sequenceto refresh the Upgrade Advisor with compilation checks selected. The compile checks trigger an Update Diagram (marked with^ ). Run the next checks and take advised actions. When you return to this check, clickContinue Upgrade Sequenceuntil this check passes. |
Best practice for upgrading a model hierarchy is to check and upgrade each model starting at the leaf end and working up to the root model.
When you clickContinue Upgrade Sequence, the Upgrade Advisor opens the leaf model as far inside the hierarchy as it can find. Subsequent steps guide you through upgrading your hierarchy from leaf to root model.
When you open the Upgrade Advisor, the checks that are selected do not require compile time information and do not trigger an Update Diagram. Checks that trigger an Update Diagram are not selected to run by default, and are marked with^
. When you use the Upgrade Advisor on a hierarchy, keep clickingContinue Upgrade Sequenceto move through this sequence of analysis:
The Upgrade Advisor opens each model and library in turn, from leaf to root, and selects the non-compile checks. Run the checks, take any advised actions, then clickContinue Upgrade Sequenceto open the next model and continue.
When you reach the root end of the hierarchy, the Upgrade Advisor then opens each model again in the same order (but not libraries) and selects only the checks that require a model compile. Run the checks, take any advised actions, then clickContinue Upgrade Sequenceto open the next model. Continue until you reach the end of the hierarchy and this check passes.
Check ID:mathworks.design.ConflictsForDataStoreReadWriters
Identify potential execution order sensitivity when reading and writing to data stores.
The execution order of blocks that read and write to the same data store can change the simulation result. When blocks in the same hierarchy access the same data store, the execution order is not deterministic.
Condition | Recommended Action |
---|---|
Data Store Memory block accessed by multiple blocks in the same hierarchy. |
To enforce execution order for the blocks, consider the following:
|
Check ID:mathworks.design.TaskBasedSorting
Check relative execution order changes between legacy and task-based sorting for Data Store Read and Data Store Write blocks.
Legacy models used block sorting to determine block execution order. With task-based sorting, the relative execution order involving Data Store Memory blocks can change. This check detects the changes and provides an option to update your model with the original execution order.
Condition | Recommended Action |
---|---|
Execution order with a Data Store Memory block changes. You want the original execution order. | Click theModifybutton. |
Check ID:mathworks.design.CaseSensitiveBlockDiagramNames
Identify and fix case-insensitive references to models and libraries.
Starting R2020a, Simulink model and library names are case-sensitive. This check detects and provides an option to fix case-insensitive references to models and libraries.
Condition | Recommended Action |
---|---|
The check finds case mismatches in references to models and libraries. | 按照推荐的升级isor. |
Check ID:mathworks.design.rfblockset.ce.checkDisconnectedDividerBlocks
Search the model and list the RF Blockset™ Divider blocks using the Wilkinson power divider component with broken port connections on port3.
Starting R2021a, port positions of the RF Blockset Divider blocks using the Wilkinson power divider component are changed. This check searches and lists the Divider blocks using the Wilkinson power divider component model with broken port connections on port 3 prior to R2021a. You can then rewire the connections using the Modify button.
Condition | Recommended Action |
---|---|
Models have RF Blockset Divider blocks using the Wilkinson power divider component with broken port connections on port 3. | Click theModifybutton to rewire the broken connections on port 3 of the RF Blockset Divider blocks. |
ClickingModifyrewires the broken port connections on port 3 of the RF Blockset Divider blocks.
Note
TheModifybutton will attempt to automatically rewire all the broken connections at port 3 of the Divider blocks using the Wilkinson power divider component in your model. To ensure accuracy, you must subsequently:
Examine the details listed under theResultpane of the Upgrade Advisor.
The first list enumerates the RF Blockset Divider blocks using the Wilkinson power divider component that require manual rewiring due to model complexity.
The second list enumerates the automatically rewired blocks.
Fixed and unfixed Divider blocks are temporarily highlighted in colors green and red, respectively. Click theRemove all temporary block highlightinglink at the bottom of theResultpane to remove the highlights.