Skip to content

Commit

Permalink
Implemented and used subX, subY, and subZ
Browse files Browse the repository at this point in the history
  • Loading branch information
samm82 committed Jul 18, 2019
1 parent 986ec35 commit 9fb50f9
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 115 deletions.
30 changes: 15 additions & 15 deletions code/drasil-data/Data/Drasil/Quantities/Physics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,30 @@ weight = uc CP.weight cW newton
-- FIXME: Add variants of vector forms?
-- FIXME: Pull out commonalities?

xDist = uc CP.xDist (sub lR lX) metre
yDist = uc CP.yDist (sub lR lY) metre
xDist = uc CP.xDist (subX lR) metre
yDist = uc CP.yDist (subY lR) metre

iPos = uc CP.iPos (sup lP lI) metre
xPos = uc CP.xPos (sub lP lX) metre
yPos = uc CP.yPos (sub lP lY) metre
xPos = uc CP.xPos (subX lP) metre
yPos = uc CP.yPos (subY lP) metre

ixPos = uc CP.ixPos (sup (sub lP lX) lI) metre
iyPos = uc CP.iyPos (sup (sub lP lY) lI) metre
ixPos = uc CP.ixPos (sup (subX lP) lI) metre
iyPos = uc CP.iyPos (sup (subY lP) lI) metre

fSpeed = uc CP.fSpeed (sup lV lF) velU
iSpeed = uc CP.iSpeed (sup lV lI) velU

fVel = uc CP.fVel (sup (vec lV) lF) velU
iVel = uc CP.iVel (sup (vec lV) lI) velU
xVel = uc CP.xVel (sub lV lX) velU
yVel = uc CP.yVel (sub lV lY) velU
xVel = uc CP.xVel (subX lV) velU
yVel = uc CP.yVel (subY lV) velU

ixVel = uc CP.ixVel (sup (sub lV lX) lI) velU
iyVel = uc CP.iyVel (sup (sub lV lY) lI) velU
ixVel = uc CP.ixVel (sup (subX lV) lI) velU
iyVel = uc CP.iyVel (sup (subY lV) lI) velU

xAccel = uc CP.xAccel (sub lA lX) accelU
yAccel = uc CP.yAccel (sub lA lY) accelU
xAccel = uc CP.xAccel (subX lA) accelU
yAccel = uc CP.yAccel (subY lA) accelU

constAccelV = uc CP.constAccelV (sup (vec lA) lC) accelU
xConstAccel = uc CP.xConstAccel (sup (sub lA lX) lC) accelU
yConstAccel = uc CP.yConstAccel (sup (sub lA lY) lC) accelU
constAccelV = uc CP.constAccelV (sup (vec lA) lC) accelU
xConstAccel = uc CP.xConstAccel (sup (subX lA) lC) accelU
yConstAccel = uc CP.yConstAccel (sup (subY lA) lC) accelU
6 changes: 3 additions & 3 deletions code/drasil-example/Drasil/GlassBR/Unitals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@ minThick = unitary "minThick" (nounPhraseSP "minimum thickness")
lH metre Rational

sdx = unitary "sdx" (nounPhraseSent $ phrase standOffDist +:+ sParen (phrase xComp))
(sub (eqSymb standOffDist) lX) metre Real
(subX (eqSymb standOffDist)) metre Real

sdy = unitary "sdy" (nounPhraseSent $ phrase standOffDist +:+ sParen (phrase yComp))
(sub (eqSymb standOffDist) lY) metre Real
(subY (eqSymb standOffDist)) metre Real

sdz = unitary "sdz" (nounPhraseSent $ phrase standOffDist +:+ sParen (phrase zComp))
(sub (eqSymb standOffDist) lZ) metre Real
(subZ (eqSymb standOffDist)) metre Real

sflawParamK = unitary "sflawParamK" (nounPhraseSP "surface flaw parameter") --parameterize?
lK sFlawPU Real
Expand Down
4 changes: 2 additions & 2 deletions code/drasil-example/Drasil/SSP/Unitals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,11 @@ fy = uc' "fy" (cn "y-coordinate of the force") ""

nrmForceSum = uc' "F_x^G" (cn "sums of the interslice normal forces")
"for each pair of adjacent interslice boundaries"
(sup (sub (vec cF) lX) cG) newton
(sup (subX (vec cF)) cG) newton

watForceSum = uc' "F_x^H" (cn "sums of the interslice normal water forces")
"for each pair of adjacent interslice boundaries"
(sup (sub (vec cF) lX) cH) newton
(sup (subX (vec cF)) cH) newton

sliceHghtRight = uc' "h^R" (cn "heights of the right side of slices")
"assuming slice surfaces have negative slope"
Expand Down
6 changes: 3 additions & 3 deletions code/drasil-lang/Language/Drasil.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ module Language.Drasil (
, Space(..)
, RealInterval(..), Inclusive(..), RTopology(..), DomainDesc(AllDD, BoundedDD)
-- Symbol
, Decoration(..), Symbol(..), sub, subMax, subMin, sup, supMax, supMin, vec
, hat, prime , compsy, staged
, Decoration(..), Symbol(..), sub, subMax, subMin, subX, subY, subZ, sup
, supMax, supMin, vec, hat, prime , compsy, staged
-- Misc
, mkTable
-- People
Expand Down Expand Up @@ -261,7 +261,7 @@ import Language.Drasil.Sentence (Sentence(..), sParen, sDash, sC, (+:+), (+:+.),
import Language.Drasil.Sentence.Extract (sdep, shortdep) -- exported for drasil-database FIXME: move to development package?
import Language.Drasil.Reference (makeCite, makeCiteS, makeRef2, makeRef2S, makeCiteInfo, makeCiteInfoS)
import Language.Drasil.Symbol (Decoration(..), Symbol(..), sub, subMax, subMin,
sup, supMax, supMin, vec, hat, prime, compsy, staged)
subX, subY, subZ, sup, supMax, supMin, vec, hat, prime, compsy, staged)
import Language.Drasil.Symbol.Helpers (eqSymb, codeSymb, hasStageSymbol)
import Language.Drasil.Stages (Stage(..))
import Language.Drasil.Misc -- all of it
Expand Down
8 changes: 6 additions & 2 deletions code/drasil-lang/Language/Drasil/Symbol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
-- semantics at all, but just a description of how things look.

module Language.Drasil.Symbol(Decoration(..), Symbol(..), compsy, sub, subMax,
subMin, sup, supMax, supMin, hat, vec, prime, staged, upperLeft) where
subMin, subX, subY, subZ, sup, supMax, supMin, hat, vec, prime, staged,
upperLeft) where

import Language.Drasil.Unicode(Special)
import Language.Drasil.Stages (Stage(..))
Expand Down Expand Up @@ -135,9 +136,12 @@ sup :: Symbol -> Symbol -> Symbol
sup b ur = Corners [] [] [ur] [] b

-- Helpers for common modifiers
subMax, subMin, supMax, supMin :: Symbol -> Symbol
subMax, subMin, subX, subY, subZ, supMax, supMin :: Symbol -> Symbol
subMax s = sub s (Label "max")
subMin s = sub s (Label "min")
subX s = sub s (Label "x")
subY s = sub s (Label "y")
subZ s = sub s (Label "z")
supMax s = sup s (Label "max")
supMin s = sup s (Label "min")

Expand Down
2 changes: 1 addition & 1 deletion code/drasil-printers/Language/Drasil/TeX/Print.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ print sm = foldr (($+$) . (`lo` sm)) empty
------------------ Symbol ----------------------------
symbol :: L.Symbol -> String
symbol (L.Variable s) = s
symbol (L.Label s) = s -- "\\text{" ++ s ++ "}"
symbol (L.Label s) = s
symbol (L.Special s) = unPL $ L.special s
symbol (L.Concat sl) = concatMap symbol sl
--
Expand Down
22 changes: 11 additions & 11 deletions code/stable/glassbr/SRS/GlassBR_SRS.tex
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ \subsection{Table of Symbols}
\\
${SD_{\text{min}}}$ & Minimum stand off distance permissible for input & m
\\
${SD_{x}}$ & stand off distance ($x$-component) & m
${SD_{\text{x}}}$ & stand off distance ($x$-component) & m
\\
${SD_{y}}$ & stand off distance ($y$-component) & m
${SD_{\text{y}}}$ & stand off distance ($y$-component) & m
\\
${SD_{z}}$ & stand off distance ($z$-component) & m
${SD_{\text{z}}}$ & stand off distance ($z$-component) & m
\\
$t$ & Nominal thickness $t\in{}\{2.5,2.7,3.0,4.0,5.0,6.0,8.0,10.0,12.0,16.0,19.0,22.0\}$ & mm
\\
Expand Down Expand Up @@ -312,7 +312,7 @@ \subsubsection{Terminology and Definitions}
\item{Specified design load - The magnitude in Pa (psf), type (for example, wind or snow) and duration of the load given by the specifying authority.}
\item{Long duration load - Any load lasting approximately 30 days.}
\end{itemize}
\item{Stand off distance (SD) - The distance from the glazing surface to the centroid of a hemispherical high explosive charge. It is represented by the coordinates (${SD_{x}}$, ${SD_{y}}$, ${SD_{z}}$).}
\item{Stand off distance (SD) - The distance from the glazing surface to the centroid of a hemispherical high explosive charge. It is represented by the coordinates (${SD_{\text{x}}}$, ${SD_{\text{y}}}$, ${SD_{\text{z}}}$).}
\item{Load share factor (LSF) - A multiplying factor derived from the load sharing between the double glazing, of equal or different thicknesses and types (including the layered behaviour of LG under long duration loads), in a sealed IG unit.}
\item{Glass type factor (GTF) - A multiplying factor for adjusting the LR of different glass type, that is, AN, FT, or HS, in monolithic glass, LG (Laminated Glass), or IG (Insulating Glass) constructions.}
\item{Aspect ratio (AR) - The ratio of the long dimension of the glass to the short dimension of the glass. For glass supported on four sides, the aspect ratio is always equal to or greater than 1.0. For glass supported on three sides, the ratio of the length of one of the supported edges perpendicular to the free edge, to the length of the free edge, is equal to or greater than 0.5.}
Expand Down Expand Up @@ -779,14 +779,14 @@ \subsubsection{Data Definitions}
Units & m
\\ \midrule \\
Equation & \begin{displaymath}
SD=\sqrt{{SD_{x}}^{2}+{SD_{y}}^{2}+{SD_{z}}^{2}}
SD=\sqrt{{SD_{\text{x}}}^{2}+{SD_{\text{y}}}^{2}+{SD_{\text{z}}}^{2}}
\end{displaymath}
\\ \midrule \\
Description & \begin{symbDescription}
\item{$SD$ is the stand off distance (m)}
\item{${SD_{x}}$ is the stand off distance ($x$-component) (m)}
\item{${SD_{y}}$ is the stand off distance ($y$-component) (m)}
\item{${SD_{z}}$ is the stand off distance ($z$-component) (m)}
\item{${SD_{\text{x}}}$ is the stand off distance ($x$-component) (m)}
\item{${SD_{\text{y}}}$ is the stand off distance ($y$-component) (m)}
\item{${SD_{\text{z}}}$ is the stand off distance ($z$-component) (m)}
\end{symbDescription}
\\ \midrule \\
Source & \cite{astm2009}
Expand Down Expand Up @@ -1113,11 +1113,11 @@ \subsection{Functional Requirements}
\\
${P_{\text{btol}}}$ & Tolerable probability of breakage & --
\\
${SD_{x}}$ & stand off distance ($x$-component) & m
${SD_{\text{x}}}$ & stand off distance ($x$-component) & m
\\
${SD_{y}}$ & stand off distance ($y$-component) & m
${SD_{\text{y}}}$ & stand off distance ($y$-component) & m
\\
${SD_{z}}$ & stand off distance ($z$-component) & m
${SD_{\text{z}}}$ & stand off distance ($z$-component) & m
\\
$t$ & Nominal thickness $t\in{}\{2.5,2.7,3.0,4.0,5.0,6.0,8.0,10.0,12.0,16.0,19.0,22.0\}$ & mm
\\
Expand Down
Loading

2 comments on commit 9fb50f9

@JacquesCarette
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely 'no' on this change. We don't want to hard-code x, y and z into drasil-lang. It was already kind of bad they were soft-coded in drasil-data, but this is just wrong. Plus it's not even clear to me whether these are labels or variables. Please revert this whole change.

@samm82
Copy link
Collaborator Author

@samm82 samm82 commented on 9fb50f9 Jul 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x, y, and z in this case would be labels, since they don't take values in this context. They provide information about the quantity they are applied to (ie. vx means velocity in the x-direction). Would there be a better way to make helper functions like this? Maybe defining them in utils?

Please sign in to comment.