module Drasil.PDController.ODEs where

import Language.Drasil.Code (odeInfo', odeOptions, quantvar, ODEInfo,
    ODEMethod(RK45), ODEOptions)
import Language.Drasil.CodeExpr (LiteralC(exactDbl), ExprC(sy))

import Drasil.PDController.Unitals (qdSetPointTD, qdPropGain, qdDerivGain,
    qdSimTime, qdStepTime, odeRelTolConst, odeAbsTolConst)
import Language.Drasil(InitialValueProblem, makeAIVP)
import Drasil.PDController.IModel(imPDRC)


pidODEOptions :: ODEOptions
pidODEOptions :: ODEOptions
pidODEOptions = ODEMethod -> CodeExpr -> CodeExpr -> CodeExpr -> ODEOptions
odeOptions 
  ODEMethod
RK45 (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstQDef
odeAbsTolConst) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstQDef
odeRelTolConst) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdStepTime)

pdIVP :: InitialValueProblem
pdIVP :: InitialValueProblem
pdIVP = Expr -> Expr -> [Expr] -> InitialValueProblem
makeAIVP (forall r. LiteralC r => Integer -> r
exactDbl Integer
0) (forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdSimTime) [forall r. LiteralC r => Integer -> r
exactDbl Integer
0, forall r. LiteralC r => Integer -> r
exactDbl Integer
0]

pidODEInfo :: ODEInfo
pidODEInfo :: ODEInfo
pidODEInfo = [CodeVarChunk]
-> ODEOptions
-> DifferentialModel
-> InitialValueProblem
-> ODEInfo
odeInfo'
  [forall c. (Quantity c, MayHaveUnit c) => c -> CodeVarChunk
quantvar QuantityDict
qdPropGain, forall c. (Quantity c, MayHaveUnit c) => c -> CodeVarChunk
quantvar QuantityDict
qdDerivGain, forall c. (Quantity c, MayHaveUnit c) => c -> CodeVarChunk
quantvar QuantityDict
qdSetPointTD]
  ODEOptions
pidODEOptions
  DifferentialModel
imPDRC
  InitialValueProblem
pdIVP