/[james]/archive/accelerate/Accelera.opl
ViewVC logotype

Contents of /archive/accelerate/Accelera.opl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21 - (show annotations) (download)
Thu Mar 13 11:51:30 2003 UTC (21 years, 8 months ago) by james
File size: 1930 byte(s)
Initial import.

1 PROC m:
2 GLOBAL a$(10),s$(10),t$(25),u$(25),v$(25)
3 STATUSWIN ON
4 FONT 12,0
5 gAT RND*gWIDTH,RND*gHEIGHT
6 DO
7 IF i:
8 c:
9 ELSE
10 a$="" :s$="" :t$="" :u$="" :v$=""
11 ENDIF
12 gLINETO RND*gWIDTH,RND*gHEIGHT
13 UNTIL 0
14 ENDP
15
16 PROC i:
17 LOCAL d%
18 dINIT
19 dTEXT "","Uniform acceleration: enter 3 values",$302
20 dEDIT a$,"Acceleration (a) ms-ý"
21 dEDIT s$,"Displacement (s) m"
22 dEDIT t$,"Time (t) s"
23 dEDIT u$,"Initial velocity (u) ms-û"
24 dEDIT v$,"Final velocity (v) ms-û"
25 dBUTTONS "Exit",-27,"Clear all",-9,"Calculate",13
26 d%=DIALOG
27 IF d%=0 :STOP :ENDIF
28 RETURN (d%=13)
29 ENDP
30
31 PROC c:
32 LOCAL a,s,t,u,v,t%,u1,u2,v1,v2,t1,t2
33
34 ONERR error1
35 IF a$<>"" :a=EVAL(a$) :ENDIF
36 IF s$<>"" :s=EVAL(s$) :ENDIF
37 IF t$<>"" :t=EVAL(t$) :ENDIF
38 IF u$<>"" :u=EVAL(u$) :ENDIF
39 IF v$<>"" :v=EVAL(v$) :ENDIF
40 ONERR OFF
41
42 t%=-(a$<>"")*10000-(s$<>"")*1000-(t$<>"")*100-(u$<>"")*10-(v$<>"")
43
44 ONERR error2
45 IF t%=00111 :s=0.5*(u+v)*t :a=(v-u)/t
46 ELSEIF t%=01011 :t=s/(0.5*(u+v)) :a=(v-u)/t
47 ELSEIF t%=01101 :u=(2*s)/t-v :a=(v-u)/t
48 ELSEIF t%=01110 :v=(2*s)/t-u :a=(v-u)/t
49 ELSEIF t%=10011 :t=(v-u)/a :s=0.5*(u+v)*t
50 ELSEIF t%=10101 :u=v-a*t :s=0.5*(u+v)*t
51 ELSEIF t%=10110 :v=u+a*t :s=0.5*(u+v)*t
52 ELSEIF t%=11001 :u1=SQR(v*v-2*a*s) :t1=(v-u1)/a :u2=-u1 :t2=(v-u2)/a :u=&7fffffff
53 ELSEIF t%=11010 :v1=SQR(u*u+2*a*s) :t1=(v1-u)/a :v2=-v1 :t2=(v2-u)/a :v=&7fffffff
54 ELSEIF t%=11100 :u=(s-0.5*a*t*t)/t :v=u+a*t
55 ELSE ONERR OFF :GIPRINT "Enter 3 values!",1 :RETURN
56 ENDIF
57 ONERR OFF
58
59 a$=GEN$(a,10)
60 s$=GEN$(s,10)
61 IF u=&7fffffff OR v=&7fffffff
62 t$=GEN$(t1,10)+" or "+GEN$(t2,10)
63 ELSE
64 t$=GEN$(t,10)
65 ENDIF
66 IF u=&7fffffff
67 u$=GEN$(u1,10)+" or "+GEN$(u2,10)
68 ELSE
69 u$=GEN$(u,10)
70 ENDIF
71 IF v=&7fffffff
72 v$=GEN$(v1,10)+" or "+GEN$(v2,10)
73 ELSE
74 v$=GEN$(v,10)
75 ENDIF
76 RETURN
77
78 error1::
79 ONERR OFF
80 GIPRINT "Entry error: "+ERR$(ERR),1
81 RETURN
82 error2::
83 ONERR OFF
84 GIPRINT "Calculation error: "+ERR$(ERR),1
85 RETURN
86 ENDP

  ViewVC Help
Powered by ViewVC 1.1.26