diff --git a/PendulumPython/pend.py b/PendulumPython/pend.py index b9d0d43938b4c52bedff68543fe2a4540197b065..a51e28e78f78f38b54b11e392b84295fd98efa19 100644 --- a/PendulumPython/pend.py +++ b/PendulumPython/pend.py @@ -57,7 +57,7 @@ time = c.defineNumber('Dyna/time [s]', value=0.0) dt = c.defineNumber('Dyna/time step [s]', value=0.001) tmax = c.defineNumber('Dyna/max time [s]', value=20) refresh = c.defineNumber('Dyna/refresh interval [s]', value=0.1) -theta0 = c.defineNumber('Init/initial theta angle [deg]', value=10, +theta0 = c.defineNumber('Init/initial theta angle [deg]', value=10, attributes={'Highlight':'Pink'}) phi0 = c.defineNumber('Init/initial phi angle [deg]', value=180, attributes={'Highlight':'Pink'}) @@ -71,7 +71,7 @@ if c.action == 'check' : exit(0) # In 'compute' mode, the code enters a loop and performs the actual computation. - + l1 = l; l2 = l; m1 = m; @@ -93,13 +93,13 @@ while (time < tmax): + m2*l2*(phi_dot**2.0)*sdelta - (m1+m2)*g*math.sin(theta) ) theta_dot_dot /= ( (m1+m2)*l1 - m2*l1*(cdelta)**2.0 ) - + phi_dot_dot = ( -m2*l2*(phi_dot**2.0)*sdelta*cdelta + (m1+m2)*(g*math.sin(theta)*cdelta - l1*(theta_dot**2.0)*sdelta - g*math.sin(phi)) ) phi_dot_dot /= ( (m1+m2)*l2 - m2*l2*(cdelta)**2.0 ) - + theta_dot = theta_dot + theta_dot_dot*dt phi_dot = phi_dot + phi_dot_dot*dt