+IDENTIFICATION DIVISION
+PROGRAM-ID MassInTube
+VERSION 20240214
+COMMENT A thin tube rotates at a constant angular velocity perpendicular to gravity
+COMMENT A mass point moves frictionless in this tube. The differential equation gives the position of this mass point.
+COMMENT r''=omega^2*r -g*sin(omega*t+phi0)
+
+ENVIRONMENT DIVISION
+ENGINE Anabrid-THAT
+TIMEBASE 1ms
+REQUIRES COEFFICIENT 8, INTEGRATOR 4, INVERTER 1, MULTIPLIER 2
+
+DATA DIVISION
+OUTPUT OUTPUT.X x
+OUTPUT OUTPUT.Y y
+COEFFICIENT.1 ICw'
+COEFFICIENT.2 ICw
+COEFFICIENT.3 OMEGAC
+COEFFICIENT.4 OMEGAS # same as OMEGAC
+COEFFICIENT.5 G
+COEFFICIENT.6 R0 # r(0)
+COEFFICIENT.7 V0 # r'(0)
+COEFFICIENT.8 OMEGA^2 # = OMEGAC*OMEGAS
+
+PROGRAM DIVISION
+### Generating sin(omega*t+phi0) ###
++1 -> COEFFICIENT.ICw’ -> icw’
+-1 -> COEFFICIENT.ICw -> -icw
+w’’, IC:icw’ -> INTEGRATOR -> -w’=-cos
+-w' -> COEFFICIENT.OMEGAC -> -omega*w'
+-omega*w', IC:-icw -> INTEGRATOR -> w=sin
+w -> INVERTER -> -w=-sin
+-w -> COEFFICIENT.OMEGAS -> -omega^2*w=w’’
+
+### the actual problem ###
+-sin -> COEFFICIENT.G -> -g*sin
+-1 -> COEFFICIENT.R0 -> -r0
++1 -> COEFFICIENT.V0 -> v0
+omega^2*r, -g*sin,IC:v0 -> INTEGRATOR -> -r' # input is r''
+-r',IC:-r0 -> INTEGRATOR -> r
+r -> COEFFICIENT.OMEGA^2 -> omega^2*r
+
+### Converting r, phi to x,y coordinates for display ###
+r, sin -> MULTIPLIER -> x
+r, -cos -> MULTIPLIER -> y # y-axis shall go down according to gravity, thus negativ input
+
+OPERATION DIVISION
+MODE REPEAT
+OP-TIME 17,5ms