Derive Ranges for Simulink.Parameter Objects

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.

  1. Open the ex_derived_min_max_3 model. At the MATLAB® command line, enter:

    addpath(fullfile(docroot,'toolbox','fixpoint','examples'))
    ex_derived_min_max_3

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

    Tip

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

  2. Examine the gain parameters for the Gain blocks.

    1. Double-click each Gain block and note the name of the Gain parameter on the Main tab.

      Gain BlockGain Parameter
      Gain1paramObjOne
      Gain2paramObjTwo

    2. In the Modeling tab, expand the Design 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 ParameterType InformationValueStorage Class
      paramObjOne

      Simulink.Parameter object

      2Auto
      paramObjTwo

      Simulink.Parameter object

      2Model default

  3. From the Simulink® Apps tab, select Fixed-Point Tool.

  4. In the Fixed-Point Tool, under New workflow, select Iterative Fixed-Point Conversion.

  5. In the Fixed-Point Tool, under System Under Design (SUD), select ex_derived_min_max_3 as the system you want to convert.

  6. Under Range Collection Mode, select Derived ranges.

  7. 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.

    BlockDerived RangeReason
    Gain1[2..4]

    The gain parameter, paramObjOne, specified on Gain block Gain1 is a Simulink.Parameter object that has its storage class specified as Auto. The range analysis uses the Value property of the Simulink.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 block Gain2 is a Simulink.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.

Related Topics