Subsections


Hystheresis

\epsfig{file=HYSTHERESIS.eps,width=90.00pt}

Library

Others

Description

Dialog Box

Set parameters
switch on at 1
switch off at 0
output when on 1
output when off 0
use zero crossing: yes (1), no (0) 1

Default properties

Interfacing function

scilab/macros/scicos_blocks/misc/HYSTHERESIS.sci

Computational function (type 4)


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

void  hystheresis(scicos_block *block,int flag)
{
  if (flag==1){
    if (get_phase_simulation()==1) {
      if (*block->inptr[0]>=block->rpar[0]){
	block->outptr[0][0]=block->rpar[2];
      }else if (*block->inptr[0]<=block->rpar[1]){
	block->outptr[0][0]=block->rpar[3];
      }
    }else{
      if (block->mode[0]<2){
	block->outptr[0][0]=block->rpar[3];
      }else{
	block->outptr[0][0]=block->rpar[2];
      }
    } 
  } else if (flag==9){
    block->g[0]=*block->inptr[0]-(block->rpar[0]);
    block->g[1]=*block->inptr[0]-(block->rpar[1]);
    if (get_phase_simulation()==1) {
      if (block->g[0]>=0){
	block->mode[0]=2;
      }else if (block->g[1]<=0){
	block->mode[0]=1;
      }
    }
  }
}

Ramine Nikoukhah 2004-06-22