module Drasil.SWHS.DataDefs where
import Language.Drasil
import Theory.Drasil (DataDefinition, ddE, ddENoRefs)
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S
import Data.Drasil.Concepts.Documentation (value)
import Data.Drasil.Concepts.Thermodynamics (heat)
import Data.Drasil.Quantities.Math (pi_)
import Data.Drasil.Quantities.Physics (energy, pressure)
import Data.Drasil.Quantities.PhysicalProperties (mass)
import Data.Drasil.Quantities.Thermodynamics (latentHeat)
import Drasil.SWHS.Assumptions (assumpVCN)
import Drasil.SWHS.References (bueche1986, koothoor2013, lightstone2012)
import Drasil.SWHS.Unitals (aspectRatio, coilHTC, coilSA, diam, eta, htCapLP,
htCapSP, htCapW, htFusion, latentEP, meltFrac, pcmHTC, pcmMass, pcmSA, pcmVol,
tankLength, tankVol, tauLP, tauSP, tauW, wDensity, wMass, wVol)
qDefs :: [SimpleQDef]
qDefs :: [SimpleQDef]
qDefs = [SimpleQDef
waterMassQD, SimpleQDef
waterVolumeQD, SimpleQDef
tankVolumeQD, SimpleQDef
balanceDecayRateQD,
SimpleQDef
balanceDecayTimeQD, SimpleQDef
balanceSolidPCMQD, SimpleQDef
balanceLiquidPCMQD, SimpleQDef
ddHtFusionQD,
SimpleQDef
ddMeltFracQD, SimpleQDef
aspRatQD]
dataDefs :: [DataDefinition]
dataDefs :: [DataDefinition]
dataDefs = [DataDefinition
waterMass, DataDefinition
waterVolume, DataDefinition
tankVolume, DataDefinition
balanceDecayRate,
DataDefinition
balanceDecayTime, DataDefinition
balanceSolidPCM, DataDefinition
balanceLiquidPCM, DataDefinition
ddHtFusion, DataDefinition
ddMeltFrac,
DataDefinition
aspRat]
waterMassQD :: SimpleQDef
waterMassQD :: SimpleQDef
waterMassQD = UnitalChunk -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
wMass Expr
waterMassEqn
waterMassEqn :: Expr
waterMassEqn :: Expr
waterMassEqn = UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
wVol Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
wDensity
waterMassNotes :: Sentence
waterMassNotes :: Sentence
waterMassNotes = [Sentence] -> Sentence
foldlSent [UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
wVol, String -> Sentence
S String
"is defined in", DataDefinition -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS DataDefinition
waterVolume]
waterMass :: DataDefinition
waterMass :: DataDefinition
waterMass = SimpleQDef
-> Maybe Derivation -> String -> [Sentence] -> DataDefinition
ddENoRefs SimpleQDef
waterMassQD Maybe Derivation
forall a. Maybe a
Nothing String
"waterMass" []
waterVolumeQD :: SimpleQDef
waterVolumeQD :: SimpleQDef
waterVolumeQD = UnitalChunk -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
wVol Expr
waterVolumeEqn
waterVolumeEqn :: Expr
waterVolumeEqn :: Expr
waterVolumeEqn = UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
tankVol Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$- UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
pcmVol
waterVolumeNotes :: Sentence
waterVolumeNotes :: Sentence
waterVolumeNotes = [Sentence] -> Sentence
foldlSent [String -> Sentence
S String
"Based on" Sentence -> Sentence -> Sentence
+:+. ConceptInstance -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
assumpVCN,
UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
tankVol, String -> Sentence
S String
"is defined in", DataDefinition -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS DataDefinition
tankVolume]
waterVolume :: DataDefinition
waterVolume :: DataDefinition
waterVolume = SimpleQDef
-> Maybe Derivation -> String -> [Sentence] -> DataDefinition
ddENoRefs SimpleQDef
waterVolumeQD Maybe Derivation
forall a. Maybe a
Nothing String
"waterVolume_pcm"
[Sentence
waterVolumeNotes]
tankVolumeQD :: SimpleQDef
tankVolumeQD :: SimpleQDef
tankVolumeQD = UnitalChunk -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
tankVol Expr
tankVolumeEqn
tankVolumeEqn :: Expr
tankVolumeEqn :: Expr
tankVolumeEqn = DefinedQuantityDict -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy DefinedQuantityDict
pi_ Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* Expr -> Expr
forall r. (ExprC r, LiteralC r) => r -> r
square (Expr -> Expr
forall r. (ExprC r, LiteralC r) => r -> r
half (Expr -> Expr) -> Expr -> Expr
forall a b. (a -> b) -> a -> b
$ UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
diam) Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
tankLength
tankVolume :: DataDefinition
tankVolume :: DataDefinition
tankVolume = SimpleQDef
-> Maybe Derivation -> String -> [Sentence] -> DataDefinition
ddENoRefs SimpleQDef
tankVolumeQD Maybe Derivation
forall a. Maybe a
Nothing String
"tankVolume" []
balanceDecayRateQD :: SimpleQDef
balanceDecayRateQD :: SimpleQDef
balanceDecayRateQD = UnitalChunk -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
tauW Expr
balanceDecayRateEqn
balanceDecayRateEqn :: Expr
balanceDecayRateEqn :: Expr
balanceDecayRateEqn = UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
wMass Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
htCapW Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$/ (UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
coilHTC Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
coilSA)
balanceDecayRateNotes :: Sentence
balanceDecayRateNotes :: Sentence
balanceDecayRateNotes = [Sentence] -> Sentence
foldlSent [UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
wMass, String -> Sentence
S String
"is defined in",
DataDefinition -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS DataDefinition
waterMass]
balanceDecayRate :: DataDefinition
balanceDecayRate :: DataDefinition
balanceDecayRate = SimpleQDef
-> [DecRef]
-> Maybe Derivation
-> String
-> [Sentence]
-> DataDefinition
ddE SimpleQDef
balanceDecayRateQD [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
koothoor2013]
Maybe Derivation
forall a. Maybe a
Nothing String
"balanceDecayRate" []
balanceDecayTimeQD :: SimpleQDef
balanceDecayTimeQD :: SimpleQDef
balanceDecayTimeQD = DefinedQuantityDict -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef DefinedQuantityDict
eta Expr
balanceDecayTimeEqn
balanceDecayTimeEqn :: Expr
balanceDecayTimeEqn :: Expr
balanceDecayTimeEqn = UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
pcmHTC Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
pcmSA Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$/ (UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
coilHTC Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
coilSA)
balanceDecayTime :: DataDefinition
balanceDecayTime :: DataDefinition
balanceDecayTime = SimpleQDef
-> [DecRef]
-> Maybe Derivation
-> String
-> [Sentence]
-> DataDefinition
ddE SimpleQDef
balanceDecayTimeQD [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
koothoor2013]
Maybe Derivation
forall a. Maybe a
Nothing String
"balanceDecayTime" []
balanceSolidPCMQD :: SimpleQDef
balanceSolidPCMQD :: SimpleQDef
balanceSolidPCMQD = UnitalChunk -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
tauSP Expr
balanceSolidPCMEqn
balanceSolidPCMEqn :: Expr
balanceSolidPCMEqn :: Expr
balanceSolidPCMEqn = (UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pcmMass Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
htCapSP) Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$/
(UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
pcmHTC Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
pcmSA)
balanceSolidPCM :: DataDefinition
balanceSolidPCM :: DataDefinition
balanceSolidPCM = SimpleQDef
-> [DecRef]
-> Maybe Derivation
-> String
-> [Sentence]
-> DataDefinition
ddE SimpleQDef
balanceSolidPCMQD [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
lightstone2012]
Maybe Derivation
forall a. Maybe a
Nothing String
"balanceSolidPCM" []
balanceLiquidPCMQD :: SimpleQDef
balanceLiquidPCMQD :: SimpleQDef
balanceLiquidPCMQD = UnitalChunk -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
tauLP Expr
balanceLiquidPCMEqn
balanceLiquidPCMEqn :: Expr
balanceLiquidPCMEqn :: Expr
balanceLiquidPCMEqn = (UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pcmMass Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
htCapLP) Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$/
(UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
pcmHTC Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
pcmSA)
balanceLiquidPCM :: DataDefinition
balanceLiquidPCM :: DataDefinition
balanceLiquidPCM = SimpleQDef
-> [DecRef]
-> Maybe Derivation
-> String
-> [Sentence]
-> DataDefinition
ddE SimpleQDef
balanceLiquidPCMQD [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
lightstone2012]
Maybe Derivation
forall a. Maybe a
Nothing String
"balanceLiquidPCM" []
ddHtFusionQD :: SimpleQDef
ddHtFusionQD :: SimpleQDef
ddHtFusionQD = UncertQ -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UncertQ
htFusion Expr
htFusionEqn
htFusionEqn :: Expr
htFusionEqn :: Expr
htFusionEqn = UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
latentHeat Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$/ UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mass
ddHtFusion :: DataDefinition
ddHtFusion :: DataDefinition
ddHtFusion = SimpleQDef
-> [DecRef]
-> Maybe Derivation
-> String
-> [Sentence]
-> DataDefinition
ddE SimpleQDef
ddHtFusionQD [Citation -> RefInfo -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> RefInfo -> DecRef
dRefInfo Citation
bueche1986 (RefInfo -> DecRef) -> RefInfo -> DecRef
forall a b. (a -> b) -> a -> b
$ [Int] -> RefInfo
Page [Int
282]]
Maybe Derivation
forall a. Maybe a
Nothing String
"htFusion" [Sentence
htFusionNote]
htFusionNote :: Sentence
htFusionNote :: Sentence
htFusionNote = [Sentence] -> Sentence
foldlSent [NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP (UncertQ -> NP
forall t. NamedIdea t => t -> NP
the UncertQ
htFusion),
Sentence -> Sentence
sParen (String -> Sentence
S String
"also known as the enthalpy of fusion") Sentence -> Sentence -> Sentence
`S.ofA` String -> Sentence
S String
"substance is the",
ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
heat, UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
energy, String -> Sentence
S String
"required", Sentence -> Sentence
sParen (UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
latentHeat), String -> Sentence
S String
"to change the state" Sentence -> Sentence -> Sentence
`S.ofA` String -> Sentence
S String
"unit of the",
UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
mass, Sentence -> Sentence
sParen (UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
mass) Sentence -> Sentence -> Sentence
`S.ofThe` String -> Sentence
S String
"substance from solid to liquid" Sentence -> Sentence -> Sentence
`sC`
String -> Sentence
S String
"at constant", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
pressure]
ddMeltFracQD :: SimpleQDef
ddMeltFracQD :: SimpleQDef
ddMeltFracQD = DefinedQuantityDict -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef DefinedQuantityDict
meltFrac Expr
meltFracEqn
meltFracEqn :: Expr
meltFracEqn :: Expr
meltFracEqn = UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
latentEP Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$/ (UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
htFusion Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
pcmMass)
ddMeltFrac :: DataDefinition
ddMeltFrac :: DataDefinition
ddMeltFrac = SimpleQDef
-> [DecRef]
-> Maybe Derivation
-> String
-> [Sentence]
-> DataDefinition
ddE SimpleQDef
ddMeltFracQD [Citation -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Citation
koothoor2013]
Maybe Derivation
forall a. Maybe a
Nothing String
"meltFrac" [Sentence
meltFracConst, DataDefinition -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS DataDefinition
ddHtFusion]
where meltFracConst :: Sentence
meltFracConst = NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP (IdeaDict -> NP
forall t. NamedIdea t => t -> NP
the IdeaDict
value) Sentence -> Sentence -> Sentence
`S.of_` DefinedQuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' DefinedQuantityDict
meltFrac Sentence -> Sentence -> Sentence
`S.is`
String -> Sentence
S String
"constrained to" Sentence -> Sentence -> Sentence
+:+. ModelExpr -> Sentence
eS (DefinedQuantityDict
-> RealInterval ModelExpr ModelExpr -> ModelExpr
forall c.
HasUID c =>
c -> RealInterval ModelExpr ModelExpr -> ModelExpr
forall r c. (ExprC r, HasUID c) => c -> RealInterval r r -> r
realInterval DefinedQuantityDict
meltFrac ((Inclusive, ModelExpr)
-> (Inclusive, ModelExpr) -> RealInterval ModelExpr ModelExpr
forall a b. (Inclusive, a) -> (Inclusive, b) -> RealInterval a b
Bounded (Inclusive
Inc, Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0) (Inclusive
Inc, Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1)))
aspRatQD :: SimpleQDef
aspRatQD :: SimpleQDef
aspRatQD = DefinedQuantityDict -> Expr -> SimpleQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef DefinedQuantityDict
aspectRatio Expr
aspRatEq
aspRatEq :: Expr
aspRatEq :: Expr
aspRatEq = UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
diam Expr -> Expr -> Expr
forall r. ExprC r => r -> r -> r
$/ UncertQ -> Expr
forall c. (HasUID c, HasSymbol c) => c -> Expr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UncertQ
tankLength
aspRat :: DataDefinition
aspRat :: DataDefinition
aspRat = SimpleQDef
-> Maybe Derivation -> String -> [Sentence] -> DataDefinition
ddENoRefs SimpleQDef
aspRatQD Maybe Derivation
forall a. Maybe a
Nothing String
"aspectRatio" []