Wednesday, October 27, 2010

Force and Drag

clg
fastgraphics
rem Initial variables
speed = 0:density=1.2 : area=2:pullforce=1000
mass=1400: dist =0 :time=0 :dragcoef=.35
dt=0.005 : c=0
font "arial",15,15
while speed<200
drag=0.5*density*speed^2*area*dragcoef
acc=((pullforce-drag)/mass)*dt
clg
speed = speed + acc
dist = dist + (speed)*dt
time = time + dt
text 10,10 ,"Time "+int(time)+" sec"
text 10,30, "Speed "+int(speed)+"m/s "+int(speed*3.6)+"km/h"
text 10,50 ,"Distance "+int(dist)+"m"
text 10,70 ,"Acceleration "+((pullforce-drag)/mass)+"m/s^2"
text 10,90 ,"Work "+int(dist*pullforce/1000)+" kj"
text 10,110 ,"Power "+int(speed*pullforce/1000)+" kw "+int(speed*pullforce/750)+"hp"
c=c + (speed)*dt
text 150,220," |''''''|'''''''|''''\"
text 150,235," |''''''|'''''''|'''''o"
text 150,250," '-(0)---(0)='"
text 1-c,255,"......................................."+(dist-c)+"m .............................................................."
if 150-c<0 then c=c-150
refresh
end while

No comments:

Post a Comment