summaryrefslogtreecommitdiffstats
path: root/scilab/modules/scicos_blocks
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2010-02-24 15:21:46 +0100
committerAllan CORNET <allan.cornet@scilab.org>2010-02-24 15:21:46 +0100
commitaad2ec90416e9f41d0e500940572d8b644205a52 (patch)
treec8f1b820b44b4f7b7f8bfca2b6b9f59f9f6a37b3 /scilab/modules/scicos_blocks
parent361cc60ffd6e24a2f592c6079f7bee824288c9cc (diff)
downloadscilab-aad2ec90416e9f41d0e500940572d8b644205a52.zip
scilab-aad2ec90416e9f41d0e500940572d8b644205a52.tar.gz
bug 6672
Diffstat (limited to 'scilab/modules/scicos_blocks')
-rw-r--r--scilab/modules/scicos_blocks/src/c/absblk.c24
-rw-r--r--scilab/modules/scicos_blocks/src/c/andlog.c25
-rw-r--r--scilab/modules/scicos_blocks/src/c/cosblk.c29
-rw-r--r--scilab/modules/scicos_blocks/src/c/dband.c41
-rw-r--r--scilab/modules/scicos_blocks/src/c/gain.c23
5 files changed, 104 insertions, 38 deletions
diff --git a/scilab/modules/scicos_blocks/src/c/absblk.c b/scilab/modules/scicos_blocks/src/c/absblk.c
index 9b09c04..fe5b0f1 100644
--- a/scilab/modules/scicos_blocks/src/c/absblk.c
+++ b/scilab/modules/scicos_blocks/src/c/absblk.c
@@ -35,12 +35,26 @@
35 * Scicos block simulator 35 * Scicos block simulator
36 * returns Absolute value of the input 36 * returns Absolute value of the input
37 *------------------------------------------------*/ 37 *------------------------------------------------*/
38SCICOS_BLOCKS_IMPEXP void absblk( flag, nevprt, t, xd, x, nx, z, nz, tvec, 38SCICOS_BLOCKS_IMPEXP void absblk(int *flag, int *nevprt, double *t, double *xd,
39 ntvec, rpar, nrpar, ipar, nipar, u, nu, y, ny) 39 double *x, int *nx, double *z, int *nz,
40 int *flag, *nevprt,*nx,*nz,*nrpar, *ipar, *nipar,*ntvec,*nu,*ny; 40 double *tvec, int *ntvec, double *rpar,
41 double *t, *xd, *x, *z, *tvec, *rpar, *u, *y; 41 int *nrpar, int *ipar, int *nipar, double *u,
42 int *nu, double *y, int *ny)
42{ 43{
43 int i = 0; 44 int i = 0;
44 for (i = 0 ; i < *nu ; ++i ) y[i] = Abs(u[i]); 45 for (i = 0 ; i < *nu ; ++i )
46 {
47 y[i] = Abs(u[i]);
48 }
45} 49}
46/*--------------------------------------------------------------------------*/ 50/*--------------------------------------------------------------------------*/
51SCICOS_BLOCKS_IMPEXP void C2F(absblk)(int *flag, int *nevprt, double *t, double *xd,
52 double *x, int *nx, double *z, int *nz,
53 double *tvec, int *ntvec, double *rpar,
54 int *nrpar, int *ipar, int *nipar, double *u,
55 int *nu, double *y, int *ny)
56{
57 absblk(flag, nevprt, t, xd, x, nx, z, nz, tvec,
58 ntvec, rpar, nrpar, ipar, nipar, u, nu, y, ny);
59}
60/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/scicos_blocks/src/c/andlog.c b/scilab/modules/scicos_blocks/src/c/andlog.c
index fab2fb5..ae76ef2 100644
--- a/scilab/modules/scicos_blocks/src/c/andlog.c
+++ b/scilab/modules/scicos_blocks/src/c/andlog.c
@@ -30,19 +30,32 @@
30 * A set of elementary blocks 30 * A set of elementary blocks
31 *------------------------------------------------*/ 31 *------------------------------------------------*/
32 32
33
34/*------------------------------------------------ 33/*------------------------------------------------
35 * Scicos block simulator 34 * Scicos block simulator
36 * Logical and block 35 * Logical and block
37 * if event input exists synchronuously, output is 1 else -1 36 * if event input exists synchronuously, output is 1 else -1
38 *------------------------------------------------*/ 37 *------------------------------------------------*/
39 38
40SCICOS_BLOCKS_IMPEXP void andlog(flag, nevprt, t, xd, x, nx, z, nz, tvec, 39SCICOS_BLOCKS_IMPEXP void andlog(int *flag, int *nevprt, double *t, double *xd,
41 ntvec, rpar, nrpar, ipar, nipar, u, nu, y, ny) 40 double *x, int *nx, double *z, int *nz,
42 int *flag, *nevprt,*nx,*nz,*nrpar, *ipar, *nipar,*ntvec,*nu,*ny; 41 double *tvec, int *ntvec, double *rpar,
43 double *t, *xd, *x, *z, *tvec, *rpar, *u, *y; 42 int *nrpar, int *ipar, int *nipar, double *u,
43 int *nu, double *y, int *ny)
44{
45 if ( *flag == 1)
46 {
47 y[0] = ( *nevprt != 3 ) ? -1.00 : 1.00;
48 }
49}
50/*--------------------------------------------------------------------------*/
51SCICOS_BLOCKS_IMPEXP void C2F(andlog)(int *flag, int *nevprt, double *t, double *xd,
52 double *x, int *nx, double *z, int *nz,
53 double *tvec, int *ntvec, double *rpar,
54 int *nrpar, int *ipar, int *nipar, double *u,
55 int *nu, double *y, int *ny)
44{ 56{
45 if ( *flag == 1) y[0] = ( *nevprt != 3 ) ? -1.00 : 1.00; 57 andlog(flag, nevprt, t, xd, x, nx, z, nz, tvec, ntvec, rpar, nrpar, ipar,
58 nipar, u, nu, y, ny);
46} 59}
47/*--------------------------------------------------------------------------*/ 60/*--------------------------------------------------------------------------*/
48 61
diff --git a/scilab/modules/scicos_blocks/src/c/cosblk.c b/scilab/modules/scicos_blocks/src/c/cosblk.c
index f77001d..68c15a0 100644
--- a/scilab/modules/scicos_blocks/src/c/cosblk.c
+++ b/scilab/modules/scicos_blocks/src/c/cosblk.c
@@ -33,15 +33,28 @@
33 * Scicos block simulator 33 * Scicos block simulator
34 * 34 *
35 *------------------------------------------------*/ 35 *------------------------------------------------*/
36 36SCICOS_BLOCKS_IMPEXP void cosblk(int *flag, int *nevprt, double *t,
37SCICOS_BLOCKS_IMPEXP void cosblk (flag, nevprt, t, xd, x, nx, z, nz, tvec, 37 double *xd, double *x, int *nx, double *z,
38 ntvec, rpar, nrpar, ipar, nipar, u, nu, y, ny) 38 int *nz, double *tvec, int *ntvec,
39 int *flag, *nevprt,*nx,*nz,*nrpar, *ipar, *nipar,*ntvec,*nu,*ny; 39 double *rpar, int *nrpar, int *ipar,
40 double *t, *xd, *x, *z, *tvec, *rpar, *u, *y; 40 int *nipar, double *u, int *nu, double *y,
41 int *ny)
41{ 42{
42
43 int i = 0; 43 int i = 0;
44 for ( i=0; i < *nu ; i++) y[i]= cos(u[i]); 44 for (i = 0; i < *nu ; i++)
45 {
46 y[i] = cos(u[i]);
47 }
48}
49/*--------------------------------------------------------------------------*/
50SCICOS_BLOCKS_IMPEXP void C2F(cosblk)(int *flag, int *nevprt, double *t,
51 double *xd, double *x, int *nx, double *z,
52 int *nz, double *tvec, int *ntvec,
53 double *rpar, int *nrpar, int *ipar,
54 int *nipar, double *u, int *nu, double *y,
55 int *ny)
56{
57 cosblk(flag, nevprt, t, xd, x, nx, z, nz, tvec,
58 ntvec, rpar, nrpar, ipar, nipar, u, nu, y, ny);
45} 59}
46/*--------------------------------------------------------------------------*/ 60/*--------------------------------------------------------------------------*/
47
diff --git a/scilab/modules/scicos_blocks/src/c/dband.c b/scilab/modules/scicos_blocks/src/c/dband.c
index 785e988..64dc034 100644
--- a/scilab/modules/scicos_blocks/src/c/dband.c
+++ b/scilab/modules/scicos_blocks/src/c/dband.c
@@ -38,19 +38,34 @@
38 * DB(i)=rpar(i) 38 * DB(i)=rpar(i)
39 *------------------------------------------------*/ 39 *------------------------------------------------*/
40 40
41SCICOS_BLOCKS_IMPEXP void dband (flag, nevprt, t, xd, x, nx, z, nz, tvec, 41SCICOS_BLOCKS_IMPEXP void dband (int *flag, int *nevprt, double*t, double*xd,
42 ntvec, rpar, nrpar, ipar, nipar, u, nu, y, ny) 42 double *x, int *nx, double*z, int *nz,
43 int *flag, *nevprt,*nx,*nz,*nrpar, *ipar, *nipar,*ntvec,*nu,*ny; 43 double *tvec, int *ntvec, double *rpar,
44 double *t, *xd, *x, *z, *tvec, *rpar, *u, *y; 44 int *nrpar, int *ipar, int *nipar, double*u,
45 int *nu, double *y, int *ny)
45{ 46{
46 int i = 0; 47 int i = 0;
47 48
48 for ( i=0 ; i < *nu ; i++ ) 49 for ( i = 0 ; i < *nu ; i++ )
49 { 50 {
50 if ( u[i] < 0 ) 51 if ( u[i] < 0 )
51 y[i] = Min(0.00,u[i]+rpar[i]/2.00); 52 {
52 else 53 y[i] = Min(0.00, u[i] + rpar[i] / 2.00);
53 y[i] = Max(0.00,u[i]-rpar[i]/2.00); 54 }
54 } 55 else
56 {
57 y[i] = Max(0.00, u[i] - rpar[i] / 2.00);
58 }
59 }
60}
61/*--------------------------------------------------------------------------*/
62SCICOS_BLOCKS_IMPEXP void C2F(dband) (int *flag, int *nevprt, double*t, double*xd,
63 double *x, int *nx, double*z, int *nz,
64 double *tvec, int *ntvec, double *rpar,
65 int *nrpar, int *ipar, int *nipar, double*u,
66 int *nu, double *y, int *ny)
67{
68 dband (flag, nevprt, t, xd, x, nx, z, nz, tvec, ntvec, rpar,
69 nrpar, ipar, nipar, u, nu, y, ny);
55} 70}
56/*--------------------------------------------------------------------------*/ 71/*--------------------------------------------------------------------------*/
diff --git a/scilab/modules/scicos_blocks/src/c/gain.c b/scilab/modules/scicos_blocks/src/c/gain.c
index 897421c..9d01921 100644
--- a/scilab/modules/scicos_blocks/src/c/gain.c
+++ b/scilab/modules/scicos_blocks/src/c/gain.c
@@ -26,12 +26,23 @@
26#include "scicos.h" 26#include "scicos.h"
27#include "dynlib_scicos_blocks.h" 27#include "dynlib_scicos_blocks.h"
28/*--------------------------------------------------------------------------*/ 28/*--------------------------------------------------------------------------*/
29SCICOS_BLOCKS_IMPEXP void gain(flag, nevprt, t, xd, x, nx, z, nz, tvec, 29SCICOS_BLOCKS_IMPEXP void gain(int *flag, int *nevprt, double *t,
30 ntvec, rpar, nrpar, ipar, nipar, u, nu, y, ny) 30 double*xd, double*x, int*nx, double *z, int *nz,
31 int *flag, *nevprt,*nx,*nz,*nrpar, *ipar, *nipar,*ntvec,*nu,*ny; 31 double *tvec, int *ntvec, double *rpar,
32 double *t, *xd, *x, *z, *tvec, *rpar, *u, *y; 32 int *nrpar, int *ipar, int *nipar, double *u,
33 int *nu, double *y, int *ny)
33{ 34{
34 int un = 1; 35 int one = 1;
35 C2F(dmmul)(rpar,ny,u,nu,y,ny,ny,nu,&un); 36 C2F(dmmul)(rpar,ny,u,nu,y,ny,ny,nu,&one);
37}
38/*--------------------------------------------------------------------------*/
39SCICOS_BLOCKS_IMPEXP void C2F(gain)(int *flag, int *nevprt, double *t,
40 double*xd, double*x, int*nx, double *z, int *nz,
41 double *tvec, int *ntvec, double *rpar,
42 int *nrpar, int *ipar, int *nipar, double *u,
43 int *nu, double *y, int *ny)
44{
45 gain(flag, nevprt, t, xd, x, nx, z, nz, tvec,
46 ntvec, rpar, nrpar, ipar, nipar, u, nu, y, ny);
36} 47}
37/*--------------------------------------------------------------------------*/ 48/*--------------------------------------------------------------------------*/