Trailing-Edge
-
PDP-10 Archives
-
decuslib20-03
-
decus/20-0078/demos/cadsim.dem
There is 1 other file named cadsim.dem in the archive. Click here to see a list.
00100 BEGIN
00200 EXTERNAL PROCEDURE abort;
00300 EXTERNAL REF(Infile) PROCEDURE findinfile;
00400 EXTERNAL REF(Outfile) PROCEDURE findoutfile;
00500 EXTERNAL TEXT PROCEDURE conc,upcase,frontstrip,rest,
00600 checkextension;
00700 EXTERNAL CHARACTER PROCEDURE fetchar,findtrigger;
00800 EXTERNAL LONG REAL PROCEDURE scanreal;
00900 EXTERNAL INTEGER PROCEDURE checkreal,checkint,scanint,ilog;
01000 EXTERNAL BOOLEAN PROCEDURE menu;
01100 EXTERNAL CLASS simeio,cadsim;
01200 cadsim(NOTEXT,"ENG") BEGIN
01300 continuous CLASS harmonic;
01400 BEGIN
01500 PROCEDURE derivatives(t);REAL t;
01600 BEGIN
01700 rate[1]:=state[2];
01800 rate[2]:=-(r*state[2]+s*state[1])/m;
01900 END DERIVATIVES;
02000
02100 state[1]:=1;
02200 state[2]:=0;
02300 min_h:=0.0001;
02400 max_h:=0.1;
02500 error_limit:=0.01;
02600 integrate(TRUE,10);
02700 REACTIVATE Main BEFORE spy;
02800 END HARMONIC;
02900
03000 nondiscrete CLASS spion(harmoni);
03100 REF(harmonic)harmoni;
03200 BEGIN
03300 WHILE TRUE DO BEGIN
03400 REACTIVATE THIS nondiscrete BEFORE harmoni;
03500 INSPECT harmoni DO BEGIN
03600 INSPECT utfil DO BEGIN
03700 Outreal(time,4,11);Outreal(state[1],4,11);
03800 Outreal(state[2],4,11); Outreal(rate[1],4,11);
03900 Outreal(rate[2],4,11);Outimage;
04000 END UTFIL;
04100 END HARMONI;
04200 REACTIVATE THIS nondiscrete AFTER harmoni;
04300 END WHILE;
04400 END SPION;
04500
04600 REF(Outfile)utfil;REF(harmonic)wave;REF(spion)spy;
04700 REAL s,m,r;
04800 outtext("I AM GOING TO SOLVE A SECOND ORDER DIFFERENTIAL EQUATION OF THE FORM");outimage;
04900 outtext("M*Y''+R*Y'+S*Y=0 USING cadsim");outimage;outimage;
05000 request("PLEASE GIVE ME YOUR 'M':",nodefault,realinput(m,m>0),"M MUST BE GREATER THAN ZERO",nohelp);
05100 request("PLEASE GIVE ME YOUR 'R':",nodefault,realinput(r,TRUE),"",nohelp);
05200 request("PLEASE GIVE ME YOUR 'S':",nodefault,realinput(s,TRUE),"",nohelp);
05300 utfil:-NEW Outfile("TEST.RST");
05400 wave:-NEW harmonic(2);
05500 spy:-NEW spion(wave);
05600 utfil.Open(Blanks(60));
05700 ACTIVATE wave; ACTIVATE spy;
05800 hold (4711);
05900 utfil.Close;
06000 END cadsim;
06100 END O P;