module Drasil.DblPend.Expressions where

import Prelude hiding (sin, cos, sqrt)
import Language.Drasil

import Data.Drasil.Quantities.Physics (gravitationalAccel, gravitationalMagnitude)
import Drasil.DblPend.DataDefs (positionXEqn_1)
import Drasil.DblPend.Unitals (lenRod_1, lenRod_2, massObj_1, massObj_2,
  xVel_1, yVel_1, xAccel_1, yAccel_1, angularAccel_1, angularAccel_2,
  tension_1, tension_2, angularVel_1, angularVel_2,
  pendDisAngle_1, pendDisAngle_2)

-- Velocity X/Y First Object
velXExpr_1, velYExpr_1 :: PExpr
velXExpr_1 :: PExpr
velXExpr_1 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1)
velYExpr_1 :: PExpr
velYExpr_1 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_1 forall r. ExprC r => r -> r -> r
`mulRe` PExpr
positionXEqn_1

-- Velocity X/Y Second Object
velXExpr_2, velYExpr_2 :: PExpr
velXExpr_2 :: PExpr
velXExpr_2 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
xVel_1 forall r. ExprC r => r -> r -> r
`addRe` (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))
velYExpr_2 :: PExpr
velYExpr_2 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
yVel_1 forall r. ExprC r => r -> r -> r
`addRe` (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))

-- Acceleration X/Y First Object
accelXExpr_1, accelYExpr_1 :: PExpr
accelXExpr_1 :: PExpr
accelXExpr_1 = forall r. ExprC r => r -> r
neg (forall r. (ExprC r, LiteralC r) => r -> r
square (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_1) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1))
                forall r. ExprC r => r -> r -> r
`addRe` (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularAccel_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1))
accelYExpr_1 :: PExpr
accelYExpr_1 = (forall r. (ExprC r, LiteralC r) => r -> r
square (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_1) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1))
                forall r. ExprC r => r -> r -> r
`addRe` (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularAccel_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1))

-- Acceleration X/Y Second Object
accelXExpr_2, accelYExpr_2 :: PExpr
accelXExpr_2 :: PExpr
accelXExpr_2 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
xAccel_1 forall r. ExprC r => r -> r -> r
$-
                (forall r. (ExprC r, LiteralC r) => r -> r
square (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_2) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))
                forall r. ExprC r => r -> r -> r
`addRe` (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularAccel_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))
accelYExpr_2 :: PExpr
accelYExpr_2 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
yAccel_1 forall r. ExprC r => r -> r -> r
`addRe`
                (forall r. (ExprC r, LiteralC r) => r -> r
square (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_2) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))
                forall r. ExprC r => r -> r -> r
`addRe` (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularAccel_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))

-- Horizontal/Vertical force acting on the first object
xForceWithAngle_1 :: PExpr
xForceWithAngle_1 :: PExpr
xForceWithAngle_1 = forall r. ExprC r => r -> r
neg (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tension_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1)) forall r. ExprC r => r -> r -> r
`addRe`
                    (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tension_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))

yForceWithAngle_1 :: PExpr
yForceWithAngle_1 :: PExpr
yForceWithAngle_1 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tension_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1) forall r. ExprC r => r -> r -> r
$- 
                    (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tension_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2)) forall r. ExprC r => r -> r -> r
$- 
                    (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
gravitationalAccel)

-- Horizontal/Vertical force acting on the second object
xForceWithAngle_2 :: PExpr
xForceWithAngle_2 :: PExpr
xForceWithAngle_2 = forall r. ExprC r => r -> r
neg (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tension_2) forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2)

yForceWithAngle_2 :: PExpr
yForceWithAngle_2 :: PExpr
yForceWithAngle_2 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tension_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2) forall r. ExprC r => r -> r -> r
$- 
                    (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
gravitationalAccel)

-- Angular acceleration acting on the first object
angularAccelExpr_1 :: PExpr
angularAccelExpr_1 :: PExpr
angularAccelExpr_1 = forall r. ExprC r => r -> r
neg(forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
gravitationalMagnitude) forall r. ExprC r => r -> r -> r
`mulRe`
                   (forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_1 forall r. ExprC r => r -> r -> r
`addRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2) forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1 ) forall r. ExprC r => r -> r -> r
$-
                   (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
gravitationalMagnitude forall r. ExprC r => r -> r -> r
`mulRe`
                   forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1 forall r. ExprC r => r -> r -> r
$- (forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))) forall r. ExprC r => r -> r -> r
$-
                   ((forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1 forall r. ExprC r => r -> r -> r
$- forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2 )) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 forall r. ExprC r => r -> r -> r
`mulRe`
                   (
                       forall r. (ExprC r, LiteralC r) => r -> r
square (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_2) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`addRe` 
                       (forall r. (ExprC r, LiteralC r) => r -> r
square (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_1) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_1 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1 forall r. ExprC r => r -> r -> r
$- forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2))
                   ))
                   forall r. ExprC r => r -> r -> r
$/
                   forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_1 forall r. ExprC r => r -> r -> r
`mulRe` 
                   (
                       forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_1 forall r. ExprC r => r -> r -> r
`addRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 forall r. ExprC r => r -> r -> r
$- 
                       (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 forall r. ExprC r => r -> r -> r
`mulRe` 
                       forall r. ExprC r => r -> r
cos (forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1  forall r. ExprC r => r -> r -> r
$- (forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2)))
                   )

-- Angular acceleration acting on the first object
angularAccelExpr_2 :: PExpr
angularAccelExpr_2 :: PExpr
angularAccelExpr_2 = forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1 forall r. ExprC r => r -> r -> r
$- forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2) forall r. ExprC r => r -> r -> r
`mulRe`
                   (
                       forall r. (ExprC r, LiteralC r) => r -> r
square (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_1) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_1 forall r. ExprC r => r -> r -> r
`mulRe` (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_1 forall r. ExprC r => r -> r -> r
`addRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 ) forall r. ExprC r => r -> r -> r
`addRe`
                       (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
gravitationalMagnitude forall r. ExprC r => r -> r -> r
`mulRe` (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_1 forall r. ExprC r => r -> r -> r
`addRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 ) forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1)) forall r. ExprC r => r -> r -> r
`addRe`
                       (forall r. (ExprC r, LiteralC r) => r -> r
square (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
angularVel_2) forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 forall r. ExprC r => r -> r -> r
`mulRe` 
                       forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1 forall r. ExprC r => r -> r -> r
$- forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2 ))
                   )
                   forall r. ExprC r => r -> r -> r
$/
                   forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
lenRod_2 forall r. ExprC r => r -> r -> r
`mulRe` 
                   (
                       forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_1 forall r. ExprC r => r -> r -> r
`addRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 forall r. ExprC r => r -> r -> r
$- 
                       (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massObj_2 forall r. ExprC r => r -> r -> r
`mulRe` 
                       forall r. ExprC r => r -> r
cos (forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1  forall r. ExprC r => r -> r -> r
$- (forall r. LiteralC r => Integer -> r
exactDbl Integer
2 forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2)))
                   )

-- Angular acceleration support equations in IM
forceDerivExpr1 :: PExpr
forceDerivExpr1 :: PExpr
forceDerivExpr1 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tension_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2)
forceDerivExpr2 :: PExpr
forceDerivExpr2 :: PExpr
forceDerivExpr2 = forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tension_2 forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2)

cosAngleExpr1 :: PExpr
cosAngleExpr1 :: PExpr
cosAngleExpr1 = forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1)
sinAngleExpr1 :: PExpr
sinAngleExpr1 :: PExpr
sinAngleExpr1 = forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_1)

cosAngleExpr2 :: PExpr
cosAngleExpr2 :: PExpr
cosAngleExpr2 = forall r. ExprC r => r -> r
cos (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2)
sinAngleExpr2 :: PExpr
sinAngleExpr2 :: PExpr
sinAngleExpr2 = forall r. ExprC r => r -> r
sin (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pendDisAngle_2)