<commit_before>module Drasil.SSP.GenDefs where

import Prelude hiding (tan)

import Language.Drasil
import Drasil.SSP.Units
import Data.Drasil.Concepts.Documentation
import Drasil.SSP.Defs
import Data.Drasil.Concepts.PhysicalProperties
import Data.Drasil.Concepts.Physics
import Data.Drasil.SentenceStructures
import Data.Drasil.Concepts.SolidMechanics (normForce, shearForce)
import Data.Drasil.Quantities.SolidMechanics
import Data.Drasil.Concepts.Math
import Data.Drasil.Utils
import qualified Drasil.SRS as SRS


---------------------------
--  General Definitions  --
---------------------------

sspGenDefs :: [RelationConcept]
sspGenDefs = [normForcEq, bsShrFEq, resShr, mobShr,
  normShrR, momentEql, netForce, hooksLaw2d, displVect]

fixmeS :: Sentence
fixmeS = S "FIXME: add description"
--
normForcEq :: RelationConcept
normForcEq = makeRC "normForcEq" (nounPhraseSP "normal force equilibrium") nmFEq_desc nmFEq_rel

nmFEq_rel :: Relation
nmFEq_rel = C totNrmForce := (Int 0) --FIXME: add the long equation

nmFEq_desc :: Sentence
nmFEq_desc = S "For a" +:+ phrase slice +:+ S "of" +:+ phrase mass +:+
  S "in the" +:+ phrase slope +:+ S "the" +:+ phrase force +:+
  S "equilibrium to satisfy" +:+ acroT "2" +:+ S "in the direction" +:+
  phrase perp +:+ S "to" +:+. (S "base" +:+ phrase surface `ofThe`
  phrase slice) +:+ S "Rearranged to solve for" +:+ (phrase normForce `ofThe`
  phrase surface) +:+. getS totNrmForce +:+ at_start force +:+ S "equilibrium is" +:+
  S "derived from the free body diagram of" +:+
  makeRef (SRS.physSyst SRS.missingP []) +:+ S "Index i" +:+
  S "refers to" +:+ (plural value `ofThe` plural property) +:+ S "for" +:+
  phrase slice :+: S "/" :+: plural intrslce +:+ S "following convention in" +:+.
  makeRef (SRS.physSyst SRS.missingP []) +:+ at_start force +:+ phrase variable +:+
  plural definition +:+ S "can be found in" +:+ acroDD "1" +:+ S "to" +:+.
  acroDD "9"

--
bsShrFEq :: RelationConcept
bsShrFEq = makeRC "bsShrFEq" (nounPhraseSP "base shear force equilibrium") bShFEq_desc bShFEq_rel

bShFEq_rel :: Relation
bShFEq_rel = C mobShrI := (Int 0) --FIXME: add the long equation

bShFEq_desc :: Sentence
bShFEq_desc = S "For a" +:+ phrase slice +:+ S "of" +:+ phrase mass +:+
  S "in the" +:+ phrase slope +:+ S "the" +:+ phrase force +:+
  S "equilibrium to satisfy" +:+ acroT "2" +:+ S "in the direction" +:+
  S "parallel to" +:+. (S "base" +:+ phrase surface `ofThe`
  phrase slice) +:+ S "Rearranged to solve for the" +:+ phrase shearForce +:+
  S "on the base" +:+. getS mobShrI +:+ at_start force +:+ S "equilibrium is" +:+
  S "derived from the free body diagram of" +:+
  makeRef (SRS.physSyst SRS.missingP []) +:+ S "Index i" +:+
  S "refers to" +:+ (plural value `ofThe` plural property) +:+ S "for" +:+
  phrase slice :+: S "/" :+: plural intrslce +:+ S "following convention in" +:+.
  makeRef (SRS.physSyst SRS.missingP []) +:+ at_start force +:+ phrase variable +:+
  plural definition +:+ S "can be found in" +:+ acroDD "1" +:+ S "to" +:+.
  acroDD "9"

--
resShr :: RelationConcept
resShr = makeRC "resShr" (nounPhraseSP "resistive shear") resShr_desc resShr_rel

resShr_rel :: Relation
resShr_rel = C shrResI := C nrmFSubWat :* tan (C fricAngle) :+ C cohesion :* C baseWthX :* sec (C baseAngle)

resShr_desc :: Sentence
resShr_desc = S "The Mohr-Coulomb resistive shear strength of a" +:+
  phrase slice +:+ getS shrResI +:+ S "is adjusted to account for the" +:+
  S "effective" +:+ phrase normal +:+
  (E $ (C nrmStrss) := (C nrmFSubWat) := (C totNrmForce) :- (C baseHydroForce)) +:+
  S "of a soil from" +:+. acroT "4" +:+ -- FIXME: add prime to nrmStrss aboves
  S "Also and the cohesion is adjusted to account for the" +:+ phrase len +:+
  S "l of the plane where the" +:+ phrase normal +:+ S "occurs, where" +:+
  (E $ (C baseLngth) := (C baseWthX) :* sec (C baseAngle))`sC` S "and" +:+ getS baseWthX +:+
  S "is the x width of the base. Therefore" +:+ --FIXME: do propering indexes and primes here
  (E $ (C cohesion) := (C cohesion) :* (C baseWthX) :* sec ((C baseAngle)))
  -- FIXME: Still needs to be more automated

--
mobShr :: RelationConcept
mobShr = makeRC "mobShr" (nounPhraseSP "mobile shear") mobShr_desc mobShr_rel

mobShr_rel :: Relation
mobShr_rel = C mobShrI := C shrResI :/ C fs := 
  (C nrmFSubWat :* tan (C fricAngle) :+ C cohesion :* C baseWthX :* sec (C baseAngle)) :/ C fs

mobShr_desc :: Sentence
mobShr_desc = foldlSent [
  S "From", (phrase definition `ofThe` S "Factor of Safety in"), acroT "1" `sC`
  S "and the new" +:+ phrase definition +:+ S "of", getS shrResI `sC` S "a new",
  S "relation for" +:+ (S "net mobile" +:+ phrase shearForce `ofThe` phrase slice),<commit_msg>Hacked in a Factor of Safety to avoid cyclical imports<commit_after>module Drasil.SSP.GenDefs where

import Prelude hiding (tan)

import Control.Lens ((^.))

import Language.Drasil
import Drasil.SSP.Units
import Data.Drasil.Concepts.Documentation
import Drasil.SSP.Defs
import Data.Drasil.Concepts.PhysicalProperties
import Data.Drasil.Concepts.Physics
import Data.Drasil.SentenceStructures
import Data.Drasil.Concepts.SolidMechanics (normForce, shearForce)
import Data.Drasil.Quantities.SolidMechanics
import Data.Drasil.Concepts.Math
import Data.Drasil.Utils
import qualified Drasil.SRS as SRS


---------------------------
--  General Definitions  --
---------------------------

sspGenDefs :: [RelationConcept]
sspGenDefs = [normForcEq, bsShrFEq, resShr, mobShr,
  normShrR, momentEql, netForce, hooksLaw2d, displVect]

fixmeS :: Sentence
fixmeS = S "FIXME: add description"
--
normForcEq :: RelationConcept
normForcEq = makeRC "normForcEq" (nounPhraseSP "normal force equilibrium") nmFEq_desc nmFEq_rel

nmFEq_rel :: Relation
nmFEq_rel = C totNrmForce := (Int 0) --FIXME: add the long equation

nmFEq_desc :: Sentence
nmFEq_desc = S "For a" +:+ phrase slice +:+ S "of" +:+ phrase mass +:+
  S "in the" +:+ phrase slope +:+ S "the" +:+ phrase force +:+
  S "equilibrium to satisfy" +:+ acroT "2" +:+ S "in the direction" +:+
  phrase perp +:+ S "to" +:+. (S "base" +:+ phrase surface `ofThe`
  phrase slice) +:+ S "Rearranged to solve for" +:+ (phrase normForce `ofThe`
  phrase surface) +:+. getS totNrmForce +:+ at_start force +:+ S "equilibrium is" +:+
  S "derived from the free body diagram of" +:+
  makeRef (SRS.physSyst SRS.missingP []) +:+ S "Index i" +:+
  S "refers to" +:+ (plural value `ofThe` plural property) +:+ S "for" +:+
  phrase slice :+: S "/" :+: plural intrslce +:+ S "following convention in" +:+.
  makeRef (SRS.physSyst SRS.missingP []) +:+ at_start force +:+ phrase variable +:+
  plural definition +:+ S "can be found in" +:+ acroDD "1" +:+ S "to" +:+.
  acroDD "9"

--
bsShrFEq :: RelationConcept
bsShrFEq = makeRC "bsShrFEq" (nounPhraseSP "base shear force equilibrium") bShFEq_desc bShFEq_rel

bShFEq_rel :: Relation
bShFEq_rel = C mobShrI := (Int 0) --FIXME: add the long equation

bShFEq_desc :: Sentence
bShFEq_desc = S "For a" +:+ phrase slice +:+ S "of" +:+ phrase mass +:+
  S "in the" +:+ phrase slope +:+ S "the" +:+ phrase force +:+
  S "equilibrium to satisfy" +:+ acroT "2" +:+ S "in the direction" +:+
  S "parallel to" +:+. (S "base" +:+ phrase surface `ofThe`
  phrase slice) +:+ S "Rearranged to solve for the" +:+ phrase shearForce +:+
  S "on the base" +:+. getS mobShrI +:+ at_start force +:+ S "equilibrium is" +:+
  S "derived from the free body diagram of" +:+
  makeRef (SRS.physSyst SRS.missingP []) +:+ S "Index i" +:+
  S "refers to" +:+ (plural value `ofThe` plural property) +:+ S "for" +:+
  phrase slice :+: S "/" :+: plural intrslce +:+ S "following convention in" +:+.
  makeRef (SRS.physSyst SRS.missingP []) +:+ at_start force +:+ phrase variable +:+
  plural definition +:+ S "can be found in" +:+ acroDD "1" +:+ S "to" +:+.
  acroDD "9"

--
resShr :: RelationConcept
resShr = makeRC "resShr" (nounPhraseSP "resistive shear") resShr_desc resShr_rel

resShr_rel :: Relation
resShr_rel = C shrResI := C nrmFSubWat :* tan (C fricAngle) :+ C cohesion :* C baseWthX :* sec (C baseAngle)

resShr_desc :: Sentence
resShr_desc = S "The Mohr-Coulomb resistive shear strength of a" +:+
  phrase slice +:+ getS shrResI +:+ S "is adjusted to account for the" +:+
  S "effective" +:+ phrase normal +:+
  (E $ (C nrmStrss) := (C nrmFSubWat) := (C totNrmForce) :- (C baseHydroForce)) +:+
  S "of a soil from" +:+. acroT "4" +:+ -- FIXME: add prime to nrmStrss aboves
  S "Also and the cohesion is adjusted to account for the" +:+ phrase len +:+
  S "l of the plane where the" +:+ phrase normal +:+ S "occurs, where" +:+
  (E $ (C baseLngth) := (C baseWthX) :* sec (C baseAngle))`sC` S "and" +:+ getS baseWthX +:+
  S "is the x width of the base. Therefore" +:+ --FIXME: do propering indexes and primes here
  (E $ (C cohesion) := (C cohesion) :* (C baseWthX) :* sec ((C baseAngle)))
  -- FIXME: Still needs to be more automated

--
mobShr :: RelationConcept
mobShr = makeRC "mobShr" (nounPhraseSP "mobile shear") mobShr_desc mobShr_rel

mobShr_rel :: Relation
mobShr_rel = C mobShrI := C shrResI :/ C fs := 
  (C nrmFSubWat :* tan (C fricAngle) :+ C cohesion :* C baseWthX :* sec (C baseAngle)) :/ C fs

mobShr_desc :: Sentence
mobShr_desc = foldlSent [
  S "From", phrase definition `ofThe` ((phrase factor) `sOf` (phrase safety)), S "in", acroT "1" `sC` --FIXME: factor of saftey hacked in to avoid cyclical imports
  S "and the new" +:+ phrase definition +:+ S "of", getS shrResI `sC` S "a new",
  S "relation for" +:+ (S "net mobile" +:+ phrase shearForce `ofThe` phrase slice),
{'fraction_non_alphanumeric': 0.16524845046748607, 'fraction_numerical': 0.0023111671394054, 'mean_word_length': 3.973876698014629, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1988985', 'n_tokens_mistral': 3853, 'n_tokens_neox': 3755, 'n_words': 1120}