switch2.c File Reference

#include "scicos_block.h"
#include <math.h>

Include dependency graph for switch2.c:

Go to the source code of this file.

Functions

void switch2 (scicos_block *block, int flag)


Function Documentation

void switch2 ( scicos_block block,
int  flag 
)

Definition at line 4 of file switch2.c.

References scicos_block::g, get_phase_simulation(), i, scicos_block::inptr, scicos_block::insz, scicos_block::ipar, j, scicos_block::mode, scicos_block::ng, scicos_block::outptr, phase, and scicos_block::rpar.

00005 {
00006   int i,j,phase;
00007   if (flag == 1) {
00008     phase=get_phase_simulation();
00009     if (phase==1||block->ng==0){
00010       i=2;
00011       if (*block->ipar==0){
00012         if (*block->inptr[1]>=*block->rpar) i=0;
00013       }else if (*block->ipar==1){
00014         if (*block->inptr[1]>*block->rpar) i=0;
00015       }else {
00016         if (*block->inptr[1]!=*block->rpar) i=0;                             
00017       }
00018     }else{
00019       if(block->mode[0]==1){
00020         i=0;
00021       }else if(block->mode[0]==2){
00022         i=2;
00023       }
00024     }
00025     for (j=0;j<block->insz[0];j++) {
00026       block->outptr[0][j]=block->inptr[i][j];
00027     }
00028   }else if(flag == 9){
00029     phase=get_phase_simulation();
00030     block->g[0]=*block->inptr[1]-(*block->rpar);
00031     if (phase==1){
00032       i=2;
00033       if (*block->ipar==0){
00034         if (block->g[0]>=0.0) i=0;
00035       }else if (*block->ipar==1){
00036         if (block->g[0]>0.0) i=0;
00037       }else {
00038         if (block->g[0]!=0.0) i=0;                           
00039       }
00040       if(i==0) {
00041         block->mode[0]=1;
00042       }else{
00043         block->mode[0]=2;
00044       }
00045     }
00046   }
00047 }

Here is the call graph for this function:


Generated on Sun Mar 4 16:12:26 2007 for Scilab [trunk] by  doxygen 1.5.1