~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to routines/scicos/hystheresis.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "scicos_block.h"
 
2
#include <math.h>
 
3
 
 
4
void  hystheresis(scicos_block *block,int flag)
 
5
{
 
6
  if (flag==1){
 
7
    if (get_phase_simulation()==1) {
 
8
      if (*block->inptr[0]>=block->rpar[0]){
 
9
        block->outptr[0][0]=block->rpar[2];
 
10
      }else if (*block->inptr[0]<=block->rpar[1]){
 
11
        block->outptr[0][0]=block->rpar[3];
 
12
      }
 
13
    }else{
 
14
      if (block->mode[0]<2){
 
15
        block->outptr[0][0]=block->rpar[3];
 
16
      }else{
 
17
        block->outptr[0][0]=block->rpar[2];
 
18
      }
 
19
    } 
 
20
  } else if (flag==9){
 
21
    block->g[0]=*block->inptr[0]-(block->rpar[0]);
 
22
    block->g[1]=*block->inptr[0]-(block->rpar[1]);
 
23
    if (get_phase_simulation()==1) {
 
24
      if (block->g[0]>=0){
 
25
        block->mode[0]=2;
 
26
      }else if (block->g[1]<=0){
 
27
        block->mode[0]=1;
 
28
      }
 
29
    }
 
30
  }
 
31
}