
| Current Path : /home/ift/52_procpy/dataninja/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //home/ift/52_procpy/dataninja/SIM.py |
import random
#*******************************************************
def rand (a,b):
return(random.randint(a,b))
#*******************************************************
def sim02 (Pos,Veloc,Force,ziel):
DAEMPFUNG = 395.0/random.randint(400,600)
while (0 == 0):
Pos. insert(0,None)
Veloc.insert(0,None)
Pos[0] = Pos[1] + Veloc[1]
Veloc[0] = DAEMPFUNG * (ziel - Pos[1])
if abs(ziel - Pos[0]) < 0.001:
Pos.reverse()
Veloc.reverse()
break
return(DAEMPFUNG)
#******************************************************
def sim03 (ZIEL,DAEMPFUNG,KF,FF):
(POS,FORCE,KOMP,VELOC) = ([],[],[],[])
while (0 == 0):
POS .append(0.0)
FORCE.append(0.0)
KOMP .append(0.0)
VELOC.append(0.0)
if len(POS) > 1:
VELOC[-1] = DAEMPFUNG * (ZIEL - POS[-2])
POS[-1] = POS[-2] + VELOC[-2] - KOMP[-2]
KOMP[-1] = KF * FORCE[-2]
x = max(0,ZIEL - POS[-2])
FORCE[-1] = FF * x
print(ZIEL,POS[-1],FORCE[-1],KOMP[-1],VELOC[-1])
if abs(ZIEL - POS[-1]) < 0.01 and abs(VELOC[-1]) < 0.01:
return(POS,FORCE,KOMP,VELOC)