Skip to content

Commit

Permalink
[Incomplete] Use ConceptInstance in NoPCM for functional requirements.
Browse files Browse the repository at this point in the history
This commit is incomplete and will be amended.

This commit translates the functional requirements in NoPCM to ones using ConceptInstance. The previous version of the requirements are still present for use with SWHS but should be removed once the dependency is no longer present. Two slight modifications have been performed to the requirements.
1. The table for requirement one has been moved to after the table and wording in requirement one has been tweaked to reflect that.

A combination of limitations has led to this being needed at the moment. Paragraph is not referable so using paragraphs instead of an enum at the moment would mean the traceability matrix would not be able to reference individual requirements. LabelledContent has not been stabilized yet, so it is not an option. And Enums only allow Sentences for their body.

2. The equation for requirement two has been inlined into the Sentence.

In addition to the above rational for the table, equations can be displayed by EqnBlock, however, EqnBlock does not contain a visual caption for the equation, and the RefAdd which can be passed in to the EqnBlock constructor is silently dropped in LayoutObj.

View #562 for a visual comparison of the old and new requirements.

TODO:
- Add prefix to shortname based on the immediate parent node (ie. “FR:<Some Req>” instead of “<Some Req>”
- Undo table being external?
- Undo inline equation (Req 2 with fixme)
- Update stable

[ci: skip]
  • Loading branch information
Mornix committed Jul 27, 2018
1 parent 4e8c5f4 commit 62939f7
Showing 1 changed file with 45 additions and 22 deletions.
67 changes: 45 additions & 22 deletions code/drasil-example/Drasil/NoPCM/Body.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ import Drasil.DocLang (DocDesc, Fields, Field(..), Verbosity(Verbose),
RefSec(RefProg), RefTab(TAandA, TUnits),
TSIntro(SymbOrder, SymbConvention, TSPurpose), dataConstraintUncertainty,
inDataConstTbl, intro, mkDoc, mkLklyChnk, mkRequirement, mkUnLklyChnk,
outDataConstTbl, physSystDesc, reqF, termDefnF, traceGIntro, traceMGF,
tsymb, valsOfAuxConstantsF)
outDataConstTbl, physSystDesc, reqF, funcReqDom, termDefnF, traceGIntro, traceMGF,
tsymb, valsOfAuxConstantsF, mkEnumCC)

import Data.Drasil.SentenceStructures (showingCxnBw, foldlSent_, sAnd,
foldlList, isThe, sOf, ofThe, foldlSPCol, foldlSent, foldlSP, acroIM,
Expand Down Expand Up @@ -180,7 +180,7 @@ nopcm_si = SI {
}

nopcmRefDB :: ReferenceDB
nopcmRefDB = rdb [] [] assumps_Nopcm_list_new [] [] referencesRefList []-- FIXME: Convert the rest to new chunk types
nopcmRefDB = rdb [] [] assumps_Nopcm_list_new [] [] referencesRefList newReqs-- FIXME: Convert the rest to new chunk types

nopcm_code :: CodeSpec
nopcm_code = codeSpec nopcm_si [inputMod]
Expand Down Expand Up @@ -625,21 +625,10 @@ reqS = reqF [funcReqs, nonFuncReqs]

funcReqs = SRS.funcReq funcReqsList [] --TODO: Placeholder values until content can be added

funcReqsList :: [Contents]
funcReqsList = weave [funcReqsListWordsNum, funcReqsListItems]

funcReqsListItems :: [Contents]
funcReqsListItems = [

Table [titleize symbol_, titleize M.unit_, titleize description]
(mkTable [ch,
unitToSentence,
phrase] inputVar)
(titleize input_ +:+ titleize variable +:+ titleize requirement) False "fr1list",
-- FIXME: Remove requirements generated from mkRequirements once SWHS does not depend on them

eqUnR ((sy w_mass) $= (sy w_vol) * (sy w_density) $=
(((sy diam) / 2) * (sy tank_length) * (sy w_density)))
]
funcReqsList :: [Contents]
funcReqsList = funcReqsListWordsNum

-- s5_1_list_words = map (\x -> Enumeration $ Simple [x])
-- $ mkEnumAbbrevList 1 (short requirement) $ map foldlSent_ [
Expand Down Expand Up @@ -670,9 +659,6 @@ funcReqsListItems = [
-- phrase simulation, phrase time +:+. sParen (S "from" +:+ acroIM 3)]
-- ]

funcReqsListWordsNum :: [Contents]
funcReqsListWordsNum = [req1, req2, req3, req4, req5, req6]

req1, req2, req3, req4, req5, req6 :: Contents

--Empty list is supposed to take a ModuleChunk. Not sure what to put there.
Expand Down Expand Up @@ -704,6 +690,44 @@ req6 = mkRequirement "req6" (
+:+ sParen (ch w_E :+: sParen (ch time)) +:+ S "over the" +:+
phrase sim_time +:+. sParen (S "from" +:+ acroIM 3) ) "Calculate-Change-Heat_Energy-Water-Time"

nr1, nr2, nr3, nr4, nr5, nr6 :: ConceptInstance
nr1 = cic "nr1" (titleize input_ +:+ S "the" +:+ plural quantity +:+ S "described in" +:+ (makeRef nrTable) `sC`
S "which define the" +:+ plural tank_para `sC` S "material" +:+
plural property +:+ S "and initial" +:+. plural condition) "Input-Inital-Values" funcReqDom
nr2 = cic "nr2" (S "Use the" +:+ plural input_ +:+ S "in" +:+
(makeRef nr1) +:+ S "to find the" +:+ phrase mass +:+
S "needed for" +:+ acroIM 1 +:+ S "to" +:+ acroIM 2 `sC`
S "as follows, where" +:+ ch w_vol `isThe` phrase w_vol +:+
S "and" +:+ (ch tank_vol `isThe` phrase tank_vol) :+: S ":" +:+
E ((sy w_mass) $= (sy w_vol) * (sy w_density) $=
(((sy diam) / 2) * (sy tank_length) * (sy w_density)))) "Use-Above-Find-Mass-IM1-IM2" funcReqDom -- FIXME: Equation shouldn't be inline.
nr3 = cic "nr3" (S "Verify that the" +:+ plural input_ +:+ S "satisfy the required"
+:+ phrase physicalConstraint +:+ S "shown in" +:+. makeRef dataConstTable1) "Check-Inputs-Satisfy-Physical-Constraints" funcReqDom
nr4 = cic "nr4" (titleize' output_ `sAnd` plural input_ +:+ plural quantity
+:+ S "and derived" +:+ plural quantity +:+ S "in the following list: the" +:+
plural quantity +:+ S "from" +:+ (makeRef nr1) `sC`
S "the" +:+ phrase mass +:+ S "from" +:+ (makeRef nr2)
`sAnd` ch tau_W +:+. sParen(S "from" +:+ acroIM 1)) "Output-Input-Derivied-Quantities" funcReqDom
nr5 = cic "nr5" (S "Calculate and output the" +:+ phrase temp_W +:+
sParen (ch temp_W :+: sParen (ch time)) +:+ S "over the" +:+
phrase sim_time) "Calculate-Temperature-Water-Over-Time" funcReqDom
nr6 = cic "nr6" (S "Calculate and" +:+ phrase output_ +:+ S "the" +:+ phrase w_E
+:+ sParen (ch w_E :+: sParen (ch time)) +:+ S "over the" +:+
phrase sim_time +:+. sParen (S "from" +:+ acroIM 3)) "Calculate-Change-Heat_Energy-Water-Time" funcReqDom

nrTable :: Contents
nrTable = Table [titleize symbol_, titleize M.unit_, titleize description]
(mkTable [ch,
unitToSentence,
phrase] inputVar)
(titleize input_ +:+ titleize variable +:+ titleize' requirement) True "fr1list"

newReqs :: [ConceptInstance]
newReqs = [nr1, nr2, nr3, nr4, nr5, nr6]

funcReqsListWordsNum :: [Contents]
funcReqsListWordsNum = mkEnumCC (\x -> (getShortName x, Flat $ x ^. defn, Just $ refAdd x)) newReqs ++ [nrTable]

-------------------------------------------
--Section 5.2 : NON-FUNCTIONAL REQUIREMENTS
-------------------------------------------
Expand Down Expand Up @@ -811,8 +835,7 @@ traceInstaModelRef = map (refFromType Theory) [eBalanceOnWtr,
heatEInWtr]

traceFuncReq = ["R1", "R2", "R3", "R4", "R5", "R6"]
traceFuncReqRef = map (\x -> (makeRef (find' x funcReqsListWordsNum)))
funcReqsListWordsNum--makeListRef s7_funcReq s5_1
traceFuncReqRef = map makeRef newReqs

traceData = ["Data Constraints"]
traceDataRef = [makeRef dataConstTable1] --FIXME: Reference section?
Expand Down

0 comments on commit 62939f7

Please sign in to comment.