.

Block Processing

MechaWare firmware processes all blocks within a model before moving on to the next model. In firmware that does not support subsampling, the models are calculated in ascending numerical order (Model 0 is calculated before Model 1, then Model 2, ..., etc.). For firmware that supports subsampling, the models are calculated in the order specified by the subsample map array.

Blocks within a specific model are processed in an order that ensures that the blocks work with the most recent data. Input Blocks (see API Documentation for a complete list) are calculated first; then, any blocks that depend on the inputs.

If a block depends on the output of another block, the dependant block is calculated after the previous block has generated the required output. Once the dependencies have been resolved, the blocks are calculated in the order they are stored in the model file by Simulink. With the current version of Simulink this is in alphabetical order by block name.

Note: Alphabetically ordered blocks are sorted character-by-character, which can sometimes cause confusion. For example, a block named SUM 11 will be processed before a block named SUM 2.

The block processing order is determined at download time. The blocks are listed in the order of processing in the associated .map file generated by the downloader.

Block Processing Order Example

In the following example (Figure 1), the input blocks (labeled as Error, Reset Status, and Constant) are calculated first. Then, the PID with Reset block, which is dependant on the input block calculations, is processed. Finally, the Output block is calculated after the output of the PID with Reset block has been generated.

In Figure 1 and Figure 2, the input blocks are calculated in alphabetical order by block name. Note that subtle differences in block names such as Constant in Figure 1 and Zero in Figure 2 affect the order that the blocks are processed.

Figure 1

 

Figure 2

 

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2021 Motion Engineering