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 = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.force ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.acceleration
                     ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
deriv (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
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 = Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
timeT) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time_1) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time_2) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.force) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$=
                    UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
QP.velocity) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
velo_1) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
velo_2) (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1)

impulseVDerivEqn3 :: ModelExpr
impulseVDerivEqn3 :: ModelExpr
impulseVDerivEqn3 = Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
timeT) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time_1) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time_2) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.force)
                    ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
velo_2) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
velo_1) 
                    ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
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]