satur.c File Reference

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

Include dependency graph for satur.c:

Go to the source code of this file.

Functions

void satur (scicos_block *block, int flag)


Function Documentation

void satur ( scicos_block block,
int  flag 
)

Definition at line 4 of file satur.c.

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

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

Here is the call graph for this function:


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