how range analysis works -凯发k8网页登录

main content

how range analysis works

analyzing a model with range analysis

the model that you want to analyze must be compatible with range analysis. if your model is not compatible, either replace unsupported blocks or divide the model so that you can analyze the parts of the model that are compatible. for more information, see model compatibility with range analysis.

when you specify derived ranges as the range collection mode, the fixed-point designer™ software performs a static range analysis of your model to derive minimum and maximum range values for signals in the model. the software analyzes the model behavior and computes the values that can occur during simulation for each block outport. the range of these values is called a derived range.

the software statically analyzes the ranges of the individual computations in the model based on:

  • specified design ranges, known as design minimum and maximum values, for example, minimum and maximum values specified for:

    • inport and outport blocks

    • block outputs

    • input, output, and local data used in matlab function and stateflow chart blocks

    • simulink® data objects ( and objects)

  • inputs

  • the semantics of each calculation in the blocks

if the model contains objects that the analysis cannot support, where possible, the software uses automatic stubbing.

the range analysis tries to narrow the derived range by using all the specified design ranges in the model. the more design range information you specify, the more likely the range analysis is to succeed. as the software performs the analysis, it derives new range information for the model. the software then attempts to use this new information, together with the specified ranges, to derive ranges for the remaining objects in the model.

for models that contain floating-point operations, range analysis might report a range that is slightly larger than expected. this difference is due to rounding errors. the software approximates floating-point numbers with infinite-precision rational numbers for analysis and then converts to floating point for reporting.

the following table summarizes how the analysis derives range information and provides links to examples.

when...how the analysis worksexamples

you specify design minimum and maximum data for a block output.

the derived range at the block output is based on these specified values and on the following values for blocks connected to its inputs and outputs:

  • specified minimum and maximum values

  • derived minimum and maximum values

only block output signals participate in derived range analysis. if a block has additional data type controls, such as for the accumulator or intermediate results, ranges are not derived for these elements.

derive ranges using design ranges

a parameter on a block has initial conditions and a design range.

the analysis takes both factors into account by taking the union of the design range and the initial conditions.

the model contains a parameter with a specified range and the parameter storage class is set to auto.

the analysis does not take into account the range specified for the parameter. instead, it uses the parameter value.

the model contains a parameter with a specified range and the parameter storage class is not set to auto.

the analysis takes into account the range specified for the parameter and ignores the value.

the model contains insufficient design range information.

the analysis cannot determine derived ranges. specify more design range information and rerun the analysis.

the range analysis results might depend on the block sorted order, which determines the order in which the software analyzes the blocks. for more information, see .

the model contains conflicting design range information.

the analysis cannot determine the derived minimum or derived maximum value for an object. the fixed-point tool generates an error. to fix this error, examine the design ranges specified in the model to identify inconsistent design specifications. modify them to make them consistent.

automatic stubbing

what is automatic stubbing?

automatic stubbing is when the software considers only the interface of the unsupported objects in a model, not their actual behavior. automatic stubbing lets you analyze a model that contains objects that the fixed-point designer software does not support. however, if any unsupported model element affects the derivation results, the analysis might achieve only partial results.

how automatic stubbing works

with automatic stubbing, when the range analysis comes to an unsupported block, the software ignores ("stubs") that block. the analysis ignores the behavior of the block. as a result, the block output can take any value.

the software cannot “stub” all simulink blocks, such as the integrator block. see the blocks marked “not stubbable” in .

model compatibility with range analysis

to verify that your model is compatible with range analysis, see:

how to derive ranges

  1. verify that your model is compatible with range analysis.

  2. in simulink, open your model and set it up for use with the fixed-point tool. for more information, see .

  3. from the simulink apps tab, select fixed-point tool.

  4. in the fixed-point tool, under new, select the iterative fixed-point conversion workflow.

  5. under system under design (sud), select the system or subsystem of interest.

  6. under range collection mode, select derived ranges as the method of range collection. this configures the model to collect ranges using idealized floating-point data types.

    by default, the tool collects ranges using design information from the system under design. for more information, see .

  7. click prepare to have the fixed-point tool check the system under design for compatibility with the conversion process and report any issues found in the model.

    the fixed-point tool:

    • checks the model against fixed-point guidelines.

    • identifies unsupported blocks.

    • identifies blocks that need design range information.

  8. click the collect ranges button to run the analysis.

    the analysis tries to derive range information for objects in the selected system under design. your next steps depend on the analysis results.

    analysis resultsfixed-point tool behaviornext stepsfor more information

    successfully derives range data for the model.

    displays the derived minimum and maximum values for the blocks in the selected system.

    review the derived ranges to determine if the results are suitable for proposing data types. if not, you must specify additional design information and rerun the analysis.

    derive ranges using design ranges

    fails because the model contains blocks that the software does not support.

    generates an error and provides information about the unsupported blocks.

    to fix the error, review the error message information and replace the unsupported blocks.

    model compatibility with range analysis

    cannot derive range data because the model contains conflicting design range information.

    generates an error.

    to fix this error, examine the design ranges specified in the model to identify inconsistent design specifications. modify the design ranges to make them consistent.

    cannot derive range data for an object because there is insufficient design range information specified on the model.

    highlights the results for the object.

    examine the model to determine which design range information is missing.

网站地图