2
/* Code prototype for standalone use */
3
/* Generated by Code_Generation toolbox of Scicos with scilab-2.6 */
4
/* date : 15-Feb-2002 */
10
void thermmain1(double *z, double *t, double * rpar, integer *nrpar,
11
integer *ipar,integer *nipar);
13
void thermmain2(double *z, double *t, double * rpar, integer *nrpar,
14
integer *ipar,integer *nipar) ;
16
void therm_init(double *z, double *t, double * rpar, integer *nrpar,
17
integer *ipar,integer *nipar) ;
19
void therm_end(double *z, double *t, double * rpar, integer *nrpar,
20
integer *ipar,integer * nipar) ;
22
void therm_sim(double tf) ;
24
void therm_events(int *nevprt, double *t);
26
void set_nevprt(int nevprt);
27
static double RPAR1[ ] = {0,0,6,-6,10,-10,1,1,0.1,0};
28
static integer NRPAR1 = 10;
29
static integer IPAR1[ ]= {1,1,1,2};
30
static integer NIPAR1 = 4;
39
/*---------------------------------------- External simulation function */
49
double z[]={0,0,0,0,0,0,6,-6,10,-10,-10,10,0,-6,-6,0,0,0,0,0,0,0,0,0,
50
0,0,0,0,0,0,0,0,0,0,0};
52
therm_init(z,&t,RPAR1,&NRPAR1,IPAR1,&NIPAR1);
54
therm_events(&nevprt,&t);
56
thermmain1(z,&t,RPAR1,&NRPAR1,IPAR1,&NIPAR1);
57
thermmain2(z,&t,RPAR1,&NRPAR1,IPAR1,&NIPAR1);
59
therm_end(z,&t,RPAR1,&NRPAR1,IPAR1,&NIPAR1);
62
/*---------------------------------------- Lapack messag function */
64
C2F(xerbla)(SRNAME,INFO,L)
69
printf("** On entry to %s, parameter number %d had an illegal value\n",SRNAME,*INFO);
71
/*---------------------------------------- External events handling function */
73
therm_events(int *nevprt,double *t)
75
/* set next event time and associated events ports
76
* nevprt has binary expression b1..b1 where bi is a bit
77
* bi is set to 1 if an activation is received by port i. Note that
78
* more than one activation can be received simultaneously
79
* Caution: at least one bi should be equal to one */
87
*nevprt=*nevprt+b[i]*p;
90
/*---------------------------------------- Actuators */
92
therm_actuator(flag,nport,nevprt,t,u,nu)
94
* To be customized for standalone execution
95
* flag : specifies the action to be done
96
* nport : specifies the index of the Super Bloc
97
* regular input (The input ports are numbered
98
* from the top to the bottom )
99
* nevprt: indicates if an activation had been received
102
* t : the current time value
103
* u : the vector inputs value
104
* nu : the input vector size
106
integer *flag,*nevprt,*nport;
113
case 1 :/* Port number 1 ----------*/
114
/* skeleton to be customized */
118
printf("t=%4.1f | | out1 = %6.2f | |\n",*t,u[0]);
120
case 4 : /* actuator initialisation */
121
/* do whatever you want to initialize the actuator */
123
case 5 : /* actuator ending */
124
/* do whatever you want to end the actuator */
128
case 2 :/* Port number 2 ----------*/
132
printf("t=%4.1f | | | OUT2 = %6.2f |\n",*t,u[0]);
134
case 4 : /* actuator initialisation */
135
/* do whatever you want to initialize the actuator */
137
case 5 : /* actuator ending */
138
/* do whatever you want to end the actuator */
144
/*---------------------------------------- Sensor */
146
therm_sensor(flag,nport,nevprt,t,y,ny)
148
* To be customized for standalone execution
149
* flag : specifies the action to be done
150
* nport : specifies the index of the Super Bloc
151
* regular input (The input ports are numbered
152
* from the top to the bottom )
153
* nevprt: indicates if an activation had been received
156
* t : the current time value
157
* y : the vector outputs value
158
* ny : the output vector size
160
integer *flag,*nevprt,*nport;
169
case 1 : /* set the ouput value */
170
/* skeleton to be customized */
172
fscanf(fd,"%e\n",&tmp);y[0]=tmp;
173
printf("t=%4.1f | in = %6.2f | | |\n",*t,y[0]);
175
case 2 : /* Update internal discrete state if any */
177
case 4 : /* sensor initialisation */
178
/* do whatever you want to initialize the sensor */
179
fd=fopen("data","r");/* CUST: added */
181
case 5 : /* sensor ending */
182
/* do whatever you want to end the sensor */
183
fclose(fd);/* CUST: added */