From 551def8cd607cdd938801e98832e6340d82aad4c Mon Sep 17 00:00:00 2001 From: Jason Balaci Date: Mon, 23 Jan 2023 23:40:55 -0500 Subject: [PATCH] JC/D #2892 : Replace posInf/negInf with existing DQDs and remove them from symbol table of pdcontroller. --- .../Language/Drasil/Code/Imperative/ConceptMatch.hs | 2 +- .../pdcontroller/lib/Drasil/PDController/Body.hs | 3 ++- .../pdcontroller/lib/Drasil/PDController/TModel.hs | 9 ++++----- .../pdcontroller/lib/Drasil/PDController/Unitals.hs | 13 +++---------- code/drasil-lang/lib/Language/Drasil/ShortHands.hs | 8 ++++---- .../pdcontroller/SRS/HTML/PDController_SRS.html | 10 ---------- .../pdcontroller/SRS/JSON/PDController_SRS.ipynb | 2 -- .../pdcontroller/SRS/PDF/PDController_SRS.tex | 4 ---- 8 files changed, 14 insertions(+), 37 deletions(-) diff --git a/code/drasil-code/lib/Language/Drasil/Code/Imperative/ConceptMatch.hs b/code/drasil-code/lib/Language/Drasil/Code/Imperative/ConceptMatch.hs index d5c5e2d3ea..479ccdca0c 100644 --- a/code/drasil-code/lib/Language/Drasil/Code/Imperative/ConceptMatch.hs +++ b/code/drasil-code/lib/Language/Drasil/Code/Imperative/ConceptMatch.hs @@ -30,4 +30,4 @@ chooseConcept chs = sequence $ Map.mapWithKey chooseConcept' (conceptMatch $ map -- | Translates a 'CodeConcept' into GOOL. conceptToGOOL :: (OOProg r) => CodeConcept -> SValue r -conceptToGOOL Pi = pi \ No newline at end of file +conceptToGOOL Pi = pi diff --git a/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs b/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs index 23598bcaaf..5b8598e523 100644 --- a/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs +++ b/code/drasil-example/pdcontroller/lib/Drasil/PDController/Body.hs @@ -19,6 +19,7 @@ import Data.Drasil.Concepts.PhysicalProperties (physicalcon) import Data.Drasil.Concepts.Physics (angular, linear) -- FIXME: should not be needed? import Data.Drasil.Quantities.PhysicalProperties (mass) import Data.Drasil.SI_Units (second, kilogram) +import Data.Drasil.Quantities.Math (posInf, negInf) import Drasil.PDController.Assumptions (assumptions) import Drasil.PDController.Changes (likelyChgs) @@ -123,7 +124,7 @@ symbolsAll = symbols ++ map qw pidDqdConstants ++ map qw pidConstants ++ map qw [listToArray $ quantvar opProcessVariable, arrayVecDepVar pidODEInfo] symbMap :: ChunkDB -symbMap = cdb (map qw physicscon ++ symbolsAll ++ [qw mass]) +symbMap = cdb (map qw physicscon ++ symbolsAll ++ [qw mass, qw posInf, qw negInf]) (nw pidControllerSystem : [nw program, nw angular, nw linear] ++ map nw doccon ++ map nw doccon' ++ concepts ++ map nw mathcon ++ map nw mathcon' ++ map nw [second, kilogram] ++ map nw symbols diff --git a/code/drasil-example/pdcontroller/lib/Drasil/PDController/TModel.hs b/code/drasil-example/pdcontroller/lib/Drasil/PDController/TModel.hs index 176af87c3c..37d4c8694b 100644 --- a/code/drasil-example/pdcontroller/lib/Drasil/PDController/TModel.hs +++ b/code/drasil-example/pdcontroller/lib/Drasil/PDController/TModel.hs @@ -13,6 +13,7 @@ import Language.Drasil.Chunk.Concept.NamedCombinators import qualified Language.Drasil.Sentence.Combinators as S import Data.Drasil.Citations(laplaceWiki) import Drasil.PDController.Unitals +import Data.Drasil.Quantities.Math (posInf, negInf) theoreticalModels :: [TheoryModel] theoreticalModels = [tmLaplace, tmInvLaplace, tmSOSystem] @@ -20,7 +21,7 @@ theoreticalModels = [tmLaplace, tmInvLaplace, tmSOSystem] tmLaplace :: TheoryModel tmLaplace = tm (othModel' laplaceRC) - [qw qdLaplaceTransform, qw qdFreqDomain, qw time, qw qdPosInf, + [qw qdLaplaceTransform, qw qdFreqDomain, qw time, qw posInf, qw qdFxnTDomain] ([] :: [ConceptChunk]) [] @@ -36,7 +37,7 @@ laplaceRC = makeRC "laplaceRC" (cn' "Laplace Transform") EmptyS laplaceRel laplaceRel :: Relation laplaceRel = sy qdLaplaceTransform $= - defint (eqSymb time) (sy qdNegInf) (sy qdPosInf) (sy qdFxnTDomain + defint (eqSymb time) (sy negInf) (sy posInf) (sy qdFxnTDomain `mulRe` DrasilLang.exp (neg (sy qdFreqDomain) `mulRe` sy time)) laplaceDesc :: Sentence @@ -52,7 +53,7 @@ laplaceDesc tmInvLaplace :: TheoryModel tmInvLaplace = tm (othModel' invlaplaceRC) - [qw qdLaplaceTransform, qw qdFreqDomain, qw time, qw qdPosInf, + [qw qdLaplaceTransform, qw qdFreqDomain, qw time, qw posInf, qw qdFxnTDomain] ([] :: [ConceptChunk]) [] @@ -111,5 +112,3 @@ soSystemDesc `S.ofA` phrase secondOrderSystem, sParen (S "mass-spring-damper"), S "is characterized by this equation"] - - -------- \ No newline at end of file diff --git a/code/drasil-example/pdcontroller/lib/Drasil/PDController/Unitals.hs b/code/drasil-example/pdcontroller/lib/Drasil/PDController/Unitals.hs index 0e4ff03e48..5493c17287 100644 --- a/code/drasil-example/pdcontroller/lib/Drasil/PDController/Unitals.hs +++ b/code/drasil-example/pdcontroller/lib/Drasil/PDController/Unitals.hs @@ -7,13 +7,11 @@ import Language.Drasil.Chunk.Concept.NamedCombinators import Drasil.PDController.Concepts -syms, symFS, symFt, symnegInf, symposInf, syminvLaplace, symKd, symKp, +syms, symFS, symFt, syminvLaplace, symKd, symKp, symYT, symYS, symYrT, symYrS, symET, symES, symPS, symDS, symHS, symCT, symCS, symTStep, symTSim, symAbsTol, symRelTol, symDampingCoeff, symStifnessCoeff :: Symbol -symnegInf = variable "-∞" -symposInf = variable "∞" symFS = sub (variable "F") $ label "s" syminvLaplace = variable "L⁻¹[F(s)]" syms = variable "s" @@ -40,14 +38,14 @@ symStifnessCoeff = variable "k" symbols :: [QuantityDict] symbols - = [qdLaplaceTransform, qdFreqDomain, qdFxnTDomain, qdNegInf, qdPosInf, + = [qdLaplaceTransform, qdFreqDomain, qdFxnTDomain, qdInvLaplaceTransform, qdPropGain, qdDerivGain, qdSetPointTD, qdSetPointFD, qdProcessVariableTD, qdProcessVariableFD, qdProcessErrorTD, qdProcessErrorFD, qdDerivativeControlFD, qdPropControlFD, qdTransferFunctionFD, qdCtrlVarTD, qdCtrlVarFD, qdStepTime, qdSimTime, qdDampingCoeff, qdStiffnessCoeff] -qdLaplaceTransform, qdFreqDomain, qdFxnTDomain, qdNegInf, qdPosInf, +qdLaplaceTransform, qdFreqDomain, qdFxnTDomain, qdInvLaplaceTransform, qdPropGain, qdDerivGain, qdSetPointTD, qdSetPointFD, qdProcessVariableTD, qdProcessVariableFD, qdProcessErrorTD, qdProcessErrorFD, @@ -167,11 +165,6 @@ qdFxnTDomain = vc "qdFxnTDomain" (nounPhraseSent (S "Function in the time domain")) symFt Real -qdNegInf - = vc "qdNegInf" (nounPhraseSent (S "Negative Infinity")) symnegInf Real - -qdPosInf = vc "qdPosInf" (nounPhraseSent (S "Infinity")) symposInf Real - qdInvLaplaceTransform = vc "qInvLaplaceTransform" (nounPhraseSent (S "Inverse Laplace Transform of a function")) diff --git a/code/drasil-lang/lib/Language/Drasil/ShortHands.hs b/code/drasil-lang/lib/Language/Drasil/ShortHands.hs index a42f1fdb56..a442d4d868 100644 --- a/code/drasil-lang/lib/Language/Drasil/ShortHands.hs +++ b/code/drasil-lang/lib/Language/Drasil/ShortHands.hs @@ -7,7 +7,7 @@ import Language.Drasil.Symbol.Helpers (variable) -- | Short forms of various variable names. c means /capital/; l means /lowercase/. cA,cB,cC,cD,cE,cF,cG,cH,cI,cJ,cK,cL,cM,cN,cO,cP,cQ,cR,cS,cT,cU,cV,cW,cX,cY,cZ, lA,lB,lC,lD,lE,lF,lG,lH,lI,lJ,lK,lL,lM,lN,lO,lP,lQ,lR,lS,lT,lU,lV, - lW,lX,lY,lZ,lAlpha,cAlpha,lBeta,cBeta,lGamma,cGamma,lDelta,cDelta,lEpsilon,vEpsilon, + lW,lX,lY,lZ,lAlpha,cAlpha,lBeta,cBeta,lGamma,cGamma,lDelta,cDelta,lEpsilon,vEpsilon, cEpsilon,lZeta,cZeta,lEta,cEta,lTheta,cTheta,lIota,cIota,lKappa,cKappa,lLambda,cLambda, lMu,cMu,lNu,cNu,lXi,cXi,lOmicron,cOmicron,lPi,cPi,lRho,cRho,lSigma,cSigma,lTau,cTau, lUpsilon,cUpsilon,lPhi,vPhi,cPhi,lChi,cChi,lPsi,cPsi,lOmega,cOmega,lNabla,lEll,lPosInf,lNegInf :: Symbol @@ -104,9 +104,9 @@ cPi = variable "Π" lRho = variable "ρ" cRho = variable "Ρ" lSigma = variable "σ" -cSigma = variable "Σ" +cSigma = variable "Σ" lTau = variable "τ" -cTau = variable "Τ" +cTau = variable "Τ" lUpsilon = variable "υ" cUpsilon = variable "Υ" lPhi = variable "ϕ" @@ -121,4 +121,4 @@ cOmega = variable "Ω" lNabla = variable "∇" lEll = variable "ℓ" lNegInf = variable "-∞" -lPosInf = variable "∞" \ No newline at end of file +lPosInf = variable "∞" diff --git a/code/stable/pdcontroller/SRS/HTML/PDController_SRS.html b/code/stable/pdcontroller/SRS/HTML/PDController_SRS.html index 6a984fc954..28eceb3ccc 100644 --- a/code/stable/pdcontroller/SRS/HTML/PDController_SRS.html +++ b/code/stable/pdcontroller/SRS/HTML/PDController_SRS.html @@ -147,11 +147,6 @@

Table of Symbols

Description Units - - -∞ - Negative Infinity - -- - AbsTol Absolute Tolerance @@ -277,11 +272,6 @@

Table of Symbols

Process Variable -- - - - Infinity - -- -

Table of Symbols

diff --git a/code/stable/pdcontroller/SRS/JSON/PDController_SRS.ipynb b/code/stable/pdcontroller/SRS/JSON/PDController_SRS.ipynb index e86a0dcd52..a1068a2230 100644 --- a/code/stable/pdcontroller/SRS/JSON/PDController_SRS.ipynb +++ b/code/stable/pdcontroller/SRS/JSON/PDController_SRS.ipynb @@ -79,7 +79,6 @@ "\n", "|Symbol|Description|Units|\n", "|:--- |:--- |:--- |\n", - "|$-∞$|Negative Infinity|--|\n", "|$AbsTol$|Absolute Tolerance|--|\n", "|$C_s$|Control Variable in the frequency domain|--|\n", "|$c$|Damping coefficient of the spring|--|\n", @@ -105,7 +104,6 @@ "|$t_step$|Step Time|$s$|\n", "|$Y_s$|Process Variable in the frequency domain|--|\n", "|$y_t$|Process Variable|--|\n", - "|$∞$|Infinity|--|\n", "\n", "\n", "## Abbreviations and Acronyms\n", diff --git a/code/stable/pdcontroller/SRS/PDF/PDController_SRS.tex b/code/stable/pdcontroller/SRS/PDF/PDController_SRS.tex index bbd65a9f00..2bca039d94 100644 --- a/code/stable/pdcontroller/SRS/PDF/PDController_SRS.tex +++ b/code/stable/pdcontroller/SRS/PDF/PDController_SRS.tex @@ -62,8 +62,6 @@ \subsection{Table of Symbols} \\ \midrule \endhead -$\mathit{-∞}$ & Negative Infinity & -- -\\ $\mathit{AbsTol}$ & Absolute Tolerance & -- \\ ${C_{\text{s}}}$ & Control Variable in the frequency domain & -- @@ -114,8 +112,6 @@ \subsection{Table of Symbols} \\ ${y_{\text{t}}}$ & Process Variable & -- \\ -$∞$ & Infinity & -- -\\ \bottomrule \caption{Table of Symbols} \label{Table:ToS}