Skip to content

Commit

Permalink
Updated IM2 Notes; closes #1069
Browse files Browse the repository at this point in the history
  • Loading branch information
samm82 committed Jun 7, 2019
1 parent 17a4467 commit 99d3f58
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 59 deletions.
59 changes: 22 additions & 37 deletions code/drasil-example/Drasil/SWHS/IMods.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 --
Expand Down
12 changes: 8 additions & 4 deletions code/stable/swhs/SRS/SWHS_SRS.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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}}$, $0<t<{t_{final}}$, with initial conditions, ${T_{W}}={T_{P}}={T_{init}}$, FIXME t\_w(0) = t\_p(0), \hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM}, and ${T_{W}}$ from \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}, such that the following governing ODE. is satisfied The temperature remains constant at ${{T_{melt}}^{P}}$, 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 \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}}=\frac{{m_{P}} {{C_{P}}^{S}}}{{h_{P}} {A_{P}}}$ is a constant (s) (\hyperref[DD:balanceSolidPCM]{DD: balanceSolidPCM}). ${{τ_{P}}^{L}}=\frac{{m_{P}} {{C_{P}}^{L}}}{{h_{P}} {A_{P}}}$ is a constant (s) (\hyperref[DD:balanceLiquidPCM]{DD: balanceLiquidPCM}).
Notes & ${T_{W}}$ is defined by \hyperref[IM:eBalanceOnWtr]{IM: eBalanceOnWtr}.
The input constraint ${T_{init}}\leq{}{{T_{melt}}^{P}}$ comes from \hyperref[assumpPIS]{A: PCM-Initially-Solid}.
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}.
\\ \midrule \\
Source & \cite{koothoor2013}
\\ \midrule \\
Expand Down Expand Up @@ -1198,7 +1202,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 & X & & & & & & & & & & & & & & &
\hyperref[assumpSITWP]{A: Same-Initial-Temp-Water-PCM} & & & & X & & & & & & & & & & & & X & X & & & & & & & & & & & & & & &
\\
\hyperref[assumpTEO]{A: Thermal-Energy-Only} & & & & & & & & & & & & & & & & & & X & & & & & & & & & & & & & &
\\
Expand Down
Loading

0 comments on commit 99d3f58

Please sign in to comment.