Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
slref.pdf
Скачиваний:
39
Добавлен:
26.03.2015
Размер:
16.01 Mб
Скачать

10 Model Advisor Checks

Check for proper Merge block usage

Analyze Merge blocks in the same tree as a group, and determine the possibility for them to execute at the same time step.

Description

Blocks that directly drive the same tree of Merge blocks should have mutually exclusive execution in each time step. This check identifies those blocks that drive the same tree of Merge blocks, and so are likely to execute at the same time step.

Input Parameters

Maximum analysis time (seconds)

Provide a maximum analysis time to execute the check.

Results and Recommended Actions

 

Condition

Recommended Action

 

 

Merge blocks can be interconnected to form

Rework your model so that no

 

 

a tree structure.

blocks drive the same tree of

 

 

 

Merge blocks.

 

See Also

Merge block

“Check consistency of initialization parameters for Outport and Merge blocks” on page 10-37

10-36

Simulink® Checks

Check consistency of initialization parameters for Outport and Merge blocks

Identify Outport and Merge blocks with parameter settings that can lead to unexpected initialization behavior, and migrate your model to the simplified initialization mode.

Description

In R2008b or later versions, you can choose the simplified initialization mode for conditionally executed subsystems, Merge blocks, subsystem elapsed time, and Discrete-Time Integrator blocks. The simplified initialization mode improves the consistency of simulation results. This result is especially true for models that do not specify initial conditions for conditionally executed subsystem output ports, and for models that have conditionally executed subsystem output ports connected to S-functions.

Note Before running this consistency check, verify that your block diagram conforms to the modeling standards set by this diagnostic. For more information, see the Simulink documentation under ’Diagnostics Pane: Connectivity’ or complete the following steps: .

1Run Check for proper bus usage in the Model Advisor to check your usage of Mux blocks.

2In the model window, select Simulation >

Model Configuration Parameters > Diagnostics > Connectivity.

3Set Mux blocks used to create bus signals to error.

4Set Bus signal treated as vector to error.

This Model Advisor check identifies settings in your model that can cause problems if you use the 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

10-37

10 Model Advisor Checks

migrate the model to the simplified initialization mode. Warning statements identify issues or changes in behavior that may occur after migration.

After running this Model Advisor consistency check, if you select the Explore Result button, then the messages will only pertain to blocks that are not library-linked blocks.

Note Because it is difficult to undo these changes, use the Save Restore Point As feature to backup your model before migrating to the simplified initialization mode.

Results and Recommended Actions

 

Condition

Recommended Action

 

 

Check the run-time diagnostic

 

 

 

setting of the Merge block.

1 In the Configuration Parameters

 

 

 

dialog box, on the Diagnostics >

 

 

 

Data Validity pane, set “Detect

 

 

 

multiple driving blocks executing

 

 

 

at the same time step” to error.

 

 

 

2 Verify that the model simulates

 

 

 

without errors before running this

 

 

 

check again.

 

 

Verify that Model blocks are using

Migrate the model referenced by

 

 

the simplified initialization mode.

the Model block to the simplified

 

 

 

initialization mode, then migrate the

 

 

 

top model.

 

 

Check for Model blocks that are

The simplified initialization

 

 

using the PIL simulation mode.

mode does not support the

 

 

 

Processor-in-the-loop (PIL)

 

 

 

simulation for model references.

 

10-38

Simulink® Checks

 

Condition

 

Recommended Action

 

 

Check for single-input Merge blocks.

 

Replace both the Mux block used

 

 

 

 

to produce the input signal and the

 

 

 

 

Merge block with one multi-input

 

 

 

 

Merge block. Single-input Merge

 

 

 

 

blocks are not supported in the

 

 

 

 

simplified initialization mode.

 

 

Check for root Merge blocks that

 

Specify an explicit value for the

 

 

have an unspecified ’Initial output’.

 

Initial output parameter of root

 

 

 

 

Merge blocks. A root Merge block is

 

 

 

 

a Merge block with an output port

 

 

 

 

that does not connect to another

 

 

 

 

Merge block.

 

 

Check for Merge blocks with nonzero

 

Clear the Allow unequal port

 

 

input port offsets.

 

widths parameter of the Merge

 

 

 

 

block.

 

 

 

 

 

 

 

 

 

 

Note Consider using Merge blocks

 

 

 

 

only for signal elements that require

 

 

 

 

true merging. You can combine other

 

 

 

 

elements with merged elements

 

 

 

 

using the Concatenate block.

 

 

 

 

 

 

 

 

Check for Merge blocks that have

 

Set the Number of inputs

 

 

unconnected inputs or that have

 

parameter of the Merge block to the

 

 

inputs from non-conditionally

 

number of Merge block inputs. You

 

 

executed subsystems.

 

must connect each input to a signal.

 

 

 

 

Verify that each Merge block input

 

 

 

 

is driven by a conditionally executed

 

 

 

 

subsystem. Merge blocks cannot

 

 

 

 

be driven directly by an Iterator

 

 

 

 

Subsystem or a block that is not a

 

 

 

 

conditionally executed subsystem.

 

10-39

10 Model Advisor Checks

 

Condition

Recommended Action

 

 

Check for Merge blocks with inputs

Verify that any combination or

 

 

that are combined or reordered

reordering of Merge block input

 

 

outside of conditionally executed

signals takes place within a

 

 

subsystems.

conditionally executed subsystem.

 

 

 

Such designs may use Mux, Bus

 

 

 

Creator, or Selector blocks.

 

 

Check for Merge blocks with

Verify that input signals to each

 

 

inconsistent input sample times.

Merge block have the same Sample

 

 

 

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

Verify that the Merge block does not

 

 

input ports that are driven by a

have multiple input signals that are

 

 

single source.

driven by the same conditionally

 

 

 

executed subsystem or conditionally

 

 

 

executed Model block.

 

 

Check for Outport blocks that

The Outport block has a function-call

 

 

have conflicting signal buffer

trigger or function-call data

 

 

requirements.

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 leads

 

 

 

to a function-call data dependency

 

 

 

violation.

 

 

 

Consider modifying the model

 

 

 

to pass function-call related

 

 

 

signals through a separate

 

 

 

Outport block. For examples of

 

 

 

function-call data dependency

 

 

 

 

 

10-40

Simulink® Checks

Condition

Recommended Action

 

 

 

violations, see the example model

 

sl_subsys_semantics.

 

A standard data signal may require

 

an additional signal copy for one of

 

the following reasons:

 

The Outport block is driven by

 

a block with output that cannot

 

be overwritten. The Ground

 

block and the Constant block are

 

examples of such blocks.

 

The Outport block shares the

 

same signal source with another

 

Outport block in the same

 

subsystem or in one nested within

 

the current subsystem but having

 

a different initial output value.

 

The Outport block connects to the

 

input of a Merge block

 

One of the input signals of the

 

Outport block is specifying a

 

Simulink.Signal object with an

 

explicit initial value .

Check for Outport blocks that

An explicit copy of the bus signal

require an explicit signal copy.

driving the Outport block is

 

required for the initialization of the

 

output signal of the corresponding

 

subsystem. Insert a Signal

 

Conversion block before the

 

Outport block, then set the Output

 

parameter of the Signal Conversion

 

block to Bus copy.

 

A standard data signal may require

 

an additional signal copy for one or

 

more of the following reasons:

 

 

10-41

10 Model Advisor Checks

Condition

Recommended Action

 

 

 

A block with output that cannot be

 

overwritten is driving the Outport

 

block. The Ground block and the

 

Constant block are examples of

 

such blocks.

 

The Outport block shares the

 

same signal source with another

 

Outport block in the same

 

subsystem or in one nested within

 

the current subsystem but having

 

a different initial output value.

 

The Outport block connects to the

 

input of a Merge block

 

One of the input signals of the

 

Outport block is specifying a

 

Simulink.Signal object with an

 

explicit initial value.

Check for merged Outport

Determine if the new behavior of the

blocks that are driven by nested

Outport blocks is acceptable. If it

conditionally executed subsystems.

is not acceptable, modify the model

 

to account for the new behavior

 

before migrating to the simplified

 

initialization mode.

Check for merged Outport blocks

Set the Output when disabled

that reset when the blocks are

parameter of the Outport block

disabled.

to held. This setting is required

 

because the Outport block connects

 

to a Merge block.

 

For more information, see Outport.

 

 

10-42

Simulink® Checks

 

Condition

 

Recommended Action

 

 

Check for Outport blocks that have

 

Specify the Initial output

 

 

an undefined ’Initial output’ value.

 

parameter for the Outport block,

 

 

 

 

unless you want the block to obtain

 

 

 

 

its Initial output value from its

 

 

 

 

input signal.

 

 

 

 

If you want the Outport block to

 

 

 

 

obtain its Initial output value

 

 

 

 

from its input signal, verify that its

 

 

 

 

sources are valid. For the simplified

 

 

 

 

initialization mode, valid sources

 

 

 

 

from which an Outport blocks can

 

 

 

 

inherit Initial output value are:

 

 

 

 

Constant, Initial Condition, Merge

 

 

 

 

(with initial output), or conditionally

 

 

 

 

executed subsystem blocks.

 

 

 

 

 

 

 

 

 

 

Note If you are working with a

 

 

 

 

conditionally executed subsystem

 

 

 

 

Outport block, driven directly by

 

 

 

 

another conditionally executed

 

 

 

 

subsystem Outport block, then

 

 

 

 

resolve this error message for

 

 

 

 

the inner Outport block first.

 

 

 

 

Subsequently, run this Model

 

 

 

 

Advisor check again to determine

 

 

 

 

if you resolved the problem for the

 

 

 

 

outer Outport block.

 

 

 

 

 

 

 

10-43

10 Model Advisor Checks

 

Condition

Recommended Action

 

 

Check Outport blocks that have

Simulink has inserted a Rate

 

 

automatic rate transitions.

Transition block at the input of the

 

 

 

Outport block. If this rate transition

 

 

 

is required, then specify the Initial

 

 

 

output parameter for each Outport

 

 

 

block.

 

 

 

Otherwise, perform the following

 

 

 

procedure:

 

 

 

1 In the Configuration Parameters

 

 

 

dialog box, on the Solver pane,

 

 

 

clear the option “Automatically

 

 

 

handle rate transition for data

 

 

 

transfer”.

 

 

 

2 Run this Model Advisor check

 

 

 

again.

 

 

Check Outport blocks that have a

Specify the Initial output

 

 

special signal storage requirement.

parameter for the Outport block.

 

 

 

The Outport block cannot obtain

 

 

 

Initial output values from its input

 

 

 

signals because of its special internal

 

 

 

signal storage requirement.

 

 

Check the ’Initial output’ setting of

Specify the Initial output

 

 

Outport blocks that reset when they

parameter of the Outport block.

 

 

are disabled.

You must specify the Initial output

 

 

 

 

 

 

value for blocks that are configured

 

 

 

to reset when they become disabled.

 

 

 

 

 

10-44

Simulink® Checks

 

Condition

Recommended Action

 

 

Check the ’Initial output’ setting for

You cannot specify an Initial

 

 

Outport blocks that pass through

output value for the Outport

 

 

a function-call data dependency

block because function-call data

 

 

signal.

dependency signals are passing

 

 

 

through it. To set the Initial output

 

 

 

value:

 

 

 

1 Set the Initial output parameter

 

 

 

of the Outport block to [].

 

 

 

2 Provide the initial value at the

 

 

 

source of the data dependency

 

 

 

signal rather than at the Outport

 

 

 

block.

 

 

Check for blocks inside of the

Within an Iterator Subsystem

 

 

Iterator Subsystem that require

hierarchy, do not use blocks that

 

 

elapsed time.

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.

 

10-45

10 Model Advisor Checks

 

Condition

 

Recommended Action

 

 

Check for Outport blocks that use

 

Verify that the following behavior is

 

 

signal objects to specify the ’Initial

 

acceptable.

 

 

output’ value.

 

In the simplified initialization mode,

 

 

 

 

 

 

 

 

signal objects cannot specify the

 

 

 

 

Initial output parameter of an

 

 

 

 

Outport block. You can still initialize

 

 

 

 

the input or output signals for an

 

 

 

 

Outport block using signal objects,

 

 

 

 

but the initialization results may be

 

 

 

 

overwritten by those of the Outport

 

 

 

 

block.

 

 

 

 

 

 

 

 

 

 

Note If you are working with a

 

 

 

 

conditionally executed subsystem

 

 

 

 

Outport block, Simulink generates a

 

 

 

 

warning that the initial value of the

 

 

 

 

signal object has been ignored.

 

 

 

 

 

 

 

 

Check for merged Outport blocks

 

Verify that the following behavior is

 

 

that are either unconnected or

 

acceptable.

 

 

connected to a Ground block.

 

The Outport block is driving a

 

 

 

 

 

 

 

 

Merge block, but its inputs are

 

 

 

 

either unconnected or connected

 

 

 

 

to Ground blocks. 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.

 

10-46

Simulink® Checks

 

Condition

 

Recommended Action

 

 

Check for Merge blocks that use

 

Verify that the following behavior is

 

 

signal objects to specify the ’Initial

 

acceptable.

 

 

output’ value.

 

In the simplified initialization mode,

 

 

 

 

 

 

 

 

signal objects cannot specify the

 

 

 

 

Initial output parameter of the

 

 

 

 

Merge block. While you can still

 

 

 

 

initialize the output signal for a

 

 

 

 

Merge block using a signal object,

 

 

 

 

the initialization result may be

 

 

 

 

overwritten by that of the Merge

 

 

 

 

block.

 

 

 

 

 

 

 

 

 

 

Note Simulink generates a warning

 

 

 

 

that the initial value of the signal

 

 

 

 

object has been ignored.

 

 

 

 

 

 

 

 

Check for Outport blocks that obtain

 

Verify that the following behavior is

 

 

the ’Initial output’ value from an

 

acceptable.

 

 

input signal when they are migrated.

 

The Initial output parameter of the

 

 

 

 

Outport block is not specified. As a

 

 

 

 

result, the simplified initialization

 

 

 

 

mode will assume that the Initial

 

 

 

 

output value for the Outport block

 

 

 

 

is derived from the input signal. This

 

 

 

 

assumption may result in different

 

 

 

 

initialization behavior.

 

 

 

 

If this behavior is not acceptable,

 

 

 

 

modify your model before

 

 

 

 

you migrate to the simplified

 

 

 

 

initialization mode.

 

10-47

10 Model Advisor Checks

 

Condition

Recommended Action

 

 

Check for innermost Outport blocks

In classic initialization mode,

 

 

with variable-size input and an

Simulink assumes that the ’Initial

 

 

unspecified ’Initial output’.

output’ parameter is 0 when it is

 

 

 

unspecified ([]) for the innermost

 

 

 

Outport block. This block has

 

 

 

variable-size input for which the

 

 

 

signal size varies only when the

 

 

 

parent subsystem is re-enabled.

 

 

 

Unless you specify the value of

 

 

 

the Initial output parameter,

 

 

 

it will be set to zero when your

 

 

 

model is migrated to the simplified

 

 

 

initialization mode.

 

 

Check for outer Outport blocks that

Verify that the following behavior is

 

 

have an explicit ’Initial output’.

acceptable.

 

 

 

In the classic initialization mode,

 

 

 

the Initial output and Output

 

 

 

when disabled parameters of the

 

 

 

Outport block must match those of

 

 

 

their source Outport blocks.

 

 

 

Consequently, Simulink will set

 

 

 

the ’Source of initial output value’

 

 

 

parameter to ’Input signal’ in the

 

 

 

simplified initialization mode.

 

 

Check for conditionally executed

Verify that the following behavior is

 

 

subsystems that propagate execution

acceptable.

 

 

context across the output boundary.

The Propagate execution context

 

 

 

 

 

 

across subsystem boundary

 

 

 

parameter is selected for the

 

 

 

subsystem. Execution context

 

 

 

will still be propagated across

 

 

 

input boundaries; however, the

 

 

 

propagation will be disabled on the

 

 

 

output side for the initialization in

 

 

 

the simplified initialization mode.

 

10-48

Simulink® Checks

 

Condition

Recommended Action

 

 

Check for Discrete-Time Integrator

Verify that the following behavior is

 

 

blocks.

acceptable.

 

 

 

Simulink has changed the

 

 

 

initialization behavior of the

 

 

 

Discrete-Time Integrator block to be

 

 

 

more consistent and robust in the

 

 

 

simplified initialization mode. These

 

 

 

changes include:

 

 

 

Elimination of the Use initial

 

 

 

condition as initial and reset

 

 

 

value for parameter

 

 

 

Application of the Initial

 

 

 

condition parameter only to the

 

 

 

integrator output

 

 

 

Simplified enable/disable

 

 

 

behavior.

 

 

 

See the Discrete-Time Integrator

 

 

 

block documentation for more

 

 

 

information on the simplified

 

 

 

initialization for the Discrete-Time

 

 

 

Integrator.

 

 

Check for blocks that read input from

Verify that the following behavior is

 

 

conditionally executed subsystems

acceptable.

 

 

during initialization.

Some blocks, such as the

 

 

 

 

 

 

Discrete-Time Integrator block,

 

 

 

read their inputs from conditionally

 

 

 

executed 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

 

 

 

 

 

10-49

10 Model Advisor Checks

Condition

Recommended Action

 

 

 

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 corresponding

 

Outport block. In particular, this

 

discrepancy occurs if the subsystem

 

is active at the first time step.

Check for library blocks with

Examine the failed subcheck results

instances that cannot be migrated.

for each block to determine the

 

corrective actions.

Check for library blocks with

Examine the warning subcheck

instances that have warnings.

results for each block before

 

migrating to the simplified

 

initialization mode.

Check for a migration conflict for

Other instances of Outport blocks

Outport blocks that will use a

with the same library link either

’Dialog’ as the ’Source of initial

cannot be migrated or are being

output value’.

migrated in a different manner.

 

Review the results from the Check

 

for library blocks with instances

 

that cannot be migrated to learn

 

about the different migration paths

 

for other instances of each Outport

 

block.

 

The Outport block will maintain its

 

current settings and use its specified

 

Initial output value.

10-50

Simulink® Checks

 

Condition

Recommended Action

 

 

Check for a migration conflict for

Other instances of Outport blocks

 

 

Outport blocks that will use an

with the same library link either

 

 

’Input signal’ as the ’Source of initial

cannot be migrated or are being

 

 

output’ value.

migrated in a different manner.

 

 

 

Review the results from the Check

 

 

 

for library blocks with instances

 

 

 

that cannot be migrated to learn

 

 

 

about the different migration paths

 

 

 

for other instances of each Outport

 

 

 

block.

 

 

 

The Outport block currently specifies

 

 

 

an Initial output of [] (empty

 

 

 

matrix), and the Output when

 

 

 

disabled as held. This means

 

 

 

that each outport does not perform

 

 

 

initialization, but implicitly relies on

 

 

 

source blocks to initialize its input

 

 

 

signal.

 

 

 

After migration, the parameter

 

 

 

Source of initial output value

 

 

 

will be set to Input signal to reflect

 

 

 

this behavior.

 

 

Check for a migration conflict for

Other instances of Outport blocks

 

 

Outport blocks that have SimEvents

with the same library link either

 

 

semantics.

cannot be migrated or are being

 

 

 

migrated in a different manner.

 

 

 

Review the results from the Check

 

 

 

for library blocks with instances

 

 

 

that cannot be migrated to learn

 

 

 

about the different migration paths

 

 

 

for other instances of each Outport

 

 

 

block.

 

 

 

The Outport blocks will continue

 

 

 

to use an Initial output value of

 

 

 

[] (empty matrix) and an Output

 

 

 

when disabled setting of held.

 

 

 

 

 

10-51

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]