deadband.c File Reference

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

Include dependency graph for deadband.c:

Go to the source code of this file.

Functions

void deadband (scicos_block *block, int flag)


Function Documentation

void deadband ( scicos_block block,
int  flag 
)

Definition at line 3 of file deadband.c.

References scicos_block::g, get_phase_simulation(), scicos_block::inptr, scicos_block::mode, scicos_block::ng, scicos_block::outptr, and scicos_block::rpar.

00004 {/* rpar[0]:upper limit,  rpar[1]:lower limit */
00005   if (flag==1){
00006     if (get_phase_simulation()==1||block->ng==0) {
00007       if (*block->inptr[0]>=block->rpar[0]){
00008         block->outptr[0][0]=*block->inptr[0]-block->rpar[0];
00009       }else if (*block->inptr[0]<=block->rpar[1]){
00010         block->outptr[0][0]=*block->inptr[0]-block->rpar[1];
00011       }else {
00012         block->outptr[0][0]=0.0;
00013       }
00014     }else{
00015       if (block->mode[0]==1){
00016         block->outptr[0][0]=*block->inptr[0]-block->rpar[0];
00017       }else if(block->mode[0]==2) {
00018         block->outptr[0][0]=*block->inptr[0]-block->rpar[1];
00019       }else{
00020         block->outptr[0][0]=0.0;
00021       } 
00022     }
00023   } else if (flag==9){
00024     block->g[0]=*block->inptr[0]-(block->rpar[0]);
00025     block->g[1]=*block->inptr[0]-(block->rpar[1]);
00026     if (get_phase_simulation()==1) {
00027       if (block->g[0]>=0){
00028         block->mode[0]=1;
00029       }else if (block->g[1]<=0){
00030         block->mode[0]=2;
00031       }else {
00032         block->mode[0]=3;
00033       }
00034     }
00035   }
00036 }

Here is the call graph for this function:


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