{-# LANGUAGE PostfixOperators #-}
module Drasil.PDController.IModel where

import Data.Drasil.Quantities.Physics (time)
import Drasil.PDController.Assumptions
import Drasil.PDController.Concepts
import Drasil.PDController.DataDefs
import Drasil.PDController.GenDefs
import Drasil.PDController.References
import Drasil.PDController.TModel
import Language.Drasil
import Theory.Drasil (InstanceModel, im, qwC, newDEModel')
import Utils.Drasil (weave)
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S
import Drasil.PDController.Unitals

instanceModels :: [InstanceModel]
instanceModels :: [InstanceModel]
instanceModels = [InstanceModel
imPD]

----------------------------------------------

imPD :: InstanceModel
imPD :: InstanceModel
imPD
  = ModelKind Expr
-> Inputs
-> QuantityDict
-> OutputConstraints
-> [DecRef]
-> Maybe Derivation
-> String
-> [Sentence]
-> InstanceModel
im (DifferentialModel -> ModelKind Expr
forall e. DifferentialModel -> ModelKind e
newDEModel' DifferentialModel
imPDRC)
      [QuantityDict -> RealInterval Expr Expr -> Input
forall q.
(Quantity q, MayHaveUnit q) =>
q -> RealInterval Expr Expr -> Input
qwC QuantityDict
qdSetPointTD (RealInterval Expr Expr -> Input)
-> RealInterval Expr Expr -> Input
forall a b. (a -> b) -> a -> b
$ (Inclusive, Expr) -> RealInterval Expr Expr
forall b a. (Inclusive, b) -> RealInterval a b
UpFrom (Inclusive
Exc, Integer -> Expr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0), QuantityDict -> RealInterval Expr Expr -> Input
forall q.
(Quantity q, MayHaveUnit q) =>
q -> RealInterval Expr Expr -> Input
qwC QuantityDict
qdPropGain (RealInterval Expr Expr -> Input)
-> RealInterval Expr Expr -> Input
forall a b. (a -> b) -> a -> b
$ (Inclusive, Expr) -> RealInterval Expr Expr
forall b a. (Inclusive, b) -> RealInterval a b
UpFrom (Inclusive
Exc, Integer -> Expr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0),
       QuantityDict -> RealInterval Expr Expr -> Input
forall q.
(Quantity q, MayHaveUnit q) =>
q -> RealInterval Expr Expr -> Input
qwC QuantityDict
qdDerivGain (RealInterval Expr Expr -> Input)
-> RealInterval Expr Expr -> Input
forall a b. (a -> b) -> a -> b
$ (Inclusive, Expr) -> RealInterval Expr Expr
forall b a. (Inclusive, b) -> RealInterval a b
UpFrom (Inclusive
Exc, Integer -> Expr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0)]
      (QuantityDict -> QuantityDict
forall q. (Quantity q, MayHaveUnit q) => q -> QuantityDict
qw QuantityDict
qdProcessVariableTD)
      [(Inclusive, Expr) -> RealInterval Expr Expr
forall b a. (Inclusive, b) -> RealInterval a b
UpFrom (Inclusive
Exc, Integer -> Expr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0)]
      [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
abbasi2015, Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
johnson2008]
      (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
imDeriv)
      String
"pdEquationIM"
      []

imPDRC :: DifferentialModel
imPDRC :: DifferentialModel
imPDRC
  = UnitalChunk
-> ConstrConcept
-> LHS
-> Expr
-> String
-> NP
-> Sentence
-> DifferentialModel
makeASingleDE
      UnitalChunk
time
      ConstrConcept
opProcessVariable
      LHS
lhs
      Expr
rhs
      String
"imPDRC"
      (String -> NP
nounPhraseSP String
"Computation of the Process Variable as a function of time")
      Sentence
EmptyS
      where lhs :: LHS
lhs = [Integer -> Expr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1 Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdDerivGain Expr -> Integer -> Term
$** (ConstrConcept
opProcessVariable ConstrConcept -> Integer -> Integer
$^^ Integer
1)]
                  LHS -> Term -> LHS
$++ (Integer -> Expr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1 Expr -> Integer -> Term
$** (ConstrConcept
opProcessVariable ConstrConcept -> Integer -> Integer
$^^ Integer
2))
                  LHS -> Term -> LHS
$++ (Integer -> Expr
forall r. LiteralC r => Integer -> r
exactDbl Integer
20 Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain Expr -> Integer -> Term
$** (ConstrConcept
opProcessVariable ConstrConcept -> Integer -> Integer
$^^ Integer
0))
            rhs :: Expr
rhs = QuantityDict -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdSetPointTD Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain
      -- Matrix form: 
      -- coeffs = [[exactDbl 1, exactDbl 1 $+ sy qdDerivGain, exactDbl 20 $+ sy qdPropGain]]
      -- unknowns = [2, 1, 0]
      -- constants = [sy qdSetPointTD $* sy qdPropGain]

imDeriv :: Derivation
imDeriv :: Derivation
imDeriv
  = Sentence -> [Sentence] -> Derivation
mkDerivName (ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
processVariable)
      ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [[Sentence]
imDerivStmts, (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
imDerivEqns])

imDerivStmts :: [Sentence]
imDerivStmts :: [Sentence]
imDerivStmts = [Sentence
derivStmt1, Sentence
derivStmt2, Sentence
derivStmt3, Sentence
derivStmt4]

imDerivEqns :: [ModelExpr]
imDerivEqns :: [ModelExpr]
imDerivEqns = [ModelExpr
derivEqn1, ModelExpr
derivEqn2, ModelExpr
derivEqn3, ModelExpr
derivEqn4]

derivStmt1 :: Sentence
derivStmt1 :: Sentence
derivStmt1
  = [Sentence] -> Sentence
foldlSent
      [NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
processVariable), QuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' QuantityDict
qdProcessVariableFD, String -> Sentence
S String
"in a", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
pidCL Sentence -> Sentence -> Sentence
+:+
         String -> Sentence
S String
"is the product" Sentence -> Sentence -> Sentence
`S.ofThe` ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
processError, DataDefinition -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource DataDefinition
ddErrSig Sentence -> Sentence -> Sentence
`sC`
         ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
controlVariable, DataDefinition -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource DataDefinition
ddCtrlVar Sentence -> Sentence -> Sentence
`sC` Sentence
EmptyS
         Sentence -> Sentence -> Sentence
`S.andThe` ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
powerPlant, GenDefn -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource GenDefn
gdPowerPlant]

derivEqn1 :: ModelExpr
derivEqn1 :: ModelExpr
derivEqn1
  = QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableFD
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdSetPointFD ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableFD)
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdDerivGain ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdFreqDomain))
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> ModelExpr
forall r. (ExprC r, LiteralC r) => r -> r
recip_ (ModelExpr -> ModelExpr
forall r. (ExprC r, LiteralC r) => r -> r
square (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdFreqDomain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdFreqDomain ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
20)

derivStmt2 :: Sentence
derivStmt2 :: Sentence
derivStmt2 = (String -> Sentence
S String
"Substituting the values and rearranging the equation" !.)

derivEqn2 :: ModelExpr
derivEqn2 :: ModelExpr
derivEqn2
  = ModelExpr -> ModelExpr
forall r. (ExprC r, LiteralC r) => r -> r
square (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdFreqDomain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableFD
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ ((Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdDerivGain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableFD ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdFreqDomain)
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ ((Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
20 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableFD)
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdSetPointFD ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdFreqDomain ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdDerivGain)
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdSetPointFD ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0

derivStmt3 :: Sentence
derivStmt3 :: Sentence
derivStmt3
  = String -> Sentence
S String
"Computing the" Sentence -> Sentence -> Sentence
+:+ QuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase QuantityDict
qdInvLaplaceTransform Sentence -> Sentence -> Sentence
+:+
     TheoryModel -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource TheoryModel
tmInvLaplace Sentence -> Sentence -> Sentence
+:+. String -> Sentence
S String
"of the equation"

derivEqn3 :: ModelExpr
derivEqn3 :: ModelExpr
derivEqn3
  = 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 (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 (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableTD) UnitalChunk
time) UnitalChunk
time ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+
      (((Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdDerivGain) 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 (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableTD) UnitalChunk
time)
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ ((Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
20 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableTD))
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdDerivGain 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 (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdSetPointTD) UnitalChunk
time)
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdSetPointTD ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0

derivStmt4 :: Sentence
derivStmt4 :: Sentence
derivStmt4
  = [Sentence] -> Sentence
foldlSent_
      [NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
setPoint), QuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' QuantityDict
qdSetPointTD, String -> Sentence
S String
"is a step function and a constant" Sentence -> Sentence -> Sentence
+:+.
         ConceptInstance -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource ConceptInstance
aSP,
       String -> Sentence
S String
"Therefore the",
         String -> Sentence
S String
"differential" Sentence -> Sentence -> Sentence
`S.ofThe` String -> Sentence
S String
"set point" Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"zero. Hence the equation",
         String -> Sentence
S String
"reduces to"]

derivEqn4 :: ModelExpr
derivEqn4 :: ModelExpr
derivEqn4
  = 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 (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 (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableTD) UnitalChunk
time) UnitalChunk
time ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+
      ((Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdDerivGain) 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 (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableTD) UnitalChunk
time)
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ ((Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
20 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdProcessVariableTD)
      ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- (QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdSetPointTD ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* QuantityDict -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy QuantityDict
qdPropGain) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0