Skip to content

Commit

Permalink
Merge pull request #3979 from daijingz/CP2
Browse files Browse the repository at this point in the history
#3252 Sentence Reworking (for the SWHS Example, Part 2)
  • Loading branch information
JacquesCarette authored Oct 26, 2024
2 parents b62eced + ee9fb6d commit 5ed2a9c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions code/drasil-example/swhs/lib/Drasil/SWHS/DataDefs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ ddHtFusion = ddE ddHtFusionQD [dRefInfo bueche1986 $ Page [282]]

htFusionNote :: Sentence
htFusionNote = foldlSent [atStartNP (the htFusion),
sParen (S "also known as the enthalpy of fusion"), S "of a substance is the",
phrase heat, phrase energy, S "required", sParen (ch latentHeat), S "to change the state of a unit of the",
phrase mass, sParen (ch mass), S "of the substance from solid to liquid" `sC`
sParen (S "also known as the enthalpy of fusion") `S.ofA` S "substance is the",
phrase heat, phrase energy, S "required", sParen (ch latentHeat), S "to change the state" `S.ofA` S "unit of the",
phrase mass, sParen (ch mass) `S.ofThe` S "substance from solid to liquid" `sC`
S "at constant", phrase pressure]

----
Expand Down
4 changes: 2 additions & 2 deletions code/drasil-example/swhs/lib/Drasil/SWHS/GenDefs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ rocTempDerivGauss = [S "Applying", titleize gaussDiv, S "to the first term over"

rocTempDerivArbVol :: [Sentence]
rocTempDerivArbVol = [S "We consider an arbitrary" +:+. phrase vol,
atStartNP (the volHtGen), S "is assumed constant. Then", eqN 1, S "can be written as"]
atStartNP (the volHtGen) `S.is` S "assumed constant. Then", eqN 1, S "can be written as"]

rocTempDerivConsFlx :: Sentence -> [ConceptInstance] -> [Sentence]
rocTempDerivConsFlx s assumps = [S "Where",
Expand All @@ -119,7 +119,7 @@ rocTempDerivConsFlx s assumps = [S "Where",

rocTempDerivConsFlxSWHS :: Sentence
rocTempDerivConsFlxSWHS = foldlSent [S "The integral over the", phrase surface,
S "could be simplified because the thermal flux is assumed constant over",
S "could be simplified because the thermal flux" `S.is` S "assumed constant over",
ch inSA `S.and_` ch outSA `S.and_` eS (exactDbl 0), S "on all other" +:+. plural surface,
S "Outward flux is considered positive"]

Expand Down
38 changes: 19 additions & 19 deletions code/drasil-example/swhs/lib/Drasil/SWHS/IMods.hs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ eBalanceOnWtrDerivDesc1 htEnd oa ea htA = foldlSentCol [
phrase water, S "from the", phrase coil, S "as", eS' htFluxC,
sParen (refS htFluxWaterFromCoil) +:+ htEnd `sC` EmptyS +:+. oa, ea, S "No", phrase heatTrans, S "occurs to", S "outside" `S.the_ofThe`
phrase tank `sC` S "since it has been assumed to be perfectly insulated" +:+.
sParen (refS assumpPIT), S "Since the", phrase assumption,
S "is made that no internal heat is generated" +:+. (sParen (refS htA) `sC`
eS (sy volHtGen $= exactDbl 0)), S "Therefore" `sC` phraseNP (the equation) `S.for`
sParen (refS assumpPIT), S "Since the", phrase assumption `S.is` S "made that no internal heat" `S.is` S "generated" +:+.
(sParen (refS htA) `sC` eS (sy volHtGen $= exactDbl 0)),
S "Therefore" `sC` phraseNP (the equation) `S.for`
refS rocTempSimp, S "can be written as"]

htTransEnd :: Sentence
Expand All @@ -115,9 +115,9 @@ overAreas :: Sentence
overAreas = S "over areas" +:+ ch coilSA `S.and_` ch pcmSA `sC` S "respectively"

extraAssumps :: Sentence
extraAssumps = foldlSent [S "The thermal flux is constant over", ch coilSA `sC`
extraAssumps = foldlSent [S "The thermal flux" `S.is` S "constant over", ch coilSA `sC`
S "since", phraseNP (temp `the_ofThe` coil) `S.is` S "assumed to not vary along its length",
sParen (refS assumpTHCCoL) `sC` EmptyS `S.andThe` S "thermal flux is constant over",
sParen (refS assumpTHCCoL) `sC` EmptyS `S.andThe` S "thermal flux" `S.is` S "constant over",
ch pcmSA `sC` S "since", phrase temp `S.the_ofThe` getAcc phsChgMtrl `S.isThe`
S "same throughout its", phrase vol, sParen (refS assumpTPCAV) `S.andThe`
phrase water `S.is` S "fully mixed", sParen (refS assumpCWTAT)]
Expand All @@ -144,7 +144,7 @@ eBalanceOnWtrDerivDesc6 = substitute [balanceDecayRate, balanceDecayTime]

eBalanceOnWtrDerivDesc7 :: Expr -> Sentence
eBalanceOnWtrDerivDesc7 eq22 = foldlSentCol [S "Finally, factoring out", eS' eq22 `sC`
S "we are left with the governing", getAcc ode `S.for` refS eBalanceOnWtr]
S "we" `S.are` S "left with the governing", getAcc ode `S.for` refS eBalanceOnWtr]

eq1, eq2 :: Expr
eq1 = sy wMass $* sy htCapW
Expand Down Expand Up @@ -211,10 +211,10 @@ eBalanceOnPCMDerivDesc1 = foldlSentCol [
S "To find the", phrase rOfChng `S.of_` ch tempPCM `sC` S "we look at the",
phrase energy, S "balance on the" +:+. getAcc phsChgMtrl, S "The", phrase vol,
S "being considered" `S.isThe` phrase pcmVol +:+. sParen (ch pcmVol),
S "The derivation that follows is initially for the solid" +:+. getAcc phsChgMtrl,
S "The derivation that follows" `S.is` S "initially" `S.for` S "the solid" +:+. getAcc phsChgMtrl,
S "The" +:+. (phrase pcmMass `S.is` ch pcmMass `S.andThe` phrase htCapSP `S.is` ch htCapSP),
atStartNP (the htFluxP) `S.is` ch htFluxP, sParen (refS htFluxPCMFromWater),
S "over", phrase pcmSA +:+. ch pcmSA, S "The thermal flux is constant over",
S "over", phrase pcmSA +:+. ch pcmSA, S "The thermal flux" `S.is` S "constant over",
ch pcmSA `sC` S "since", phrase temp `S.the_ofThe` getAcc phsChgMtrl `S.isThe`
S "same throughout its", phrase vol, sParen (refS assumpTPCAV) `S.andThe`
phrase water `S.is` S "fully mixed" +:+. sParen (refS assumpCWTAT),
Expand All @@ -235,23 +235,23 @@ eBalanceOnPCMDerivDesc4 = substitute [balanceSolidPCM]

eBalanceOnPCMDerivDesc5 :: Sentence
eBalanceOnPCMDerivDesc5 = foldlSent [
eqN 4, S "applies for the", phrase solid +:+. getAcc phsChgMtrl, S "In the case where all of the",
eqN 4, S "applies for the", phrase solid +:+. getAcc phsChgMtrl, S "In the case where all" `S.ofThe`
getAcc phsChgMtrl `S.is` S "melted" `sC` S "the same derivation applies" `sC` S "except that",
htCapSP `isReplacedBy` htCapLP `sC` S "and thus" +:+. (tauSP `isReplacedBy` tauLP),
S "Although a small change in", phrase surArea, S "would be expected with", phrase melting `sC`
S "this is not included" `sC` S "since the", phrase vol, S "change of the", getAcc phsChgMtrl,
S "with", phrase melting, S "is assumed to be negligible", sParen (refS assumpVCMPN)]
S "this is not included" `sC` S "since the", phrase vol, S "change" `S.ofThe` getAcc phsChgMtrl,
S "with", phrase melting `S.is` S "assumed to be negligible", sParen (refS assumpVCMPN)]
where isReplacedBy a b = ch a `S.is` S "replaced by" +:+ ch b

eBalanceOnPCMDerivDesc6 :: Sentence
eBalanceOnPCMDerivDesc6 = foldlSent [
S "In the case where", eS' eq6_1 `S.and_` S "not all of the", getAcc phsChgMtrl `S.is`
S "In the case where", eS' eq6_1 `S.and_` S "not all" `S.ofThe` getAcc phsChgMtrl `S.is`
S "melted" `sC` S "the", phrase tempPCM +:+. S "does not change", S "Therefore" `sC` eq6_2]

eBalanceOnPCMDerivDesc7 :: Sentence
eBalanceOnPCMDerivDesc7 = foldlSent [
S "This derivation does not consider", phrase boiling `S.the_ofThe` getAcc phsChgMtrl `sC`
S "as the PCM is assumed to either be in a", phrase solid, S "state or a",
S "as the PCM" `S.is` S "assumed to either be in a", phrase solid, S "state or a",
phrase liquid, S "state", sParen (refS assumpNGSP)]

eq6_1 :: Expr
Expand Down Expand Up @@ -285,7 +285,7 @@ htWtrExpr = sy htCapW $* sy wMass $*

htWtrNotes :: [Sentence]
htWtrNotes = map foldlSent [
[S "The above", phrase equation, S "is derived using", refS sensHtE],
[S "The above", phrase equation `S.is` S "derived using", refS sensHtE],
[atStartNP (NP.the (change `in_`temp)) `S.isThe` S "difference between the",
phrase temp, S "at", phrase time, ch time, sParen (unwrap $ getUnit tInitMelt) `sC`
ch tempW `S.andThe` phrase tempInit `sC` ch tempInit, sParen (unwrap $ getUnit tempInit)],
Expand Down Expand Up @@ -324,7 +324,7 @@ htPCMNotes :: [Sentence]
htPCMNotes = map foldlSent [
[S "The above", phrase equation `S.is` S "derived using",
refS sensHtE `S.and_` refS latentHtE],
[ch pcmE, S "for the", phrase solid, short phsChgMtrl, S "is found using",
[ch pcmE, S "for the", phrase solid, short phsChgMtrl `S.is` S "found using",
refS sensHtE `S.for` phrase sensHeat :+: S "ing, with",
phraseNP (heatCapSpec `the_ofThe` solid), short phsChgMtrl `sC` ch htCapSP,
sParen (unwrap $ getUnit htCapSP) `S.andThe` phrase change `S.inThe`
Expand All @@ -333,19 +333,19 @@ htPCMNotes = map foldlSent [
S "is found using", refS sensHtE `S.for` phraseNP (sensHeat `ofThe` liquid),
short phsChgMtrl, S "plus the", phrase energy, S "when", phrase melting, S "starts" `sC`
S "plus", (phrase energy +:+ S "required to melt all") `S.the_ofThe` short phsChgMtrl],
[atStartNP (the energy), S "required to melt all of the", short phsChgMtrl `S.is`
[atStartNP (the energy), S "required to melt all" `S.ofThe` short phsChgMtrl `S.is`
eS (sy htFusion $* sy pcmMass), sParen (unwrap $ getUnit pcmInitMltE),
fromSource ddHtFusion],
[atStartNP (NP.the (change `in_` temp)) `S.is` eS (sy tempPCM $- sy tempMeltP),
sParen (unwrap $ getUnit tempMeltP)],
[ch pcmE, S "during", phrase melting `S.ofThe` short phsChgMtrl,
S "is found using the", phrase energy, S "required at", S "instant" +:+
[ch pcmE, S "during", phrase melting `S.ofThe` short phsChgMtrl `S.is` S "found using the",
phrase energy, S "required at", S "instant" +:+
phrase melting `S.the_ofThe` short phsChgMtrl, S "begins" `sC` ch pcmInitMltE, S "plus the",
phrase latentHeat, phrase energy, S "added" `S.toThe` short phsChgMtrl `sC`
ch latentEP, sParen (unwrap $ getUnit latentEP), S "since the", phrase time, S "when",
phrase melting, S "began", ch tInitMelt, sParen (unwrap $ getUnit tInitMelt)],
[atStartNP (NP.the (combineNINI heat energy)) `S.for` phrase boiling `S.ofThe` short phsChgMtrl,
S "is not detailed" `sC` S "since the", short phsChgMtrl, S "is assumed to either be in a",
S "is not detailed" `sC` S "since the", short phsChgMtrl `S.is` S "assumed to either be in a",
phrase solid `S.or_` phrase liquid, S "state", sParen (refS assumpNGSP),
sParen (refS assumpPIS)]]

Expand Down

0 comments on commit 5ed2a9c

Please sign in to comment.