hystheresis.c

Go to the documentation of this file.
00001 #include "scicos_block.h"
00002 #include <math.h>
00003 
00004 void  hystheresis(scicos_block *block,int flag)
00005 {
00006   if (flag==1){
00007     if (get_phase_simulation()==1||block->ng==0) {
00008       if (*block->inptr[0]>=block->rpar[0]){
00009         block->outptr[0][0]=block->rpar[2];
00010       }else if (*block->inptr[0]<=block->rpar[1]){
00011         block->outptr[0][0]=block->rpar[3];
00012       }
00013     }else{
00014       if (block->mode[0]<2){
00015         block->outptr[0][0]=block->rpar[3];
00016       }else{
00017         block->outptr[0][0]=block->rpar[2];
00018       }
00019     } 
00020   } else if (flag==9){
00021     block->g[0]=*block->inptr[0]-(block->rpar[0]);
00022     block->g[1]=*block->inptr[0]-(block->rpar[1]);
00023     if (get_phase_simulation()==1) {
00024       if (block->g[0]>=0){
00025         block->mode[0]=2;
00026       }else if (block->g[1]<=0){
00027         block->mode[0]=1;
00028       }
00029     }
00030   }
00031 }

Generated on Sun Mar 4 15:03:59 2007 for Scilab [trunk] by  doxygen 1.5.1