# - red: y
-1 -> InitialPosition -> -y0 # -initial position of the mass
-1 -> InitialSpeed -> y0s’ # y’ is scaled to be within -1..+1
-+1, y0s’, y0s’ -> Summer.1 -> y0’
++1, y0s’, y0s’ -> Summer -> y0’
-y’’, IC:y0’ -> INTEGRATOR.1 -> -y’
--y’,IC:-y0 -> INTEGRATOR.2 -> y
+y’’, IC:y0’ -> INTEGRATOR -> -y’
+-y’,IC:-y0 -> INTEGRATOR -> y
y -> SpringForce -> S*y # springforce times displacement
--y’ -> INVERTER.1 -> y’
+-y’ -> INVERTER -> y’
y’ -> Damping -> D*y’ # damping times speed
-10:S*y, 10:D*y’ -> SUMMER.2 -> -(Dy’+Sy)
+10:S*y, 10:D*y’ -> SUMMER -> -(Dy’+Sy)
-(Dy’+Sy) -> Mass -> -1/m*(Dy’+Sy)=y’’
OPERATION DIVISION
DATA DIVISION
OUTPUT OUTPUT.U y
-ALIAS COEFFICIENT.1 InitialPosition
-ALIAS COEFFICIENT.2 InitialSpeed
-ALIAS COEFFICIENT.3 SpringForce
-ALIAS COEFFICIENT.4 Damping # linear to speed
-ALIAS COEFFICIENT.5 Mass # 1 / mass
+COEFFICIENT.1 InitialPosition
+COEFFICIENT.2 InitialSpeed
+COEFFICIENT.3 SpringForce
+COEFFICIENT.4 Damping # linear to speed
+COEFFICIENT.5 Mass # 1 / mass
PROGRAM DIVISION
# Colors being used for wiring
# - green: y0’’
# - yellow: y’’, y’
# - red: y
--1 -> InitialPosition -> -y0 # -initial position of the mass
--1 -> InitialSpeed -> y0s’ # y’ is scaled to be within -1..+1
-+1, y0s’, y0s’ -> Summer.1 -> y0’
-y’’, IC:y0’ -> INTEGRATOR.1 -> -y’
--y’,IC:-y0 -> INTEGRATOR.2 -> y
-y -> SpringForce -> S*y # springforce times displacement
--y’ -> INVERTER.1 -> y’
-y’ -> Damping -> D*y’ # damping times speed
-S*y, D*y’ -> SUMMER.2 -> -(Dy’+Sy)
--(Dy’+Sy) -> Mass -> -1/m*(Dy’+Sy)=y’’
+-1 -> COEFFICIENT.InitialPosition -> -y0 # -initial position of the mass
+-1 -> COEFFICIENT.InitialSpeed -> y0s’ # y’ is scaled to be within -1..+1
++1, y0s’, y0s’ -> SUMMER -> y0’
+y’’, IC:y0’ -> INTEGRATOR -> -y’
+-y’,IC:-y0 -> INTEGRATOR -> y
+y -> COEFFICIENT.SpringForce -> S*y # springforce times displacement
+-y’ -> INVERTER -> y’
+y’ -> COEFFICIENT.Damping -> D*y’ # damping times speed
+S*y, D*y’ -> SUMMER -> -(Dy’+Sy)
+-(Dy’+Sy) -> COEFFICIENT.Mass -> -1/m*(Dy’+Sy)=y’’
OPERATION DIVISION
MODE REPEAT
ENVIRONMENT DIVISION
ENGINE Anabrid-THAT
-REQUIRES Coefficient 2
-REQUIRES Integrator 1
-REQUIRES Inverter 1
+REQUIRES COEFFICIENT 2
+REQUIRES INTEGRATOR 1
+REQUIRES INVERTER 1
DATA DIVISION
OUTPUT OUTPUT.X N
-ALIAS COEFFICIENT.1 InitialValue
-ALIAS COEFFICIENT.2 Decay
+COEFFICIENT.1 InitialValue
+COEFFICIENT.2 Decay
PROGRAM DIVISION
-+1 -> InitialValue -> N0
-N’, IC:N0 -> Integrator.1 -> -N
--N -> Decay -> -lambda*N=N’
--N -> Inverter.1 -> N
++1 -> COEFFICIENT.InitialValue -> N0
+N’, IC:N0 -> INTEGRATOR -> -N
+-N -> COEFFICIENT.Decay -> -lambda*N=N’
+-N -> INVERTER -> N
OPERATION DIVISION
MODE REPEAT
ENVIRONMENT DIVISION
ENGINE Anabrid-THAT
TIMEBASE 1ms # corresponds to 1s
-REQUIRES INTEGRATOR 4
-REQUIRES INVERTER 1
-REQUIRES COEFFICIENT 3
+REQUIRES INTEGRATOR 4, INVERTER 1, COEFFICIENT 3
DATA DIVISION
OUTPUT OUTPUT.X x
OUTPUT OUTPUT.Z z
+COEFFICIENT.1 OMEGA_X # -omega for x'
+COEFFICIENT.2 A*OMEGA^2
+COEFFICIENT.3 OMEGA_z # omega for z'
PROGRAM DIVISION
-x'' -> INTEGRATOR.1 -> -x'
--x' -> INTEGRATOR.2 -> x
--x' -> COEFFICIENT.6 -> -omega*x'
-+1 -> COEFFICIENT.7 -> a*omega^2
-a*omega^2, -omega*x' -> INTEGRATOR.4 -> -z' # input is z''
--z' -> INTEGRATOR.5 -> z
--z' -> INVERTER.1 -> z'
-z' -> COEFFICIENT.5 -> omega*z' = x''
+x'' -> INTEGRATOR -> -x'
+-x' -> INTEGRATOR -> x
+-x' -> COEFFICIENT.OMEGA_X -> -omega*x'
++1 -> COEFFICIENT.A*OMEGA^2 -> a*omega^2
+a*omega^2, -omega*x' -> INTEGRATOR -> -z' # input is z''
+-z' -> INTEGRATOR -> z
+-z' -> INVERTER -> z'
+z' -> COEFFICIENT.OMEGA_Z -> omega*z' = x''
OPERATION DIVISION
MODE REPEAT
-1 -> COEFFICIENT.6 -> -y0
-1 -> COEFFICIENT.7 -> -x0
-x'' -> INTEGRATOR.1 -> -x'
--x', IC:-x0 -> INTEGRATOR.2 -> x
-y'' -> INTEGRATOR.3 -> -y'
--y', IC:-y0 -> INTEGRATOR.4 -> y
-x,y -> MULTIPLIER.1 -> x*y
-y,y -> MULTIPLIER.2 -> y^2
+x'' -> INTEGRATOR -> -x'
+-x', IC:-x0 -> INTEGRATOR -> x
+y'' -> INTEGRATOR -> -y'
+-y', IC:-y0 -> INTEGRATOR -> y
+x,y -> MULTIPLIER -> x*y
+y,y -> MULTIPLIER -> y^2
x*y -> COEFFICIENT.1 -> 3g/a²*x*y/10
y^2 -> COEFFICIENT.2 -> 3g/a²*y^2/10
x -> COEFFICIENT.3 -> 2g/a*x/10
y -> COEFFICIENT.4 -> 2g/a*y/10
-2g/a*x/10 -> INVERTER.1 -> -2g/a*x/10
-2g/a*y/10 -> INVERTER.2 -> -2g/a*y/10
-10:3g/a²*x*y/10, 10:-2g/a*x/10 -> SUMMER.1 -> -x''
--x'' -> INVERTER.3 -> x''
-10:3g/a²*y^2/10, 10:-2g/a*y/10, 1:-g -> SUMMER.2 -> -y''
--y'' -> INVERTER.4 -> y''
+2g/a*x/10 -> INVERTER -> -2g/a*x/10
+2g/a*y/10 -> INVERTER -> -2g/a*y/10
+10:3g/a²*x*y/10, 10:-2g/a*x/10 -> SUMMER -> -x''
+-x'' -> INVERTER -> x''
+10:3g/a²*y^2/10, 10:-2g/a*y/10, 1:-g -> SUMMER -> -y''
+-y'' -> INVERTER -> y''
OPERATION DIVISION
MODE REPEAT
IDENTIFICATION DIVISION
PROGRAM-ID TwoRaindrops
-VERSION 20240131
+VERSION 20240201
COMMENT Two raindrops of same size and altitude are falling from a cloud.
COMMENT How long does it take until the touch?
COMMENT s'' = -2*gamma*m/s^2
DATA DIVISION
OUTPUT OUTPUT.X s_limited
-COEFFICIENT.1 2*radius of the raindrop
-COEFFICIENT.2 initial distance -s0
-COEFFICIENT.3 2*gamma*m
+COEFFICIENT.1 MIN_DISTANCE # 2*radius of the raindrop
+COEFFICIENT.2 INIT_DISTANCE # initial distance -s0
+COEFFICIENT.3 FACTOR # 2*gamma*m
PROGRAM DIVISION
-+1 -> COEFFICIENT.1 -> 2r
-2r -> INVERTER.1 -> -2r
--1 -> COEFFICIENT.2 -> -s0
-+1 -> COEFFICIENT.3 -> 2gamma*m
-s'' -> INTEGRATOR.1 -> -s'
--s', IC:-s0 -> INTEGRATOR.2 -> s
++1 -> COEFFICIENT.MIN_DISTANCE -> 2r
+2r -> INVERTER -> -2r
+-1 -> COEFFICIENT.INIT_DISTANCE -> -s0
++1 -> COEFFICIENT.FACTOR -> 2gamma*m
+s'' -> INTEGRATOR -> -s'
+-s', IC:-s0 -> INTEGRATOR -> s
# The raindrops may only approach until they touch. Our model does not include their unification
-A:s, B:-2r, GT0:s, LT0:2r -> COMPARATOR.1 -> s_limited
+A:s, B:-2r, GT0:s, LT0:2r -> COMPARATOR -> s_limited
-s_limited,s_limited -> MULTIPLIER.1 -> s^2
+s_limited,s_limited -> MULTIPLIER -> s^2
# division 2gamma*m / s^2
# Open amplifier is realized on THAT by FB:SUMMER.GND -> SUMMER
2gamma*m, inp2 -> OPEN-AMP -> -2gamma*m/s^2=s''
-2gamma*m^2, s^2 -> MULTIPLIER.2 -> inp2
+2gamma*m^2, s^2 -> MULTIPLIER -> inp2
OPERATION DIVISION
MODE REPEAT
--- /dev/null
+IDENTIFICATION DIVISION
+PROGRAM-ID HarmonicOscillator
+VERSION 20240201
+COMMENT A mass m is subject to a force F=-k*r.
+COMMENT What is the trajectory if the mass starts at position (a,0,0)?
+COMMENT How much time does it take to pass through zero?
+COMMENT What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)?
+COMMENT m*x'' = -k*x
+COMMENT m*y'' = -k*y (z can be set to 0).
+
+ENVIRONMENT DIVISION
+ENGINE Anabrid-THAT
+TIMEBASE 1ms
+REQUIRES COEFFICIENT 4, INTEGRATOR 4, INVERTER 2
+
+DATA DIVISION
+OUTPUT OUTPUT.X x
+OUTPUT OUTPUT.Y y
+COEFFICIENT.1 A # (a,0,0)
+COEFFICIENT.2 K/M_x # k/m for x
+COEFFICIENT.3 V0 # (0,v0,0)
+COEFFICIENT.4 K/M_y # k/m for y, identical to k/m for x
+
+PROGRAM DIVISION
+-1 -> COEFFICIENT.A -> -a # has to be negative because x' is negative
++1 -> COEFFICIENT.V0 -> v0 # has to be positive because y'' is positive
+
+x'' -> INTEGRATOR -> -x'
+-x', IC:-a -> INTEGRATOR -> x
+x -> COEFFICIENT.K/M_x -> k/m*x
+k/m*x -> INVERTER -> -k/m*x = x''
+
+y'', IC:v0 -> INTEGRATOR -> -y'
+-y' -> INTEGRATOR -> y
+y -> COEFFICIENT.K/M_y -> k/m*y
+k/m*y -> INVERTER -> -k/m*y = y''
+
+OPERATION DIVISION
+MODE REPEAT
+OP-TIME 100 ms
OUTPUT OUTPUT.Y ...
OUTPUT OUTPUT.Z ...
OUTPUT OUTPUT.U ...
-ALIAS ...
COEFFICIENT.n ...
PROGRAM DIVISION