MexBIOS Development Studio: Creating layers and their settings in the inspector layers

CREATION OF LAYERS

 

  • To create a layer you should go to inlay Layers. The inlay contains two layers on default. Into layer Models (Layer) the simulation model blocks from library Models are placed. Into layer TMS320F2803x (Layer1) on default the blocks are placed, which are added to panel Dataflow.
  • Layer TMS320F2803x (Layer1) contains two outputs. Output Task is intended for linking the layers, which do not require severe cyclicity, is executed in idle loop of the processor. 
  • Add an extra output to layer Layer1
  • Drag the Layer block from palette Embedded.

Fig. 1. Adding a layer

  • Set library TMS320F2803x. 
  • Add an output to main layer in Inspector:
Fig. 2. Layer properties
 
  1. In Name field give name of a layer.
  2. Prescale is a divider of reference clock frequency, in which the MexBIOS™ kernel is operating. The kernel operates at frequency of 10 kHz. If Prescale is set equal to 2, then the layer will be executing with frequency 5 kHz.
  3. OutCount is the setting of output number of the layer. Main layer contains two outputs on default.
  4. Blocks field displays number of blocks in a layer. Clicking «…» opens Layer Inspector dialog box (see further).
  • Add one more layer.
  • Set color to the added layers:
Fig. 3. Setting color to the layer
 
  • Go to Dataflow field. Move blocks for displaying into layer Layer2, the rest of blocks - into Layer3. Frequency reference and Reset leave in layer Layer1.
  • The circuit looks like the one shown below:
Fig. 4. Circuit after the blocks placing into layers
 
 

LAYERS COMPUTATION WITH DIFFERENT FREQUENCIES

  • Assemble the following circuit:

Fig. 5. Circuit of simple counter

Block ADD (addition) is located in TMS320F2803x→Math.

  1. Set format Integer for blocks IN and OUT.
  2. Set 1 into block IN.
  3. Copy this circuit three times. Place each one in three different created layers.

Fig. 6. Circuit for illustration of the layers operation

  • Set simulation time equal to 1 second. 

Fig. 7. Setting simulation time

 
  • Start simulation. Make sure that all three counters have stopped with the same value.
NOTE: After finishing simulation the OUT blocks display the pre-simulation state. To display the results you need to click in Workspace.
  • Thereafter go to inlay Layers and change property Prescale of layers Layer2 and Layer3 to 10 and 100 respectively.
  • Start simulation. Now the created layers are counted with different frequencies. Main layer (Layer1) is counted with frequency 10 000 Hz, additional layers Layer2 and Layer3 are counted with frequencies 1000 Hz and 100 Hz respectively. It illustrate the simulation results shown in fig. 8:

Fig. 8. Layer operation with different counting frequencies

 

CREATION OF CONDITIONAL AND UNCONDITIONAL LAYERS

 

On default all the layers are executed unconditionally. To create a layer execution condition (for event-driven layer execution) you need to do the following:

  • Assemble the circuit shown in fig 9.

Fig. 9. Manual start of conditional layer

 

Block TP_IN (signal transmitter or Teleporter) is located in Palette → Embedded. By means of this block the condition of execution into layer properties will be sent.

  • In block IN set value 0.
  • Then go to Layers inlay, select the layer that will be executed on the condition. Let it be Layer2. In layer properties set the condition:

Fig. 10. Selection of the layer execution condition

  • The layer will be executed, if signal in TP_IN block is non-zero. 
  • Start simulation. Add IN block to Watch Window. Set non-zero value. Make sure that the layer starts executing. 

 

Let’s consider one more example of executing the conditional layer.
  • Assemble the following circuit:
Fig. 11. Realization of the layers execution logic
 
  1. Block EQ (logic equality) is located in Palette→TMS320F2803x→Logic.
  2. Set value in blocks IN, named Condition1 = 1, Condition2 = 2. In this case either one layer will be executed, if condition Condition=Condtition1 is true, or another layer, if Condition=Condition2 is true, or none of layers, if both conditions are false.
  3. Make sure that all IN output signals in one format Integer or IQ24
  4. Block EQ (and all logic blocks) outputs the signal of logic 1 in format Integer when the condition is true.
  • Further, in Layers inlay assign the execution condition TP_IN1 to Layer3.
  • Start simulation. Add conditions in Watch Window. Make sure starting the conditional layers execution. 
Therefore the StateFlow can be realized by means of logic blocks. 
 

 

LAYER INSPECTOR

 

Layer Inspector is intended for assigning the block execution order. Under MexBIOS™ Development Studio environment a user assigns the block execution order by oneself. It is done caused by the logic of signal flowing from reference to output device (for example: PMW driver, discrete input-output driver, mathematical model of the control object etc.). Accordingly the signal should flow also from signal input device (ADC).

Fig.  12. Starting Layer Inspector

Fig. 13. Layer Inspector

 

The execution order and the layer belonging of the blocks can be modified by dragging the list components.

To move a block into correct layer you can use another method: right-clicking a block (or a group of selected blocks) in Workspace and choosing from the drop-down menu Add to layer, see fig. 14.

Fig. 14. Adding the block to the layer

Further you need to assign the execution order of the added block in Layer Inspector.

Теги: 
Layer Inspector