1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
3
<!--Converted with LaTeX2HTML 2002-2-1 (1.70)
4
original version by: Nikos Drakos, CBLU, University of Leeds
5
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
6
* with significant contributions from:
7
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
11
<META NAME="description" CONTENT="Scope ">
12
<META NAME="keywords" CONTENT="main">
13
<META NAME="resource-type" CONTENT="document">
14
<META NAME="distribution" CONTENT="global">
16
<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
17
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
19
<LINK REL="STYLESHEET" HREF="main.css">
23
<BODY bgcolor="#FFFFFF">
25
<!--Table of Child-Links-->
26
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
29
<LI><A NAME="tex2html3240"
30
HREF="CSCOPE.htm#SECTION00526100000000000000">Library</A>
31
<LI><A NAME="tex2html3241"
32
HREF="CSCOPE.htm#SECTION00526200000000000000">Description</A>
33
<LI><A NAME="tex2html3242"
34
HREF="CSCOPE.htm#SECTION00526300000000000000">Dialog Box</A>
35
<LI><A NAME="tex2html3243"
36
HREF="CSCOPE.htm#SECTION00526400000000000000">Default properties</A>
37
<LI><A NAME="tex2html3244"
38
HREF="CSCOPE.htm#SECTION00526500000000000000">Interfacing function</A>
39
<LI><A NAME="tex2html3245"
40
HREF="CSCOPE.htm#SECTION00526600000000000000">Computational function (type 4)</A>
42
<!--End of Table of Child-Links-->
45
<H2><A NAME="SECTION00526000000000000000"></A><A NAME="CSCOPE"></A>
51
$\epsfig{file=CSCOPE.eps,width=90.00pt}$
54
WIDTH="143" HEIGHT="161" ALIGN="BOTTOM" BORDER="0"
56
ALT="\epsfig{file=CSCOPE.eps,width=90.00pt}">
58
<H3><font color="blue"><A NAME="SECTION00526100000000000000">
63
<H3><font color="blue"><A NAME="SECTION00526200000000000000">
69
<H3><font color="blue"><A NAME="SECTION00526300000000000000">
73
<TABLE CELLPADDING=3 BORDER="1">
74
<TR><TD ALIGN="CENTER">Set Scope parameters</TD>
77
<TR><TD ALIGN="CENTER">Color (<IMG
78
WIDTH="18" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
80
ALT="$ >$">0) or mark (<IMG
81
WIDTH="18" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
83
ALT="$ <$">0) vector (8 entries)</TD>
84
<TD ALIGN="CENTER">1 3 5 7 9 11 13 15</TD>
86
<TR><TD ALIGN="CENTER">Output window number (-1 for automatic)</TD>
87
<TD ALIGN="CENTER">-1</TD>
89
<TR><TD ALIGN="CENTER">Output window position</TD>
90
<TD ALIGN="CENTER">[]</TD>
92
<TR><TD ALIGN="CENTER">Output window sizes</TD>
93
<TD ALIGN="CENTER">[600;400]</TD>
95
<TR><TD ALIGN="CENTER">Ymin</TD>
96
<TD ALIGN="CENTER">-15</TD>
98
<TR><TD ALIGN="CENTER">Ymax</TD>
99
<TD ALIGN="CENTER">15</TD>
101
<TR><TD ALIGN="CENTER">Refresh period</TD>
102
<TD ALIGN="CENTER">30</TD>
104
<TR><TD ALIGN="CENTER">Buffer size</TD>
105
<TD ALIGN="CENTER">2</TD>
107
<TR><TD ALIGN="CENTER">Accept herited events 0/1</TD>
108
<TD ALIGN="CENTER">0</TD>
110
<TR><TD ALIGN="CENTER">Name of Scope (label&Id)</TD>
111
<TD ALIGN="CENTER"> </TD>
117
<LI>Color : a vector of integers. The i-th element is the color
119
WIDTH="31" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
121
ALT="$ >0$">) or dash type (<IMG
122
WIDTH="31" HEIGHT="32" ALIGN="MIDDLE" BORDER="0"
124
ALT="$ <0$">) used to draw the evolution of the i-th
125
input port signal. See <B>plot2d</B> for color (dash type) definitions.
127
<LI>Output window number :The number of graphic window used for
128
the display. It is often good to use high values to avoid conflict
129
with palettes and Super Block windows. If default value is used <B> (1)</B>, Scicos define the output window number.
131
<LI>Output window position:a 2 vector specifying the coordinates
132
of the upper left corner of the graphic window. Answer [] for
133
default window position.
135
<LI>Output window sizes: a 2 vector specifying the coordinates of
136
the upper left corner of the graphic window. Answer [] for default
139
<LI>Ymin: Minimum values of the input; used to set up the Y-axis
140
of the plot in the graphics window.
142
<LI>Ymax: Maximum values of the input; used to set up the Y-axis
143
of the plot in the graphics window.
145
<LI>Refresh period: Maximum value on the X-axis (time). The plot
146
is redrawn when time reaches a multiple of this value.
148
<LI>Buffer size:To improve efficiency it is possible to buffer the
149
input data. The drawing is only done after each <B>Buffer size</B>
152
<LI>Accept herited events 0/1: if 0 <B>CSCOPE_f</B> draws a new point
153
only when an event occurs on its event input port. if 1 <B>CSCOPE_f</B>
154
draws a new point when an event occurs on its event input port and
155
when it's regular input changes due to an event on an other upstrem
156
block (herited events).
158
<LI>Name of Scope : Name/label of the block.
162
<H3><font color="blue"><A NAME="SECTION00526400000000000000">
163
Default properties</A>
167
<LI>always active: no
169
<LI>direct-feedthrough: yes
171
<LI>zero-crossing: no
175
<LI>number/sizes of inputs: 1 / -1
177
<LI>number/sizes of outputs: 0 /
179
<LI>number/sizes of activation inputs: 1 / 1
181
<LI>number/sizes of activation outputs: 0 /
183
<LI>continuous-time state: no
185
<LI>discrete-time state: yes
187
<LI>name of computational function: <EM>cscope</EM>
190
<H3><font color="blue"><A NAME="SECTION00526500000000000000">
191
Interfacing function</A>
193
<TT>scilab/macros/scicos_blocks/sinks/CSCOPE.sci</TT>
195
<H3><font color="blue"><A NAME="SECTION00526600000000000000">
196
Computational function (type 4)</A>
199
<PRE>#include "scicos_block.h"
200
#include <math.h>
201
#include "../machine.h"
209
static int c_n1 = -1;
211
static int c__21 = 21;
213
static double c_b84 = 0.;
215
void cscope(scicos_block *block,int flag)
220
int *ipar, nipar,nu,kfun;
223
/* Initialized data */
225
static double frect[4] = { 0.,0.,1.,1. };
231
static double rect[4];
232
extern int C2F(getlabel)(), C2F(dset)();
233
static double ymin, ymax;
234
static int i__, k, n, v;
237
extern int C2F(plot2d)(), C2F(setscale2d)();
239
extern int C2F(dr)();
240
static double dt, dv;
242
extern int C2F(sciwin)(), C2F(dr1)(), C2F(scicosclip)();
246
static int nax[4], iwp;
248
/* Copyright INRIA */
249
/* Scicos block simulator */
250
/* ipar(1) = win_num */
251
/* ipar(2) = 0/1 color flag */
252
/* ipar(3) = buffer size */
253
/* ipar(4:11) = line type for ith curve */
255
/* ipar(12:13) : window position */
256
/* ipar(14:15) : window dimension */
261
/* rpar(4)=periode */
263
nu=block->insz[0];
267
nipar=block->nipar;
270
/* character*(4) logf */
271
/* Parameter adjustments */
280
wid=20000+get_block_number();
293
n1 = (int) (z__[k + 1] / per);
294
if (z__[k + 1] < 0.) {
306
n2 = (int) (t / per);
311
/* add new point to the buffer */
314
for (i = 0; i < nu; ++i) {
315
z__[n + 1 + i * n + k] = block->inptr[0][i];
319
if (n1 == n2 && k < n) {
324
/* plot 1:K points of the buffer */
325
C2F(dr1)("xget\000", "window\000", &verb, &cur, &na, &v, &v, &v, &dv, &dv,
328
C2F(dr1)("xset\000", "window\000", &wid, &v, &v, &v, &v, &v, &dv, &dv,
331
C2F(dr1)("xsetdr\000", "Rec\000", &v, &v, &v, &v, &v, &v, &dv, &dv, &dv, &
334
C2F(scicosclip)(&c__1);
335
for (i__ = 0; i__ < nu; ++i__) {
336
C2F(dr1)("xpolys\000", "v\000", &v, &v, &ipar[i__ + 4], &c__1, &k,
337
&v, &z__[2], &z__[n + 2 + i__ * n], &dv, &dv);
339
C2F(scicosclip)(&c__0);
341
/* shift buffer left */
343
for (i__ = 0; i__ < nu; ++i__) {
344
z__[n + 1 + i__ * n + 1] = z__[n + 1 + i__ * n + k];
353
C2F(dr1)("xclear\000", "v\000", &v, &v, &v, &v, &v, &v, &dv, &dv, &dv,
355
C2F(dr1)("xset\000", "use color\000", &ipar[2], &c__0, &c__0, &c__0, &
356
c__0, &v, &dv, &dv, &dv, &dv);
357
C2F(dr)("xstart\000", "v\000", &wid, &v, &v, &v, &v, &v, &dv, &dv, &
359
rect[0] = per * (n1 + 1);
361
rect[2] = per * (n1 + 2);
363
C2F(dr1)("xset\000", "dashes\000", &c__0, &c__0, &c__0, &c__0, &c__0,
364
&v, &dv, &dv, &dv, &dv);
365
C2F(plot2d)(rect, &rect[1], &c__1, &c__1, &c_n1, "011", buf, rect, nax,
366
&c__4, &c__21);
370
} else if (flag == 4) {/* the workspace is used to store buffer
372
if ((*block->work=
373
scicos_malloc(sizeof(double)*(1+ipar[3]*(1+nu))))== NULL ) {
374
set_block_error(-16);
390
n1 = (int) (t / per);
395
C2F(dr1)("xset\000", "window\000", &wid, &v, &v, &v, &v, &v, &dv, &dv, &
397
C2F(dr1)("xsetdr\000", "Rec\000", &v, &v, &v, &v, &v, &v, &dv, &dv, &dv, &
399
if (ipar[iwp] >= 0) {
400
C2F(dr1)("xset\000", "wpos\000", &ipar[iwp], &ipar[iwp + 1], &v, &v, &
401
v, &v, &dv, &dv, &dv, &dv);
403
if (ipar[iwd] >= 0) {
404
C2F(dr1)("xset\000", "wdim\000", &ipar[iwd], &ipar[iwd + 1], &v, &v, &
405
v, &v, &dv, &dv, &dv, &dv);
406
/* to force dimensions update */
407
C2F(dr1)("xset\000", "window\000", &wid, &v, &v, &v, &v, &v, &dv, &dv,
410
rect[0] = per * (n1 + 1);
412
rect[2] = per * (n1 + 2);
414
C2F(setscale2d)(frect, rect, "nn\000");
415
C2F(dr1)("xset\000", "use color\000", &ipar[2], &c__0, &c__0, &c__0, &
416
c__0, &v, &dv, &dv, &dv, &dv);
417
C2F(dr1)("xset\000", "alufunction\000", &c__3, &c__0, &c__0, &c__0, &c__0,
418
&v, &dv, &dv, &dv, &dv);
419
C2F(dr1)("xclear\000", "v\000", &v, &v, &v, &v, &v, &v, &dv, &dv, &dv, &
421
C2F(dr)("xstart\000", "v\000", &wid, &v, &v, &v, &v, &v, &dv, &dv, &dv, &
423
C2F(dr1)("xset\000", "dashes\000", &c__0, &c__0, &c__0, &c__0, &c__0, &v,
424
&dv, &dv, &dv, &dv);
425
C2F(plot2d)(rect, &rect[1], &c__1, &c__1, &c_n1, "011", buf, rect, nax, &
427
C2F(scicosclip)(&c__1);
429
kfun=get_block_number();
430
C2F(getlabel)(&kfun, buf, &nxname);
431
if (nxname > 39) {
436
if ((nxname == 1 && *(unsigned char *)buf == ' ') || (nxname == 0)) {
438
C2F(dr)("xname\000", buf, &v, &v, &v, &v, &v, &v, &dv, &dv, &dv, &dv);
443
C2F(dset)(&i__1, &c_b84, &z__[3], &c__1);
444
} else if (flag == 5) {
450
scicos_free(*block->work);
453
C2F(dr1)("xget\000", "window\000", &verb, &cur, &na, &v, &v, &v, &dv, &dv,
456
C2F(dr1)("xset\000", "window\000", &wid, &v, &v, &v, &v, &v, &dv, &dv,
459
C2F(scicosclip)(&c__1);
460
for (i__ = 0; i__ < nu; ++i__) {
461
C2F(dr1)("xpolys\000", "v\000", &v, &v, &ipar[i__ + 4], &c__1, &k, &v,
462
&z__[2], &z__[n + 2 + i__ * n], &dv, &dv);
464
C2F(scicosclip)(&c__0);
465
scicos_free(*block->work);