Scicos Block
fr - eng

##
Debug block

### Contents

- Debug block
  - Palette
  - Description
  - Default properties
  - Interfacing function
  - Authors

### Palette

- Others - Others palette

### Description

The DEBUG block is a powerful debugging tool in Scicos. When placed in a Scicos diagram, during simulation, it impersonates every block, once before its activation, once after. By opening the DEBUG block, user can write the scilab script that will be executed when it is activated. The DEBUG block is very similar to a standard type 5 Scilab block. It is called with two arguments (block and flag), it has access to functions such as curblock(), scicos_time(), etc., and its output is block.

For every block, during simulation, the DEBUG block is called first (as if it were the block itself). Then the simulation routine of the block is called, and finally the DEBUG is called a second time the same way. This way, the DEBUG block can be used to monitor the block values before and after executation. The DEBUG block can also modify these values, thus making it a powerful debugging tool.

For example if a simple pause is placed in the DEBUG block, then the simulation runs in single step mode. But the pause statement can also be made conditional. For example:

`if curblock()==3 & scicos_time()>2 & flag==2 then pause, end`

The test can also be made dependent on the values of the block, for example: if block.outptr(1)(1)>9 then disp(scicos_time()),end

This block can also be used to create log files by printing information about the block values during simulation.

Note that for the DEBUG block to function, the debugging level must be set to 2 or higher. The debugging level is changed automatically when the DEBUG block is placed inside the diagram. It is possible to disable a DEBUG block by changing back the debugging level to 0, without having to remove it from the diagram. This can be done by using the menu Debug Level, or at the Scilab prompt (often under pause), using the scicos_debug() function.

### Default properties

- always active: no
- direct-feedthrough: no
- zero-crossing: no
- mode: no
- number/sizes of activation inputs: 0
- number/sizes of activation outputs: 0
- continuous-time state: no
- discrete-time state: no
- object discrete-time state: no
- name of computational function: %debug_scicos

### Interfacing function

- SCI/macros/scicos_blocks/Misc/DEBUG_SCICOS.sci [view code]

### Authors

Ramine Nikoukhah INRIA