Derive Ranges for Simulink.Parameter Objects - MATLAB & Simulink (original) (raw)

This example shows how the range analysis takes into account design range information for Simulink.Parameter objects unless the parameter storage class is set to Auto. If the parameter storage class is set to Auto, the analysis uses the value of the parameter.

Open the ex_derived_min_max_3 Model

open_system("ex_derived_min_max_3.slx")

The model displays the specified design minimum and maximum values for the Inport blocks. The design range for both Inport blocks is [1...2].

To display design ranges in your model, in the Debug tab, select Information Overlays > Signal Data Ranges.

Examine Gain Parameters

  1. Double-click each Gain block and note the name of the Gain parameter on the Main tab.
    Gain Block Gain Parameter
    Gain1 paramObjOne
    Gain2 paramObjTwo
  2. In the Modeling tab, expand theDesign gallery and select Model Explorer.
  3. In Model Explorer window, select the base workspace and view information for each of the gain parameters used in the model.
    Gain Parameter Type Information Value Storage Class
    paramObjOne Simulink.Parameter object 2 Auto
    paramObjTwo Simulink.Parameter object 2 Model default

Derive Ranges

  1. From the Simulink® Apps tab, select Fixed-Point Tool.
  2. In the Fixed-Point Tool, under New workflow, selectIterative Fixed-Point Conversion.
  3. In the Fixed-Point Tool, under System Under Design (SUD), select ex_derived_min_max_3 as the system you want to convert.
  4. Under Range Collection Mode, selectDerived ranges.
  5. Click the Collect Ranges button.
    When the analysis is finished, the Fixed-Point Tool displays the derived minimum and maximum values for the blocks in the model in the spreadsheet.
    Block Derived Range Reason
    Gain1 [2..4] The gain parameter, paramObjOne, specified on Gain blockGain1 is aSimulink.Parameter object that has its storage class specified asAuto. The range analysis uses the Value property of theSimulink.Parameter object, whose value is 2, and ignores the design range specified for these parameters.
    Gain2 [1..20] The gain parameter, paramObjTwo, specified on Gain blockGain2 is aSimulink.Parameter object that has its storage class specified as Model default. The range analysis takes into account the design range, [1..10], specified for this parameter.