From: Permondes Date: Sun, 22 Dec 2024 19:46:56 +0000 (+0100) Subject: Further examples of harmonic oscillation X-Git-Url: https://permondes.de/gitweb/Analog_Engine.git/commitdiff_plain/92b24062f5676c290b5d041358aaa25b49f2f4f2 Further examples of harmonic oscillation Examples: - Calculation of damping of harmonic oscillator; - Forced harmonic oscillator; - 2 coupled pendulums; - Superposition of oscillations Technical Topics: Better understanding of sine/cosine AESL: - Some DIVISIONs are optional; - combining operators with indentation; - direct connection --- diff --git a/Analog Engine Example Applications.odt b/Analog Engine Example Applications.odt index 6152e06..d26398f 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 50ef933..8ec8b44 100644 Binary files a/Analog Engine Scripting Language.odt and b/Analog Engine Scripting Language.odt differ diff --git a/Analog Engine Technical Topics.odt b/Analog Engine Technical Topics.odt index 28d4ff1..f8423c0 100644 Binary files a/Analog Engine Technical Topics.odt and b/Analog Engine Technical Topics.odt differ diff --git a/scripts/EP1 10.01 Damped Harmonic Oscillator.LACE b/scripts/EP1 10.01 Damped Harmonic Oscillator.LACE new file mode 100644 index 0000000..0f03c01 --- /dev/null +++ b/scripts/EP1 10.01 Damped Harmonic Oscillator.LACE @@ -0,0 +1,19 @@ +# Damped_Oscillator +# phi'' = -(S*phi + D/m*phi') + +coefficient.1(-1) -> -phi0 # Initial Amplitude +coefficient.3 -> S # SpringForce +coefficient.4 -> D/m # Damping linear to speed + +iintegrate phi'' -> -phi' +invert -phi' -> phi' +cmultiply phi', D/m -> D/m*phi' + +iintegrate -phi' -> phi + IC: -phi0 +cmultiply S, phi -> S*phi + +isum 10:S*phi, D/m*phi' -> -(Sphi+D/mphi') +assign -(Sphi+D/mphi') -> phi'' + +output(y) -> out.y diff --git a/scripts/EP1 10.02 Forced Harmonic Oscillator.LACE b/scripts/EP1 10.02 Forced Harmonic Oscillator.LACE new file mode 100644 index 0000000..6e51b64 --- /dev/null +++ b/scripts/EP1 10.02 Forced Harmonic Oscillator.LACE @@ -0,0 +1,33 @@ +# Forced Damped_Harmonic Oscillator +# x'' + 2*delta*x' + omega.0^2*x = A cos (omega.f t) + +# generating oscillation with omega.f +# f'' = -omega.f^2*f +coefficient.1(-1) -> -f0 # amplitude +coefficient.2 -> omega^2 +iintegrate f'' -> -f' +iintegrate -f' -> f + IC: -f0 +cmultiply f, omega^2 -> omega^2*f +invert omega^2*f -> -omega^2*f +assign -omega^2*f -> f'' +invert f -> -f +output f -> y + +# forced damped harmonic oscillation +# x'' = -(2*delta*x' + omega.0^2*x) + A cos (omega.f t) +coefficient.5(-1) -> -x0 # amplitude of oscillation +coefficient.6 -> 2*delta # attenuation +coefficient.7 -> omega.0^2 # Eigenfrequency of this oscillator, ^2 + +iintegrate x'' -> -x' +invert -x' -> x' +cmultiply x', 2*delta -> 2*delta*x' + +iintegrate -x' -> x + IC: -x0 +cmultiply x, omega.0^2 -> omega.0^2*x +isum 2*delta*x', omega.0^2*x, -f -> -(2*delta*x'+omega.0^2*x)-f +assign -(2*delta*x'+omega.0^2*x)-f -> x'' + +output(x) -> x diff --git a/scripts/EP1 10.03 Coupled Pendulums.LACE b/scripts/EP1 10.03 Coupled Pendulums.LACE new file mode 100644 index 0000000..5ef0517 --- /dev/null +++ b/scripts/EP1 10.03 Coupled Pendulums.LACE @@ -0,0 +1,34 @@ +# 2 coupled pendulums +# x1'' = -k1*x1 + k*(x2-x1) +# x2'' = -k2*x2 - k*(x2-x1) +# xi are the displacement of the pendulum to its resting position + +coefficient.1 -> k1 +coefficient.2 -> k2 +coefficient.3 -> k +coefficient.5(-1) -> -x10 # initial displacement x1 +coefficient.6(-1) -> -x20 # initial displacement x2 + +iintegrate x1'' -> -x1' +iintegrate -x1' -> x1 + IC: -x10 + +iintegrate x2'' -> -x2' +iintegrate -x2' -> x2 + IC: -x20 + +cmultiply x1, k1 -> k1*x1 +cmultiply x2, k2 -> k2*x2 + +invert x1 -> -x1 +isum x2, -x1 -> -(x2-x1) +cmultiply -(x2-x1), k -> -k*(x2-x1) + +isum k1*x1, -k*(x2-x1) -> -k1*x1+k*(x2-x1) +assign -k1*x1+k*(x2-x1) -> x1'' +invert -k*(x2-x1) -> k*(x2-x1) +isum k2*x2, k*(x2-x1) -> -k2*x2-k*(x2-x1) +assign -k2*x2-k*(x2-x1) -> x2'' + +output x1 -> out.x +output x2 -> out.y diff --git a/scripts/Superposition of oscillations.LACE b/scripts/Superposition of oscillations.LACE new file mode 100644 index 0000000..b25f7e4 --- /dev/null +++ b/scripts/Superposition of oscillations.LACE @@ -0,0 +1,31 @@ +# Superposition of the oscillation of two undamped harmonic oscillators +# x1'' = -omega1^2*x1 +# x2'' = -omega2^2*x2 + +coefficient.1(-1) -> -x10 # amplitude of 1 +coefficient.2 -> omega1^2 +coefficient.5(-1) -> -x20 # amplitude of 2 +coefficient.6 -> omega2^2 + +# 1st oscillator +iintegrate x1'' -> -x1' +iintegrate -x1' -> x1 + IC: -x10 +cmultiply x1, omega1^2 -> omega1^2*x1 +invert omega1^2*x1 -> -omega1^2*x1 +assign -omega1^2*x1 -> x1'' +output x1 -> out.x + +# 2nd oscillator +iintegrate x2'' -> -x2' +iintegrate -x2' -> x2 + IC: -x20 +cmultiply x2, omega2^2 -> omega2^2*x2 +invert omega2^2*x2 -> -omega2^2*x2 +assign -omega2^2*x2 -> x2'' +output x2 -> out.y + +# Sum +isum x1, x2 -> -(x1+x2) +invert -(x1+x2) -> x1+x2 +output x1+x2 -> out.z diff --git a/scripts/TP1 04.12 Harmonic Oscillator.AESL b/scripts/TP1 04.12 Harmonic Oscillator.AESL deleted file mode 100644 index 2c0e512..0000000 --- a/scripts/TP1 04.12 Harmonic Oscillator.AESL +++ /dev/null @@ -1,40 +0,0 @@ -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