From 84388c0522eae30a37fd76a51b71b65506c596e5 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 13:13:29 -0400 Subject: [PATCH 01/20] Updated notes section of IM1 as per #1064 --- code/drasil-example/Drasil/SWHS/IMods.hs | 40 ++++++++----------- code/drasil-lang/Language/Drasil.hs | 4 +- code/drasil-lang/Language/Drasil/Expr/Math.hs | 3 ++ code/stable/swhs/SRS/SWHS_SRS.tex | 10 ++--- code/stable/swhs/Website/SWHS_SRS.html | 24 +++-------- 5 files changed, 32 insertions(+), 49 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 9938086e9d..3f26b082b3 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -5,9 +5,10 @@ import Language.Drasil import Theory.Drasil (DataDefinition, InstanceModel, im, imNoDeriv) import Utils.Drasil +import Data.Drasil.SentenceStructures (follows) import Data.Drasil.Utils (unwrap, weave) -import Data.Drasil.Concepts.Documentation (assumption, goal, solution) -import Data.Drasil.Concepts.Math (area, change, equation, rOfChng, surface) +import Data.Drasil.Concepts.Documentation (assumption, condition, constraint, goal, solution) +import Data.Drasil.Concepts.Math (area, change, equation, ode, rOfChng, surface) import Data.Drasil.Concepts.PhysicalProperties (liquid, mass, solid, vol) import Data.Drasil.Concepts.Thermodynamics (boilPt, boiling, heat, heatCapSpec, heatTrans, htFlux, latentHeat, melting, phaseChange, sensHeat, temp, @@ -53,25 +54,18 @@ balWtr_Rel = (deriv (sy temp_W) time) $= 1 / (sy tau_W) * (sy eta) * ((apply1 temp_PCM time) - (apply1 temp_W time))) balWtrDesc :: Sentence -balWtrDesc = foldlSent [(E $ sy tau_W) `sC` (E $ sy time_final) - `sC` (E $ sy temp_C) `sC` (E $ sy temp_PCM), S "from" +:+. - sParen (makeRef2S eBalanceOnPCM), S "The input is constrained so that" +:+. - (E $ sy temp_init $<= (sy temp_C)), sParen (makeRef2S assumpCTNOD), - (E $ sy temp_W) `isThe` phrase temp_W +:+. - sParen (unwrap $ getUnit temp_W), (E $ sy temp_PCM) `isThe` - phrase temp_PCM +:+. sParen (unwrap $ getUnit temp_PCM), - (E $ sy temp_C) `isThe` phrase temp_C +:+. sParen (unwrap $ getUnit temp_C), - (E $ sy tau_W $= (sy w_mass * sy htCap_W) / (sy coil_HTC * sy coil_SA)), - S "is a constant", sParen (makeRef2S dd3HtFusion) +:+. sParen (unwrap $ getUnit tau_W), - (E $ sy eta $= (sy pcm_HTC * sy pcm_SA) / (sy coil_HTC * sy coil_SA)), - S "is a constant" +:+. sParen (S "dimensionless"), - S "The above", phrase equation, S "applies as long as the", phrase water, - S "is in", phrase liquid, S "form" `sC` (E $ real_interval temp_W (Bounded (Exc,0) (Exc,100))), - sParen (unwrap $ getUnit temp_W), S "where", E 0, - sParen (unwrap $ getUnit temp_W) `sAnd` (E 100), - sParen (unwrap $ getUnit temp_W), S "are the", phrase melting `sAnd` - plural boilPt, S "of", phrase water `sC` S "respectively", - sParen (makeRef2S assumpWAL `sC` makeRef2S assumpAPT)] +balWtrDesc = foldlSent [E $ sy temp_PCM, S "is defined by" +:+. makeRef2S eBalanceOnPCM, + S "The input", phrase constraint, E $ sy temp_init $<= sy temp_C, S "comes from" +:+. + makeRef2S assumpCTNOD, E $ sy tau_W, S "is calculated from" +:+. S "FIXME: Missing DD #1484", + E $ sy eta, S "is calculated from" +:+. S "FIXME: Missing DD #1484", + S "The initial", plural condition, S "for the" +:+. (getAcc ode `sAre` + E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP), + S "The", getAcc ode, S "applies as long as the", phrase water `sIs` + S "in", phrase liquid, S "form" `sC` (E $ real_interval temp_W (Bounded (Exc,0) (Exc,100))), + sParen (unwrap $ getUnit temp_W), S "where", E 0, sParen (unwrap $ getUnit temp_W) `sAnd` + (E 100), sParen (unwrap $ getUnit temp_W) `sAre` S "the", phrase melting `sAnd` + plural boilPt `sOf` phrase water `sC` S "respectively", + sParen (S "from" +:+ makeRef2S assumpWAL `sAnd` makeRef2S assumpAPT)] ---------------------------------------------- -- Derivation of eBalanceOnWtr -- @@ -145,7 +139,7 @@ eBalanceOnWtrDerivDesc6 eq33 eq44 = eBalanceOnWtrDerivDesc7 :: Expr -> [Sentence] eBalanceOnWtrDerivDesc7 eq55 = - [S "Finally, factoring out", (E eq55), S ", we are left with the governing ODE for", + [S "Finally, factoring out", (E eq55), S ", we are left with the governing", getAcc ode, S "for", sParen (makeRef2S eBalanceOnWtr)] eq2 :: [Sentence] @@ -256,7 +250,7 @@ balPCMDesc_note = foldlSent [ (S "FIXME t_w(0) = t_p(0)") `sC` makeRef2S assumpSITWP `sC` (S "and"), (E (sy temp_W)), S "from", (makeRef2S eBalanceOnWtr) `sC` - S "such that the following governing ODE is satisfied.", + S "such that the following governing" +:+. getAcc ode `sIs` S "satisfied", S "The temperature remains constant at", (E (sy temp_melt_P)) `sC` (S "even with the heating (or cool-ing), until the phase change has occurred for all of the material; that is as long as"), diff --git a/code/drasil-lang/Language/Drasil.hs b/code/drasil-lang/Language/Drasil.hs index f56968caad..9eb9fb1a1f 100644 --- a/code/drasil-lang/Language/Drasil.hs +++ b/code/drasil-lang/Language/Drasil.hs @@ -14,7 +14,7 @@ module Language.Drasil ( , real_interval , deriv, pderiv , sy -- old "Chunk" constructor C - , apply, apply1, apply2 + , apply, apply1, apply1Int, apply2 , cross, m2x2, vec2D, dgnl2x2 -- all the stuff from Unicode , Special(..), RenderSpecial(..) @@ -186,7 +186,7 @@ import Language.Drasil.Expr.Math (log, ln, sin, cos, tan, sqrt, square, sec, dim, idx, int, dbl, str, isin, case_, sum_all, defsum, prod_all, defprod, real_interval, - apply, apply1, apply2, + apply, apply1, apply1Int, apply2, sy, deriv, pderiv, cross, m2x2, vec2D, dgnl2x2, euclidean, defint, int_all) import Language.Drasil.Document (section, fig, figWithWidth diff --git a/code/drasil-lang/Language/Drasil/Expr/Math.hs b/code/drasil-lang/Language/Drasil/Expr/Math.hs index 74928ad2af..5d9340ca7e 100644 --- a/code/drasil-lang/Language/Drasil/Expr/Math.hs +++ b/code/drasil-lang/Language/Drasil/Expr/Math.hs @@ -139,6 +139,9 @@ apply = FCall apply1 :: (HasUID f, HasSymbol f, HasUID a, HasSymbol a) => f -> a -> Expr apply1 f a = FCall (sy f) [sy a] +apply1Int :: (HasUID f, HasSymbol f) => f -> Integer -> Expr +apply1Int f a = FCall (sy f) [Int a] + apply2 :: (HasUID f, HasSymbol f, HasUID a, HasSymbol a, HasUID b, HasSymbol b) => f -> a -> b -> Expr apply2 f a b = FCall (sy f) [sy a, sy b] diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index a22eb0c3be..fdab696733 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -353,7 +353,7 @@ \subsubsection{Assumptions} \item[Temp-Heating-Coil-Constant-over-Length:\phantomsection\label{assumpTHCCoL}]The temperature of the heating coil does not vary along its length. \hyperref[likeChgTCVOL]{LC: Temperature-Coil-Variable-Over-Length} \hyperref[DD:ht.flux.C]{DD: ht\_flux\_C} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. \item[Law-Convective-Cooling-Water-PCM:\phantomsection\label{assumpLCCWP}]Newton's law of convective cooling applies between the water and the PCM. \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P}. \item[Charging-Tank-No-Temp-Discharge:\phantomsection\label{assumpCTNOD}]The model only accounts for charging of the tank, not discharging. The temperature of the water and temperature of the phase change material can only increase, or remain constant; they do not decrease. This implies that the initial temperature \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM} is less than (or equal) to the temperature of the heating coil. \hyperref[likeChgDT]{LC: Discharging-Tank} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. -\item[Same-Initial-Temp-Water-PCM:\phantomsection\label{assumpSITWP}]The initial temperature of the water and the PCM is the same. \hyperref[likeChgDITPW]{LC: Different-Initial-Temps-PCM-Water} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. +\item[Same-Initial-Temp-Water-PCM:\phantomsection\label{assumpSITWP}]The initial temperature of the water and the PCM is the same. \hyperref[likeChgDITPW]{LC: Different-Initial-Temps-PCM-Water} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. \item[PCM-Initially-Solid:\phantomsection\label{assumpPIS}]The simulation will start with the PCM in a solid state. \hyperref[IM:heatEInPCM]{IM: heatEInPCM} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. \item[Water-Always-Liquid:\phantomsection\label{assumpWAL}]The operating temperature range of the system is such that the water is always in liquid state. That is, the temperature will not drop below the melting point temperature of water, or rise above its boiling point temperature. \hyperref[unlikeChgWPFS]{UC: Water-PCM-Fixed-States} \hyperref[IM:heatEInWtr]{IM: heatEInWtr} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. \item[Perfect-Insulation-Tank:\phantomsection\label{assumpPIT}]The tank is perfectly insulated so that there is no heat loss from the tank. \hyperref[likeChgTLH]{LC: Tank-Lose-Heat} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. @@ -710,7 +710,7 @@ \subsubsection{Data Definitions} \\ \midrule \\ Source & \cite[(pg. 282)]{bueche1986} \\ \midrule \\ -RefBy & \hyperref[DD:melt.frac]{DD: melt\_frac} \hyperref[TM:latentHtE]{TM: latentHtE} \hyperref[IM:heatEInPCM]{IM: heatEInPCM} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. +RefBy & \hyperref[DD:melt.frac]{DD: melt\_frac} \hyperref[TM:latentHtE]{TM: latentHtE} \hyperref[IM:heatEInPCM]{IM: heatEInPCM} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. \\ \bottomrule \end{tabular} \end{minipage} \par~ @@ -784,7 +784,7 @@ \subsubsection{Instance Models} \item{${T_{P}}$ is the temperature of the phase change material (${}^{\circ}$C)} \end{symbDescription} \\ \midrule \\ -Notes & ${τ_{W}}$, ${t_{final}}$, ${T_{C}}$, ${T_{P}}$ from (\hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}). The input is constrained so that ${T_{init}}\leq{}{T_{C}}$. (\hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}) ${T_{W}}$ is the temperature of the water (${}^{\circ}$C). ${T_{P}}$ is the temperature of the phase change material (${}^{\circ}$C). ${T_{C}}$ is the temperature of the heating coil (${}^{\circ}$C). ${τ_{W}}=\frac{{m_{W}} {C_{W}}}{{h_{C}} {A_{C}}}$ is a constant (\hyperref[DD:htFusion]{DD: htFusion}) (s). $η=\frac{{h_{P}} {A_{P}}}{{h_{C}} {A_{C}}}$ is a constant (dimensionless). The above equation applies as long as the water is in liquid form, $0<{T_{W}}<100$ (${}^{\circ}$C) where $0$ (${}^{\circ}$C) and $100$ (${}^{\circ}$C) are the melting and boiling point temperatures of water, respectively (\hyperref[assumpWAL]{A: Water-Always-Liquid}, \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). +Notes & ${T_{P}}$ is defined by \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. The input constraint ${T_{init}}\leq{}{T_{C}}$ comes from \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. ${τ_{W}}$ is calculated from FIXME: Missing DD #1484. $η$ is calculated from FIXME: Missing DD #1484. The initial conditions for the ODE are ${T_{W}}\left(0\right)={T_{P}}\left(0\right)={T_{init}}$ following \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM}. The ODE applies as long as the water is in liquid form, $0<{T_{W}}<100$ (${}^{\circ}$C) where $0$ (${}^{\circ}$C) and $100$ (${}^{\circ}$C) are the melting and boiling point temperatures of water, respectively (from \hyperref[assumpWAL]{A: Water-Always-Liquid} and \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). \\ \midrule \\ Source & \cite{koothoor2013} \\ \midrule \\ @@ -861,7 +861,7 @@ \subsubsection{Instance Models} \item{$ϕ$ is the melt fraction (Unitless)} \end{symbDescription} \\ \midrule \\ -Notes & ${{T_{melt}}^{P}}$, ${t_{final}}$, ${T_{init}}$, ${h_{P}}$, ${m_{P}}$, ${{C_{P}}^{S}}$, ${{C_{P}}^{S}}$ form (\hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}). The input is constrained so that ${T_{init}}<{{T_{melt}}^{P}}$ (\hyperref[assumpPIS]{A: PCM-Initially-Solid}) ${T_{P}}$, $0Assumptions

-Same-Initial-Temp-Water-PCM: The initial temperature of the water and the PCM is the same. LC: Different-Initial-Temps-PCM-Water IM: eBalanceOnPCM A: Charging-Tank-No-Temp-Discharge. +Same-Initial-Temp-Water-PCM: The initial temperature of the water and the PCM is the same. LC: Different-Initial-Temps-PCM-Water IM: eBalanceOnWtr IM: eBalanceOnPCM A: Charging-Tank-No-Temp-Discharge.

@@ -1556,7 +1556,7 @@

Data Definitions

RefBy

-DD: melt_frac TM: latentHtE IM: heatEInPCM IM: eBalanceOnWtr IM: eBalanceOnWtr. +DD: melt_frac TM: latentHtE IM: heatEInPCM IM: eBalanceOnWtr.

@@ -1712,21 +1712,7 @@

Instance Models

Notes

-τW, tfinal, TC, TP from (IM: eBalanceOnPCM). The input is constrained so that Tinit ≤ TC. (A: Charging-Tank-No-Temp-Discharge) TW is the temperature of the water (°C). TP is the temperature of the phase change material (°C). TC is the temperature of the heating coil (°C). τW =

- - mW CW - - - hC AC - -
is a constant (DD: htFusion) (s). η =
- - hP AP - - - hC AC - -
is a constant (dimensionless). The above equation applies as long as the water is in liquid form, 0 < TW < 100 (°C) where 0 (°C) and 100 (°C) are the melting and boiling point temperatures of water, respectively (A: Water-Always-Liquid, A: Atmospheric-Pressure-Tank). +TP is defined by IM: eBalanceOnPCM. The input constraint Tinit ≤ TC comes from A: Charging-Tank-No-Temp-Discharge. τW is calculated from FIXME: Missing DD #1484. η is calculated from FIXME: Missing DD #1484. The initial conditions for the ODE are TW(0) = TP(0) = Tinit following A: Same-Initial-Temp-Water-PCM. The ODE applies as long as the water is in liquid form, 0 < TW < 100 (°C) where 0 (°C) and 100 (°C) are the melting and boiling point temperatures of water, respectively (from A: Water-Always-Liquid and A: Atmospheric-Pressure-Tank).

@@ -1981,7 +1967,7 @@

Instance Models

Notes

-TmeltP, tfinal, Tinit, hP, mP, CPS, CPS form (IM: eBalanceOnWtr). The input is constrained so that Tinit < TmeltP (A: PCM-Initially-Solid) TP, 0 < t < tfinal, with initial conditions, TW = TP = Tinit, FIXME t_w(0) = t_p(0), A: Same-Initial-Temp-Water-PCM, and TW from IM: eBalanceOnWtr, such that the following governing ODE is satisfied. The temperature remains constant at TmeltP, even with the heating (or cool-ing), until the phase change has occurred for all of the material; that is as long as 0 < ϕ < 1 (from DD: melt_frac ) is determined as part of the heat energy in the PCM, as given in (IM: heatEInPCM). τPS =

+TmeltP, tfinal, Tinit, hP, mP, CPS, CPS form (IM: eBalanceOnWtr). The input is constrained so that Tinit < TmeltP (A: PCM-Initially-Solid) TP, 0 < t < tfinal, with initial conditions, TW = TP = Tinit, FIXME t_w(0) = t_p(0), A: Same-Initial-Temp-Water-PCM, and TW from IM: eBalanceOnWtr, such that the following governing ODE. is satisfied The temperature remains constant at TmeltP, even with the heating (or cool-ing), until the phase change has occurred for all of the material; that is as long as 0 < ϕ < 1 (from DD: melt_frac ) is determined as part of the heat energy in the PCM, as given in (IM: heatEInPCM). τPS =
mP CPS @@ -3405,7 +3391,7 @@

Traceability Matrices and Graphs

- +X From d330484d3e5627108b85c93f5cb2d43718f6ebb9 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 13:33:17 -0400 Subject: [PATCH 02/20] Updated Notes section to list of [Sentence] --- code/drasil-example/Drasil/SWHS/IMods.hs | 71 ++++++++++++------------ code/stable/swhs/SRS/SWHS_SRS.tex | 7 ++- code/stable/swhs/Website/SWHS_SRS.html | 17 +++++- 3 files changed, 57 insertions(+), 38 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 3f26b082b3..a01b453be8 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -7,7 +7,8 @@ import Utils.Drasil import Data.Drasil.SentenceStructures (follows) import Data.Drasil.Utils (unwrap, weave) -import Data.Drasil.Concepts.Documentation (assumption, condition, constraint, goal, solution) +import Data.Drasil.Concepts.Documentation (assumption, condition, constraint, + goal, solution, term_) import Data.Drasil.Concepts.Math (area, change, equation, ode, rOfChng, surface) import Data.Drasil.Concepts.PhysicalProperties (liquid, mass, solid, vol) import Data.Drasil.Concepts.Thermodynamics (boilPt, boiling, heat, heatCapSpec, @@ -41,11 +42,11 @@ eBalanceOnWtr = im eBalanceOnWtr_rc [qw w_mass, qw htCap_W, qw coil_HTC, qw pcm_ qw pcm_HTC, qw coil_SA, qw temp_PCM, qw time_final, qw temp_C, qw temp_init] [sy temp_init $< sy temp_C] (qw temp_W) [0 $< sy time $< sy time_final] [makeCite koothoor2013] eBalanceOnWtrDeriv - "eBalanceOnWtr" [balWtrDesc] + "eBalanceOnWtr" balWtrDesc eBalanceOnWtr_rc :: RelationConcept eBalanceOnWtr_rc = makeRC "eBalanceOnWtr_rc" (nounPhraseSP $ "Energy balance on " ++ - "water to find the temperature of the water") balWtrDesc balWtr_Rel + "water to find the temperature of the water") EmptyS balWtr_Rel -- eBalanceOnWtrL balWtr_Rel :: Relation @@ -53,19 +54,19 @@ balWtr_Rel = (deriv (sy temp_W) time) $= 1 / (sy tau_W) * (((sy temp_C) - (apply1 temp_W time)) + (sy eta) * ((apply1 temp_PCM time) - (apply1 temp_W time))) -balWtrDesc :: Sentence -balWtrDesc = foldlSent [E $ sy temp_PCM, S "is defined by" +:+. makeRef2S eBalanceOnPCM, - S "The input", phrase constraint, E $ sy temp_init $<= sy temp_C, S "comes from" +:+. - makeRef2S assumpCTNOD, E $ sy tau_W, S "is calculated from" +:+. S "FIXME: Missing DD #1484", - E $ sy eta, S "is calculated from" +:+. S "FIXME: Missing DD #1484", - S "The initial", plural condition, S "for the" +:+. (getAcc ode `sAre` - E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP), - S "The", getAcc ode, S "applies as long as the", phrase water `sIs` - S "in", phrase liquid, S "form" `sC` (E $ real_interval temp_W (Bounded (Exc,0) (Exc,100))), +balWtrDesc :: [Sentence] +balWtrDesc = map foldlSent [[E (sy temp_PCM) `sIs` S "defined by", makeRef2S eBalanceOnPCM], + [S "The input", phrase constraint, E $ sy temp_init $<= sy temp_C, S "comes from", makeRef2S assumpCTNOD], + [E (sy tau_W) `sIs` S "calculated from" +:+ S "FIXME: Missing DD #1484"], + [E (sy eta) `sIs` S "calculated from" +:+ S "FIXME: Missing DD #1484"], + [S "The initial", plural condition, S "for the" +:+ (getAcc ode `sAre` + E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP)], + [S "The", getAcc ode, S "applies as long as the", phrase water `sIs` EmptyS `sIn` + phrase liquid, S "form" `sC` (E $ real_interval temp_W (Bounded (Exc,0) (Exc,100))), sParen (unwrap $ getUnit temp_W), S "where", E 0, sParen (unwrap $ getUnit temp_W) `sAnd` (E 100), sParen (unwrap $ getUnit temp_W) `sAre` S "the", phrase melting `sAnd` plural boilPt `sOf` phrase water `sC` S "respectively", - sParen (S "from" +:+ makeRef2S assumpWAL `sAnd` makeRef2S assumpAPT)] + sParen (S "from" +:+ makeRef2S assumpWAL `sAnd` makeRef2S assumpAPT)]] ---------------------------------------------- -- Derivation of eBalanceOnWtr -- @@ -73,7 +74,7 @@ balWtrDesc = foldlSent [E $ sy temp_PCM, S "is defined by" +:+. makeRef2S eBalan -- type Derivation = [Sentence] eBalanceOnWtrDeriv :: Derivation eBalanceOnWtrDeriv = - S "Derivation of the" +:+ phrase energy +:+ S "balance on water:" : + S "Derivation" `sOf` S "the" +:+ phrase energy +:+ S "balance on water:" : weave [eBalanceOnWtrDerivSentences, map E eBalanceOnWtr_deriv_eqns__im1] eBalanceOnWtrDerivSentences :: [Sentence] @@ -89,44 +90,42 @@ eBalanceOnWtrDerivSentences = map foldlSentCol [ eBalanceOnWtrDerivDesc1 :: Sentence -> Sentence-> Sentence -> ConceptInstance -> [Sentence] eBalanceOnWtrDerivDesc1 htEnd oa ea htA = [S "To find the", phrase rOfChng `sOf` (E $ sy temp_W) `sC` S "we look at the", phrase energy, S "balance on" +:+. phrase water, S "The", - phrase vol, S "being considered" `isThe` (phrase vol `sOf` phrase water), S "in the", + phrase vol, S "being considered" `isThe` (phrase vol `sOf` phrase water) `sIn` S "the", phrase tank, (E $ sy w_vol) `sC` S "which has", phrase mass +:+. ((E $ sy w_mass) `sAnd` phrase heatCapSpec `sC` (E $ sy htCap_W)), at_start heatTrans, S "occurs in the", phrase water, S "from the", phrase coil, S "as", (E $ sy ht_flux_C), - sParen (makeRef2S dd1HtFluxC) :+: htEnd `sC` EmptyS +:+. oa, ea, S "No", phrase heatTrans, S "occurs to", S "outside" `ofThe` - phrase tank `sC` S "since it has been assumed to be perfectly insulated" +:+. - sParen (makeRef2S assumpPIT), S "Since the", phrase assumption, - S "is made that no internal heat is generated" +:+. (sParen (makeRef2S htA) `sC` - (E $ sy vol_ht_gen $= 0)), S "Therefore" `sC` S "the", phrase equation, S "for", - makeRef2S rocTempSimp, S "can be written as"] + sParen (makeRef2S dd1HtFluxC) :+: htEnd `sC` EmptyS +:+. oa, ea, S "No", + phrase heatTrans, S "occurs to", S "outside" `ofThe` phrase tank `sC` + S "since it has been assumed to be perfectly insulated" +:+. sParen (makeRef2S assumpPIT), + S "Since the", phrase assumption `sIs` S "made that no internal heat" `sIs` + S "generated" +:+. (sParen (makeRef2S htA) `sC` (E $ sy vol_ht_gen $= 0)), + S "Therefore" `sC` S "the", phrase equation, S "for", makeRef2S rocTempSimp, S "can be written as"] htTransEnd :: Sentence -htTransEnd = foldlSent_ [S " " `sAnd` S "from the", phrase water, S "into the PCM as", - (E $ sy ht_flux_P), sParen (makeRef2S dd2HtFluxP)] +htTransEnd = foldlSent_ [S " " `sAnd` S "from the", phrase water, S "into the", + getAcc phsChgMtrl, S "as", (E $ sy ht_flux_P), sParen (makeRef2S dd2HtFluxP)] overAreas :: Sentence overAreas = S "over areas" +:+ ((E $ sy coil_SA) `sAnd` (E $ sy pcm_SA) `sC` S "respectively") extraAssumps :: Sentence -extraAssumps = foldlSent [S "The thermal flux is constant over", (E $ sy coil_SA) `sC` - S "since", phrase temp `ofThe` phrase coil, S "is assumed to not vary along its length", - sParen (makeRef2S assumpTHCCoL) `sC` EmptyS `andThe` S "thermal flux is constant over", - (E $ sy pcm_SA) `sC` S "since", phrase temp `ofThe` S "PCM is the same throughout its", - phrase vol, sParen (makeRef2S assumpTPCAV) `andThe` phrase water, S "is fully mixed" +:+ - sParen (makeRef2S assumpCWTAT)] +extraAssumps = foldlSent [S "The thermal flux" `sIs` S "constant over", (E $ sy coil_SA) `sC` + S "since", phrase temp `ofThe` phrase coil `sIs` S "assumed to not vary along its length", + sParen (makeRef2S assumpTHCCoL) `sC` EmptyS `andThe` S "thermal flux" `sIs` S "constant over", + (E $ sy pcm_SA) `sC` S "since", phrase temp `ofThe` getAcc phsChgMtrl `isThe` + S "same throughout its", phrase vol, sParen (makeRef2S assumpTPCAV) `andThe` + phrase water `sIs` S "fully mixed" +:+ sParen (makeRef2S assumpCWTAT)] eBalanceOnWtrDerivDesc2 :: DataDefinition -> DataDefinition -> [Sentence] -eBalanceOnWtrDerivDesc2 dd1 dd2 = - [S "Using", makeRef2S dd1 `sAnd` makeRef2S dd2, S "for", - (E $ sy dd1) `sAnd` (E $ sy dd2), - S "respectively, this can be written as"] +eBalanceOnWtrDerivDesc2 dd1 dd2 = [S "Using", makeRef2S dd1 `sAnd` makeRef2S dd2, + S "for", (E $ sy dd1) `sAnd` (E $ sy dd2), S "respectively" `sC` S "this can be written as"] eBalanceOnWtrDerivDesc3 :: UnitalChunk -> UncertQ -> [Sentence] eBalanceOnWtrDerivDesc3 wm hcw = [S "Dividing (3) by", ch wm :+: ch hcw `sC` S "we obtain"] eBalanceOnWtrDerivDesc4 :: [Sentence] -> [Sentence] -eBalanceOnWtrDerivDesc4 eq22 = [S "Factoring the negative sign out of the second term", +eBalanceOnWtrDerivDesc4 eq22 = [S "Factoring", S "negative sign out" `ofThe` S "second", phrase term_, S "of the RHS of Equation (4) and multiplying it by"] ++ eq22 ++ [S "yields"] eBalanceOnWtrDerivDesc5 ::[Sentence] @@ -139,8 +138,8 @@ eBalanceOnWtrDerivDesc6 eq33 eq44 = eBalanceOnWtrDerivDesc7 :: Expr -> [Sentence] eBalanceOnWtrDerivDesc7 eq55 = - [S "Finally, factoring out", (E eq55), S ", we are left with the governing", getAcc ode, S "for", - sParen (makeRef2S eBalanceOnWtr)] + [S "Finally" `sC` S "factoring out", E eq55, S ", we are left with the governing", + getAcc ode, S "for", sParen (makeRef2S eBalanceOnWtr)] eq2 :: [Sentence] eq2 = [ch coil_HTC, ch coil_SA, S "/", ch coil_HTC, ch coil_SA] diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index fdab696733..49ec659e79 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -784,7 +784,12 @@ \subsubsection{Instance Models} \item{${T_{P}}$ is the temperature of the phase change material (${}^{\circ}$C)} \end{symbDescription} \\ \midrule \\ -Notes & ${T_{P}}$ is defined by \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. The input constraint ${T_{init}}\leq{}{T_{C}}$ comes from \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. ${τ_{W}}$ is calculated from FIXME: Missing DD #1484. $η$ is calculated from FIXME: Missing DD #1484. The initial conditions for the ODE are ${T_{W}}\left(0\right)={T_{P}}\left(0\right)={T_{init}}$ following \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM}. The ODE applies as long as the water is in liquid form, $0<{T_{W}}<100$ (${}^{\circ}$C) where $0$ (${}^{\circ}$C) and $100$ (${}^{\circ}$C) are the melting and boiling point temperatures of water, respectively (from \hyperref[assumpWAL]{A: Water-Always-Liquid} and \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). +Notes & ${T_{P}}$ is defined by \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. + The input constraint ${T_{init}}\leq{}{T_{C}}$ comes from \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. + ${τ_{W}}$ is calculated from FIXME: Missing DD #1484. + $η$ is calculated from FIXME: Missing DD #1484. + The initial conditions for the ODE are ${T_{W}}\left(0\right)={T_{P}}\left(0\right)={T_{init}}$ following \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM}. + The ODE applies as long as the water is in liquid form, $0<{T_{W}}<100$ (${}^{\circ}$C) where $0$ (${}^{\circ}$C) and $100$ (${}^{\circ}$C) are the melting and boiling point temperatures of water, respectively (from \hyperref[assumpWAL]{A: Water-Always-Liquid} and \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). \\ \midrule \\ Source & \cite{koothoor2013} \\ \midrule \\ diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index bb6cea3cbc..d1ce1d2629 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -1712,7 +1712,22 @@

Instance Models

Notes

-TP is defined by IM: eBalanceOnPCM. The input constraint Tinit ≤ TC comes from A: Charging-Tank-No-Temp-Discharge. τW is calculated from FIXME: Missing DD #1484. η is calculated from FIXME: Missing DD #1484. The initial conditions for the ODE are TW(0) = TP(0) = Tinit following A: Same-Initial-Temp-Water-PCM. The ODE applies as long as the water is in liquid form, 0 < TW < 100 (°C) where 0 (°C) and 100 (°C) are the melting and boiling point temperatures of water, respectively (from A: Water-Always-Liquid and A: Atmospheric-Pressure-Tank). +TP is defined by IM: eBalanceOnPCM. +

+

+The input constraint Tinit ≤ TC comes from A: Charging-Tank-No-Temp-Discharge. +

+

+τW is calculated from FIXME: Missing DD #1484. +

+

+η is calculated from FIXME: Missing DD #1484. +

+

+The initial conditions for the ODE are TW(0) = TP(0) = Tinit following A: Same-Initial-Temp-Water-PCM. +

+

+The ODE applies as long as the water is in liquid form, 0 < TW < 100 (°C) where 0 (°C) and 100 (°C) are the melting and boiling point temperatures of water, respectively (from A: Water-Always-Liquid and A: Atmospheric-Pressure-Tank).

From 7390b2af8b35efbaf12c9d0fd19a13091bca4044 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 13:37:08 -0400 Subject: [PATCH 03/20] Replaced # with Issue for TeX compilation --- code/drasil-example/Drasil/SWHS/IMods.hs | 4 ++-- code/stable/swhs/SRS/SWHS_SRS.tex | 4 ++-- code/stable/swhs/Website/SWHS_SRS.html | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index a01b453be8..d4c7695778 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -57,8 +57,8 @@ balWtr_Rel = (deriv (sy temp_W) time) $= 1 / (sy tau_W) * balWtrDesc :: [Sentence] balWtrDesc = map foldlSent [[E (sy temp_PCM) `sIs` S "defined by", makeRef2S eBalanceOnPCM], [S "The input", phrase constraint, E $ sy temp_init $<= sy temp_C, S "comes from", makeRef2S assumpCTNOD], - [E (sy tau_W) `sIs` S "calculated from" +:+ S "FIXME: Missing DD #1484"], - [E (sy eta) `sIs` S "calculated from" +:+ S "FIXME: Missing DD #1484"], + [E (sy tau_W) `sIs` S "calculated from" +:+ S "FIXME: Missing DD Issue 1484"], + [E (sy eta) `sIs` S "calculated from" +:+ S "FIXME: Missing DD Issue 1484"], [S "The initial", plural condition, S "for the" +:+ (getAcc ode `sAre` E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP)], [S "The", getAcc ode, S "applies as long as the", phrase water `sIs` EmptyS `sIn` diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 49ec659e79..f0162be489 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -786,8 +786,8 @@ \subsubsection{Instance Models} \\ \midrule \\ Notes & ${T_{P}}$ is defined by \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. The input constraint ${T_{init}}\leq{}{T_{C}}$ comes from \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. - ${τ_{W}}$ is calculated from FIXME: Missing DD #1484. - $η$ is calculated from FIXME: Missing DD #1484. + ${τ_{W}}$ is calculated from FIXME: Missing DD Issue 1484. + $η$ is calculated from FIXME: Missing DD Issue 1484. The initial conditions for the ODE are ${T_{W}}\left(0\right)={T_{P}}\left(0\right)={T_{init}}$ following \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM}. The ODE applies as long as the water is in liquid form, $0<{T_{W}}<100$ (${}^{\circ}$C) where $0$ (${}^{\circ}$C) and $100$ (${}^{\circ}$C) are the melting and boiling point temperatures of water, respectively (from \hyperref[assumpWAL]{A: Water-Always-Liquid} and \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). \\ \midrule \\ diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index d1ce1d2629..2ebf0051db 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -1718,10 +1718,10 @@

Instance Models

The input constraint Tinit ≤ TC comes from A: Charging-Tank-No-Temp-Discharge.

-τW is calculated from FIXME: Missing DD #1484. +τW is calculated from FIXME: Missing DD Issue 1484.

-η is calculated from FIXME: Missing DD #1484. +η is calculated from FIXME: Missing DD Issue 1484.

The initial conditions for the ODE are TW(0) = TP(0) = Tinit following A: Same-Initial-Temp-Water-PCM. From afa41b1867146e260cf41ccb69a072ad4960a92b Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 14:34:33 -0400 Subject: [PATCH 04/20] Fixed equalities in IM constraints; closes #1487 --- code/drasil-example/Drasil/SWHS/IMods.hs | 10 +++++----- code/stable/nopcm/SRS/NoPCM_SRS.tex | 2 +- code/stable/nopcm/Website/NoPCM_SRS.html | 2 +- code/stable/swhs/SRS/SWHS_SRS.tex | 10 +++++----- code/stable/swhs/Website/SWHS_SRS.html | 10 +++++----- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index d4c7695778..8d023ab1b6 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -40,8 +40,8 @@ iMods = [eBalanceOnWtr, eBalanceOnPCM, heatEInWtr, heatEInPCM] eBalanceOnWtr :: InstanceModel eBalanceOnWtr = im eBalanceOnWtr_rc [qw w_mass, qw htCap_W, qw coil_HTC, qw pcm_SA, qw pcm_HTC, qw coil_SA, qw temp_PCM, qw time_final, qw temp_C, qw temp_init] - [sy temp_init $< sy temp_C] (qw temp_W) - [0 $< sy time $< sy time_final] [makeCite koothoor2013] eBalanceOnWtrDeriv + [sy temp_init $<= sy temp_C] (qw temp_W) + [0 $<= sy time $<= sy time_final] [makeCite koothoor2013] eBalanceOnWtrDeriv "eBalanceOnWtr" balWtrDesc eBalanceOnWtr_rc :: RelationConcept @@ -203,7 +203,7 @@ eBalanceOnPCM :: InstanceModel eBalanceOnPCM = im eBalanceOnPCM_rc [qw temp_melt_P, qw time_final, qw temp_init, qw pcm_SA, qw pcm_HTC, qw pcm_mass, qw htCap_S_P, qw htCap_L_P] [sy temp_init $< sy temp_melt_P] (qw temp_PCM) - [0 $< sy time $< sy time_final] [makeCite koothoor2013] eBalanceOnPCMDeriv + [0 $<= sy time $<= sy time_final] [makeCite koothoor2013] eBalanceOnPCMDeriv "eBalanceOnPCM" [balPCMDesc_note] eBalanceOnPCM_rc :: RelationConcept @@ -376,7 +376,7 @@ eBalanceOnPCM_deriv_eqns__im2 = [eBalanceOnPCM_Eqn1, eBalanceOnPCM_Eqn2, --------- heatEInWtr :: InstanceModel heatEInWtr = im heatEInWtr_rc [qw temp_init, qw w_mass, qw htCap_W, qw w_mass] - [] (qw w_E) [0 $< sy time $< sy time_final] [makeCite koothoor2013] [] "heatEInWtr" + [] (qw w_E) [0 $<= sy time $<= sy time_final] [makeCite koothoor2013] [] "heatEInWtr" [htWtrDesc] heatEInWtr_rc :: RelationConcept @@ -410,7 +410,7 @@ heatEInPCM :: InstanceModel heatEInPCM = imNoDeriv heatEInPCM_rc [qw temp_melt_P, qw time_final, qw temp_init, qw pcm_SA, qw pcm_HTC, qw pcm_mass, qw htCap_S_P, qw htCap_L_P, qw temp_PCM, qw htFusion, qw t_init_melt] [sy temp_init $< sy temp_melt_P] (qw pcm_E) - [0 $< sy time $< sy time_final] [makeCite koothoor2013] + [0 $<= sy time $<= sy time_final] [makeCite koothoor2013] "heatEInPCM" [htPCMDesc] heatEInPCM_rc :: RelationConcept diff --git a/code/stable/nopcm/SRS/NoPCM_SRS.tex b/code/stable/nopcm/SRS/NoPCM_SRS.tex index 9702037b66..fb108472fa 100644 --- a/code/stable/nopcm/SRS/NoPCM_SRS.tex +++ b/code/stable/nopcm/SRS/NoPCM_SRS.tex @@ -556,7 +556,7 @@ \subsubsection{Instance Models} Input Constraints & \\ \midrule \\ Output Constraints & \begin{displaymath} - 0Instance Models Output Constraints

-0 < t < tfinal +0 ≤ t ≤ tfinal
diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index f0162be489..c01721b089 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -764,11 +764,11 @@ \subsubsection{Instance Models} Output & ${T_{W}}$ \\ \midrule \\ Input Constraints & \begin{displaymath} - {T_{init}}<{T_{C}} + {T_{init}}\leq{}{T_{C}} \end{displaymath} \\ \midrule \\ Output Constraints & \begin{displaymath} - 0Instance Models Input Constraints
-Tinit < TC +Tinit ≤ TC
@@ -1671,7 +1671,7 @@

Instance Models

Output Constraints
-0 < t < tfinal +0 ≤ t ≤ tfinal
@@ -1911,7 +1911,7 @@

Instance Models

Output Constraints
-0 < t < tfinal +0 ≤ t ≤ tfinal
@@ -2102,7 +2102,7 @@

Instance Models

Output Constraints
-0 < t < tfinal +0 ≤ t ≤ tfinal
@@ -2189,7 +2189,7 @@

Instance Models

Output Constraints
-0 < t < tfinal +0 ≤ t ≤ tfinal
From 17a44675c9642734dd20bb273fe3645cb2e6c575 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 14:41:06 -0400 Subject: [PATCH 05/20] Fixed equation in IM2 as per #1069 --- code/drasil-example/Drasil/SWHS/IMods.hs | 6 ++---- code/stable/swhs/SRS/SWHS_SRS.tex | 3 +-- code/stable/swhs/Website/SWHS_SRS.html | 7 +------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 8d023ab1b6..112270013a 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -212,16 +212,14 @@ eBalanceOnPCM_rc = makeRC "eBalanceOnPCM_rc" (nounPhraseSP balPCMDesc balPCM_Rel -- eBalanceOnPCML balPCM_Rel :: Relation -balPCM_Rel = (deriv (sy temp_PCM) time) $= case_ [case1, case2, case3, case4] +balPCM_Rel = (deriv (sy temp_PCM) time) $= case_ [case1, case2, case3] where case1 = ((1 / (sy tau_S_P)) * ((apply1 temp_W time) - (apply1 temp_PCM time)), real_interval temp_PCM (UpTo (Exc,sy temp_melt_P))) case2 = ((1 / (sy tau_L_P)) * ((apply1 temp_W time) - (apply1 temp_PCM time)), real_interval temp_PCM (UpFrom (Exc,sy temp_melt_P))) - case3 = (0, (sy temp_PCM) $= (sy temp_melt_P)) - - case4 = (0, real_interval melt_frac (Bounded (Exc,0) (Exc,1))) + case3 = (0, (sy temp_PCM) $= (sy temp_melt_P) $&& real_interval melt_frac (Bounded (Exc,0) (Exc,1))) balPCMDesc :: Sentence balPCMDesc = foldlSent [(E $ sy temp_W) `isThe` phrase temp_W +:+. diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index c01721b089..5b0f6c39af 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -851,8 +851,7 @@ \subsubsection{Instance Models} \frac{d\,{T_{P}}}{d\,t}=\begin{cases} \frac{1}{{{τ_{P}}^{S}}} \left({T_{W}}\left(t\right)-{T_{P}}\left(t\right)\right), & {T_{P}}<{{T_{melt}}^{P}}\\ \frac{1}{{{τ_{P}}^{L}}} \left({T_{W}}\left(t\right)-{T_{P}}\left(t\right)\right), & {T_{P}}>{{T_{melt}}^{P}}\\ -0, & {T_{P}}={{T_{melt}}^{P}}\\ -0, & 0<ϕ<1 +0, & {T_{P}}={{T_{melt}}^{P}}\land{}0<ϕ<1 \end{cases} \end{displaymath} \\ \midrule \\ diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index 938e1a8355..bbdfeee4b8 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -1942,12 +1942,7 @@

Instance Models

0 , - TP = TmeltP - - - - 0 , - 0 < ϕ < 1 + TP = TmeltP ∧ 0 < ϕ < 1
From 99d3f582d715571a9a4827205529379e72d2ac94 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 15:06:08 -0400 Subject: [PATCH 06/20] Updated IM2 Notes; closes #1069 --- code/drasil-example/Drasil/SWHS/IMods.hs | 59 +++++++++--------------- code/stable/swhs/SRS/SWHS_SRS.tex | 12 +++-- code/stable/swhs/Website/SWHS_SRS.html | 34 +++++++------- 3 files changed, 46 insertions(+), 59 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 112270013a..85eef7d6c4 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -8,7 +8,7 @@ import Utils.Drasil import Data.Drasil.SentenceStructures (follows) import Data.Drasil.Utils (unwrap, weave) import Data.Drasil.Concepts.Documentation (assumption, condition, constraint, - goal, solution, term_) + goal, input_, solution, term_) import Data.Drasil.Concepts.Math (area, change, equation, ode, rOfChng, surface) import Data.Drasil.Concepts.PhysicalProperties (liquid, mass, solid, vol) import Data.Drasil.Concepts.Thermodynamics (boilPt, boiling, heat, heatCapSpec, @@ -56,11 +56,12 @@ balWtr_Rel = (deriv (sy temp_W) time) $= 1 / (sy tau_W) * balWtrDesc :: [Sentence] balWtrDesc = map foldlSent [[E (sy temp_PCM) `sIs` S "defined by", makeRef2S eBalanceOnPCM], - [S "The input", phrase constraint, E $ sy temp_init $<= sy temp_C, S "comes from", makeRef2S assumpCTNOD], - [E (sy tau_W) `sIs` S "calculated from" +:+ S "FIXME: Missing DD Issue 1484"], - [E (sy eta) `sIs` S "calculated from" +:+ S "FIXME: Missing DD Issue 1484"], - [S "The initial", plural condition, S "for the" +:+ (getAcc ode `sAre` - E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP)], + [S "The", phrase input_, phrase constraint, E $ sy temp_init $<= sy temp_C, + S "comes from", makeRef2S assumpCTNOD], + [E (sy tau_W) `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], + [E (sy eta) `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], + [S "The initial", plural condition, S "for the", getAcc ode `sAre` + E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP], [S "The", getAcc ode, S "applies as long as the", phrase water `sIs` EmptyS `sIn` phrase liquid, S "form" `sC` (E $ real_interval temp_W (Bounded (Exc,0) (Exc,100))), sParen (unwrap $ getUnit temp_W), S "where", E 0, sParen (unwrap $ getUnit temp_W) `sAnd` @@ -204,7 +205,7 @@ eBalanceOnPCM = im eBalanceOnPCM_rc [qw temp_melt_P, qw time_final, qw temp_init qw pcm_HTC, qw pcm_mass, qw htCap_S_P, qw htCap_L_P] [sy temp_init $< sy temp_melt_P] (qw temp_PCM) [0 $<= sy time $<= sy time_final] [makeCite koothoor2013] eBalanceOnPCMDeriv - "eBalanceOnPCM" [balPCMDesc_note] + "eBalanceOnPCM" balPCMDescNotes eBalanceOnPCM_rc :: RelationConcept eBalanceOnPCM_rc = makeRC "eBalanceOnPCM_rc" (nounPhraseSP @@ -234,36 +235,20 @@ balPCMDesc = foldlSent [(E $ sy temp_W) `isThe` phrase temp_W +:+. sParen (unwrap $ getUnit tau_S_P), sParen (makeRef2S ddBalanceLiquidPCM)] -balPCMDesc_note :: Sentence -balPCMDesc_note = foldlSent [ - (E (sy temp_melt_P)) `sC` (E (sy time_final)) `sC` (E (sy temp_init)) `sC` - (E (sy pcm_HTC)) `sC` (E (sy pcm_mass)) `sC` (E (sy htCap_S_P)) `sC` - (E (sy htCap_S_P)), S "form" +:+. sParen (makeRef2S eBalanceOnWtr), - S "The input is constrained so that", (E (sy temp_init $< sy temp_melt_P)), - sParen (makeRef2S assumpPIS), - (E (sy temp_PCM)) `sC` (E (0 $< sy time $< sy time_final)) `sC` - (S "with initial conditions") - `sC` (E (sy temp_W $= sy temp_PCM $= sy temp_init)) `sC` - (S "FIXME t_w(0) = t_p(0)") `sC` - makeRef2S assumpSITWP `sC` (S "and"), (E (sy temp_W)), - S "from", (makeRef2S eBalanceOnWtr) `sC` - S "such that the following governing" +:+. getAcc ode `sIs` S "satisfied", - S "The temperature remains constant at", - (E (sy temp_melt_P)) `sC` - (S "even with the heating (or cool-ing), until the phase change has occurred for all of the material; that is as long as"), - (E (0 $< sy melt_frac $< 1)), S "(from", makeRef2S dd4MeltFrac, - S ") is determined as part of the heat energy in the PCM, as given in" +:+. - sParen (makeRef2S heatEInPCM), - -- Addition based on smiths manual version. - (E $ (sy tau_S_P) $= ((sy pcm_mass) * (sy htCap_S_P)) / - ((sy pcm_HTC) * (sy pcm_SA))), S "is a constant", - sParen (unwrap $ getUnit tau_S_P) +:+. - sParen (makeRef2S ddBalanceSolidPCM), - - (E $ (sy tau_L_P) $= ((sy pcm_mass) * (sy htCap_L_P)) / - ((sy pcm_HTC) * (sy pcm_SA))), S "is a constant", - sParen (unwrap $ getUnit tau_L_P), - sParen (makeRef2S ddBalanceLiquidPCM)] +balPCMDescNotes :: [Sentence] +balPCMDescNotes = map foldlSent [ + [E (sy temp_W) `sIs` S "defined by", makeRef2S eBalanceOnWtr], + [S "The", phrase input_, phrase constraint, E $ sy temp_init $<= sy temp_melt_P, + S "comes from", makeRef2S assumpPIS], + [S "The", phrase temp, S "remains constant at", (E $ sy temp_melt_P) `sC` + S "even with the heating", sParen (S "or cooling") `sC` S "until the", + phrase phaseChange, S "has occurred for all" `sOf` S "the material; that" `sIs` + S "as long as" +:+. E (0 $< sy melt_frac $< 1), E $ sy melt_frac, + sParen (S "from" +:+ makeRef2S dd4MeltFrac) `sIs` + S "determined as part" `sOf` S "the", phrase heat, phrase energy `sIn` + S "the", getAcc phsChgMtrl `sC` S "as given" `sIn` sParen (makeRef2S heatEInPCM)], + [E (sy tau_S_P) `sIs` S "calculated" `sIn` makeRef2S ddBalanceSolidPCM], + [E (sy tau_L_P) `sIs` S "calculated" `sIn` makeRef2S ddBalanceLiquidPCM]] ---------------------------------------------- -- Derivation of eBalanceOnPCM -- diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 5b0f6c39af..cdc058fb61 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -353,7 +353,7 @@ \subsubsection{Assumptions} \item[Temp-Heating-Coil-Constant-over-Length:\phantomsection\label{assumpTHCCoL}]The temperature of the heating coil does not vary along its length. \hyperref[likeChgTCVOL]{LC: Temperature-Coil-Variable-Over-Length} \hyperref[DD:ht.flux.C]{DD: ht\_flux\_C} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. \item[Law-Convective-Cooling-Water-PCM:\phantomsection\label{assumpLCCWP}]Newton's law of convective cooling applies between the water and the PCM. \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P}. \item[Charging-Tank-No-Temp-Discharge:\phantomsection\label{assumpCTNOD}]The model only accounts for charging of the tank, not discharging. The temperature of the water and temperature of the phase change material can only increase, or remain constant; they do not decrease. This implies that the initial temperature \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM} is less than (or equal) to the temperature of the heating coil. \hyperref[likeChgDT]{LC: Discharging-Tank} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. -\item[Same-Initial-Temp-Water-PCM:\phantomsection\label{assumpSITWP}]The initial temperature of the water and the PCM is the same. \hyperref[likeChgDITPW]{LC: Different-Initial-Temps-PCM-Water} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. +\item[Same-Initial-Temp-Water-PCM:\phantomsection\label{assumpSITWP}]The initial temperature of the water and the PCM is the same. \hyperref[likeChgDITPW]{LC: Different-Initial-Temps-PCM-Water} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. \item[PCM-Initially-Solid:\phantomsection\label{assumpPIS}]The simulation will start with the PCM in a solid state. \hyperref[IM:heatEInPCM]{IM: heatEInPCM} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. \item[Water-Always-Liquid:\phantomsection\label{assumpWAL}]The operating temperature range of the system is such that the water is always in liquid state. That is, the temperature will not drop below the melting point temperature of water, or rise above its boiling point temperature. \hyperref[unlikeChgWPFS]{UC: Water-PCM-Fixed-States} \hyperref[IM:heatEInWtr]{IM: heatEInWtr} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. \item[Perfect-Insulation-Tank:\phantomsection\label{assumpPIT}]The tank is perfectly insulated so that there is no heat loss from the tank. \hyperref[likeChgTLH]{LC: Tank-Lose-Heat} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. @@ -793,7 +793,7 @@ \subsubsection{Instance Models} \\ \midrule \\ Source & \cite{koothoor2013} \\ \midrule \\ -RefBy & \hyperref[unlikeChgNIHG]{UC: No-Internal-Heat-Generation} \hyperref[outputInputDerivQuants]{FR: Output-Input-Derived-Quantities} \hyperref[outputInputDerivQuants]{FR: Output-Input-Derived-Quantities} \hyperref[findMass]{FR: Find-Mass} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} \hyperref[calcTempWtrOverTime]{FR: Calculate-Temperature-Water-Over-Time}. +RefBy & \hyperref[unlikeChgNIHG]{UC: No-Internal-Heat-Generation} \hyperref[outputInputDerivQuants]{FR: Output-Input-Derived-Quantities} \hyperref[outputInputDerivQuants]{FR: Output-Input-Derived-Quantities} \hyperref[findMass]{FR: Find-Mass} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} \hyperref[calcTempWtrOverTime]{FR: Calculate-Temperature-Water-Over-Time}. \\ \bottomrule \end{tabular} \end{minipage} Derivation of the energy balance on water: @@ -865,7 +865,11 @@ \subsubsection{Instance Models} \item{$ϕ$ is the melt fraction (Unitless)} \end{symbDescription} \\ \midrule \\ -Notes & ${{T_{melt}}^{P}}$, ${t_{final}}$, ${T_{init}}$, ${h_{P}}$, ${m_{P}}$, ${{C_{P}}^{S}}$, ${{C_{P}}^{S}}$ form (\hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}). The input is constrained so that ${T_{init}}<{{T_{melt}}^{P}}$ (\hyperref[assumpPIS]{A: PCM-Initially-Solid}) ${T_{P}}$, $0Assumptions

-Same-Initial-Temp-Water-PCM: The initial temperature of the water and the PCM is the same. LC: Different-Initial-Temps-PCM-Water IM: eBalanceOnWtr IM: eBalanceOnPCM A: Charging-Tank-No-Temp-Discharge. +Same-Initial-Temp-Water-PCM: The initial temperature of the water and the PCM is the same. LC: Different-Initial-Temps-PCM-Water IM: eBalanceOnWtr A: Charging-Tank-No-Temp-Discharge.

@@ -1741,7 +1741,7 @@

Instance Models

RefBy

-UC: No-Internal-Heat-Generation FR: Output-Input-Derived-Quantities FR: Output-Input-Derived-Quantities FR: Find-Mass IM: eBalanceOnWtr IM: eBalanceOnPCM IM: eBalanceOnPCM FR: Calculate-Temperature-Water-Over-Time. +UC: No-Internal-Heat-Generation FR: Output-Input-Derived-Quantities FR: Output-Input-Derived-Quantities FR: Find-Mass IM: eBalanceOnWtr IM: eBalanceOnPCM FR: Calculate-Temperature-Water-Over-Time.

@@ -1977,21 +1977,19 @@

Instance Models

Notes

-TmeltP, tfinal, Tinit, hP, mP, CPS, CPS form (IM: eBalanceOnWtr). The input is constrained so that Tinit < TmeltP (A: PCM-Initially-Solid) TP, 0 < t < tfinal, with initial conditions, TW = TP = Tinit, FIXME t_w(0) = t_p(0), A: Same-Initial-Temp-Water-PCM, and TW from IM: eBalanceOnWtr, such that the following governing ODE. is satisfied The temperature remains constant at TmeltP, even with the heating (or cool-ing), until the phase change has occurred for all of the material; that is as long as 0 < ϕ < 1 (from DD: melt_frac ) is determined as part of the heat energy in the PCM, as given in (IM: heatEInPCM). τPS =

- - mP CPS - - - hP AP - -
is a constant (s) (DD: balanceSolidPCM). τPL =
- - mP CPL - - - hP AP - -
is a constant (s) (DD: balanceLiquidPCM). +TW is defined by IM: eBalanceOnWtr. +

+

+The input constraint Tinit ≤ TmeltP comes from A: PCM-Initially-Solid. +

+

+The temperature remains constant at TmeltP, even with the heating (or cooling), until the phase change has occurred for all of the material; that is as long as 0 < ϕ < 1. ϕ (from DD: melt_frac) is determined as part of the heat energy in the PCM, as given in (IM: heatEInPCM). +

+

+τPS is calculated in DD: balanceSolidPCM. +

+

+τPL is calculated in DD: balanceLiquidPCM.

@@ -3410,7 +3408,7 @@

Traceability Matrices and Graphs

-X + X From bfc8f484ea6075c6224b3484398fa006c99b9e20 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 15:38:48 -0400 Subject: [PATCH 07/20] Added initial condition to IM2; closes #1488 --- code/drasil-example/Drasil/SWHS/IMods.hs | 4 +++- code/stable/swhs/SRS/SWHS_SRS.tex | 5 +++-- code/stable/swhs/Website/SWHS_SRS.html | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 558cbcb3df..bfcce3320f 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -248,7 +248,9 @@ balPCMDescNotes = map foldlSent [ S "determined as part" `sOf` S "the", phrase heat, phrase energy `sIn` S "the", getAcc phsChgMtrl `sC` S "as given" `sIn` sParen (makeRef2S heatEInPCM)], [E (sy tau_S_P) `sIs` S "calculated" `sIn` makeRef2S ddBalanceSolidPCM], - [E (sy tau_L_P) `sIs` S "calculated" `sIn` makeRef2S ddBalanceLiquidPCM]] + [E (sy tau_L_P) `sIs` S "calculated" `sIn` makeRef2S ddBalanceLiquidPCM], + [S "The initial", plural condition, S "for the", getAcc ode `sAre` + E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP]] ---------------------------------------------- -- Derivation of eBalanceOnPCM -- diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index d310a65aef..9440f22856 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -353,7 +353,7 @@ \subsubsection{Assumptions} \item[Temp-Heating-Coil-Constant-over-Length:\phantomsection\label{assumpTHCCoL}]The temperature of the heating coil does not vary along its length. \hyperref[likeChgTCVOL]{LC: Temperature-Coil-Variable-Over-Length} \hyperref[DD:ht.flux.C]{DD: ht\_flux\_C} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. \item[Law-Convective-Cooling-Water-PCM:\phantomsection\label{assumpLCCWP}]Newton's law of convective cooling applies between the water and the PCM. \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P}. \item[Charging-Tank-No-Temp-Discharge:\phantomsection\label{assumpCTNOD}]The model only accounts for charging of the tank, not discharging. The temperature of the water and temperature of the phase change material can only increase, or remain constant; they do not decrease. This implies that the initial temperature \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM} is less than (or equal) to the temperature of the heating coil. \hyperref[likeChgDT]{LC: Discharging-Tank} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. -\item[Same-Initial-Temp-Water-PCM:\phantomsection\label{assumpSITWP}]The initial temperature of the water and the PCM is the same. \hyperref[likeChgDITPW]{LC: Different-Initial-Temps-PCM-Water} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. +\item[Same-Initial-Temp-Water-PCM:\phantomsection\label{assumpSITWP}]The initial temperature of the water and the PCM is the same. \hyperref[likeChgDITPW]{LC: Different-Initial-Temps-PCM-Water} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. \item[PCM-Initially-Solid:\phantomsection\label{assumpPIS}]The simulation will start with the PCM in a solid state. \hyperref[IM:heatEInPCM]{IM: heatEInPCM} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. \item[Water-Always-Liquid:\phantomsection\label{assumpWAL}]The operating temperature range of the system is such that the water is always in liquid state. That is, the temperature will not drop below the melting point temperature of water, or rise above its boiling point temperature. \hyperref[unlikeChgWPFS]{UC: Water-PCM-Fixed-States} \hyperref[IM:heatEInWtr]{IM: heatEInWtr} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. \item[Perfect-Insulation-Tank:\phantomsection\label{assumpPIT}]The tank is perfectly insulated so that there is no heat loss from the tank. \hyperref[likeChgTLH]{LC: Tank-Lose-Heat} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. @@ -870,6 +870,7 @@ \subsubsection{Instance Models} The temperature remains constant at ${{T_{melt}}^{P}}$, even with the heating (or cooling), until the phase change has occurred for all of the material; that is as long as $0<ϕ<1$. $ϕ$ (from \hyperref[DD:melt.frac]{DD: melt\_frac}) is determined as part of the heat energy in the PCM, as given in (\hyperref[IM:heatEInPCM]{IM: heatEInPCM}). ${{τ_{P}}^{S}}$ is calculated in \hyperref[DD:balanceSolidPCM]{DD: balanceSolidPCM}. ${{τ_{P}}^{L}}$ is calculated in \hyperref[DD:balanceLiquidPCM]{DD: balanceLiquidPCM}. + The initial conditions for the ODE are ${T_{W}}\left(0\right)={T_{P}}\left(0\right)={T_{init}}$ following \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM}. \\ \midrule \\ Source & \cite{koothoor2013} \\ \midrule \\ @@ -1202,7 +1203,7 @@ \section{Traceability Matrices and Graphs} \\ \hyperref[assumpSHECov]{A: Specific-Heat-Energy-Constant-over-Volume} & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM} & & & & X & & & & & & & & & & & & X & X & & & & & & & & & & & & & & & +\hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM} & & & & X & & & & & & & & & X & & & X & X & & & & & & & & & & & & & & & \\ \hyperref[assumpTEO]{A: Thermal-Energy-Only} & & & & & & & & & & & & & & & & & & X & & & & & & & & & & & & & & \\ diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index dc07634990..242a9632e6 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -772,7 +772,7 @@

Assumptions

-Same-Initial-Temp-Water-PCM: The initial temperature of the water and the PCM is the same. LC: Different-Initial-Temps-PCM-Water IM: eBalanceOnWtr A: Charging-Tank-No-Temp-Discharge. +Same-Initial-Temp-Water-PCM: The initial temperature of the water and the PCM is the same. LC: Different-Initial-Temps-PCM-Water IM: eBalanceOnWtr IM: eBalanceOnPCM A: Charging-Tank-No-Temp-Discharge.

@@ -1991,6 +1991,9 @@

Instance Models

τPL is calculated in DD: balanceLiquidPCM.

+

+The initial conditions for the ODE are TW(0) = TP(0) = Tinit following A: Same-Initial-Temp-Water-PCM. +

@@ -3408,7 +3411,7 @@

Traceability Matrices and Graphs

- +X X From ab59f8c4154a30d3098515ee83498068806a0e41 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 15:53:45 -0400 Subject: [PATCH 08/20] Updated derivation of IM2; closes #1489 --- code/drasil-example/Drasil/SWHS/IMods.hs | 19 ++++---- code/stable/swhs/SRS/SWHS_SRS.tex | 58 ++++++++++++------------ code/stable/swhs/Website/SWHS_SRS.html | 58 ++++++++++++------------ 3 files changed, 69 insertions(+), 66 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index bfcce3320f..5de52b2f44 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -256,9 +256,8 @@ balPCMDescNotes = map foldlSent [ -- Derivation of eBalanceOnPCM -- ---------------------------------------------- eBalanceOnPCMDeriv :: Derivation -eBalanceOnPCMDeriv = - [S "Detailed derivation of the" +:+ phrase energy +:+ S "balance on the PCM during " +:+ - S "sensible heating phase:" ] ++ +eBalanceOnPCMDeriv = foldlSentCol [S "Detailed derivation of the", phrase energy, + S "balance on the PCM during sensible heating phase"] : (weave [eBalanceOnPCMDerivSentences, map E eBalanceOnPCM_deriv_eqns__im2]) ++ (eBalanceOnPCMDerivDesc5 htCap_S_P htCap_L_P tau_S_P tau_L_P surface area melting vol assumpVCMPN) ++ (eBalanceOnPCMDerivDesc6 temp_PCM) @@ -283,11 +282,15 @@ eBalanceOnPCMDerivDesc1 roc tempP en wt vo pcmvo pm hcs hsp hf hfp pc ps ht ass1 `isThe` (phrase vo `sOf` S "PCM,") +:+. (E $ sy pcmvo), S "The derivation that follows is" +:+. S "initially for the solid PCM", S "The mass of phase change material is", (E $ sy pm) `andThe` phrase hcs `sOf` S "PCM as a solid is" +:+. (E $ sy hsp), S "The", phrase hf, - S "into the PCM from", phrase wt, S "is", (E $ sy hfp), S "over", phrase pc, - S "material surface area" +:+. (E $ sy ps), S "There is no", phrase hf +:+. phrase output_, - S "Assuming no volumetric", phrase ht, S "generation per unit", phrase vo, - (sParen (makeRef2S ass16)) `sC` (E $ sy vhg $= 0) `sC` S "the equation for", - makeRef2S rocTempSimp, S "can be written as"] + S "into the PCM from", phrase wt `sIs` (E $ sy hfp), sParen (makeRef2S dd2HtFluxP), + S "over", phrase pc, S "material surface area" +:+. (E $ sy ps), + S "The thermal flux" `sIs` S "constant over", (E $ sy pcm_SA) `sC` S "since", + phrase temp `ofThe` getAcc phsChgMtrl `isThe` S "same throughout its", phrase vol, + sParen (makeRef2S assumpTPCAV) `andThe` phrase water `sIs` S "fully mixed" +:+. + sParen (makeRef2S assumpCWTAT), S "There is no", phrase hf, phrase output_, + S "from the" +:+. getAcc phsChgMtrl, S "Assuming no volumetric", phrase ht, + S "generation per unit", phrase vo, sParen (makeRef2S ass16) `sC` (E $ sy vhg $= 0) `sC` + S "the equation for", makeRef2S rocTempSimp, S "can be written as"] eBalanceOnPCMDerivDesc2 :: DataDefinition -> UnitalChunk -> [Sentence] eBalanceOnPCMDerivDesc2 dd2 hfp = diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 9440f22856..4d12a5b5fd 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -344,8 +344,8 @@ \subsubsection{Assumptions} \begin{itemize} \item[Thermal-Energy-Only:\phantomsection\label{assumpTEO}]The only form of energy that is relevant for this problem is thermal energy. All other forms of energy, such as mechanical energy, are assumed to be negligible. \hyperref[TM:consThermE]{TM: consThermE}. \item[Heat-Transfer-Coeffs-Constant:\phantomsection\label{assumpHTCC}]All heat transfer coefficients are constant over time. \hyperref[GD:nwtnCooling]{GD: nwtnCooling}. -\item[Constant-Water-Temp-Across-Tank:\phantomsection\label{assumpCWTAT}]The water in the tank is fully mixed, so the temperature of the water is the same throughout the entire tank. \hyperref[GD:rocTempSimp]{GD: rocTempSimp} \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. -\item[Temp-PCM-Constant-Across-Volume:\phantomsection\label{assumpTPCAV}]The temperature of the phase change material is the same throughout the volume of PCM. \hyperref[GD:rocTempSimp]{GD: rocTempSimp} \hyperref[likeChgUTP]{LC: Uniform-Temperature-PCM} \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}. +\item[Constant-Water-Temp-Across-Tank:\phantomsection\label{assumpCWTAT}]The water in the tank is fully mixed, so the temperature of the water is the same throughout the entire tank. \hyperref[GD:rocTempSimp]{GD: rocTempSimp} \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. +\item[Temp-PCM-Constant-Across-Volume:\phantomsection\label{assumpTPCAV}]The temperature of the phase change material is the same throughout the volume of PCM. \hyperref[GD:rocTempSimp]{GD: rocTempSimp} \hyperref[likeChgUTP]{LC: Uniform-Temperature-PCM} \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. \item[Density-Water-PCM-Constant-over-Volume:\phantomsection\label{assumpDWPCoV}]The density of water and density of PCM have no spatial variation; that is, they are each constant over their entire volume. \hyperref[GD:rocTempSimp]{GD: rocTempSimp}. \item[Specific-Heat-Energy-Constant-over-Volume:\phantomsection\label{assumpSHECov}]The specific heat capacity of water, specific heat capacity of PCM as a solid, and specific heat capacity of PCM as a liquid have no spatial variation; that is, they are each constant over their entire volume. \hyperref[GD:rocTempSimp]{GD: rocTempSimp}. \item[Newton-Law-Convective-Cooling-Coil-Water:\phantomsection\label{assumpLCCCW}]Newton's law of convective cooling applies between the heating coil and the water. \hyperref[DD:ht.flux.C]{DD: ht\_flux\_C}. @@ -619,7 +619,7 @@ \subsubsection{Data Definitions} \\ \midrule \\ Source & \cite{koothoor2013} \\ \midrule \\ -RefBy & \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. +RefBy & \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM}. \\ \bottomrule \end{tabular} \end{minipage} \par~ @@ -877,8 +877,8 @@ \subsubsection{Instance Models} RefBy & \hyperref[unlikeChgNIHG]{UC: No-Internal-Heat-Generation} \hyperref[unlikeChgNGS]{UC: No-Gaseous-State} \hyperref[outputInputDerivQuants]{FR: Output-Input-Derived-Quantities} \hyperref[outputInputDerivQuants]{FR: Output-Input-Derived-Quantities} \hyperref[findMass]{FR: Find-Mass} \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} \hyperref[calcTempPCMOverTime]{FR: Calculate-Temperature-PCM-Over-Time} \hyperref[calcPCMMeltEnd]{FR: Calculate-PCM-Melt-End-Time} \hyperref[calcPCMMeltBegin]{FR: Calculate-PCM-Melt-Begin-Time}. \\ \bottomrule \end{tabular} \end{minipage} -Detailed derivation of the energy balance on the PCM during sensible heating phase: -To find the rate of change of ${T_{P}}$, we look at the energy balance on the PCM. The volume being considered is the volume of PCM, ${V_{P}}$. The derivation that follows is initially for the solid PCM. The mass of phase change material is ${m_{P}}$ and the specific heat capacity of PCM as a solid is ${{C_{P}}^{S}}$. The heat flux into the PCM from water is ${q_{P}}$ over phase change material surface area ${A_{P}}$. There is no heat flux output. Assuming no volumetric heat generation per unit volume (\hyperref[assumpNIHGBWP]{A: No-Internal-Heat-Generation-By-Water-PCM}), $g=0$, the equation for \hyperref[GD:rocTempSimp]{GD: rocTempSimp} can be written as: +Detailed derivation of the energy balance on the PCM during sensible heating phase: +To find the rate of change of ${T_{P}}$, we look at the energy balance on the PCM. The volume being considered is the volume of PCM, ${V_{P}}$. The derivation that follows is initially for the solid PCM. The mass of phase change material is ${m_{P}}$ and the specific heat capacity of PCM as a solid is ${{C_{P}}^{S}}$. The heat flux into the PCM from water is ${q_{P}}$ (\hyperref[DD:ht.flux.P]{DD: ht\_flux\_P}) over phase change material surface area ${A_{P}}$. The thermal flux is constant over ${A_{P}}$, since the temperature of the PCM is the same throughout its volume (\hyperref[assumpTPCAV]{A: Temp-PCM-Constant-Across-Volume}) and the water is fully mixed (\hyperref[assumpCWTAT]{A: Constant-Water-Temp-Across-Tank}). There is no heat flux output from the PCM. Assuming no volumetric heat generation per unit volume (\hyperref[assumpNIHGBWP]{A: No-Internal-Heat-Generation-By-Water-PCM}), $g=0$, the equation for \hyperref[GD:rocTempSimp]{GD: rocTempSimp} can be written as: \begin{displaymath} {m_{P}} {{C_{P}}^{S}} \frac{d\,{T_{P}}}{d\,t}={q_{P}} {A_{P}} \end{displaymath} @@ -1171,7 +1171,7 @@ \section{Traceability Matrices and Graphs} The purpose of the traceability matrices is to provide easy references on what has to be additionally modified if a certain component is changed. Every time a component is changed, the items in the row of that component that are marked with an ``X'' should be modified as well. \hyperref[Table:Tracey]{Table:Tracey} shows the dependencies of theoretical models, general definitions, data definitions, and instance models with each other. \hyperref[Table:Tracey2]{Table:Tracey2} shows the dependencies of instance models, requirements, and data constraints on each other. \hyperref[Table:Tracey1]{Table:Tracey1} shows the dependencies of theoretical models, general definitions, data definitions, instance models, and likely changes on the assumptions. \begin{longtable}{l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l l} \toprule - & \hyperref[checkWithPhysConsts]{FR: Check-Input-with-Physical\_Constraints} & \hyperref[inputInitQuants]{FR: Input-Initial-Quantities} & \hyperref[IM:heatEInWtr]{IM: heatEInWtr} & \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} & \hyperref[likeChgDT]{LC: Discharging-Tank} & \hyperref[GD:rocTempSimp]{GD: rocTempSimp} & \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P} & \hyperref[GD:nwtnCooling]{GD: nwtnCooling} & \hyperref[DD:ht.flux.C]{DD: ht\_flux\_C} & \hyperref[unlikeChgWPFS]{UC: Water-PCM-Fixed-States} & \hyperref[unlikeChgNGS]{UC: No-Gaseous-State} & \hyperref[IM:heatEInPCM]{IM: heatEInPCM} & \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} & \hyperref[unlikeChgNIHG]{UC: No-Internal-Heat-Generation} & \hyperref[likeChgTLH]{LC: Tank-Lose-Heat} & \hyperref[likeChgDITPW]{LC: Different-Initial-Temps-PCM-Water} & \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge} & \hyperref[TM:consThermE]{TM: consThermE} & \hyperref[likeChgTCVOL]{LC: Temperature-Coil-Variable-Over-Length} & \hyperref[likeChgTCVOD]{LC: Temperature-Coil-Variable-Over-Day} & \hyperref[likeChgUTP]{LC: Uniform-Temperature-PCM} & \hyperref[findMass]{FR: Find-Mass} & \hyperref[outputInputDerivQuants]{FR: Output-Input-Derived-Quantities} & \hyperref[calcTempPCMOverTime]{FR: Calculate-Temperature-PCM-Over-Time} & \hyperref[calcPCMMeltEnd]{FR: Calculate-PCM-Melt-End-Time} & \hyperref[calcPCMMeltBegin]{FR: Calculate-PCM-Melt-Begin-Time} & \hyperref[calcTempWtrOverTime]{FR: Calculate-Temperature-Water-Over-Time} & \hyperref[calcChgHeatEnergyPCMOverTime]{FR: Calculate-Change-Heat\_Energy-PCM-Over-Time} & \hyperref[calcChgHeatEnergyWtrOverTime]{FR: Calculate-Change-Heat\_Energy-Water-Over-Time} & \hyperref[DD:melt.frac]{DD: melt\_frac} & \hyperref[TM:latentHtE]{TM: latentHtE} & \hyperref[TM:sensHtE]{TM: sensHtE} + & \hyperref[checkWithPhysConsts]{FR: Check-Input-with-Physical\_Constraints} & \hyperref[inputInitQuants]{FR: Input-Initial-Quantities} & \hyperref[IM:heatEInWtr]{IM: heatEInWtr} & \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} & \hyperref[likeChgDT]{LC: Discharging-Tank} & \hyperref[GD:rocTempSimp]{GD: rocTempSimp} & \hyperref[DD:ht.flux.P]{DD: ht\_flux\_P} & \hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} & \hyperref[GD:nwtnCooling]{GD: nwtnCooling} & \hyperref[DD:ht.flux.C]{DD: ht\_flux\_C} & \hyperref[unlikeChgWPFS]{UC: Water-PCM-Fixed-States} & \hyperref[unlikeChgNGS]{UC: No-Gaseous-State} & \hyperref[IM:heatEInPCM]{IM: heatEInPCM} & \hyperref[unlikeChgNIHG]{UC: No-Internal-Heat-Generation} & \hyperref[likeChgTLH]{LC: Tank-Lose-Heat} & \hyperref[likeChgDITPW]{LC: Different-Initial-Temps-PCM-Water} & \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge} & \hyperref[TM:consThermE]{TM: consThermE} & \hyperref[likeChgTCVOL]{LC: Temperature-Coil-Variable-Over-Length} & \hyperref[likeChgTCVOD]{LC: Temperature-Coil-Variable-Over-Day} & \hyperref[likeChgUTP]{LC: Uniform-Temperature-PCM} & \hyperref[findMass]{FR: Find-Mass} & \hyperref[outputInputDerivQuants]{FR: Output-Input-Derived-Quantities} & \hyperref[calcTempPCMOverTime]{FR: Calculate-Temperature-PCM-Over-Time} & \hyperref[calcPCMMeltEnd]{FR: Calculate-PCM-Melt-End-Time} & \hyperref[calcPCMMeltBegin]{FR: Calculate-PCM-Melt-Begin-Time} & \hyperref[calcTempWtrOverTime]{FR: Calculate-Temperature-Water-Over-Time} & \hyperref[calcChgHeatEnergyPCMOverTime]{FR: Calculate-Change-Heat\_Energy-PCM-Over-Time} & \hyperref[calcChgHeatEnergyWtrOverTime]{FR: Calculate-Change-Heat\_Energy-Water-Over-Time} & \hyperref[DD:melt.frac]{DD: melt\_frac} & \hyperref[TM:latentHtE]{TM: latentHtE} & \hyperref[TM:sensHtE]{TM: sensHtE} \\ \midrule \endhead @@ -1183,73 +1183,73 @@ \section{Traceability Matrices and Graphs} \\ \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge} & & & & X & X & & & & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[assumpCWTAT]{A: Constant-Water-Temp-Across-Tank} & & & & X & & X & X & & & & & & & & & & & & & & & & & & & & & & & & & +\hyperref[assumpCWTAT]{A: Constant-Water-Temp-Across-Tank} & & & & X & & X & X & X & & & & & & & & & & & & & & & & & & & & & & & & \\ \hyperref[assumpDWPCoV]{A: Density-Water-PCM-Constant-over-Volume} & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[assumpHTCC]{A: Heat-Transfer-Coeffs-Constant} & & & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & +\hyperref[assumpHTCC]{A: Heat-Transfer-Coeffs-Constant} & & & & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[assumpLCCCW]{A: Newton-Law-Convective-Cooling-Coil-Water} & & & & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & +\hyperref[assumpLCCCW]{A: Newton-Law-Convective-Cooling-Coil-Water} & & & & & & & & & & X & & & & & & & & & & & & & & & & & & & & & & \\ \hyperref[assumpLCCWP]{A: Law-Convective-Cooling-Water-PCM} & & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[assumpNGSP]{A: No-Gaseous-State-PCM} & & & & & & & & & & X & X & X & X & & & & & & & & & & & & & & & & & & & +\hyperref[assumpNGSP]{A: No-Gaseous-State-PCM} & & & & & & & & X & & & X & X & X & & & & & & & & & & & & & & & & & & & \\ -\hyperref[assumpNIHGBWP]{A: No-Internal-Heat-Generation-By-Water-PCM} & & & & X & & & & & & & & & X & X & & & & & & & & & & & & & & & & & & +\hyperref[assumpNIHGBWP]{A: No-Internal-Heat-Generation-By-Water-PCM} & & & & X & & & & X & & & & & & X & & & & & & & & & & & & & & & & & & \\ -\hyperref[assumpPIS]{A: PCM-Initially-Solid} & & & & & & & & & & & & X & X & & & & & & & & & & & & & & & & & & & +\hyperref[assumpPIS]{A: PCM-Initially-Solid} & & & & & & & & X & & & & & X & & & & & & & & & & & & & & & & & & & \\ \hyperref[assumpPIT]{A: Perfect-Insulation-Tank} & & & & X & & & & & & & & & & & X & & & & & & & & & & & & & & & & & \\ \hyperref[assumpSHECov]{A: Specific-Heat-Energy-Constant-over-Volume} & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM} & & & & X & & & & & & & & & X & & & X & X & & & & & & & & & & & & & & & +\hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM} & & & & X & & & & X & & & & & & & & X & X & & & & & & & & & & & & & & & \\ \hyperref[assumpTEO]{A: Thermal-Energy-Only} & & & & & & & & & & & & & & & & & & X & & & & & & & & & & & & & & \\ -\hyperref[assumpTHCCoL]{A: Temp-Heating-Coil-Constant-over-Length} & & & & X & & & & & X & & & & & & & & & & X & & & & & & & & & & & & & +\hyperref[assumpTHCCoL]{A: Temp-Heating-Coil-Constant-over-Length} & & & & X & & & & & & X & & & & & & & & & X & & & & & & & & & & & & & \\ -\hyperref[assumpTHCCoT]{A: Temp-Heating-Coil-Constant-over-Time} & & & & & & & & & X & & & & & & & & & & & X & & & & & & & & & & & & +\hyperref[assumpTHCCoT]{A: Temp-Heating-Coil-Constant-over-Time} & & & & & & & & & & X & & & & & & & & & & X & & & & & & & & & & & & \\ -\hyperref[assumpTPCAV]{A: Temp-PCM-Constant-Across-Volume} & & & & X & & X & X & & & & & & & & & & & & & & X & & & & & & & & & & & +\hyperref[assumpTPCAV]{A: Temp-PCM-Constant-Across-Volume} & & & & X & & X & X & X & & & & & & & & & & & & & X & & & & & & & & & & & \\ -\hyperref[assumpVCMPN]{A: Volume-Change-Melting-PCM-Negligible} & & & & & & & & & & & & & X & & & & & & & & & & & & & & & & & & & +\hyperref[assumpVCMPN]{A: Volume-Change-Melting-PCM-Negligible} & & & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & \\ \hyperref[assumpVCN]{A: Volume-Coil-Negligible} & & & & & & & & & & & & & & & & & & & & & & X & & & & & & & & & & \\ -\hyperref[assumpWAL]{A: Water-Always-Liquid} & & & X & X & & & & & & X & & & & & & & & & & & & & & & & & & & & & & +\hyperref[assumpWAL]{A: Water-Always-Liquid} & & & X & X & & & & & & & X & & & & & & & & & & & & & & & & & & & & & \\ \hyperref[TM:consThermE]{TM: consThermE} & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} & & & & X & & & & & & & X & & & X & & & & & & & & X & X & X & X & X & & & & & & +\hyperref[IM:eBalanceOnPCM]{IM: eBalanceOnPCM} & & & & X & & & & & & & & X & & X & & & & & & & & X & X & X & X & X & & & & & & \\ -\hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} & & & & X & & & & & & & & & X & X & & & & & & & & X & X & & & & X & & & & & +\hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr} & & & & X & & & & X & & & & & & X & & & & & & & & X & X & & & & X & & & & & \\ \hyperref[findMass]{FR: Find-Mass} & & & & & & & & & & & & & & & & & & & & & & & X & & & & & & & & & \\ -\hyperref[IM:heatEInPCM]{IM: heatEInPCM} & & & & & & & & & & & X & & X & & & & & & & & & X & & & & & & X & & & & +\hyperref[IM:heatEInPCM]{IM: heatEInPCM} & & & & & & & & X & & & & X & & & & & & & & & & X & & & & & & X & & & & \\ \hyperref[IM:heatEInWtr]{IM: heatEInWtr} & & & & & & & & & & & & & & & & & & & & & & X & & & & & & & X & & & \\ -\hyperref[DD:htFusion]{DD: htFusion} & & & & X & & & & & & & & X & & & & & & & & & & & & & & & & & & X & X & +\hyperref[DD:htFusion]{DD: htFusion} & & & & X & & & & & & & & & X & & & & & & & & & & & & & & & & & X & X & \\ \hyperref[DD:ht.flux.C]{DD: ht\_flux\_C} & & & & X & & & & & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[DD:ht.flux.P]{DD: ht\_flux\_P} & & & & X & & & & & & & & & X & & & & & & & & & & & & & & & & & & & +\hyperref[DD:ht.flux.P]{DD: ht\_flux\_P} & & & & X & & & & X & & & & & & & & & & & & & & & & & & & & & & & & \\ \hyperref[inputInitQuants]{FR: Input-Initial-Quantities} & & & & & & & & & & & & & & & & & & & & & & X & X & & & & & & & & & \\ -\hyperref[TM:latentHtE]{TM: latentHtE} & & & & & & & & & & & & X & & & & & & & & & & & & & & & & & & & & X +\hyperref[TM:latentHtE]{TM: latentHtE} & & & & & & & & & & & & & X & & & & & & & & & & & & & & & & & & & X \\ -\hyperref[DD:melt.frac]{DD: melt\_frac} & & & & X & & & & & & & & & X & & & & & & & & & & & & & & & & & & & +\hyperref[DD:melt.frac]{DD: melt\_frac} & & & & X & & & & X & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[GD:rocTempSimp]{GD: rocTempSimp} & & & & X & & X & & & & & & & X & & & & & & & & & & & & & & & & & & & +\hyperref[GD:rocTempSimp]{GD: rocTempSimp} & & & & X & & X & & X & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[TM:sensHtE]{TM: sensHtE} & & & X & & & & & & & & & X & & & & & & & & & & & & & & & & & & & & +\hyperref[TM:sensHtE]{TM: sensHtE} & & & X & & & & & & & & & & X & & & & & & & & & & & & & & & & & & & \\ -\hyperref[DD:balanceLiquidPCM]{DD: balanceLiquidPCM} & & & & & & & & & & & & & X & & & & & & & & & & & & & & & & & & & +\hyperref[DD:balanceLiquidPCM]{DD: balanceLiquidPCM} & & & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & \\ -\hyperref[DD:balanceSolidPCM]{DD: balanceSolidPCM} & & & & & & & & & & & & & X & & & & & & & & & & & & & & & & & & & +\hyperref[DD:balanceSolidPCM]{DD: balanceSolidPCM} & & & & & & & & X & & & & & & & & & & & & & & & & & & & & & & & & \\ \bottomrule \caption{Traceability Matrix Showing the Connections Between Items of Different Sections} diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index 242a9632e6..1e32f8a0d8 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -727,12 +727,12 @@

Assumptions

-Constant-Water-Temp-Across-Tank: The water in the tank is fully mixed, so the temperature of the water is the same throughout the entire tank. GD: rocTempSimp DD: ht_flux_P IM: eBalanceOnWtr. +Constant-Water-Temp-Across-Tank: The water in the tank is fully mixed, so the temperature of the water is the same throughout the entire tank. GD: rocTempSimp DD: ht_flux_P IM: eBalanceOnWtr IM: eBalanceOnPCM.

-Temp-PCM-Constant-Across-Volume: The temperature of the phase change material is the same throughout the volume of PCM. GD: rocTempSimp LC: Uniform-Temperature-PCM DD: ht_flux_P IM: eBalanceOnWtr. +Temp-PCM-Constant-Across-Volume: The temperature of the phase change material is the same throughout the volume of PCM. GD: rocTempSimp LC: Uniform-Temperature-PCM DD: ht_flux_P IM: eBalanceOnWtr IM: eBalanceOnPCM.

@@ -1367,7 +1367,7 @@

Data Definitions

RefBy

-IM: eBalanceOnWtr IM: eBalanceOnWtr IM: eBalanceOnPCM. +IM: eBalanceOnWtr IM: eBalanceOnWtr IM: eBalanceOnPCM IM: eBalanceOnPCM.

@@ -2013,10 +2013,10 @@

Instance Models

-Detailed derivation of the energy balance on the PCM during sensible heating phase: +Detailed derivation of the energy balance on the PCM during sensible heating phase:

-To find the rate of change of TP, we look at the energy balance on the PCM. The volume being considered is the volume of PCM, VP. The derivation that follows is initially for the solid PCM. The mass of phase change material is mP and the specific heat capacity of PCM as a solid is CPS. The heat flux into the PCM from water is qP over phase change material surface area AP. There is no heat flux output. Assuming no volumetric heat generation per unit volume (A: No-Internal-Heat-Generation-By-Water-PCM), g = 0, the equation for GD: rocTempSimp can be written as: +To find the rate of change of TP, we look at the energy balance on the PCM. The volume being considered is the volume of PCM, VP. The derivation that follows is initially for the solid PCM. The mass of phase change material is mP and the specific heat capacity of PCM as a solid is CPS. The heat flux into the PCM from water is qP (DD: ht_flux_P) over phase change material surface area AP. The thermal flux is constant over AP, since the temperature of the PCM is the same throughout its volume (A: Temp-PCM-Constant-Across-Volume) and the water is fully mixed (A: Constant-Water-Temp-Across-Tank). There is no heat flux output from the PCM. Assuming no volumetric heat generation per unit volume (A: No-Internal-Heat-Generation-By-Water-PCM), g = 0, the equation for GD: rocTempSimp can be written as:

mP CPS
@@ -2843,12 +2843,12 @@

Traceability Matrices and Graphs

LC: Discharging-Tank GD: rocTempSimp DD: ht_flux_P +IM: eBalanceOnPCM GD: nwtnCooling DD: ht_flux_C UC: Water-PCM-Fixed-States UC: No-Gaseous-State IM: heatEInPCM -IM: eBalanceOnPCM UC: No-Internal-Heat-Generation LC: Tank-Lose-Heat @@ -3046,7 +3046,7 @@

Traceability Matrices and Graphs

X X - +X @@ -3118,8 +3118,8 @@

Traceability Matrices and Graphs

-X +X @@ -3156,8 +3156,8 @@

Traceability Matrices and Graphs

-X +X @@ -3227,12 +3227,12 @@

Traceability Matrices and Graphs

+X X X X -X @@ -3264,13 +3264,13 @@

Traceability Matrices and Graphs

+X X -X @@ -3299,12 +3299,12 @@

Traceability Matrices and Graphs

+X X -X @@ -3406,12 +3406,12 @@

Traceability Matrices and Graphs

+X -X X @@ -3479,8 +3479,8 @@

Traceability Matrices and Graphs

-X +X @@ -3516,8 +3516,8 @@

Traceability Matrices and Graphs

-X +X @@ -3552,7 +3552,7 @@

Traceability Matrices and Graphs

X X - +X @@ -3589,12 +3589,12 @@

Traceability Matrices and Graphs

+X -X @@ -3661,8 +3661,8 @@

Traceability Matrices and Graphs

-X +X @@ -3732,8 +3732,8 @@

Traceability Matrices and Graphs

-X +X X @@ -3764,13 +3764,13 @@

Traceability Matrices and Graphs

+X X -X @@ -3834,12 +3834,12 @@

Traceability Matrices and Graphs

+X X -X @@ -3908,8 +3908,8 @@

Traceability Matrices and Graphs

-X +X @@ -3974,12 +3974,12 @@

Traceability Matrices and Graphs

+X -X @@ -4048,8 +4048,8 @@

Traceability Matrices and Graphs

-X +X @@ -4079,12 +4079,12 @@

Traceability Matrices and Graphs

+X -X @@ -4114,12 +4114,12 @@

Traceability Matrices and Graphs

X +X -X @@ -4153,8 +4153,8 @@

Traceability Matrices and Graphs

-X +X @@ -4184,12 +4184,12 @@

Traceability Matrices and Graphs

+X -X @@ -4219,12 +4219,12 @@

Traceability Matrices and Graphs

+X -X From 21443488acd08c7ff0a2c0cb379896696a779147 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 16:05:01 -0400 Subject: [PATCH 09/20] Removed redunant information from IM3 as per #1476 --- code/drasil-example/Drasil/SWHS/IMods.hs | 34 ++++++++++-------------- code/stable/nopcm/SRS/NoPCM_SRS.tex | 4 ++- code/stable/nopcm/Website/NoPCM_SRS.html | 8 +++++- code/stable/swhs/SRS/SWHS_SRS.tex | 4 ++- code/stable/swhs/Website/SWHS_SRS.html | 8 +++++- 5 files changed, 34 insertions(+), 24 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 5de52b2f44..ec683d46fd 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -205,7 +205,7 @@ eBalanceOnPCM = im eBalanceOnPCM_rc [qw temp_melt_P, qw time_final, qw temp_init qw pcm_HTC, qw pcm_mass, qw htCap_S_P, qw htCap_L_P] [sy temp_init $< sy temp_melt_P] (qw temp_PCM) [0 $<= sy time $<= sy time_final] [makeCite koothoor2013] eBalanceOnPCMDeriv - "eBalanceOnPCM" balPCMDescNotes + "eBalanceOnPCM" balPCMNotes eBalanceOnPCM_rc :: RelationConcept eBalanceOnPCM_rc = makeRC "eBalanceOnPCM_rc" (nounPhraseSP @@ -235,8 +235,8 @@ balPCMDesc = foldlSent [(E $ sy temp_W) `isThe` phrase temp_W +:+. sParen (unwrap $ getUnit tau_S_P), sParen (makeRef2S ddBalanceLiquidPCM)] -balPCMDescNotes :: [Sentence] -balPCMDescNotes = map foldlSent [ +balPCMNotes :: [Sentence] +balPCMNotes = map foldlSent [ [E (sy temp_W) `sIs` S "defined by", makeRef2S eBalanceOnWtr], [S "The", phrase input_, phrase constraint, E $ sy temp_init $<= sy temp_melt_P, S "comes from", makeRef2S assumpPIS], @@ -365,31 +365,25 @@ eBalanceOnPCM_deriv_eqns__im2 = [eBalanceOnPCM_Eqn1, eBalanceOnPCM_Eqn2, heatEInWtr :: InstanceModel heatEInWtr = im heatEInWtr_rc [qw temp_init, qw w_mass, qw htCap_W, qw w_mass] [] (qw w_E) [0 $<= sy time $<= sy time_final] [makeCite koothoor2013] [] "heatEInWtr" - [htWtrDesc] + htWtrNotes heatEInWtr_rc :: RelationConcept heatEInWtr_rc = makeRC "heatEInWtr_rc" (nounPhraseSP "Heat energy in the water") - htWtrDesc htWtr_Rel -- heatEInWtrL + EmptyS htWtr_Rel -- heatEInWtrL htWtr_Rel :: Relation htWtr_Rel = (apply1 w_E time) $= (sy htCap_W) * (sy w_mass) * ((apply1 temp_W time) - sy temp_init) -htWtrDesc :: Sentence -htWtrDesc = foldlSent [S "The above", phrase equation, S "is derived using" +:+. - makeRef2S sensHtE, ch w_E `sIs` ((phrase change `sIn` - phrase thermalEnergy) `ofThe` phrase liquid), phrase water, - S "relative" `toThe` phrase energy, S "at the initial", phrase temp, - sParen (ch temp_init) +:+. sParen (unwrap $ getUnit pcm_initMltE), - (ch htCap_W) `isThe` phrase heatCapSpec `sOf` phrase liquid, phrase water, - sParen (unwrap $ getUnit htCap_S_P) `sAnd` (ch w_mass) `sIs` (phrase mass `ofThe` - phrase water) +:+. sParen (unwrap $ getUnit w_mass), S "The", - phrase change `sIn` phrase temp `isThe` S "difference between the", - phrase temp, S "at", phrase time, ch time, sParen (unwrap $ getUnit t_init_melt) `sC` - (ch temp_W) `andThe` phrase temp_init `sC` ch temp_init +:+. - sParen (unwrap $ getUnit temp_init), S "This", phrase equation, - S "applies as long as", (E $ real_interval temp_W (Bounded (Exc,0) (Exc,100))) - :+: unwrap (getUnit temp_W), sParen $ makeRef2S assumpWAL `sC` makeRef2S assumpAPT] +htWtrNotes :: [Sentence] +htWtrNotes = map foldlSent [ + [S "The above", phrase equation, S "is derived using", makeRef2S sensHtE], + [S "The", phrase change `sIn` phrase temp `isThe` S "difference between the", + phrase temp, S "at", phrase time, ch time, sParen (unwrap $ getUnit t_init_melt) `sC` + (ch temp_W) `andThe` phrase temp_init `sC` ch temp_init, sParen (unwrap $ getUnit temp_init)], + [S "This", phrase equation, S "applies as long as", + (E $ real_interval temp_W (Bounded (Exc,0) (Exc,100))) :+: + unwrap (getUnit temp_W), sParen $ makeRef2S assumpWAL `sC` makeRef2S assumpAPT]] --------- -- IM4 -- diff --git a/code/stable/nopcm/SRS/NoPCM_SRS.tex b/code/stable/nopcm/SRS/NoPCM_SRS.tex index fb108472fa..edbab66a99 100644 --- a/code/stable/nopcm/SRS/NoPCM_SRS.tex +++ b/code/stable/nopcm/SRS/NoPCM_SRS.tex @@ -572,7 +572,9 @@ \subsubsection{Instance Models} \item{${T_{init}}$ is the initial temperature (${}^{\circ}$C)} \end{symbDescription} \\ \midrule \\ -Notes & The above equation is derived using \hyperref[TM:sensHtE]{TM: sensHtE}. ${E_{W}}$ is the change in thermal energy of the liquid water relative to the energy at the initial temperature (${T_{init}}$) (J). ${C_{W}}$ is the specific heat capacity of liquid water ($\frac{\text{J}}{(\text{kg}{}^{\circ}\text{C})}$) and ${m_{W}}$ is the mass of the water (kg). The change in temperature is the difference between the temperature at time $t$ (s), ${T_{W}}$ and the initial temperature, ${T_{init}}$ (${}^{\circ}$C). This equation applies as long as $0<{T_{W}}<100$${}^{\circ}$C (\hyperref[assumpWAL]{A: Water-Always-Liquid}, \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). +Notes & The above equation is derived using \hyperref[TM:sensHtE]{TM: sensHtE}. + The change in temperature is the difference between the temperature at time $t$ (s), ${T_{W}}$ and the initial temperature, ${T_{init}}$ (${}^{\circ}$C). + This equation applies as long as $0<{T_{W}}<100$${}^{\circ}$C (\hyperref[assumpWAL]{A: Water-Always-Liquid}, \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). \\ \midrule \\ Source & \cite{koothoor2013} \\ \midrule \\ diff --git a/code/stable/nopcm/Website/NoPCM_SRS.html b/code/stable/nopcm/Website/NoPCM_SRS.html index c43ba24d9c..c28572b887 100644 --- a/code/stable/nopcm/Website/NoPCM_SRS.html +++ b/code/stable/nopcm/Website/NoPCM_SRS.html @@ -1216,7 +1216,13 @@

Instance Models

Notes

-The above equation is derived using TM: sensHtE. EW is the change in thermal energy of the liquid water relative to the energy at the initial temperature (Tinit) (J). CW is the specific heat capacity of liquid water (J/(kg⋅°C)) and mW is the mass of the water (kg). The change in temperature is the difference between the temperature at time t (s), TW and the initial temperature, Tinit (°C). This equation applies as long as 0 < TW < 100°C (A: Water-Always-Liquid, A: Atmospheric-Pressure-Tank). +The above equation is derived using TM: sensHtE. +

+

+The change in temperature is the difference between the temperature at time t (s), TW and the initial temperature, Tinit (°C). +

+

+This equation applies as long as 0 < TW < 100°C (A: Water-Always-Liquid, A: Atmospheric-Pressure-Tank).

diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 4d12a5b5fd..bae85c60ae 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -930,7 +930,9 @@ \subsubsection{Instance Models} \item{${T_{init}}$ is the initial temperature (${}^{\circ}$C)} \end{symbDescription} \\ \midrule \\ -Notes & The above equation is derived using \hyperref[TM:sensHtE]{TM: sensHtE}. ${E_{W}}$ is the change in thermal energy of the liquid water relative to the energy at the initial temperature (${T_{init}}$) (J). ${C_{W}}$ is the specific heat capacity of liquid water ($\frac{\text{J}}{(\text{kg}{}^{\circ}\text{C})}$) and ${m_{W}}$ is the mass of the water (kg). The change in temperature is the difference between the temperature at time $t$ (s), ${T_{W}}$ and the initial temperature, ${T_{init}}$ (${}^{\circ}$C). This equation applies as long as $0<{T_{W}}<100$${}^{\circ}$C (\hyperref[assumpWAL]{A: Water-Always-Liquid}, \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). +Notes & The above equation is derived using \hyperref[TM:sensHtE]{TM: sensHtE}. + The change in temperature is the difference between the temperature at time $t$ (s), ${T_{W}}$ and the initial temperature, ${T_{init}}$ (${}^{\circ}$C). + This equation applies as long as $0<{T_{W}}<100$${}^{\circ}$C (\hyperref[assumpWAL]{A: Water-Always-Liquid}, \hyperref[assumpAPT]{A: Atmospheric-Pressure-Tank}). \\ \midrule \\ Source & \cite{koothoor2013} \\ \midrule \\ diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index 1e32f8a0d8..0de66fc6e3 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -2135,7 +2135,13 @@

Instance Models

Notes

-The above equation is derived using TM: sensHtE. EW is the change in thermal energy of the liquid water relative to the energy at the initial temperature (Tinit) (J). CW is the specific heat capacity of liquid water (J/(kg⋅°C)) and mW is the mass of the water (kg). The change in temperature is the difference between the temperature at time t (s), TW and the initial temperature, Tinit (°C). This equation applies as long as 0 < TW < 100°C (A: Water-Always-Liquid, A: Atmospheric-Pressure-Tank). +The above equation is derived using TM: sensHtE. +

+

+The change in temperature is the difference between the temperature at time t (s), TW and the initial temperature, Tinit (°C). +

+

+This equation applies as long as 0 < TW < 100°C (A: Water-Always-Liquid, A: Atmospheric-Pressure-Tank).

From 43f6effefd2c117e14e74c6639b4c65b310cda97 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 16:18:07 -0400 Subject: [PATCH 10/20] Removed redundant info from Notes of IM4 as per #1476 --- code/drasil-example/Drasil/SWHS/IMods.hs | 66 +++++++++++------------- code/stable/swhs/SRS/SWHS_SRS.tex | 8 ++- code/stable/swhs/Website/SWHS_SRS.html | 20 ++++++- 3 files changed, 57 insertions(+), 37 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index ec683d46fd..adb1029b6d 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -12,8 +12,7 @@ import Data.Drasil.Concepts.Documentation (assumption, condition, constraint, import Data.Drasil.Concepts.Math (area, change, equation, ode, rOfChng, surface) import Data.Drasil.Concepts.PhysicalProperties (liquid, mass, solid, vol) import Data.Drasil.Concepts.Thermodynamics (boilPt, boiling, heat, heatCapSpec, - heatTrans, htFlux, latentHeat, melting, phaseChange, sensHeat, temp, - thermalEnergy) + heatTrans, htFlux, latentHeat, melting, phaseChange, sensHeat, temp) import Data.Drasil.Quantities.Physics (energy, time) import Drasil.SWHS.Assumptions (assumpCTNOD, assumpSITWP, assumpPIS, assumpWAL, @@ -393,11 +392,11 @@ heatEInPCM = imNoDeriv heatEInPCM_rc [qw temp_melt_P, qw time_final, qw temp_ini qw pcm_HTC, qw pcm_mass, qw htCap_S_P, qw htCap_L_P, qw temp_PCM, qw htFusion, qw t_init_melt] [sy temp_init $< sy temp_melt_P] (qw pcm_E) [0 $<= sy time $<= sy time_final] [makeCite koothoor2013] - "heatEInPCM" [htPCMDesc] + "heatEInPCM" htPCMNotes heatEInPCM_rc :: RelationConcept heatEInPCM_rc = makeRC "heatEInPCM_rc" (nounPhraseSP "Heat energy in the PCM") - htPCMDesc htPCM_Rel + EmptyS htPCM_Rel htPCM_Rel :: Relation htPCM_Rel = sy pcm_E $= case_ [case1, case2, case3, case4] @@ -414,37 +413,34 @@ htPCM_Rel = sy pcm_E $= case_ [case1, case2, case3, case4] case4 = (sy pcm_initMltE + (apply1 latentE_P time), real_interval melt_frac (Bounded (Exc,0) (Exc,1))) -htPCMDesc :: Sentence -htPCMDesc = foldlSent [S "The above", phrase equation `sIs` S "derived using" +:+. - (makeRef2S sensHtE `sAnd` makeRef2S latentHtE), ch pcm_E `sIs` ((phrase change `sIn` - phrase thermalEnergy) `ofThe` short phsChgMtrl), S "relative" `toThe` - phrase energy, S "at the", phrase temp_init, sParen (ch temp_init) +:+. - unwrap (getUnit pcm_initMltE), ch pcm_E, S "for the", phrase solid, - short phsChgMtrl, S "is found using", makeRef2S sensHtE, S "for", phrase sensHeat :+: - S "ing, with", phrase heatCapSpec `ofThe` phrase solid, short phsChgMtrl `sC` - ch htCap_S_P, sParen (unwrap $ getUnit htCap_S_P) `andThe` phrase change, S "in the", - short phsChgMtrl, phrase temp, S "from the", phrase temp_init +:+. - sParen (unwrap $ getUnit temp_init), ch pcm_E, S "for the melted", short phsChgMtrl, - sParen (E (sy temp_PCM $> sy pcm_initMltE)), S "is found using", makeRef2S sensHtE, - S "for", phrase sensHeat, S "of the" +:+. phrase liquid, short phsChgMtrl, - S "plus the", phrase energy, S "when", phrase melting, S "starts" `sC` S "plus" +:+. - ((phrase energy +:+ S "required to melt all") `ofThe` short phsChgMtrl), S "The", phrase energy, - S "when", phrase melting, S "starts" `sIs` ch pcm_initMltE +:+. sParen (unwrap $ getUnit pcm_initMltE), - S "The", phrase energy, S "required to melt all of the", short phsChgMtrl `sIs` - E (sy htFusion * sy pcm_mass), sParen (unwrap $ getUnit pcm_initMltE) +:+. - sParen (makeRef2S dd3HtFusion), phrase heatCapSpec `ofThe'` phrase liquid, short phsChgMtrl `sIs` - ch htCap_L_P, sParen (unwrap $ getUnit htCap_L_P) `andThe` phrase change `sIn` - phrase temp `sIs` E (sy temp_PCM - sy temp_melt_P) +:+. - sParen (unwrap $ getUnit temp_melt_P), ch pcm_E, S "during", phrase melting, S "of the", - short phsChgMtrl, S "is found using the", phrase energy, S "required at", S "instant" +:+ - phrase melting `ofThe` short phsChgMtrl, S "begins" `sC` ch pcm_initMltE, S "plus the", - phrase latentHeat, phrase energy, S "added" `toThe` short phsChgMtrl `sC` - ch latentE_P, sParen (unwrap $ getUnit latentE_P), S "since the", phrase time, S "when", - phrase melting, S "began", ch t_init_melt +:+. sParen (unwrap $ getUnit t_init_melt), - S "The", phrase heat, phrase energy, S "for", phrase boiling, S "of the", short phsChgMtrl, - S "is not detailed" `sC` S "since the", short phsChgMtrl, S "is assumed to either be in a", - phrase solid `sOr` phrase liquid, S "state", sParen (makeRef2S assumpNGSP), - sParen (makeRef2S assumpPIS)] +htPCMNotes :: [Sentence] +htPCMNotes = map foldlSent [ + [S "The above", phrase equation `sIs` S "derived using", + (makeRef2S sensHtE `sAnd` makeRef2S latentHtE)], + [ch pcm_E, S "for the", phrase solid, short phsChgMtrl, S "is found using", + makeRef2S sensHtE, S "for", phrase sensHeat :+: S "ing, with", + phrase heatCapSpec `ofThe` phrase solid, short phsChgMtrl `sC` ch htCap_S_P, + sParen (unwrap $ getUnit htCap_S_P) `andThe` phrase change, S "in the", + short phsChgMtrl, phrase temp, S "from the", phrase temp_init, sParen (unwrap $ getUnit temp_init)], + [ch pcm_E, S "for the melted", short phsChgMtrl, sParen (E (sy temp_PCM $> sy pcm_initMltE)), + S "is found using", makeRef2S sensHtE, S "for", phrase sensHeat, S "of the", phrase liquid, + short phsChgMtrl, S "plus the", phrase energy, S "when", phrase melting, S "starts" `sC` + S "plus", (phrase energy +:+ S "required to melt all") `ofThe` short phsChgMtrl], + [S "The", phrase energy, S "required to melt all of the", short phsChgMtrl `sIs` + E (sy htFusion * sy pcm_mass), sParen (unwrap $ getUnit pcm_initMltE), + sParen (S "from" +:+ makeRef2S dd3HtFusion)], + [S "The", phrase change `sIn` phrase temp `sIs` E (sy temp_PCM - sy temp_melt_P), + sParen (unwrap $ getUnit temp_melt_P)], + [ch pcm_E, S "during", phrase melting, S "of the", short phsChgMtrl, + S "is found using the", phrase energy, S "required at", S "instant" +:+ + phrase melting `ofThe` short phsChgMtrl, S "begins" `sC` ch pcm_initMltE, S "plus the", + phrase latentHeat, phrase energy, S "added" `toThe` short phsChgMtrl `sC` + ch latentE_P, sParen (unwrap $ getUnit latentE_P), S "since the", phrase time, S "when", + phrase melting, S "began", ch t_init_melt, sParen (unwrap $ getUnit t_init_melt)], + [S "The", phrase heat, phrase energy, S "for", phrase boiling, S "of the", short phsChgMtrl, + S "is not detailed" `sC` S "since the", short phsChgMtrl, S "is assumed to either be in a", + phrase solid `sOr` phrase liquid, S "state", sParen (makeRef2S assumpNGSP), + sParen (makeRef2S assumpPIS)]] ----------- -- Intro -- diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index bae85c60ae..5ef549c738 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -985,7 +985,13 @@ \subsubsection{Instance Models} \item{$ϕ$ is the melt fraction (Unitless)} \end{symbDescription} \\ \midrule \\ -Notes & The above equation is derived using \hyperref[TM:sensHtE]{TM: sensHtE} and \hyperref[TM:latentHtE]{TM: latentHtE}. ${E_{P}}$ is the change in thermal energy of the PCM relative to the energy at the initial temperature (${T_{init}}$) J. ${E_{P}}$ for the solid PCM is found using \hyperref[TM:sensHtE]{TM: sensHtE} for sensible heating, with the specific heat capacity of the solid PCM, ${{C_{P}}^{S}}$ ($\frac{\text{J}}{(\text{kg}{}^{\circ}\text{C})}$) and the change in the PCM temperature from the initial temperature (${}^{\circ}$C). ${E_{P}}$ for the melted PCM (${T_{P}}>{{{E_{P}}_{melt}}^{init}}$) is found using \hyperref[TM:sensHtE]{TM: sensHtE} for sensible heat of the liquid. PCM plus the energy when melting starts, plus the energy required to melt all of the PCM. The energy when melting starts is ${{{E_{P}}_{melt}}^{init}}$ (J). The energy required to melt all of the PCM is ${H_{f}} {m_{P}}$ (J) (\hyperref[DD:htFusion]{DD: htFusion}). The specific heat capacity of the liquid PCM is ${{C_{P}}^{L}}$ ($\frac{\text{J}}{(\text{kg}{}^{\circ}\text{C})}$) and the change in temperature is ${T_{P}}-{{T_{melt}}^{P}}$ (${}^{\circ}$C). ${E_{P}}$ during melting of the PCM is found using the energy required at the instant melting of the PCM begins, ${{{E_{P}}_{melt}}^{init}}$ plus the latent heat energy added to the PCM, ${Q_{P}}$ (J) since the time when melting began ${{t_{melt}}^{init}}$ (s). The heat energy for boiling of the PCM is not detailed, since the PCM is assumed to either be in a solid or liquid state (\hyperref[assumpNGSP]{A: No-Gaseous-State-PCM}) (\hyperref[assumpPIS]{A: PCM-Initially-Solid}). +Notes & The above equation is derived using \hyperref[TM:sensHtE]{TM: sensHtE} and \hyperref[TM:latentHtE]{TM: latentHtE}. + ${E_{P}}$ for the solid PCM is found using \hyperref[TM:sensHtE]{TM: sensHtE} for sensible heating, with the specific heat capacity of the solid PCM, ${{C_{P}}^{S}}$ ($\frac{\text{J}}{(\text{kg}{}^{\circ}\text{C})}$) and the change in the PCM temperature from the initial temperature (${}^{\circ}$C). + ${E_{P}}$ for the melted PCM (${T_{P}}>{{{E_{P}}_{melt}}^{init}}$) is found using \hyperref[TM:sensHtE]{TM: sensHtE} for sensible heat of the liquid PCM plus the energy when melting starts, plus the energy required to melt all of the PCM. + The energy required to melt all of the PCM is ${H_{f}} {m_{P}}$ (J) (from \hyperref[DD:htFusion]{DD: htFusion}). + The change in temperature is ${T_{P}}-{{T_{melt}}^{P}}$ (${}^{\circ}$C). + ${E_{P}}$ during melting of the PCM is found using the energy required at the instant melting of the PCM begins, ${{{E_{P}}_{melt}}^{init}}$ plus the latent heat energy added to the PCM, ${Q_{P}}$ (J) since the time when melting began ${{t_{melt}}^{init}}$ (s). + The heat energy for boiling of the PCM is not detailed, since the PCM is assumed to either be in a solid or liquid state (\hyperref[assumpNGSP]{A: No-Gaseous-State-PCM}) (\hyperref[assumpPIS]{A: PCM-Initially-Solid}). \\ \midrule \\ Source & \cite{koothoor2013} \\ \midrule \\ diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index 0de66fc6e3..25006ecdd5 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -2268,7 +2268,25 @@

Instance Models

Notes

-The above equation is derived using TM: sensHtE and TM: latentHtE. EP is the change in thermal energy of the PCM relative to the energy at the initial temperature (Tinit) J. EP for the solid PCM is found using TM: sensHtE for sensible heating, with the specific heat capacity of the solid PCM, CPS (J/(kg⋅°C)) and the change in the PCM temperature from the initial temperature (°C). EP for the melted PCM (TP > EPmeltinit) is found using TM: sensHtE for sensible heat of the liquid. PCM plus the energy when melting starts, plus the energy required to melt all of the PCM. The energy when melting starts is EPmeltinit (J). The energy required to melt all of the PCM is Hf mP (J) (DD: htFusion). The specific heat capacity of the liquid PCM is CPL (J/(kg⋅°C)) and the change in temperature is TP−TmeltP (°C). EP during melting of the PCM is found using the energy required at the instant melting of the PCM begins, EPmeltinit plus the latent heat energy added to the PCM, QP (J) since the time when melting began tmeltinit (s). The heat energy for boiling of the PCM is not detailed, since the PCM is assumed to either be in a solid or liquid state (A: No-Gaseous-State-PCM) (A: PCM-Initially-Solid). +The above equation is derived using TM: sensHtE and TM: latentHtE. +

+

+EP for the solid PCM is found using TM: sensHtE for sensible heating, with the specific heat capacity of the solid PCM, CPS (J/(kg⋅°C)) and the change in the PCM temperature from the initial temperature (°C). +

+

+EP for the melted PCM (TP > EPmeltinit) is found using TM: sensHtE for sensible heat of the liquid PCM plus the energy when melting starts, plus the energy required to melt all of the PCM. +

+

+The energy required to melt all of the PCM is Hf mP (J) (from DD: htFusion). +

+

+The change in temperature is TP−TmeltP (°C). +

+

+EP during melting of the PCM is found using the energy required at the instant melting of the PCM begins, EPmeltinit plus the latent heat energy added to the PCM, QP (J) since the time when melting began tmeltinit (s). +

+

+The heat energy for boiling of the PCM is not detailed, since the PCM is assumed to either be in a solid or liquid state (A: No-Gaseous-State-PCM) (A: PCM-Initially-Solid).

From fbc4635834fef74ead6ffd0dc7f7d4f7e19182db Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 16:24:33 -0400 Subject: [PATCH 11/20] Removed redundant info from Notes of NoPCM IM1 as per #1476 --- code/drasil-example/Drasil/NoPCM/IMods.hs | 26 ++++++++++------------- code/stable/nopcm/SRS/NoPCM_SRS.tex | 3 ++- code/stable/nopcm/Website/NoPCM_SRS.html | 12 ++++------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/code/drasil-example/Drasil/NoPCM/IMods.hs b/code/drasil-example/Drasil/NoPCM/IMods.hs index 4007354478..f5f015fa5d 100644 --- a/code/drasil-example/Drasil/NoPCM/IMods.hs +++ b/code/drasil-example/Drasil/NoPCM/IMods.hs @@ -36,30 +36,26 @@ eBalanceOnWtr = im eBalanceOnWtr_rc [qw temp_C, qw temp_init, qw time_final, [sy temp_init $<= sy temp_C] (qw temp_W) --Tw(0) cannot be presented, there is one more constraint Tw(0) = Tinit [0 $< sy time $< sy time_final] [makeCiteInfo koothoor2013 $ RefNote "with PCM removed"] - eBalanceOnWtrDeriv "eBalanceOnWtr" [balWtrDesc] + eBalanceOnWtrDeriv "eBalanceOnWtr" balWtrNotes eBalanceOnWtr_rc :: RelationConcept eBalanceOnWtr_rc = makeRC "eBalanceOnWtr_rc" (nounPhraseSP $ "Energy balance on " ++ - "water to find the temperature of the water") balWtrDesc balWtr_Rel + "water to find the temperature of the water") EmptyS balWtr_Rel -- (mkLabelSame "eBalnaceOnWtr" (Def Instance)) balWtr_Rel :: Relation balWtr_Rel = (deriv (sy temp_W) time) $= 1 / (sy tau_W) * (((sy temp_C) - (apply1 temp_W time))) -balWtrDesc :: Sentence -balWtrDesc = foldlSent [(E $ sy temp_W) `isThe` phrase temp_W +:+. - sParen (unwrap $ getUnit temp_W), - (E $ sy temp_C) `isThe` phrase temp_C +:+. sParen (unwrap $ getUnit temp_C), - (E $ sy tau_W $= (sy w_mass * sy htCap_W) / (sy coil_HTC * sy coil_SA)), - S "is a constant" +:+. sParen (unwrap $ getUnit tau_W), - S "The above", phrase equation, S "applies as long as the", phrase water, - S "is in", phrase liquid, S "form" `sC` (E $ 0 $< sy temp_W $< 100), - sParen (unwrap $ getUnit temp_W), S "where", E 0, - sParen (unwrap $ getUnit temp_W) `sAnd` (E 100), - sParen (unwrap $ getUnit temp_W), S "are the", phrase melting `sAnd` - plural boilPt, S "of", phrase water `sC` S "respectively" - +:+ sParen (makeRef2S assumpWAL)] +balWtrNotes :: [Sentence] +balWtrNotes = map foldlSent [ + [E (sy tau_W) `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], + [S "The above", phrase equation, S "applies as long as the", phrase water, + S "is in", phrase liquid, S "form" `sC` (E $ 0 $< sy temp_W $< 100), + sParen (unwrap $ getUnit temp_W), S "where", E 0, + sParen (unwrap $ getUnit temp_W) `sAnd` (E 100), + sParen (unwrap $ getUnit temp_W), S "are the", phrase melting `sAnd` + plural boilPt `sOf` phrase water `sC` S "respectively", sParen (makeRef2S assumpWAL)]] ---------------------------------------------- -- Derivation of eBalanceOnWtr -- diff --git a/code/stable/nopcm/SRS/NoPCM_SRS.tex b/code/stable/nopcm/SRS/NoPCM_SRS.tex index edbab66a99..474d76e813 100644 --- a/code/stable/nopcm/SRS/NoPCM_SRS.tex +++ b/code/stable/nopcm/SRS/NoPCM_SRS.tex @@ -515,7 +515,8 @@ \subsubsection{Instance Models} \item{${T_{C}}$ is the temperature of the heating coil (${}^{\circ}$C)} \end{symbDescription} \\ \midrule \\ -Notes & ${T_{W}}$ is the temperature of the water (${}^{\circ}$C). ${T_{C}}$ is the temperature of the heating coil (${}^{\circ}$C). ${τ_{W}}=\frac{{m_{W}} {C_{W}}}{{h_{C}} {A_{C}}}$ is a constant (s). The above equation applies as long as the water is in liquid form, $0<{T_{W}}<100$ (${}^{\circ}$C) where $0$ (${}^{\circ}$C) and $100$ (${}^{\circ}$C) are the melting and boiling point temperatures of water, respectively (\hyperref[assumpWAL]{A: Water-Always-Liquid}). +Notes & ${τ_{W}}$ is calculated from FIXME: Missing DD Issue 1484. + The above equation applies as long as the water is in liquid form, $0<{T_{W}}<100$ (${}^{\circ}$C) where $0$ (${}^{\circ}$C) and $100$ (${}^{\circ}$C) are the melting and boiling point temperatures of water, respectively (\hyperref[assumpWAL]{A: Water-Always-Liquid}). \\ \midrule \\ Source & \cite[(with PCM removed)]{koothoor2013} \\ \midrule \\ diff --git a/code/stable/nopcm/Website/NoPCM_SRS.html b/code/stable/nopcm/Website/NoPCM_SRS.html index c28572b887..bcb952f6b2 100644 --- a/code/stable/nopcm/Website/NoPCM_SRS.html +++ b/code/stable/nopcm/Website/NoPCM_SRS.html @@ -1081,14 +1081,10 @@

Instance Models

Notes

-TW is the temperature of the water (°C). TC is the temperature of the heating coil (°C). τW =

- - mW CW - - - hC AC - -
is a constant (s). The above equation applies as long as the water is in liquid form, 0 < TW < 100 (°C) where 0 (°C) and 100 (°C) are the melting and boiling point temperatures of water, respectively (A: Water-Always-Liquid). +τW is calculated from FIXME: Missing DD Issue 1484. +

+

+The above equation applies as long as the water is in liquid form, 0 < TW < 100 (°C) where 0 (°C) and 100 (°C) are the melting and boiling point temperatures of water, respectively (A: Water-Always-Liquid).

From f3e944153232077e8e55b4a150290cc50a6048ef Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 17:11:25 -0400 Subject: [PATCH 12/20] Used defns in RCs for SWHS and NoPCM --- code/drasil-example/Drasil/NoPCM/IMods.hs | 3 ++- code/drasil-example/Drasil/SWHS/IMods.hs | 22 +++++----------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/code/drasil-example/Drasil/NoPCM/IMods.hs b/code/drasil-example/Drasil/NoPCM/IMods.hs index f5f015fa5d..416292078d 100644 --- a/code/drasil-example/Drasil/NoPCM/IMods.hs +++ b/code/drasil-example/Drasil/NoPCM/IMods.hs @@ -3,6 +3,7 @@ module Drasil.NoPCM.IMods (eBalanceOnWtr, iMods, instModIntro) where import Language.Drasil import Theory.Drasil (DataDefinition, InstanceModel, im) import Utils.Drasil +import Control.Lens ((^.)) import Data.Drasil.Concepts.Documentation (goal) import Data.Drasil.Concepts.Math (equation) @@ -40,7 +41,7 @@ eBalanceOnWtr = im eBalanceOnWtr_rc [qw temp_C, qw temp_init, qw time_final, eBalanceOnWtr_rc :: RelationConcept eBalanceOnWtr_rc = makeRC "eBalanceOnWtr_rc" (nounPhraseSP $ "Energy balance on " ++ - "water to find the temperature of the water") EmptyS balWtr_Rel + "water to find the temperature of the water") (temp_W ^. defn) balWtr_Rel -- (mkLabelSame "eBalnaceOnWtr" (Def Instance)) balWtr_Rel :: Relation diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index adb1029b6d..8920830458 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -4,6 +4,7 @@ module Drasil.SWHS.IMods (iMods, eBalanceOnWtr, eBalanceOnWtrDerivDesc1, import Language.Drasil import Theory.Drasil (DataDefinition, InstanceModel, im, imNoDeriv) import Utils.Drasil +import Control.Lens((^.)) import Data.Drasil.SentenceStructures (follows) import Data.Drasil.Utils (unwrap, weave) @@ -45,7 +46,7 @@ eBalanceOnWtr = im eBalanceOnWtr_rc [qw w_mass, qw htCap_W, qw coil_HTC, qw pcm_ eBalanceOnWtr_rc :: RelationConcept eBalanceOnWtr_rc = makeRC "eBalanceOnWtr_rc" (nounPhraseSP $ "Energy balance on " ++ - "water to find the temperature of the water") EmptyS balWtr_Rel + "water to find the temperature of the water") (temp_W ^. defn) balWtr_Rel -- eBalanceOnWtrL balWtr_Rel :: Relation @@ -209,7 +210,7 @@ eBalanceOnPCM = im eBalanceOnPCM_rc [qw temp_melt_P, qw time_final, qw temp_init eBalanceOnPCM_rc :: RelationConcept eBalanceOnPCM_rc = makeRC "eBalanceOnPCM_rc" (nounPhraseSP "Energy Balance on PCM to find temperature of PCM") - balPCMDesc balPCM_Rel -- eBalanceOnPCML + (temp_PCM ^. defn) balPCM_Rel -- eBalanceOnPCML balPCM_Rel :: Relation balPCM_Rel = (deriv (sy temp_PCM) time) $= case_ [case1, case2, case3] @@ -221,19 +222,6 @@ balPCM_Rel = (deriv (sy temp_PCM) time) $= case_ [case1, case2, case3] case3 = (0, (sy temp_PCM) $= (sy temp_melt_P) $&& real_interval melt_frac (Bounded (Exc,0) (Exc,1))) -balPCMDesc :: Sentence -balPCMDesc = foldlSent [(E $ sy temp_W) `isThe` phrase temp_W +:+. - sParen (unwrap $ getUnit temp_W), (E $ sy temp_PCM) `isThe` - phrase temp_PCM +:+. sParen (unwrap $ getUnit temp_PCM), - (E $ (sy tau_S_P) $= ((sy pcm_mass) * (sy htCap_S_P)) / - ((sy pcm_HTC) * (sy pcm_SA))), S "is a constant", - sParen (unwrap $ getUnit tau_S_P) +:+. - sParen (makeRef2S ddBalanceSolidPCM), - (E $ (sy tau_L_P) $= ((sy pcm_mass) * (sy htCap_L_P)) / - ((sy pcm_HTC) * (sy pcm_SA))), S "is a constant", - sParen (unwrap $ getUnit tau_S_P), - sParen (makeRef2S ddBalanceLiquidPCM)] - balPCMNotes :: [Sentence] balPCMNotes = map foldlSent [ [E (sy temp_W) `sIs` S "defined by", makeRef2S eBalanceOnWtr], @@ -368,7 +356,7 @@ heatEInWtr = im heatEInWtr_rc [qw temp_init, qw w_mass, qw htCap_W, qw w_mass] heatEInWtr_rc :: RelationConcept heatEInWtr_rc = makeRC "heatEInWtr_rc" (nounPhraseSP "Heat energy in the water") - EmptyS htWtr_Rel -- heatEInWtrL + (w_E ^. defn) htWtr_Rel -- heatEInWtrL htWtr_Rel :: Relation htWtr_Rel = (apply1 w_E time) $= (sy htCap_W) * (sy w_mass) * @@ -396,7 +384,7 @@ heatEInPCM = imNoDeriv heatEInPCM_rc [qw temp_melt_P, qw time_final, qw temp_ini heatEInPCM_rc :: RelationConcept heatEInPCM_rc = makeRC "heatEInPCM_rc" (nounPhraseSP "Heat energy in the PCM") - EmptyS htPCM_Rel + (pcm_E ^. defn) htPCM_Rel htPCM_Rel :: Relation htPCM_Rel = sy pcm_E $= case_ [case1, case2, case3, case4] From d22b8488a58cce78fd5b90ad2ba695d5f7628494 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Fri, 7 Jun 2019 17:44:52 -0400 Subject: [PATCH 13/20] Removed apply1Int and used apply instead --- code/drasil-example/Drasil/SWHS/IMods.hs | 4 ++-- code/drasil-lang/Language/Drasil.hs | 4 ++-- code/drasil-lang/Language/Drasil/Expr/Math.hs | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 8920830458..1e878ab25a 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -61,7 +61,7 @@ balWtrDesc = map foldlSent [[E (sy temp_PCM) `sIs` S "defined by", makeRef2S eBa [E (sy tau_W) `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], [E (sy eta) `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], [S "The initial", plural condition, S "for the", getAcc ode `sAre` - E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP], + E (apply (sy temp_W) [Int 0] $= apply (sy temp_PCM) [Int 0] $= sy temp_init) `follows` assumpSITWP], [S "The", getAcc ode, S "applies as long as the", phrase water `sIs` EmptyS `sIn` phrase liquid, S "form" `sC` (E $ real_interval temp_W (Bounded (Exc,0) (Exc,100))), sParen (unwrap $ getUnit temp_W), S "where", E 0, sParen (unwrap $ getUnit temp_W) `sAnd` @@ -237,7 +237,7 @@ balPCMNotes = map foldlSent [ [E (sy tau_S_P) `sIs` S "calculated" `sIn` makeRef2S ddBalanceSolidPCM], [E (sy tau_L_P) `sIs` S "calculated" `sIn` makeRef2S ddBalanceLiquidPCM], [S "The initial", plural condition, S "for the", getAcc ode `sAre` - E ((apply1Int temp_W 0) $= (apply1Int temp_PCM 0) $= sy temp_init) `follows` assumpSITWP]] + E (apply (sy temp_W) [Int 0] $= apply (sy temp_PCM) [Int 0] $= sy temp_init) `follows` assumpSITWP]] ---------------------------------------------- -- Derivation of eBalanceOnPCM -- diff --git a/code/drasil-lang/Language/Drasil.hs b/code/drasil-lang/Language/Drasil.hs index 9eb9fb1a1f..f56968caad 100644 --- a/code/drasil-lang/Language/Drasil.hs +++ b/code/drasil-lang/Language/Drasil.hs @@ -14,7 +14,7 @@ module Language.Drasil ( , real_interval , deriv, pderiv , sy -- old "Chunk" constructor C - , apply, apply1, apply1Int, apply2 + , apply, apply1, apply2 , cross, m2x2, vec2D, dgnl2x2 -- all the stuff from Unicode , Special(..), RenderSpecial(..) @@ -186,7 +186,7 @@ import Language.Drasil.Expr.Math (log, ln, sin, cos, tan, sqrt, square, sec, dim, idx, int, dbl, str, isin, case_, sum_all, defsum, prod_all, defprod, real_interval, - apply, apply1, apply1Int, apply2, + apply, apply1, apply2, sy, deriv, pderiv, cross, m2x2, vec2D, dgnl2x2, euclidean, defint, int_all) import Language.Drasil.Document (section, fig, figWithWidth diff --git a/code/drasil-lang/Language/Drasil/Expr/Math.hs b/code/drasil-lang/Language/Drasil/Expr/Math.hs index 5d9340ca7e..74928ad2af 100644 --- a/code/drasil-lang/Language/Drasil/Expr/Math.hs +++ b/code/drasil-lang/Language/Drasil/Expr/Math.hs @@ -139,9 +139,6 @@ apply = FCall apply1 :: (HasUID f, HasSymbol f, HasUID a, HasSymbol a) => f -> a -> Expr apply1 f a = FCall (sy f) [sy a] -apply1Int :: (HasUID f, HasSymbol f) => f -> Integer -> Expr -apply1Int f a = FCall (sy f) [Int a] - apply2 :: (HasUID f, HasSymbol f, HasUID a, HasSymbol a, HasUID b, HasSymbol b) => f -> a -> b -> Expr apply2 f a b = FCall (sy f) [sy a, sy b] From f678713b4df1db5548a8c9b533e42289c2f929a1 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Thu, 25 Jul 2019 15:10:24 -0400 Subject: [PATCH 14/20] Used eqN in IMs --- code/drasil-example/Drasil/NoPCM/IMods.hs | 4 ++-- code/drasil-example/Drasil/SWHS/IMods.hs | 12 ++++++------ code/stable/nopcm/SRS/NoPCM_SRS.tex | 2 +- code/stable/nopcm/Website/NoPCM_SRS.html | 2 +- code/stable/swhs/SRS/SWHS_SRS.tex | 4 ++-- code/stable/swhs/Website/SWHS_SRS.html | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/code/drasil-example/Drasil/NoPCM/IMods.hs b/code/drasil-example/Drasil/NoPCM/IMods.hs index 9aea1919eb..1069b367fc 100644 --- a/code/drasil-example/Drasil/NoPCM/IMods.hs +++ b/code/drasil-example/Drasil/NoPCM/IMods.hs @@ -75,11 +75,11 @@ eBalanceOnWtrDerivDesc2 dd = [S "Using", makeRef2S dd, S ", this can be written as"] eBalanceOnWtrDerivDesc3 :: Expr -> [Sentence] -eBalanceOnWtrDerivDesc3 eq = [S "Dividing (3) by", E eq `sC` S "we obtain"] +eBalanceOnWtrDerivDesc3 eq = [S "Dividing", eqN 3, S"by", E eq `sC` S "we obtain"] eBalanceOnWtrDerivDesc4 :: [Sentence]-> [Sentence] eBalanceOnWtrDerivDesc4 eq = - [S "Setting"] ++ eq ++ [S ", Equation (4) can be written in its final form as"] + [S "Setting"] ++ eq ++ [EmptyS `sC` eqN 4, S "can be written in its final form as"] eq1:: Expr eq1 = sy wMass * sy htCapW diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index fa62bc6f7a..04aa5b9c20 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -140,11 +140,11 @@ eBalanceOnWtrDerivDesc2 dd1 dd2 = [S "Using", makeRef2S dd1 `sAnd` makeRef2S dd2 eBalanceOnWtrDerivDesc3 :: UnitalChunk -> UncertQ -> [Sentence] eBalanceOnWtrDerivDesc3 wm hcw = - [S "Dividing (3) by", ch wm :+: ch hcw `sC` S "we obtain"] + [S "Dividing", eqN 3, S "by", ch wm :+: ch hcw `sC` S "we obtain"] eBalanceOnWtrDerivDesc4 :: [Sentence] -> [Sentence] eBalanceOnWtrDerivDesc4 eq22 = [S "Factoring", S "negative sign out" `ofThe` S "second", phrase term_, - S "of the RHS of Equation (4) and multiplying it by"] ++ eq22 ++ [S "yields"] + S "of the RHS" `sOf` eqN 4 `sAnd` S "multiplying it by"] ++ eq22 ++ [S "yields"] eBalanceOnWtrDerivDesc5 ::[Sentence] eBalanceOnWtrDerivDesc5 = [S "Which simplifies to"] @@ -152,11 +152,11 @@ eBalanceOnWtrDerivDesc5 = [S "Which simplifies to"] eBalanceOnWtrDerivDesc6 :: Expr -> Expr -> [Sentence] eBalanceOnWtrDerivDesc6 eq33 eq44 = [S "Setting", E eq33, sParen (makeRef2S ddHtFusion) `sAnd` E eq44, - sParen (makeRef2S ddMeltFrac) `sC` S "Equation (5) can be written as"] + sParen (makeRef2S ddMeltFrac) `sC` eqN 5, S "can be written as"] eBalanceOnWtrDerivDesc7 :: Expr -> [Sentence] eBalanceOnWtrDerivDesc7 eq55 = - [S "Finally" `sC` S "factoring out", E eq55, S ", we are left with the governing", + [S "Finally" `sC` S "factoring out", E eq55 `sC` S "we are left with the governing", getAcc ode, S "for", sParen (makeRef2S eBalanceOnWtr)] eq2 :: [Sentence] @@ -306,8 +306,8 @@ eBalanceOnPCMDerivDesc4 eq77 = eBalanceOnPCMDerivDesc5 :: UncertQ -> UncertQ -> UnitalChunk -> UnitalChunk -> ConceptChunk -> ConceptChunk-> ConceptChunk -> ConceptChunk -> ConceptInstance -> [Sentence] -eBalanceOnPCMDerivDesc5 hsp hlp tsp tlp sur ar melt vo ass17= - [S "Equation (6) applies for the solid PCM. In the case where all of the PCM is melted, the same" +:+ +eBalanceOnPCMDerivDesc5 hsp hlp tsp tlp sur ar melt vo ass17 = + [eqN 6 +:+ S "applies for the solid PCM. In the case where all of the PCM is melted, the same" +:+ S "derivation applies, except that" +:+ (E $ sy hsp) +:+ S "is replaced by" +:+ (E $ sy hlp) `sC` S "and thus" +:+ (E $ sy tsp) +:+ S "is replaced by" +:+. (E $ sy tlp) +:+ S "Although a small change in" +:+ phrase sur +:+ phrase ar +:+ S "would be expected with" +:+ phrase melt `sC` S "this is not included" `sC` diff --git a/code/stable/nopcm/SRS/NoPCM_SRS.tex b/code/stable/nopcm/SRS/NoPCM_SRS.tex index e3edf326f5..36fc92dd68 100644 --- a/code/stable/nopcm/SRS/NoPCM_SRS.tex +++ b/code/stable/nopcm/SRS/NoPCM_SRS.tex @@ -541,7 +541,7 @@ \subsubsection{Instance Models} \begin{displaymath} {m_{W}} {C_{W}} \frac{\,d{T_{W}}}{\,dt}={h_{C}} {A_{C}} \left({T_{C}}-{T_{W}}\right) \end{displaymath} -Dividing (3) by ${m_{W}} {C_{W}}$, we obtain: +Dividing Equation (3) by ${m_{W}} {C_{W}}$, we obtain: \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{{h_{C}} {A_{C}}}{{m_{W}} {C_{W}}} \left({T_{C}}-{T_{W}}\right) \end{displaymath} diff --git a/code/stable/nopcm/Website/NoPCM_SRS.html b/code/stable/nopcm/Website/NoPCM_SRS.html index 9793ad9e5c..131e0bb751 100644 --- a/code/stable/nopcm/Website/NoPCM_SRS.html +++ b/code/stable/nopcm/Website/NoPCM_SRS.html @@ -1179,7 +1179,7 @@

Detailed derivation of the energy balance on water:

= hC AC (TC−TW)

- Dividing (3) by mW CW, we obtain: + Dividing Equation (3) by mW CW, we obtain:

diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 30fc47fa8a..68bd6dcb7b 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -819,7 +819,7 @@ \subsubsection{Instance Models} \begin{displaymath} {m_{W}} {C_{W}} \frac{\,d{T_{W}}}{\,dt}={h_{C}} {A_{C}} \left({T_{C}}-{T_{W}}\right)-{h_{P}} {A_{P}} \left({T_{W}}-{T_{P}}\right) \end{displaymath} -Dividing (3) by ${m_{W}}$${C_{W}}$, we obtain: +Dividing Equation (3) by ${m_{W}}$${C_{W}}$, we obtain: \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{{h_{C}} {A_{C}}}{{m_{W}} {C_{W}}} \left({T_{C}}-{T_{W}}\right)-\frac{{h_{P}} {A_{P}}}{{m_{W}} {C_{W}}} \left({T_{W}}-{T_{P}}\right) \end{displaymath} @@ -835,7 +835,7 @@ \subsubsection{Instance Models} \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{1}{{τ_{W}}} \left({T_{C}}-{T_{W}}\right)+\frac{η}{{τ_{W}}} \left({T_{P}}-{T_{W}}\right) \end{displaymath} -Finally, factoring out $\frac{1}{{τ_{W}}}$ , we are left with the governing ODE for (\hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}): +Finally, factoring out $\frac{1}{{τ_{W}}}$, we are left with the governing ODE for (\hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}): \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{1}{{τ_{W}}} \left({T_{C}}-{T_{W}}+η \left({T_{P}}-{T_{W}}\right)\right) \end{displaymath} diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index e58cf39bc8..67e4fa88ea 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -1854,7 +1854,7 @@

Detailed derivation of the energy balance on water:

= hC AC (TC−TW)−hP AP (TW−TP)

- Dividing (3) by mWCW, we obtain: + Dividing Equation (3) by mWCW, we obtain:

@@ -1959,7 +1959,7 @@

Detailed derivation of the energy balance on water:

Finally, factoring out
1 τW -
, we are left with the governing ODE for (IM: eBalanceOnWtr): +
, we are left with the governing ODE for (IM: eBalanceOnWtr):

From e18d1a4525219a225d52effe887810a652bb7b92 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Thu, 25 Jul 2019 15:35:06 -0400 Subject: [PATCH 15/20] Fixed case statement from master merge --- code/drasil-example/Drasil/SWHS/IMods.hs | 7 ++----- code/stable/swhs/SRS/SWHS_SRS.tex | 3 +-- code/stable/swhs/Website/SWHS_SRS.html | 7 +------ 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index eea356c0bd..d0a71dde96 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -389,7 +389,7 @@ heatEInPCMRC = makeRC "heatEInPCMRC" (nounPhraseSP "Heat energy in the PCM") (pcmE ^. defn) htPCMRel htPCMRel :: Relation -htPCMRel = sy pcmE $= completeCase [case1, case2, case3, case4] +htPCMRel = sy pcmE $= completeCase [case1, case2, case3] where case1 = (sy htCapSP * sy pcmMass * (apply1 tempPCM time - sy tempInit), realInterval tempPCM (UpTo (Exc, sy tempMeltP))) @@ -398,10 +398,7 @@ htPCMRel = sy pcmE $= completeCase [case1, case2, case3, case4] sy tempMeltP)), realInterval tempPCM (UpFrom (Exc, sy tempMeltP))) case3 = (sy pcmInitMltE + apply1 latentEP time, - sy tempPCM $= sy tempMeltP) - - case4 = (sy pcmInitMltE + apply1 latentEP time, - realInterval meltFrac (Bounded (Exc,0) (Exc,1))) + sy tempPCM $= sy tempMeltP $&& realInterval meltFrac (Bounded (Exc,0) (Exc,1))) htPCMNotes :: [Sentence] htPCMNotes = map foldlSent [ diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 21e33fa031..27d58fcbc4 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -1126,8 +1126,7 @@ \subsubsection{Instance Models} {E_{P}}=\begin{cases} {{C_{P}}^{S}} {m_{P}} \left({T_{P}}\left(t\right)-{T_{init}}\right), & {T_{P}}<{{T_{melt}}^{P}}\\ {{{E_{P}}_{melt}}^{init}}+{H_{f}} {m_{P}}+{{C_{P}}^{L}} {m_{P}} \left({T_{P}}\left(t\right)-{{T_{melt}}^{P}}\right), & {T_{P}}>{{T_{melt}}^{P}}\\ -{{{E_{P}}_{melt}}^{init}}+{Q_{P}}\left(t\right), & {T_{P}}={{T_{melt}}^{P}}\\ -{{{E_{P}}_{melt}}^{init}}+{Q_{P}}\left(t\right), & 0<ϕ<1 +{{{E_{P}}_{melt}}^{init}}+{Q_{P}}\left(t\right), & {T_{P}}={{T_{melt}}^{P}}\land{}0<ϕ<1 \end{cases} \end{displaymath} \\ \midrule \\ diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index 3d5392faf0..a32ff5c3a0 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -2327,12 +2327,7 @@

EPmeltinit+QP(t) , - TP = TmeltP - - - - EPmeltinit+QP(t) , - 0 < ϕ < 1 + TP = TmeltP ∧ 0 < ϕ < 1

From cf99da873a907ff0cf3020e5402e48561f2f2f7b Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Thu, 25 Jul 2019 16:02:58 -0400 Subject: [PATCH 16/20] Used ch more; improved the derivation of IM1 --- code/drasil-example/Drasil/NoPCM/IMods.hs | 20 ++-- code/drasil-example/Drasil/SWHS/IMods.hs | 129 +++++++++------------- code/stable/swhs/SRS/SWHS_SRS.tex | 2 +- code/stable/swhs/Website/SWHS_SRS.html | 2 +- 4 files changed, 61 insertions(+), 92 deletions(-) diff --git a/code/drasil-example/Drasil/NoPCM/IMods.hs b/code/drasil-example/Drasil/NoPCM/IMods.hs index 95e0fbd979..c51bc4b8ef 100644 --- a/code/drasil-example/Drasil/NoPCM/IMods.hs +++ b/code/drasil-example/Drasil/NoPCM/IMods.hs @@ -1,7 +1,7 @@ module Drasil.NoPCM.IMods (eBalanceOnWtr, iMods, instModIntro) where import Language.Drasil -import Theory.Drasil (DataDefinition, InstanceModel, im) +import Theory.Drasil (InstanceModel, im) import Utils.Drasil import Control.Lens ((^.)) @@ -14,8 +14,8 @@ import Data.Drasil.Quantities.Physics (energy, time) import Drasil.SWHS.Concepts (water) import Drasil.SWHS.DataDefs (ddHtFluxC) -import Drasil.SWHS.IMods (eBalanceOnWtrDerivDesc1, eBalanceOnWtrDerivDesc3, - heatEInWtr) +import Drasil.SWHS.IMods (eBalanceOnWtrDerivDesc1, eBalanceOnWtrDerivDesc2, + eBalanceOnWtrDerivDesc3, heatEInWtr) import Drasil.SWHS.References (koothoor2013) import Drasil.SWHS.Unitals (tempW, tempC, tauW, wMass, htCapW, coilHTC, coilSA, tempInit, timeFinal, htFluxC) @@ -65,17 +65,11 @@ eBalanceOnWtrDeriv = mkDerivName (S "the" +:+ phrase energy +:+ S "balance on wa (weave [eBalanceOnWtrDerivSentences, map E eBalanceOnWtrDerivEqns]) eBalanceOnWtrDerivSentences :: [Sentence] -eBalanceOnWtrDerivSentences = map foldlSentCol [ - eBalanceOnWtrDerivDesc1 EmptyS (S "over area" +:+ (E $ sy coilSA)) EmptyS assumpNIHGBW, - eBalanceOnWtrDerivDesc2 ddHtFluxC, - eBalanceOnWtrDerivDesc3, eBalanceOnWtrDerivDesc4] +eBalanceOnWtrDerivSentences = [eBalanceOnWtrDerivDesc1 EmptyS (S "over area" +:+ ch coilSA) EmptyS assumpNIHGBW, + eBalanceOnWtrDerivDesc2 [ddHtFluxC], eBalanceOnWtrDerivDesc3, eBalanceOnWtrDerivDesc4] -eBalanceOnWtrDerivDesc2 :: DataDefinition -> [Sentence] -eBalanceOnWtrDerivDesc2 dd = [S "Using", makeRef2S dd, S "for", ch dd `sC` - S "this can be written as"] - -eBalanceOnWtrDerivDesc4 :: [Sentence] -eBalanceOnWtrDerivDesc4 = [S "Setting", ch tauW, S "=", ch wMass, ch htCapW, +eBalanceOnWtrDerivDesc4 :: Sentence +eBalanceOnWtrDerivDesc4 = foldlSentCol [S "Setting", ch tauW, S "=", ch wMass, ch htCapW, S "/", ch coilHTC, ch coilSA `sC` eqN 4, S "can be written in its final form as"] eBalanceOnWtrDerivEqn1, eBalanceOnWtrDerivEqn2, eBalanceOnWtrDerivEqn3, eBalanceOnWtrDerivEqn4 :: Expr diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index d0a71dde96..87ccfba42f 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -1,5 +1,6 @@ module Drasil.SWHS.IMods (iMods, eBalanceOnWtr, eBalanceOnWtrDerivDesc1, - eBalanceOnWtrDerivDesc3, eBalanceOnPCM, heatEInWtr, heatEInPCM, instModIntro) where + eBalanceOnWtrDerivDesc2, eBalanceOnWtrDerivDesc3, eBalanceOnPCM, + heatEInWtr, heatEInPCM, instModIntro) where import Language.Drasil import Theory.Drasil (DataDefinition, InstanceModel, im, imNoDeriv) @@ -55,8 +56,8 @@ balWtrDesc :: [Sentence] balWtrDesc = map foldlSent [[E (sy tempPCM) `sIs` S "defined by", makeRef2S eBalanceOnPCM], [S "The", phrase input_, phrase constraint, E $ sy tempInit $<= sy tempC, S "comes from", makeRef2S assumpCTNOD], - [E (sy tauW) `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], - [E (sy eta) `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], + [ch tauW `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], + [ch eta `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], [S "The initial", plural condition, S "for the", getAcc ode `sAre` E (apply (sy tempW) [Int 0] $= apply (sy tempPCM) [Int 0] $= sy tempInit) `follows` assumpSITWP], [S "The", getAcc ode, S "applies as long as the", phrase water `sIs` EmptyS `sIn` @@ -65,27 +66,6 @@ balWtrDesc = map foldlSent [[E (sy tempPCM) `sIs` S "defined by", makeRef2S eBal E 100, sParen (unwrap $ getUnit tempW) `sAre` S "the", phrase melting `sAnd` plural boilPt `sOf` phrase water `sC` S "respectively", sParen (S "from" +:+ makeRef2S assumpWAL `sAnd` makeRef2S assumpAPT)]] -{-} -balWtrDesc :: Sentence -balWtrDesc = foldlSent [(E $ sy tauW) `sC` (E $ sy timeFinal) - `sC` (E $ sy tempC) `sC` (E $ sy tempPCM), S "from" +:+. - sParen (makeRef2S eBalanceOnPCM), S "The input is constrained so that" +:+. - (E $ sy tempInit $<= sy tempC), sParen (makeRef2S assumpCTNOD), - (E $ sy tempW) `isThe` phrase tempW +:+. - sParen (unwrap $ getUnit tempW), (E $ sy tempPCM) `isThe` - phrase tempPCM +:+. sParen (unwrap $ getUnit tempPCM), - (E $ sy tempC) `isThe` phrase tempC +:+. sParen (unwrap $ getUnit tempC), - E $ sy tauW $= (sy wMass * sy htCapW) / (sy coilHTC * sy coilSA), - S "is a constant", sParen (makeRef2S ddHtFusion) +:+. sParen (unwrap $ getUnit tauW), - E $ sy eta $= (sy pcmHTC * sy pcmSA) / (sy coilHTC * sy coilSA), - S "is a constant" +:+. sParen (S "dimensionless"), - S "The above", phrase equation, S "applies as long as the", phrase water, - S "is in", phrase liquid, S "form" `sC` (E $ realInterval tempW (Bounded (Exc,0) (Exc,100))), - sParen (unwrap $ getUnit tempW), S "where", E 0, - sParen (unwrap $ getUnit tempW) `sAnd` E 100, - sParen (unwrap $ getUnit tempW), S "are the", phrase melting `sAnd` - plural boilPt, S "of", phrase water `sC` S "respectively", - sParen (makeRef2S assumpWAL `sC` makeRef2S assumpAPT)]-} ---------------------------------------------- -- Derivation of eBalanceOnWtr -- @@ -96,22 +76,21 @@ eBalanceOnWtrDeriv = mkDerivName (S "the" +:+ phrase energy +:+ S "balance on wa (weave [eBalanceOnWtrDerivSentences, map E eBalanceOnWtrDerivEqnsIM1]) eBalanceOnWtrDerivSentences :: [Sentence] -eBalanceOnWtrDerivSentences = map foldlSentCol [ - eBalanceOnWtrDerivDesc1 htTransEnd overAreas extraAssumps assumpNIHGBWP, - eBalanceOnWtrDerivDesc2 ddHtFluxC ddHtFluxP, +eBalanceOnWtrDerivSentences = [eBalanceOnWtrDerivDesc1 htTransEnd overAreas extraAssumps assumpNIHGBWP, + eBalanceOnWtrDerivDesc2 [ddHtFluxC, ddHtFluxP], eBalanceOnWtrDerivDesc3, - eBalanceOnWtrDerivDesc4 eq2, + eBalanceOnWtrDerivDesc4, eBalanceOnWtrDerivDesc5, - eBalanceOnWtrDerivDesc6 eq3 eq4, - eBalanceOnWtrDerivDesc7 eq5] + eBalanceOnWtrDerivDesc6 eq2 eq3, + eBalanceOnWtrDerivDesc7 eq4] -eBalanceOnWtrDerivDesc1 :: Sentence -> Sentence-> Sentence -> ConceptInstance -> [Sentence] -eBalanceOnWtrDerivDesc1 htEnd oa ea htA = [S "To find the", phrase rOfChng `sOf` (E $ sy tempW) `sC` - S "we look at the", phrase energy, S "balance on" +:+. phrase water, S "The", +eBalanceOnWtrDerivDesc1 :: Sentence -> Sentence -> Sentence -> ConceptInstance -> Sentence +eBalanceOnWtrDerivDesc1 htEnd oa ea htA = foldlSentCol [S "To find the", phrase rOfChng `sOf` + ch tempW `sC` S "we look at the", phrase energy, S "balance on" +:+. phrase water, S "The", phrase vol, S "being considered" `isThe` (phrase vol `sOf` phrase water) `sIn` S "the", - phrase tank, (E $ sy wVol) `sC` S "which has", phrase mass +:+. ((E $ sy wMass) `sAnd` - phrase heatCapSpec `sC` (E $ sy htCapW)), atStart heatTrans, S "occurs in the", - phrase water, S "from the", phrase coil, S "as", E $ sy htFluxC, + phrase tank, ch wVol `sC` S "which has", phrase mass +:+. (ch wMass `sAnd` + phrase heatCapSpec `sC` ch htCapW), atStart heatTrans, S "occurs in the", + phrase water, S "from the", phrase coil, S "as", ch htFluxC, sParen (makeRef2S ddHtFluxC) +:+ htEnd `sC` EmptyS +:+. oa, ea, S "No", phrase heatTrans, S "occurs to", S "outside" `ofThe` phrase tank `sC` S "since it has been assumed to be perfectly insulated" +:+. sParen (makeRef2S assumpPIT), @@ -124,50 +103,46 @@ htTransEnd = foldlSent_ [S "and from the", phrase water, S "into the", getAcc phsChgMtrl, S "as", ch htFluxP, sParen (makeRef2S ddHtFluxP)] overAreas :: Sentence -overAreas = S "over areas" +:+ ((E $ sy coilSA) `sAnd` (E $ sy pcmSA) `sC` S "respectively") +overAreas = S "over areas" +:+ ch coilSA `sAnd` ch pcmSA `sC` S "respectively" extraAssumps :: Sentence -extraAssumps = foldlSent [S "The thermal flux" `sIs` S "constant over", (E $ sy coilSA) `sC` +extraAssumps = foldlSent [S "The thermal flux" `sIs` S "constant over", ch coilSA `sC` S "since", phrase temp `ofThe` phrase coil `sIs` S "assumed to not vary along its length", sParen (makeRef2S assumpTHCCoL) `sC` EmptyS `andThe` S "thermal flux" `sIs` S "constant over", - (E $ sy pcmSA) `sC` S "since", phrase temp `ofThe` getAcc phsChgMtrl `isThe` + ch pcmSA `sC` S "since", phrase temp `ofThe` getAcc phsChgMtrl `isThe` S "same throughout its", phrase vol, sParen (makeRef2S assumpTPCAV) `andThe` phrase water `sIs` S "fully mixed" +:+ sParen (makeRef2S assumpCWTAT)] -eBalanceOnWtrDerivDesc2 :: DataDefinition -> DataDefinition -> [Sentence] -eBalanceOnWtrDerivDesc2 dd1 dd2 = [S "Using", makeRef2S dd1 `sAnd` makeRef2S dd2, - S "for", ch dd1 `sAnd` ch dd2, S "respectively, this can be written as"] +eBalanceOnWtrDerivDesc2 :: [DataDefinition] -> Sentence +eBalanceOnWtrDerivDesc2 dds = foldlSentCol [S "Using", foldlList Comma List + (map (\x -> makeRef2S x +:+ S "for" +:+ ch x) dds) `sC` S "this can be written as"] -eBalanceOnWtrDerivDesc3 :: [Sentence] -eBalanceOnWtrDerivDesc3 = [S "Dividing", eqN 3, S "by", E eq1 `sC` S "we obtain"] +eBalanceOnWtrDerivDesc3 :: Sentence +eBalanceOnWtrDerivDesc3 = foldlSentCol [S "Dividing", eqN 3, S "by", E eq1 `sC` S "we obtain"] -eBalanceOnWtrDerivDesc4 :: [Sentence] -> [Sentence] -eBalanceOnWtrDerivDesc4 eq22 = [S "Factoring the negative sign out of", +eBalanceOnWtrDerivDesc4 :: Sentence +eBalanceOnWtrDerivDesc4 = foldlSentCol [S "Factoring the negative sign out of", S "second term" `ofThe` short rightSide `sOf` eqN 4 `sAnd` - S "multiplying it by"] ++ eq22 ++ [S "yields"] + S "multiplying it by", ch coilHTC, ch coilSA, S "/", ch coilHTC, ch coilSA, S "yields"] -eBalanceOnWtrDerivDesc5 ::[Sentence] -eBalanceOnWtrDerivDesc5 = [S "Which simplifies to"] +eBalanceOnWtrDerivDesc5 :: Sentence +eBalanceOnWtrDerivDesc5 = S "Which simplifies to:" -eBalanceOnWtrDerivDesc6 :: Expr -> Expr -> [Sentence] -eBalanceOnWtrDerivDesc6 eq33 eq44 = - [S "Setting", E eq33, sParen (makeRef2S ddHtFusion) `sAnd` E eq44, - sParen (makeRef2S ddMeltFrac) `sC` eqN 5, S "can be written as"] +eBalanceOnWtrDerivDesc6 :: Expr -> Expr -> Sentence +eBalanceOnWtrDerivDesc6 eq33 eq44 = foldlSentCol [S "Setting", E eq33, + sParen (makeRef2S ddHtFusion) `sAnd` E eq44, sParen (makeRef2S ddMeltFrac) `sC` + eqN 5, S "can be written as"] -eBalanceOnWtrDerivDesc7 :: Expr -> [Sentence] -eBalanceOnWtrDerivDesc7 eq55 = [S "Finally, factoring out", E eq55 `sC` +eBalanceOnWtrDerivDesc7 :: Expr -> Sentence +eBalanceOnWtrDerivDesc7 eq55 = foldlSentCol [S "Finally, factoring out", E eq55 `sC` S "we are left with the governing", getAcc ode, S "for", makeRef2S eBalanceOnWtr] -eq1, eq3, eq4, eq5 :: Expr +eq1, eq2, eq3, eq4 :: Expr eq1 = sy wMass * sy htCapW - -eq2 :: [Sentence] -eq2 = [ch coilHTC, ch coilSA, S "/", ch coilHTC, ch coilSA] - -eq3 = sy tauW $= (sy wMass * sy htCapW) / (sy coilHTC * sy coilSA) -eq4 = sy eta $= (sy pcmHTC * sy pcmSA) / +eq2 = sy tauW $= (sy wMass * sy htCapW) / (sy coilHTC * sy coilSA) +eq3 = sy eta $= (sy pcmHTC * sy pcmSA) / (sy coilHTC * sy coilSA) -eq5 = 1 / sy tauW +eq4 = 1 / sy tauW eBalanceOnWtrDerivEqn1, eBalanceOnWtrDerivEqn2, eBalanceOnWtrDerivEqn3, eBalanceOnWtrDerivEqn4, eBalanceOnWtrDerivEqn5, eBalanceOnWtrDerivEqn6, eBalanceOnWtrDerivEqn7 :: Expr @@ -234,18 +209,18 @@ balPCMRel = deriv (sy tempPCM) time $= completeCase [case1, case2, case3] balPCMNotes :: [Sentence] balPCMNotes = map foldlSent [ - [E (sy tempW) `sIs` S "defined by", makeRef2S eBalanceOnWtr], + [ch tempW `sIs` S "defined by", makeRef2S eBalanceOnWtr], [S "The", phrase input_, phrase constraint, E $ sy tempInit $<= sy tempMeltP, S "comes from", makeRef2S assumpPIS], - [S "The", phrase temp, S "remains constant at", (E $ sy tempMeltP) `sC` + [S "The", phrase temp, S "remains constant at", ch tempMeltP `sC` S "even with the heating", sParen (S "or cooling") `sC` S "until the", phrase phaseChange, S "has occurred for all" `sOf` S "the material; that" `sIs` - S "as long as" +:+. E (0 $< sy meltFrac $< 1), E $ sy meltFrac, + S "as long as" +:+. E (0 $< sy meltFrac $< 1), ch meltFrac, sParen (S "from" +:+ makeRef2S ddMeltFrac) `sIs` S "determined as part" `sOf` S "the", phrase heat, phrase energy `sIn` S "the", getAcc phsChgMtrl `sC` S "as given" `sIn` sParen (makeRef2S heatEInPCM)], - [E (sy tauSP) `sIs` S "calculated" `sIn` makeRef2S ddBalanceSolidPCM], - [E (sy tauLP) `sIs` S "calculated" `sIn` makeRef2S ddBalanceLiquidPCM], + [ch tauSP `sIs` S "calculated" `sIn` makeRef2S ddBalanceSolidPCM], + [ch tauLP `sIs` S "calculated" `sIn` makeRef2S ddBalanceLiquidPCM], [S "The initial", plural condition, S "for the", getAcc ode `sAre` E (apply (sy tempW) [Int 0] $= apply (sy tempPCM) [Int 0] $= sy tempInit) `follows` assumpSITWP]] @@ -272,14 +247,14 @@ eBalanceOnPCMDerivDesc1 :: ConceptChunk -> ConstrConcept -> UnitalChunk -> Conce ConceptChunk -> UnitalChunk -> ConceptChunk -> UncertQ -> ConceptChunk -> ConceptInstance -> UnitalChunk -> [Sentence] eBalanceOnPCMDerivDesc1 roc tempP en wt vo pcmvo pm hcs hsp hf hfp pc ps ht ass16 vhg= - [S "To find the", phrase roc `sOf` (E $ sy tempP) `sC` S "we look at the", + [S "To find the", phrase roc `sOf` ch tempP `sC` S "we look at the", phrase en, S "balance on the" +:+. S "PCM", S "The", phrase vo, S "being considered" - `isThe` (phrase vo `sOf` S "PCM,") +:+. (E $ sy pcmvo), S "The derivation that follows is" +:+. - S "initially for the solid PCM", S "The mass of phase change material is", (E $ sy pm) `andThe` - phrase hcs `sOf` S "PCM as a solid is" +:+. (E $ sy hsp), S "The", phrase hf, - S "into the PCM from", phrase wt `sIs` (E $ sy hfp), sParen (makeRef2S ddHtFluxP), - S "over", phrase pc, S "material surface area" +:+. (E $ sy ps), - S "The thermal flux" `sIs` S "constant over", (E $ sy pcmSA) `sC` S "since", + `isThe` (phrase vo `sOf` S "PCM,") +:+. ch pcmvo, S "The derivation that follows is" +:+. + S "initially for the solid PCM", S "The mass of phase change material is", ch pm `andThe` + phrase hcs `sOf` S "PCM as a solid is" +:+. ch hsp, S "The", phrase hf, + S "into the PCM from", phrase wt `sIs` ch hfp, sParen (makeRef2S ddHtFluxP), + S "over", phrase pc, S "material surface area" +:+. ch ps, + S "The thermal flux" `sIs` S "constant over", ch pcmSA `sC` S "since", phrase temp `ofThe` getAcc phsChgMtrl `isThe` S "same throughout its", phrase vol, sParen (makeRef2S assumpTPCAV) `andThe` phrase water `sIs` S "fully mixed" +:+. sParen (makeRef2S assumpCWTAT), S "There is no", phrase hf, phrase output_, @@ -302,8 +277,8 @@ eBalanceOnPCMDerivDesc5 :: UncertQ -> UncertQ -> UnitalChunk -> UnitalChunk -> -> ConceptChunk -> ConceptInstance -> [Sentence] eBalanceOnPCMDerivDesc5 hsp hlp tsp tlp sur ar melt vo ass17 = [eqN 6 +:+ S "applies for the solid PCM. In the case where all of the PCM is melted, the same" +:+ - S "derivation applies, except that" +:+ (E $ sy hsp) +:+ S "is replaced by" +:+ (E $ sy hlp) `sC` - S "and thus" +:+ (E $ sy tsp) +:+ S "is replaced by" +:+. (E $ sy tlp) +:+ S "Although a small change in" +:+ + S "derivation applies, except that" +:+ ch hsp +:+ S "is replaced by" +:+ ch hlp `sC` + S "and thus" +:+ ch tsp +:+ S "is replaced by" +:+. ch tlp +:+ S "Although a small change in" +:+ phrase sur +:+ phrase ar +:+ S "would be expected with" +:+ phrase melt `sC` S "this is not included" `sC` S "since the" +:+ phrase vo +:+ S "change of the PCM with" +:+ phrase melting +:+ S "is assumed to be negligible" +:+. sParen (makeRef2S ass17)] diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 27d58fcbc4..33a134a6bc 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -923,7 +923,7 @@ \subsubsection{Instance Models} \begin{displaymath} {m_{W}} {C_{W}} \frac{\,d{T_{W}}}{\,dt}={q_{C}} {A_{C}}-{q_{P}} {A_{P}} \end{displaymath} -Using \hyperref[DD:htFluxC]{DD: htFluxC} and \hyperref[DD:htFluxP]{DD: htFluxP} for ${q_{C}}$ and ${q_{P}}$ respectively, this can be written as: +Using \hyperref[DD:htFluxC]{DD: htFluxC} for ${q_{C}}$ and \hyperref[DD:htFluxP]{DD: htFluxP} for ${q_{P}}$, this can be written as: \begin{displaymath} {m_{W}} {C_{W}} \frac{\,d{T_{W}}}{\,dt}={h_{C}} {A_{C}} \left({T_{C}}-{T_{W}}\right)-{h_{P}} {A_{P}} \left({T_{W}}-{T_{P}}\right) diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index a32ff5c3a0..56e7d7361c 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -1839,7 +1839,7 @@

Detailed derivation of the energy balance on water:

= qC AC−qP AP

- Using DD: htFluxC and DD: htFluxP for qC and qP respectively, this can be written as: + Using DD: htFluxC for qC and DD: htFluxP for qP, this can be written as:

mW CW
From ef8b7370a9b01808c5c0544521ba47a60e0d17b6 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Thu, 25 Jul 2019 17:26:13 -0400 Subject: [PATCH 17/20] Minor fixes to derivations --- code/drasil-example/Drasil/NoPCM/IMods.hs | 2 +- code/drasil-example/Drasil/SWHS/IMods.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/code/drasil-example/Drasil/NoPCM/IMods.hs b/code/drasil-example/Drasil/NoPCM/IMods.hs index c51bc4b8ef..a8e77f4e7a 100644 --- a/code/drasil-example/Drasil/NoPCM/IMods.hs +++ b/code/drasil-example/Drasil/NoPCM/IMods.hs @@ -70,7 +70,7 @@ eBalanceOnWtrDerivSentences = [eBalanceOnWtrDerivDesc1 EmptyS (S "over area" +:+ eBalanceOnWtrDerivDesc4 :: Sentence eBalanceOnWtrDerivDesc4 = foldlSentCol [S "Setting", ch tauW, S "=", ch wMass, ch htCapW, - S "/", ch coilHTC, ch coilSA `sC` eqN 4, S "can be written in its final form as"] + S "/", ch coilHTC, ch coilSA `sC` eqN 3, S "can be written in its final form as"] eBalanceOnWtrDerivEqn1, eBalanceOnWtrDerivEqn2, eBalanceOnWtrDerivEqn3, eBalanceOnWtrDerivEqn4 :: Expr diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 87ccfba42f..f0c8c9b491 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -118,15 +118,15 @@ eBalanceOnWtrDerivDesc2 dds = foldlSentCol [S "Using", foldlList Comma List (map (\x -> makeRef2S x +:+ S "for" +:+ ch x) dds) `sC` S "this can be written as"] eBalanceOnWtrDerivDesc3 :: Sentence -eBalanceOnWtrDerivDesc3 = foldlSentCol [S "Dividing", eqN 3, S "by", E eq1 `sC` S "we obtain"] +eBalanceOnWtrDerivDesc3 = foldlSentCol [S "Dividing", eqN 2, S "by", E eq1 `sC` S "we obtain"] eBalanceOnWtrDerivDesc4 :: Sentence eBalanceOnWtrDerivDesc4 = foldlSentCol [S "Factoring the negative sign out of", - S "second term" `ofThe` short rightSide `sOf` eqN 4 `sAnd` + S "second term" `ofThe` short rightSide `sOf` eqN 3 `sAnd` S "multiplying it by", ch coilHTC, ch coilSA, S "/", ch coilHTC, ch coilSA, S "yields"] eBalanceOnWtrDerivDesc5 :: Sentence -eBalanceOnWtrDerivDesc5 = S "Which simplifies to:" +eBalanceOnWtrDerivDesc5 = S "Rearraging this" +:+ phrase equation +: S "gives us" eBalanceOnWtrDerivDesc6 :: Expr -> Expr -> Sentence eBalanceOnWtrDerivDesc6 eq33 eq44 = foldlSentCol [S "Setting", E eq33, @@ -276,7 +276,7 @@ eBalanceOnPCMDerivDesc4 = [S "Setting", ch tauSP, S "=", ch pcmMass, ch htCapSP, eBalanceOnPCMDerivDesc5 :: UncertQ -> UncertQ -> UnitalChunk -> UnitalChunk -> ConceptChunk -> ConceptChunk-> ConceptChunk -> ConceptChunk -> ConceptInstance -> [Sentence] eBalanceOnPCMDerivDesc5 hsp hlp tsp tlp sur ar melt vo ass17 = - [eqN 6 +:+ S "applies for the solid PCM. In the case where all of the PCM is melted, the same" +:+ + [eqN 4 +:+ S "applies for the solid PCM. In the case where all of the PCM is melted, the same" +:+ S "derivation applies, except that" +:+ ch hsp +:+ S "is replaced by" +:+ ch hlp `sC` S "and thus" +:+ ch tsp +:+ S "is replaced by" +:+. ch tlp +:+ S "Although a small change in" +:+ phrase sur +:+ phrase ar +:+ S "would be expected with" +:+ phrase melt `sC` S "this is not included" `sC` From 5c47443b6ceac17829858d947f6cac9608135102 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Tue, 30 Jul 2019 11:09:45 -0400 Subject: [PATCH 18/20] Fixed stable from equation number fixes --- code/stable/nopcm/SRS/NoPCM_SRS.tex | 4 ++-- code/stable/nopcm/Website/NoPCM_SRS.html | 4 ++-- code/stable/swhs/SRS/SWHS_SRS.tex | 8 ++++---- code/stable/swhs/Website/SWHS_SRS.html | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/code/stable/nopcm/SRS/NoPCM_SRS.tex b/code/stable/nopcm/SRS/NoPCM_SRS.tex index 6af5805dbd..7a8c62f84e 100644 --- a/code/stable/nopcm/SRS/NoPCM_SRS.tex +++ b/code/stable/nopcm/SRS/NoPCM_SRS.tex @@ -609,12 +609,12 @@ \subsubsection{Instance Models} \begin{displaymath} {m_{W}} {C_{W}} \frac{\,d{T_{W}}}{\,dt}={h_{C}} {A_{C}} \left({T_{C}}-{T_{W}}\right) \end{displaymath} -Dividing Equation (3) by ${m_{W}} {C_{W}}$, we obtain: +Dividing Equation (2) by ${m_{W}} {C_{W}}$, we obtain: \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{{h_{C}} {A_{C}}}{{m_{W}} {C_{W}}} \left({T_{C}}-{T_{W}}\right) \end{displaymath} -Setting ${τ_{W}}$ = ${m_{W}}$ ${C_{W}}$ / ${h_{C}}$ ${A_{C}}$, Equation (4) can be written in its final form as: +Setting ${τ_{W}}$ = ${m_{W}}$ ${C_{W}}$ / ${h_{C}}$ ${A_{C}}$, Equation (3) can be written in its final form as: \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{1}{{τ_{W}}} \left({T_{C}}-{T_{W}}\right) diff --git a/code/stable/nopcm/Website/NoPCM_SRS.html b/code/stable/nopcm/Website/NoPCM_SRS.html index c492d21b56..77a697fac4 100644 --- a/code/stable/nopcm/Website/NoPCM_SRS.html +++ b/code/stable/nopcm/Website/NoPCM_SRS.html @@ -1177,7 +1177,7 @@

Detailed derivation of the energy balance on water:

= hC AC (TC−TW)

- Dividing Equation (3) by mW CW, we obtain: + Dividing Equation (2) by mW CW, we obtain:

@@ -1189,7 +1189,7 @@

Detailed derivation of the energy balance on water:

 (TC−TW)

- Setting τW = mW CW / hC AC, Equation (4) can be written in its final form as: + Setting τW = mW CW / hC AC, Equation (3) can be written in its final form as:

diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 33a134a6bc..446f149444 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -928,17 +928,17 @@ \subsubsection{Instance Models} \begin{displaymath} {m_{W}} {C_{W}} \frac{\,d{T_{W}}}{\,dt}={h_{C}} {A_{C}} \left({T_{C}}-{T_{W}}\right)-{h_{P}} {A_{P}} \left({T_{W}}-{T_{P}}\right) \end{displaymath} -Dividing Equation (3) by ${m_{W}} {C_{W}}$, we obtain: +Dividing Equation (2) by ${m_{W}} {C_{W}}$, we obtain: \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{{h_{C}} {A_{C}}}{{m_{W}} {C_{W}}} \left({T_{C}}-{T_{W}}\right)-\frac{{h_{P}} {A_{P}}}{{m_{W}} {C_{W}}} \left({T_{W}}-{T_{P}}\right) \end{displaymath} -Factoring the negative sign out of the second term of the RHS of Equation (4) and multiplying it by ${h_{C}}$ ${A_{C}}$ / ${h_{C}}$ ${A_{C}}$ yields: +Factoring the negative sign out of the second term of the RHS of Equation (3) and multiplying it by ${h_{C}}$ ${A_{C}}$ / ${h_{C}}$ ${A_{C}}$ yields: \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{{h_{C}} {A_{C}}}{{m_{W}} {C_{W}}} \left({T_{C}}-{T_{W}}\right)+\frac{{h_{C}} {A_{C}}}{{h_{C}} {A_{C}}} \frac{{h_{P}} {A_{P}}}{{m_{W}} {C_{W}}} \left({T_{P}}-{T_{W}}\right) \end{displaymath} -Which simplifies to: +Rearraging this equation gives us: \begin{displaymath} \frac{\,d{T_{W}}}{\,dt}=\frac{{h_{C}} {A_{C}}}{{m_{W}} {C_{W}}} \left({T_{C}}-{T_{W}}\right)+\frac{{h_{P}} {A_{P}}}{{h_{C}} {A_{C}}} \frac{{h_{C}} {A_{C}}}{{m_{W}} {C_{W}}} \left({T_{P}}-{T_{W}}\right) @@ -1039,7 +1039,7 @@ \subsubsection{Instance Models} \begin{displaymath} \frac{\,d{T_{P}}}{\,dt}=\frac{1}{{{τ_{P}}^{S}}} \left({T_{W}}-{T_{P}}\right) \end{displaymath} -Equation (6) applies for the solid PCM. In the case where all of the PCM is melted, the same derivation applies, except that ${{C_{P}}^{S}}$ is replaced by ${{C_{P}}^{L}}$, and thus ${{τ_{P}}^{S}}$ is replaced by ${{τ_{P}}^{L}}$. Although a small change in surface area would be expected with melting, this is not included, since the volume change of the PCM with melting is assumed to be negligible (\hyperref[assumpVCMPN]{A: Volume-Change-Melting-PCM-Negligible}). +Equation (4) applies for the solid PCM. In the case where all of the PCM is melted, the same derivation applies, except that ${{C_{P}}^{S}}$ is replaced by ${{C_{P}}^{L}}$, and thus ${{τ_{P}}^{S}}$ is replaced by ${{τ_{P}}^{L}}$. Although a small change in surface area would be expected with melting, this is not included, since the volume change of the PCM with melting is assumed to be negligible (\hyperref[assumpVCMPN]{A: Volume-Change-Melting-PCM-Negligible}). In the case where ${T_{P}}={{T_{melt}}^{P}}$ and not all of the PCM is melted, the temperature of the phase change material does not change. Therefore, in this case d ${T_{P}}$ / d $t$ = 0. diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index 56e7d7361c..d05c133c18 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -1852,7 +1852,7 @@

Detailed derivation of the energy balance on water:

= hC AC (TC−TW)−hP AP (TW−TP)

- Dividing Equation (3) by mW CW, we obtain: + Dividing Equation (2) by mW CW, we obtain:

@@ -1871,7 +1871,7 @@

Detailed derivation of the energy balance on water:

 (TW−TP)

- Factoring the negative sign out of the second term of the RHS of Equation (4) and multiplying it by hC AC / hC AC yields: + Factoring the negative sign out of the second term of the RHS of Equation (3) and multiplying it by hC AC / hC AC yields:

@@ -1896,7 +1896,7 @@

Detailed derivation of the energy balance on water:

 (TP−TW)
-

Which simplifies to:

+

Rearraging this equation gives us:

 dTW @@ -2167,7 +2167,7 @@

 (TW−TP)

- Equation (6) applies for the solid PCM. In the case where all of the PCM is melted, the same derivation applies, except that CPS is replaced by CPL, and thus τPS is replaced by τPL. Although a small change in surface area would be expected with melting, this is not included, since the volume change of the PCM with melting is assumed to be negligible (A: Volume-Change-Melting-PCM-Negligible). + Equation (4) applies for the solid PCM. In the case where all of the PCM is melted, the same derivation applies, except that CPS is replaced by CPL, and thus τPS is replaced by τPL. Although a small change in surface area would be expected with melting, this is not included, since the volume change of the PCM with melting is assumed to be negligible (A: Volume-Change-Melting-PCM-Negligible).

In the case where TP = TmeltP and not all of the PCM is melted, the temperature of the phase change material does not change. Therefore, in this case d TP / d t = 0. From a59b1253700a551ebce5cfd0b4b26917a1eb0fb3 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Tue, 30 Jul 2019 11:30:53 -0400 Subject: [PATCH 19/20] Fixed reference to new DDs --- code/drasil-example/Drasil/NoPCM/IMods.hs | 2 +- code/drasil-example/Drasil/SWHS/IMods.hs | 4 ++-- code/stable/nopcm/SRS/NoPCM_SRS.tex | 2 +- code/stable/nopcm/Website/NoPCM_SRS.html | 2 +- code/stable/swhs/SRS/SWHS_SRS.tex | 4 ++-- code/stable/swhs/Website/SWHS_SRS.html | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/code/drasil-example/Drasil/NoPCM/IMods.hs b/code/drasil-example/Drasil/NoPCM/IMods.hs index f32ef94a0b..84b4c90559 100644 --- a/code/drasil-example/Drasil/NoPCM/IMods.hs +++ b/code/drasil-example/Drasil/NoPCM/IMods.hs @@ -49,7 +49,7 @@ balWtrRel = deriv (sy tempW) time $= 1 / sy tauW * balWtrNotes :: [Sentence] balWtrNotes = map foldlSent [ - [E (sy tauW) `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], + [ch tauW `sIs` S "calculated from", makeRef2S balanceDecayRate], [S "The above", phrase equation, S "applies as long as the", phrase water, S "is in", phrase liquid, S "form" `sC` E (0 $< sy tempW $< 100), sParen (unwrap $ getUnit tempW), S "where", E 0, diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index 5d313a1057..f7c71e64b7 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -57,8 +57,8 @@ balWtrDesc = map foldlSent [ [E (sy tempPCM) `sIs` S "defined by", makeRef2S eBalanceOnPCM], [S "The", phrase input_, phrase constraint, E $ sy tempInit $<= sy tempC, S "comes from", makeRef2S assumpCTNOD], - [ch tauW `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], - [ch eta `sIs` S "calculated from", S "FIXME: Missing DD Issue 1484"], + [ch tauW `sIs` S "calculated from", makeRef2S balanceDecayRate], + [ch eta `sIs` S "calculated from", makeRef2S balanceDecayTime], [S "The initial", plural condition, S "for the", getAcc ode `sAre` E (apply (sy tempW) [Int 0] $= apply (sy tempPCM) [Int 0] $= sy tempInit) `follows` assumpSITWP], [S "The", getAcc ode, S "applies as long as the", phrase water `sIs` EmptyS `sIn` diff --git a/code/stable/nopcm/SRS/NoPCM_SRS.tex b/code/stable/nopcm/SRS/NoPCM_SRS.tex index 6ae6d1af2f..d1e5be4387 100644 --- a/code/stable/nopcm/SRS/NoPCM_SRS.tex +++ b/code/stable/nopcm/SRS/NoPCM_SRS.tex @@ -622,7 +622,7 @@ \subsubsection{Instance Models} \item{${T_{C}}$ is the temperature of the heating coil (${}^{\circ}$C)} \end{symbDescription} \\ \midrule \\ -Notes & ${τ_{W}}$ is calculated from FIXME: Missing DD Issue 1484. +Notes & ${τ_{W}}$ is calculated from \hyperref[DD:balanceDecayRate]{DD: balanceDecayRate}. The above equation applies as long as the water is in liquid form, $0<{T_{W}}<100$ (${}^{\circ}$C) where $0$ (${}^{\circ}$C) and $100$ (${}^{\circ}$C) are the melting and boiling point temperatures of water, respectively (\hyperref[assumpWAL]{A: Water-Always-Liquid}). diff --git a/code/stable/nopcm/Website/NoPCM_SRS.html b/code/stable/nopcm/Website/NoPCM_SRS.html index e2963c3b4e..8049078a95 100644 --- a/code/stable/nopcm/Website/NoPCM_SRS.html +++ b/code/stable/nopcm/Website/NoPCM_SRS.html @@ -1198,7 +1198,7 @@

Instance Models

Notes

- τW is calculated from FIXME: Missing DD Issue 1484. + τW is calculated from DD: balanceDecayRate.

The above equation applies as long as the water is in liquid form, 0 < TW < 100 (°C) where 0 (°C) and 100 (°C) are the melting and boiling point temperatures of water, respectively (A: Water-Always-Liquid). diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index bc4be317c3..14fcfb232b 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -1015,9 +1015,9 @@ \subsubsection{Instance Models} The input constraint ${T_{init}}\leq{}{T_{C}}$ comes from \hyperref[assumpCTNOD]{A: Charging-Tank-No-Temp-Discharge}. - ${τ_{W}}$ is calculated from FIXME: Missing DD Issue 1484. + ${τ_{W}}$ is calculated from \hyperref[DD:balanceDecayRate]{DD: balanceDecayRate}. - $η$ is calculated from FIXME: Missing DD Issue 1484. + $η$ is calculated from \hyperref[DD:balanceDecayTime]{DD: balanceDecayTime}. The initial conditions for the ODE are ${T_{W}}\left(0\right)={T_{P}}\left(0\right)={T_{init}}$ following \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM}. diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index 8e716e1119..a77fd8877c 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -2004,10 +2004,10 @@

Instance Models

The input constraint Tinit ≤ TC comes from A: Charging-Tank-No-Temp-Discharge.

- τW is calculated from FIXME: Missing DD Issue 1484. + τW is calculated from DD: balanceDecayRate.

- η is calculated from FIXME: Missing DD Issue 1484. + η is calculated from DD: balanceDecayTime.

The initial conditions for the ODE are TW(0) = TP(0) = Tinit following A: Same-Initial-Temp-Water-PCM. From 64045dd63e8015cf67334f8bc977ad22670ed710 Mon Sep 17 00:00:00 2001 From: Sam Crawford Date: Tue, 30 Jul 2019 12:33:31 -0400 Subject: [PATCH 20/20] Improved IM2 derivation --- code/drasil-example/Drasil/NoPCM/IMods.hs | 2 +- code/drasil-example/Drasil/SWHS/IMods.hs | 132 ++++++++++------------ code/drasil-utils/Utils/Drasil/Misc.hs | 2 +- code/stable/swhs/SRS/SWHS_SRS.tex | 4 +- code/stable/swhs/Website/SWHS_SRS.html | 4 +- 5 files changed, 67 insertions(+), 77 deletions(-) diff --git a/code/drasil-example/Drasil/NoPCM/IMods.hs b/code/drasil-example/Drasil/NoPCM/IMods.hs index 84b4c90559..2e024f1323 100644 --- a/code/drasil-example/Drasil/NoPCM/IMods.hs +++ b/code/drasil-example/Drasil/NoPCM/IMods.hs @@ -69,7 +69,7 @@ eBalanceOnWtrDerivSentences = [eBalanceOnWtrDerivDesc1 EmptyS (S "over area" +:+ eBalanceOnWtrDerivDesc2 [ddHtFluxC], eBalanceOnWtrDerivDesc3, eBalanceOnWtrDerivDesc4] eBalanceOnWtrDerivDesc4 :: Sentence -eBalanceOnWtrDerivDesc4 = foldlSentCol [substitute [balanceDecayRate]] +eBalanceOnWtrDerivDesc4 = substitute [balanceDecayRate] eBalanceOnWtrDerivEqn1, eBalanceOnWtrDerivEqn2, eBalanceOnWtrDerivEqn3, eBalanceOnWtrDerivEqn4 :: Expr diff --git a/code/drasil-example/Drasil/SWHS/IMods.hs b/code/drasil-example/Drasil/SWHS/IMods.hs index f7c71e64b7..249257e355 100644 --- a/code/drasil-example/Drasil/SWHS/IMods.hs +++ b/code/drasil-example/Drasil/SWHS/IMods.hs @@ -9,7 +9,7 @@ import Control.Lens((^.)) import Data.Drasil.Concepts.Documentation (assumption, condition, constraint, goal, input_, solution, output_) -import Data.Drasil.Concepts.Math (area, change, equation, ode, rOfChng, surface) +import Data.Drasil.Concepts.Math (change, equation, ode, rOfChng, surArea) import Data.Drasil.Concepts.PhysicalProperties (liquid, mass, solid, vol) import Data.Drasil.Concepts.Thermodynamics (boilPt, boiling, heat, heatCapSpec, heatTrans, htFlux, latentHeat, melting, phaseChange, sensHeat, temp) @@ -131,7 +131,7 @@ eBalanceOnWtrDerivDesc5 :: Sentence eBalanceOnWtrDerivDesc5 = S "Rearraging this" +:+ phrase equation +: S "gives us" eBalanceOnWtrDerivDesc6 :: Sentence -eBalanceOnWtrDerivDesc6 = foldlSentCol [substitute [balanceDecayRate, balanceDecayTime]] +eBalanceOnWtrDerivDesc6 = substitute [balanceDecayRate, balanceDecayTime] eBalanceOnWtrDerivDesc7 :: Expr -> Sentence eBalanceOnWtrDerivDesc7 eq22 = foldlSentCol [S "Finally, factoring out", E eq22 `sC` @@ -179,8 +179,8 @@ eBalanceOnWtrDerivEqn7 = deriv (sy tempW) time $= eBalanceOnWtrDerivEqnsIM1 :: [Expr] eBalanceOnWtrDerivEqnsIM1 = [eBalanceOnWtrDerivEqn1, eBalanceOnWtrDerivEqn2, - eBalanceOnWtrDerivEqn3, eBalanceOnWtrDerivEqn4, eBalanceOnWtrDerivEqn5, eBalanceOnWtrDerivEqn6, - eBalanceOnWtrDerivEqn7] + eBalanceOnWtrDerivEqn3, eBalanceOnWtrDerivEqn4, eBalanceOnWtrDerivEqn5, + eBalanceOnWtrDerivEqn6, eBalanceOnWtrDerivEqn7] --------- -- IM2 -- @@ -228,80 +228,70 @@ eBalanceOnPCMDeriv :: Derivation eBalanceOnPCMDeriv = mkDerivName (S "the" +:+ phrase energy +:+ S "balance on the PCM during sensible heating phase") (weave [eBalanceOnPCMDerivSentences, map E eBalanceOnPCMDerivEqnsIM2] - ++ eBalanceOnPCMDerivDesc5 htCapSP htCapLP tauSP tauLP surface area melting vol assumpVCMPN - ++ eBalanceOnPCMDerivDesc6 tempPCM - ++ eBalanceOnPCMDerivDesc7 boiling solid liquid assumpNGSP) + ++ [eBalanceOnPCMDerivDesc5, eBalanceOnPCMDerivDesc6, eBalanceOnPCMDerivDesc7]) eBalanceOnPCMDerivSentences :: [Sentence] -eBalanceOnPCMDerivSentences = map foldlSentCol [ - eBalanceOnPCMDerivDesc1 rOfChng tempPCM energy water vol pcmVol pcmMass heatCapSpec - htCapSP htFlux htFluxP phaseChange pcmSA heat assumpNIHGBWP volHtGen, - eBalanceOnPCMDerivDesc2 ddHtFluxP htFluxP, +eBalanceOnPCMDerivSentences = [eBalanceOnPCMDerivDesc1, eBalanceOnPCMDerivDesc2, eBalanceOnPCMDerivDesc3, eBalanceOnPCMDerivDesc4] -eBalanceOnPCMDerivDesc1 :: ConceptChunk -> ConstrConcept -> UnitalChunk -> ConceptChunk -> - ConceptChunk-> UncertQ -> UnitalChunk -> ConceptChunk -> UncertQ -> - ConceptChunk -> UnitalChunk -> ConceptChunk -> UncertQ -> ConceptChunk -> - ConceptInstance -> UnitalChunk -> [Sentence] -eBalanceOnPCMDerivDesc1 roc tempP en wt vo pcmvo pm hcs hsp hf hfp pc ps ht ass16 vhg= - [S "To find the", phrase roc `sOf` ch tempP `sC` S "we look at the", - phrase en, S "balance on the" +:+. S "PCM", S "The", phrase vo, S "being considered" - `isThe` (phrase vo `sOf` S "PCM,") +:+. ch pcmvo, S "The derivation that follows is" +:+. - S "initially for the solid PCM", S "The mass of phase change material is", ch pm `andThe` - phrase hcs `sOf` S "PCM as a solid is" +:+. ch hsp, S "The", phrase hf, - S "into the PCM from", phrase wt `sIs` ch hfp, sParen (makeRef2S ddHtFluxP), - S "over", phrase pc, S "material surface area" +:+. ch ps, - S "The thermal flux" `sIs` S "constant over", ch pcmSA `sC` S "since", - phrase temp `ofThe` getAcc phsChgMtrl `isThe` S "same throughout its", phrase vol, - sParen (makeRef2S assumpTPCAV) `andThe` phrase water `sIs` S "fully mixed" +:+. - sParen (makeRef2S assumpCWTAT), S "There is no", phrase hf, phrase output_, - S "from the" +:+. getAcc phsChgMtrl, S "Assuming no volumetric", phrase ht, - S "generation per unit", phrase vo, sParen (makeRef2S ass16) `sC` (E $ sy vhg $= 0) `sC` - S "the equation for", makeRef2S rocTempSimp, S "can be written as"] - -eBalanceOnPCMDerivDesc2 :: DataDefinition -> UnitalChunk -> [Sentence] -eBalanceOnPCMDerivDesc2 dd hfp = [S "Using", makeRef2S dd, S "for", ch hfp `sC` - S "this", phrase equation, S "can be written as"] - -eBalanceOnPCMDerivDesc3 :: [Sentence] -eBalanceOnPCMDerivDesc3 = [S "Dividing by"] ++ eq6 ++ [S "we obtain"] - -eBalanceOnPCMDerivDesc4 :: [Sentence] -eBalanceOnPCMDerivDesc4 = [substitute [balanceSolidPCM]] - -eBalanceOnPCMDerivDesc5 :: UncertQ -> UncertQ -> UnitalChunk -> UnitalChunk -> ConceptChunk -> ConceptChunk-> ConceptChunk - -> ConceptChunk -> ConceptInstance -> [Sentence] -eBalanceOnPCMDerivDesc5 hsp hlp tsp tlp sur ar melt vo ass17 = - [eqN 4 +:+ S "applies for the solid PCM. In the case where all of the PCM is melted, the same" +:+ - S "derivation applies, except that" +:+ ch hsp +:+ S "is replaced by" +:+ ch hlp `sC` - S "and thus" +:+ ch tsp +:+ S "is replaced by" +:+. ch tlp +:+ S "Although a small change in" +:+ - phrase sur +:+ phrase ar +:+ S "would be expected with" +:+ phrase melt `sC` S "this is not included" `sC` - S "since the" +:+ phrase vo +:+ S "change of the PCM with" +:+ phrase melting +:+ S "is assumed to be negligible" +:+. - sParen (makeRef2S ass17)] - -eBalanceOnPCMDerivDesc6 :: NamedIdea a => a -> [Sentence] -eBalanceOnPCMDerivDesc6 tp = - [S "In the case where" +:+ E eq6_1 +:+ S "and not all of the PCM is melted" `sC` - S "the" +:+ phrase tp +:+. S "does not change" +:+ S "Therefore" `sC` - S "in this case" +:+ foldlSent eq6_2] - -eBalanceOnPCMDerivDesc7 :: ConceptChunk -> ConceptChunk -> ConceptChunk -> ConceptInstance -> [Sentence] -eBalanceOnPCMDerivDesc7 boil sld lqd assp18 = - [S "This derivation does not consider the" +:+ - phrase boil +:+ S "of the PCM" `sC` S "as the PCM is assumed to either be in a" +:+ phrase sld +:+ S "state or a" +:+ - phrase lqd +:+ S "state" +:+. sParen (makeRef2S assp18)] ---(E $ ((deriv (sy temp_PCm) time) $= 0) -eq6:: [Sentence] -eq6 = [ch pcmMass, ch htCapSP] +eBalanceOnPCMDerivDesc1 :: Sentence +eBalanceOnPCMDerivDesc1 = foldlSentCol [ + S "To find the", phrase rOfChng `sOf` ch tempPCM `sC` S "we look at the", + phrase energy, S "balance on the" +:+. getAcc phsChgMtrl, S "The", phrase vol, + S "being considered" `isThe` phrase pcmVol +:+. sParen (ch pcmVol), + S "The derivation that follows is initially for the solid" +:+. getAcc phsChgMtrl, + S "The" +:+. (phrase pcmMass `sIs` ch pcmMass `andThe` phrase htCapSP `sIs` ch htCapSP), + S "The", phrase htFluxP `sIs` ch htFluxP, sParen (makeRef2S ddHtFluxP), + S "over", phrase pcmSA +:+. ch pcmSA, S "The thermal flux is constant over", + ch pcmSA `sC` S "since", phrase temp `ofThe` getAcc phsChgMtrl `isThe` + S "same throughout its", phrase vol, sParen (makeRef2S assumpTPCAV) `andThe` + phrase water `sIs` S "fully mixed" +:+. sParen (makeRef2S assumpCWTAT), + S "There is no", phrase htFlux, phrase output_, S "from the" +:+. getAcc phsChgMtrl, + S "Assuming no volumetric", phrase heat, S "generation per unit", phrase vol, + sParen (makeRef2S assumpNIHGBWP) `sC` (E $ sy volHtGen $= 0) `sC` + S "the equation for", makeRef2S rocTempSimp, S "can be written as"] + +eBalanceOnPCMDerivDesc2 :: Sentence +eBalanceOnPCMDerivDesc2 = foldlSentCol [S "Using", makeRef2S ddHtFluxP, S "for", + ch htFluxP `sC` S "this", phrase equation, S "can be written as"] + +eBalanceOnPCMDerivDesc3 :: Sentence +eBalanceOnPCMDerivDesc3 = foldlSentCol [S "Dividing by", ch pcmMass, ch htCapSP, S "we obtain"] + +eBalanceOnPCMDerivDesc4 :: Sentence +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", + getAcc phsChgMtrl `sIs` 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 (makeRef2S assumpVCMPN)] + where isReplacedBy a b = ch a `sIs` S "replaced by" +:+ ch b + +eBalanceOnPCMDerivDesc6 :: Sentence +eBalanceOnPCMDerivDesc6 = foldlSent [ + S "In the case where", E eq6_1 `sAnd` S "not all of the", getAcc phsChgMtrl `sIs` + 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 `ofThe` getAcc phsChgMtrl `sC` + S "as the PCM is assumed to either be in a", phrase solid, S "state or a", + phrase liquid, S "state", sParen (makeRef2S assumpNGSP)] eq6_1 :: Expr eq6_1 = sy tempPCM $= sy tempMeltP -eq6_2 :: [Sentence] -eq6_2 = [S "d" +:+ ch tempPCM +:+ S "/ d" +:+ ch time +:+ S "= 0"] - - -eBalanceOnPCMEqn1, eBalanceOnPCMEqn2, eBalanceOnPCMEqn3, - eBalanceOnPCMEqn4 :: Expr +eq6_2 :: Sentence +eq6_2 = foldlSent_ [S "d", ch tempPCM, S "/ d", ch time, S "= 0"] +{- +eq6_2 :: Expr +eq6_2 = (deriv (sy tempPCM) time) $= 0 +-} + +eBalanceOnPCMEqn1, eBalanceOnPCMEqn2, eBalanceOnPCMEqn3, eBalanceOnPCMEqn4 :: Expr eBalanceOnPCMEqn1 = sy pcmMass * sy htCapSP * deriv (sy tempPCM) time $= sy htFluxP * sy pcmSA diff --git a/code/drasil-utils/Utils/Drasil/Misc.hs b/code/drasil-utils/Utils/Drasil/Misc.hs index 71c31d48c6..cdfbfb610d 100644 --- a/code/drasil-utils/Utils/Drasil/Misc.hs +++ b/code/drasil-utils/Utils/Drasil/Misc.hs @@ -48,7 +48,7 @@ fromReplace src c = S "From" +:+ makeRef2S src +:+ S "we can replace" +: ch c -- | takes a referable and a HasSymbol and outputs as a Sentence "By substituting " substitute :: (Referable r, HasShortName r, HasSymbol r) => [r] -> Sentence -substitute s = S "By substituting" +:+ foldlList Comma List l `sC` S "this can be written as" +substitute s = S "By substituting" +: (foldlList Comma List l `sC` S "this can be written as") where l = map (\x -> ch x +:+ sParen (S "from" +:+ makeRef2S x)) s -- | zip helper function enumerates abbreviation and zips it with list of itemtype diff --git a/code/stable/swhs/SRS/SWHS_SRS.tex b/code/stable/swhs/SRS/SWHS_SRS.tex index 14fcfb232b..fd6a004bd8 100644 --- a/code/stable/swhs/SRS/SWHS_SRS.tex +++ b/code/stable/swhs/SRS/SWHS_SRS.tex @@ -1135,7 +1135,7 @@ \subsubsection{Instance Models} \end{minipage} \paragraph{Detailed derivation of the energy balance on the PCM during sensible heating phase:} \label{IM:eBalanceOnPCMDeriv} -To find the rate of change of ${T_{P}}$, we look at the energy balance on the PCM. The volume being considered is the volume of PCM, ${V_{P}}$. The derivation that follows is initially for the solid PCM. The mass of phase change material is ${m_{P}}$ and the specific heat capacity of PCM as a solid is ${{C_{P}}^{S}}$. The heat flux into the PCM from water is ${q_{P}}$ (\hyperref[DD:htFluxP]{DD: htFluxP}) over phase change material surface area ${A_{P}}$. The thermal flux is constant over ${A_{P}}$, since the temperature of the PCM is the same throughout its volume (\hyperref[assumpTPCAV]{A: Temp-PCM-Constant-Across-Volume}) and the water is fully mixed (\hyperref[assumpCWTAT]{A: Constant-Water-Temp-Across-Tank}). There is no heat flux output from the PCM. Assuming no volumetric heat generation per unit volume (\hyperref[assumpNIHGBWP]{A: No-Internal-Heat-Generation-By-Water-PCM}), $g=0$, the equation for \hyperref[GD:rocTempSimp]{GD: rocTempSimp} can be written as: +To find the rate of change of ${T_{P}}$, we look at the energy balance on the PCM. The volume being considered is the volume of PCM (${V_{P}}$). The derivation that follows is initially for the solid PCM. The mass of phase change material is ${m_{P}}$ and the specific heat capacity of PCM as a solid is ${{C_{P}}^{S}}$. The heat flux into the PCM from water is ${q_{P}}$ (\hyperref[DD:htFluxP]{DD: htFluxP}) over phase change material surface area ${A_{P}}$. The thermal flux is constant over ${A_{P}}$, since the temperature of the PCM is the same throughout its volume (\hyperref[assumpTPCAV]{A: Temp-PCM-Constant-Across-Volume}) and the water is fully mixed (\hyperref[assumpCWTAT]{A: Constant-Water-Temp-Across-Tank}). There is no heat flux output from the PCM. Assuming no volumetric heat generation per unit volume (\hyperref[assumpNIHGBWP]{A: No-Internal-Heat-Generation-By-Water-PCM}), $g=0$, the equation for \hyperref[GD:rocTempSimp]{GD: rocTempSimp} can be written as: \begin{displaymath} {m_{P}} {{C_{P}}^{S}} \frac{\,d{T_{P}}}{\,dt}={q_{P}} {A_{P}} @@ -1157,7 +1157,7 @@ \subsubsection{Instance Models} \end{displaymath} Equation (4) applies for the solid PCM. In the case where all of the PCM is melted, the same derivation applies, except that ${{C_{P}}^{S}}$ is replaced by ${{C_{P}}^{L}}$, and thus ${{τ_{P}}^{S}}$ is replaced by ${{τ_{P}}^{L}}$. Although a small change in surface area would be expected with melting, this is not included, since the volume change of the PCM with melting is assumed to be negligible (\hyperref[assumpVCMPN]{A: Volume-Change-Melting-PCM-Negligible}). -In the case where ${T_{P}}={{T_{melt}}^{P}}$ and not all of the PCM is melted, the temperature of the phase change material does not change. Therefore, in this case d ${T_{P}}$ / d $t$ = 0. +In the case where ${T_{P}}={{T_{melt}}^{P}}$ and not all of the PCM is melted, the temperature of the phase change material does not change. Therefore, d ${T_{P}}$ / d $t$ = 0. This derivation does not consider the boiling of the PCM, as the PCM is assumed to either be in a solid state or a liquid state (\hyperref[assumpNGSP]{A: No-Gaseous-State-PCM}). diff --git a/code/stable/swhs/Website/SWHS_SRS.html b/code/stable/swhs/Website/SWHS_SRS.html index a77fd8877c..11a442e03b 100644 --- a/code/stable/swhs/Website/SWHS_SRS.html +++ b/code/stable/swhs/Website/SWHS_SRS.html @@ -2312,7 +2312,7 @@

Detailed derivation of the energy balance on the PCM during sensible heating phase:

- To find the rate of change of TP, we look at the energy balance on the PCM. The volume being considered is the volume of PCM, VP. The derivation that follows is initially for the solid PCM. The mass of phase change material is mP and the specific heat capacity of PCM as a solid is CPS. The heat flux into the PCM from water is qP (DD: htFluxP) over phase change material surface area AP. The thermal flux is constant over AP, since the temperature of the PCM is the same throughout its volume (A: Temp-PCM-Constant-Across-Volume) and the water is fully mixed (A: Constant-Water-Temp-Across-Tank). There is no heat flux output from the PCM. Assuming no volumetric heat generation per unit volume (A: No-Internal-Heat-Generation-By-Water-PCM), g = 0, the equation for GD: rocTempSimp can be written as: + To find the rate of change of TP, we look at the energy balance on the PCM. The volume being considered is the volume of PCM (VP). The derivation that follows is initially for the solid PCM. The mass of phase change material is mP and the specific heat capacity of PCM as a solid is CPS. The heat flux into the PCM from water is qP (DD: htFluxP) over phase change material surface area AP. The thermal flux is constant over AP, since the temperature of the PCM is the same throughout its volume (A: Temp-PCM-Constant-Across-Volume) and the water is fully mixed (A: Constant-Water-Temp-Across-Tank). There is no heat flux output from the PCM. Assuming no volumetric heat generation per unit volume (A: No-Internal-Heat-Generation-By-Water-PCM), g = 0, the equation for GD: rocTempSimp can be written as:

mP CPS
@@ -2367,7 +2367,7 @@

Equation (4) applies for the solid PCM. In the case where all of the PCM is melted, the same derivation applies, except that CPS is replaced by CPL, and thus τPS is replaced by τPL. Although a small change in surface area would be expected with melting, this is not included, since the volume change of the PCM with melting is assumed to be negligible (A: Volume-Change-Melting-PCM-Negligible).

- In the case where TP = TmeltP and not all of the PCM is melted, the temperature of the phase change material does not change. Therefore, in this case d TP / d t = 0. + In the case where TP = TmeltP and not all of the PCM is melted, the temperature of the phase change material does not change. Therefore, d TP / d t = 0.

This derivation does not consider the boiling of the PCM, as the PCM is assumed to either be in a solid state or a liquid state (A: No-Gaseous-State-PCM).