From: Permondes Date: Thu, 1 Feb 2024 08:55:59 +0000 (+0100) Subject: Harmonic Oscillator basics, some changes to AESL X-Git-Url: https://permondes.de/gitweb/Analog_Engine.git/commitdiff_plain/6e8a139250e34cbc1c5e161bc5b27411430edd37?ds=inline;hp=ae9d78b70625763cb86e8eeaf4949d3824dc230d Harmonic Oscillator basics, some changes to AESL Applicaton: new Harmonic Oscillator basics Scripting language: - Operators are not numbered any more . Coefficients are addressed by their “name” - Removed ALIAS, it does not support readability --- diff --git a/AESL/Damped Harmonic Osciallator scaled.AESL b/AESL/Damped Harmonic Osciallator scaled.AESL index 06a7a9e..8bae8f3 100644 --- a/AESL/Damped Harmonic Osciallator scaled.AESL +++ b/AESL/Damped Harmonic Osciallator scaled.AESL @@ -26,14 +26,14 @@ PROGRAM DIVISION # - 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 diff --git a/AESL/Damped Harmonic Oscillator.AESL b/AESL/Damped Harmonic Oscillator.AESL index 12a995e..7451fcb 100644 --- a/AESL/Damped Harmonic Oscillator.AESL +++ b/AESL/Damped Harmonic Oscillator.AESL @@ -10,11 +10,11 @@ REQUIRES SUMMER 2 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 @@ -23,16 +23,16 @@ PROGRAM DIVISION # - 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 diff --git a/AESL/Radioactive Decay.AESL b/AESL/Radioactive Decay.AESL index e225eef..ef7fcdf 100644 --- a/AESL/Radioactive Decay.AESL +++ b/AESL/Radioactive Decay.AESL @@ -3,20 +3,20 @@ PROGRAM-ID Radioactive_Decay 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 diff --git a/AESL/Charge in em field.AESL b/AESL/TP1 03.08 Charge in em field.AESL similarity index 55% rename from AESL/Charge in em field.AESL rename to AESL/TP1 03.08 Charge in em field.AESL index 2a301fc..e56c9bd 100644 --- a/AESL/Charge in em field.AESL +++ b/AESL/TP1 03.08 Charge in em field.AESL @@ -9,23 +9,24 @@ COMMENT good start settings are omega=0,92, a*omega^2=0,05 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 diff --git a/AESL/4.10 MassOnSphere.AESL b/AESL/TP1 04.10 MassOnSphere.AESL similarity index 77% rename from AESL/4.10 MassOnSphere.AESL rename to AESL/TP1 04.10 MassOnSphere.AESL index 795a794..b6dfbbe 100644 --- a/AESL/4.10 MassOnSphere.AESL +++ b/AESL/TP1 04.10 MassOnSphere.AESL @@ -36,22 +36,22 @@ PROGRAM DIVISION -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 diff --git a/AESL/4.11 TwoRaindrops.AESL b/AESL/TP1 04.11 TwoRaindrops.AESL similarity index 58% rename from AESL/4.11 TwoRaindrops.AESL rename to AESL/TP1 04.11 TwoRaindrops.AESL index 4c83095..2f67350 100644 --- a/AESL/4.11 TwoRaindrops.AESL +++ b/AESL/TP1 04.11 TwoRaindrops.AESL @@ -1,6 +1,6 @@ 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 @@ -12,27 +12,27 @@ REQUIRES COEFFICIENT 3, INVERTER 1, INTEGRATOR 2, COMPARATOR 1, MULTIPLIER 2, OP 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 diff --git a/AESL/TP1 04.12 Harmonic Oscillator.AESL b/AESL/TP1 04.12 Harmonic Oscillator.AESL new file mode 100644 index 0000000..2c0e512 --- /dev/null +++ b/AESL/TP1 04.12 Harmonic Oscillator.AESL @@ -0,0 +1,40 @@ +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 diff --git a/AESL/Template.AESL b/AESL/Template.AESL index 7807ae7..48143fb 100644 --- a/AESL/Template.AESL +++ b/AESL/Template.AESL @@ -14,7 +14,6 @@ OUTPUT OUTPUT.X ... OUTPUT OUTPUT.Y ... OUTPUT OUTPUT.Z ... OUTPUT OUTPUT.U ... -ALIAS ... COEFFICIENT.n ... PROGRAM DIVISION diff --git a/Analog Engine Example Applications.odt b/Analog Engine Example Applications.odt index c308074..ec40f5f 100644 Binary files a/Analog Engine Example Applications.odt and b/Analog Engine Example Applications.odt differ diff --git a/Analog Engine Scripting Language.odt b/Analog Engine Scripting Language.odt index 03a362e..d45a6c1 100644 Binary files a/Analog Engine Scripting Language.odt and b/Analog Engine Scripting Language.odt differ