<commit_before>module Drasil.GlassBR.IMods (iModels, probOfBr, calOfCap, calOfDe, probOfBreak, calofCapacity, calofDemand) where

import Language.Drasil

import Data.Drasil.SentenceStructures (acroA, foldlSent, isThe, sAnd, sOr)
import Data.Drasil.Utils (getES)
import Data.Drasil.Concepts.Math (parameter)
import Data.Drasil.Concepts.Documentation (coordinate)

import Prelude hiding (exp)
import Control.Lens ((^.))

import Drasil.GlassBR.Unitals (tNT, sdWithEqn, demand, standOffDist, 
  char_weight, eqTNTWeight, demandq, sdVectorSent, wtntWithEqn, loadSF,
  lRe, risk_fun, prob_br)
import Drasil.GlassBR.DataDefs (nonFL, risk, glaTyFac)
import Drasil.GlassBR.Concepts (lResistance, glassTypeFac, lShareFac)
import Drasil.DocumentLanguage.Chunk.InstanceModel
{--}

iModels :: [RelationConcept]
iModels = [probOfBr, calOfCap, calOfDe]

{--}

probOfBreak :: InstanceModel
probOfBreak = im probOfBr [qw risk] [TCon AssumedCon $ C risk $> 0] [qw prob_br] [TCon AssumedCon $ C prob_br $> 0] []

{--}

probOfBr :: RelationConcept
probOfBr = makeRC "probOfBr" (nounPhraseSP "Probability of Glass Breakage")
  pbdescr $ (C prob_br) $= 1 - (exp (Neg (C risk)))

pbdescr :: Sentence
pbdescr =
  foldlSent [(getES prob_br) `isThe` (S "calculated" +:+. (phrase prob_br)),
  (getES risk_fun) `isThe` (phrase risk)]

{--}

calofCapacity :: InstanceModel
calofCapacity = im calOfCap [qw nonFL, qw glaTyFac, qw loadSF] [TCon AssumedCon $ C nonFL $> 0, TCon AssumedCon $ C glaTyFac $> 0, TCon AssumedCon $ C loadSF $> 0] [qw lRe] [] [] 


{--}
calOfCap :: RelationConcept
calOfCap = makeRC "calOfCap" (nounPhraseSP "Calculation of Capacity(LR)") 
  capdescr $ (C lRe) $= ((C nonFL) * (C glaTyFac) * (C loadSF))

capdescr :: Sentence
capdescr =
  foldlSent [(getES lRe) `isThe` (phrase lResistance) `sC`
  S "which" +:+. S "is also called capacity" +:+. ((getES nonFL) `isThe`
  (phrase nonFL)) +:+. ((getES glaTyFac) `isThe` (phrase glassTypeFac))
  +:+. ((getES loadSF) `isThe` (phrase lShareFac)), S "Follows",
  (acroA 2) `sAnd` (acroA 1), sParen (Quote 
  (S "In the development of this procedure, it was assumed that" +:+
  S "all four edges of the glass are simply supported and free to slip" +:+
  S "in the plane of the glass. This boundary condition has been shown" +:+
  S "to be typical of many glass installations")) +:+ S "from [4 (pg. 53)]"
  {-astm_LR2009-}]

{--}

calofDemand :: InstanceModel
calofDemand = im calOfDe [qw demand, qw eqTNTWeight, qw standOffDist] [TCon AssumedCon $ C demand $> 0, TCon AssumedCon $ C eqTNTWeight $> 0, TCon AssumedCon $ C standOffDist $> 0] [qw demand] [] [] 



calOfDe :: RelationConcept
calOfDe = makeRC "calOfDe" (nounPhraseSP "Calculation of Demand(q)") 
  dedescr $ (C demand) $= FCall (C demand) [C eqTNTWeight, C standOffDist] 
  --dedescr $ (C demand) $= FCall (asExpr interpY) [V "TSD.txt", C standOffDist, C eqTNTWeight] 
  
dedescr :: Sentence
dedescr = 
  foldlSent [(getES demand `sOr` phrase demandq) `sC`<commit_msg>Modified IMods.hs of GlassBR using new instance model chunk<commit_after>module Drasil.GlassBR.IMods (iModels, probOfBr, calOfCap, calOfDe, probOfBreak, calofCapacity, calofDemand) where

import Language.Drasil

import Data.Drasil.SentenceStructures (acroA, foldlSent, isThe, sAnd, sOr)
import Data.Drasil.Utils (getES)
import Data.Drasil.Concepts.Math (parameter)
import Data.Drasil.Concepts.Documentation (coordinate)

import Prelude hiding (exp)
import Control.Lens ((^.))

import Drasil.GlassBR.Unitals (tNT, sdWithEqn, demand, standOffDist, 
  char_weight, eqTNTWeight, demandq, sdVectorSent, wtntWithEqn, loadSF,
  lRe, risk_fun, prob_br)
import Drasil.GlassBR.DataDefs (nonFL, risk, glaTyFac)
import Drasil.GlassBR.Concepts (lResistance, glassTypeFac, lShareFac)
import Drasil.DocumentLanguage.Chunk.InstanceModel
{--}

iModels :: [RelationConcept]
iModels = [probOfBr, calOfCap, calOfDe]

{--}

probOfBreak :: InstanceModel
probOfBreak = im probOfBr [qw risk] [TCon AssumedCon $ C risk $> 0] [qw prob_br] [TCon AssumedCon $ C prob_br $> 0] []

{--}

probOfBr :: RelationConcept
probOfBr = makeRC "probOfBr" (nounPhraseSP "Probability of Glass Breakage")
  pbdescr $ (C prob_br) $= 1 - (exp (Neg (C risk)))

pbdescr :: Sentence
pbdescr =
  foldlSent [(getES prob_br) `isThe` (S "calculated" +:+. (phrase prob_br)),
  (getES risk_fun) `isThe` (phrase risk)]

{--}

calofCapacity :: InstanceModel
calofCapacity = im calOfCap [qw nonFL, qw glaTyFac, qw loadSF] [TCon AssumedCon $ C nonFL $> 0,
  TCon AssumedCon $ C glaTyFac $> 0, TCon AssumedCon $ C loadSF $> 0] [qw lRe] [] [] 

{--}

calOfCap :: RelationConcept
calOfCap = makeRC "calOfCap" (nounPhraseSP "Calculation of Capacity(LR)") 
  capdescr $ (C lRe) $= ((C nonFL) * (C glaTyFac) * (C loadSF))

capdescr :: Sentence
capdescr =
  foldlSent [(getES lRe) `isThe` (phrase lResistance) `sC`
  S "which" +:+. S "is also called capacity" +:+. ((getES nonFL) `isThe`
  (phrase nonFL)) +:+. ((getES glaTyFac) `isThe` (phrase glassTypeFac))
  +:+. ((getES loadSF) `isThe` (phrase lShareFac)), S "Follows",
  (acroA 2) `sAnd` (acroA 1), sParen (Quote 
  (S "In the development of this procedure, it was assumed that" +:+
  S "all four edges of the glass are simply supported and free to slip" +:+
  S "in the plane of the glass. This boundary condition has been shown" +:+
  S "to be typical of many glass installations")) +:+ S "from [4 (pg. 53)]"
  {-astm_LR2009-}]

{--}

calofDemand :: InstanceModel
calofDemand = im calOfDe [qw demand, qw eqTNTWeight, qw standOffDist] [TCon AssumedCon $ C demand $> 0,
  TCon AssumedCon $ C eqTNTWeight $> 0, TCon AssumedCon $ C standOffDist $> 0] [qw demand] [] [] 

{--}

calOfDe :: RelationConcept
calOfDe = makeRC "calOfDe" (nounPhraseSP "Calculation of Demand(q)") 
  dedescr $ (C demand) $= FCall (C demand) [C eqTNTWeight, C standOffDist] 
  --dedescr $ (C demand) $= FCall (asExpr interpY) [V "TSD.txt", C standOffDist, C eqTNTWeight] 
  
dedescr :: Sentence
dedescr = 
  foldlSent [(getES demand `sOr` phrase demandq) `sC`
{'fraction_non_alphanumeric': 0.1360146862483311, 'fraction_numerical': 0.006008010680907877, 'mean_word_length': 4.740421455938697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3814103', 'n_tokens_mistral': 2423, 'n_tokens_neox': 2322, 'n_words': 663}