module Drasil.GamePhysics.Derivations where

import Language.Drasil (eqSymb, ModelExprC(..), ExprC(..), ModelExpr, LiteralC(..))

import Drasil.GamePhysics.Unitals (timeT, time_1, time_2, velo_1, velo_2)

import qualified Data.Drasil.Quantities.Physics as QP (force, time, velocity,
  acceleration, chgInVelocity)

import qualified Data.Drasil.Quantities.PhysicalProperties as QPP (mass)


impulseVDerivEqn1 :: ModelExpr
impulseVDerivEqn1 :: ModelExpr
impulseVDerivEqn1 =  forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.force forall r. ExprC r => r -> r -> r
$= forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.acceleration
                     forall r. ExprC r => r -> r -> r
$= forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
deriv (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.velocity) UnitalChunk
QP.time

impulseVDerivEqn2 :: ModelExpr -- TODO: Why does defint take a symbol as an argument? Shouldn't it be a UID?
impulseVDerivEqn2 :: ModelExpr
impulseVDerivEqn2 = forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
timeT) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time_1) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time_2) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.force) forall r. ExprC r => r -> r -> r
$=
                    forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass forall r. ExprC r => r -> r -> r
`mulRe` forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
QP.velocity) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
velo_1) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
velo_2) (forall r. LiteralC r => Integer -> r
exactDbl Integer
1)

impulseVDerivEqn3 :: ModelExpr
impulseVDerivEqn3 :: ModelExpr
impulseVDerivEqn3 = forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
timeT) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time_1) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time_2) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.force)
                    forall r. ExprC r => r -> r -> r
$= (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
velo_2) forall r. ExprC r => r -> r -> r
$- (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
velo_1) 
                    forall r. ExprC r => r -> r -> r
$= forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass forall r. ExprC r => r -> r -> r
`mulRe` forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.chgInVelocity
                                      
impulseVDerivEqns :: [ModelExpr]
impulseVDerivEqns :: [ModelExpr]
impulseVDerivEqns = [ModelExpr
impulseVDerivEqn1, ModelExpr
impulseVDerivEqn2, ModelExpr
impulseVDerivEqn3]