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, from the model menu, select Display > Signals & Ports and select Design 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. From the model menu, select Tools > 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 Information
      paramObjOne

      Simulink.Parameter object. Value 2. Storage class set to Auto.

      paramObjTwo

      Simulink.Parameter object. Value 2. Storage class set to Model default.

  3. From the Simulink® Analysis menu, select Data Type Design > Fixed-Point Tool.

  4. In the Fixed-Point Tool, in the Prepare System section of the toolstrip, under System under design, select ex_derived_min_max_3 as the system you want to convert.

  5. In the Collect Ranges section of the toolstrip, select Derived Ranges.

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