Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{-# LANGUAGE TemplateHaskell #-}
module Language.Drasil.Chunk.CodeDefinition (
CodeDefinition, DefinitionType(..), qtoc, qtov, odeDef, auxExprs, defType,
CodeDefinition, DefinitionType(..), qtoc, qtov,
odeDef, auxExprs, defType,
) where

import Drasil.Code.CodeExpr.Development (expr, CanGenCode(..))
Expand Down Expand Up @@ -54,12 +55,12 @@ instance DefiningCodeExpr CodeDefinition where codeExpr = def
-- It _might_ be good to create make a ``CanGenCodeDefinition''-like typeclass

-- | Constructs a 'CodeDefinition' where the underlying 'CodeChunk' is for a function.
qtoc :: (Quantity (q Expr), MayHaveUnit (q Expr), DefiningExpr q) => q Expr -> CodeDefinition
qtoc q = CD (codeChunk $ quantfunc q) (expr $ q ^. defnExpr) [] Definition
qtoc :: (DefinesQuantity (q Expr), DefiningExpr q) => q Expr -> CodeDefinition
qtoc q = CD (codeChunk $ quantfunc $ q ^. defLhs) (expr $ q ^. defnExpr) [] Definition

-- | Constructs a 'CodeDefinition' where the underlying 'CodeChunk' is for a variable.
qtov :: CanGenCode e => QDefinition e -> CodeDefinition
qtov q = CD (codeChunk $ quantvar q) (toCodeExpr $ q ^. defnExpr) [] Definition
qtov q = CD (codeChunk $ quantvar $ q ^. defLhs) (toCodeExpr $ q ^. defnExpr) [] Definition

-- | Constructs a 'CodeDefinition' for an ODE.
odeDef :: ODEInfo -> CodeDefinition
Expand Down
6 changes: 3 additions & 3 deletions code/drasil-code/lib/Language/Drasil/CodeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import System.Drasil (HasSystem(..))
import Theory.Drasil (DataDefinition, qdEFromDD, getEqModQdsFromIm)

import Language.Drasil.Chunk.ConstraintMap (ConstraintCEMap, ConstraintCE, constraintMap)
import Language.Drasil.Chunk.CodeDefinition (CodeDefinition, qtov, qtoc, odeDef,
auxExprs)
import Language.Drasil.Chunk.CodeDefinition (CodeDefinition, qtov, qtoc,
odeDef, auxExprs)
import Language.Drasil.Choices (Choices(..), Maps(..), ODE(..), ExtLib(..))
import Language.Drasil.Chunk.CodeBase
import Language.Drasil.Mod (Func(..), FuncData(..), FuncDef(..), Mod(..), Name)
Expand Down Expand Up @@ -199,7 +199,7 @@ oldcodeSpec SI.SI{ SI._sys = sys
-- directly from the instance models (ims) instead of directly from the choices.
outs' = map quantvar outs
allInputs = nub $ inputs' ++ map quantvar derived
exOrder = getExecOrder rels (allInputs ++ map quantvar cnsts) outs' db
exOrder = getExecOrder rels (allInputs ++ map (quantvar . (^. defLhs)) cnsts) outs' db
in OldCodeSpec {
_pName = n,
_authors = as,
Expand Down
2 changes: 1 addition & 1 deletion code/drasil-docLang/lib/Drasil/DocumentLanguage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ mkOffShelfSolnSec (OffShelfSolnsProg cs) = SRS.offShelfSol cs []

-- | Helper for making the Values of Auxiliary Constants section.
mkAuxConsSec :: AuxConstntSec -> Section
mkAuxConsSec (AuxConsProg key listOfCons) = AC.valsOfAuxConstantsF key $ sortBySymbol listOfCons
mkAuxConsSec (AuxConsProg key listOfCons) = AC.valsOfAuxConstantsF key $ sortByLhsSymbol listOfCons

-- ** References

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ intro kWord = foldlSP [S "This section contains the standard values that are use
tableOfConstants :: [ConstQDef] -> LabelledContent
tableOfConstants f = llcc tableOfConstantsRef $ Table
[titleize symbol_, titleize description, titleize value, titleize CM.unit_]
(mkTable [ch, phrase, \c -> eS $ express $ c ^. defnExpr, toSentence] f)
(mkTable [ch . (^. defLhs), phrase, \c -> eS $ express $ c ^. defnExpr, toSentence] f)
(titleize' tAuxConsts)
True

Expand Down
4 changes: 3 additions & 1 deletion code/drasil-example/dblpend/lib/Drasil/DblPend/Unitals.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Drasil.DblPend.Unitals where

import Control.Lens ((^.))

import Language.Drasil
import Language.Drasil.Display (Symbol(..))
import Language.Drasil.ShortHands
Expand All @@ -23,7 +25,7 @@ import Data.Drasil.Quantities.Physics (gravitationalAccelConst)


symbols:: [QuantityDict]
symbols = map qw unitalChunks ++ map qw unitless ++ [qw pendDisAngle] ++ map qw constants
symbols = map qw unitalChunks ++ map qw unitless ++ [qw pendDisAngle] ++ map (^. defLhs) constants

acronyms :: [CI]
acronyms = [twoD, assumption, dataDefn, genDefn, goalStmt, inModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module Drasil.GlassBR.Assumptions (assumpGT, assumpGC, assumpES, assumpSV,
assumpGL, assumpBC, assumpRT, assumpLDFC, assumptionConstants,
assumptions) where

import Control.Lens ((^.))

import Language.Drasil hiding (organization)
import qualified Drasil.DocLang.SRS as SRS (valsOfAuxCons)
import Language.Drasil.Chunk.Concept.NamedCombinators
Expand Down Expand Up @@ -67,7 +69,7 @@ standardValuesDesc :: UnitaryChunk -> Sentence
standardValuesDesc mainIdea = foldlSent [atStartNP' (the value), S "provided in",
refS $ SRS.valsOfAuxCons ([]::[Contents]) ([]::[Section]), S "are assumed for the", phrase mainIdea,
sParen (ch mainIdea) `sC` S "and the", plural materialProprty `S.of_`
foldlList Comma List (map ch (take 3 assumptionConstants))]
foldlList Comma List (map (ch . (^. defLhs)) (take 3 assumptionConstants))]

glassLiteDesc :: Sentence
glassLiteDesc = foldlSent [atStart glass, S "under consideration is assumed to be a single",
Expand Down
4 changes: 3 additions & 1 deletion code/drasil-example/glassbr/lib/Drasil/GlassBR/Changes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module Drasil.GlassBR.Changes (likelyChgs, unlikelyChgs) where

--A list of likely and unlikely changes for GlassBR

import Control.Lens ((^.))

import Language.Drasil hiding (variable)
import Language.Drasil.Chunk.Concept.NamedCombinators

Expand Down Expand Up @@ -39,7 +41,7 @@ calcInternalBlastRiskDesc mainConcept = foldlSent [chgsStart assumpES (S "The"),
S "can be added for the internal", phrase mainConcept]

varValsOfmkEDesc = foldlSent [refS assumpSV `sC` chgsStart assumpLDFC (S "Currently, the"),
plural value, S "for", foldlList Comma List (map ch (take 3 assumptionConstants)),
plural value, S "for", foldlList Comma List (map (ch . (^. defLhs)) (take 3 assumptionConstants)),
S "are assumed to be the same for all" +:+. phrase glass,
S "In the future, these", plural value, S "can be changed to",
pluralNP (combineNINI variable input_)]
Expand Down
2 changes: 1 addition & 1 deletion code/drasil-example/glassbr/lib/Drasil/GlassBR/IMods.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ riskQD = mkQuantDef riskFun ((sy sflawParamK $/
strDisFac :: InstanceModel
strDisFac = imNoDeriv (equationalModelN (stressDistFac ^. term) strDisFacQD)
(qwC aspectRatio aspectRatioConstraint : [qwUC dimlessLoad]) (qw stressDistFac)
[Bounded (Inc, sy stressDistFacMin) (Inc, sy stressDistFacMax)]
[Bounded (Inc, sy $ stressDistFacMin ^. defLhs) (Inc, sy $ stressDistFacMax ^. defLhs)]
[dRef astm2009] "stressDistFac"
[interpolating stressDistFac dimlessloadVsARFig, arRef, qHtRef]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sysSetValsFollowingAssumpsTable =
"ReqAssignments"
(S "Required Assignments")
where
r2AQs = qw loadSF : map qw (take 4 assumptionConstants)
r2AQs = qw loadSF : map (qw . (^. defLhs)) (take 4 assumptionConstants)
r2ARs = assumpGL : replicate 4 assumpSV
r2DDs = [loadDF, hFromt, glaTyFac, standOffDis, aspRat]

Expand Down
6 changes: 4 additions & 2 deletions code/drasil-example/glassbr/lib/Drasil/GlassBR/Symbols.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Drasil.GlassBR.Symbols where

import Language.Drasil (QuantityDict, qw, cnstrw)
import Control.Lens ((^.))

import Language.Drasil (QuantityDict, qw, cnstrw, DefinesQuantity(defLhs))
import Language.Drasil.Code (Mod(Mod), asVC)

import Drasil.GlassBR.ModuleDefs (allMods, implVars)
Expand All @@ -17,7 +19,7 @@ symbolsForSymbolTable = symbolsForTermTable ++ map qw symbols ++

symbolsForTermTable :: [QuantityDict]
symbolsForTermTable = map qw inputsWUnitsUncrtn ++ map qw inputsWUncrtn ++
map qw sdVector ++ tmSymbols ++ map qw specParamVals ++
map qw sdVector ++ tmSymbols ++ map (^. defLhs) specParamVals ++
map qw symbolsWithDefns ++ interps

-- include all module functions as symbols
Expand Down
14 changes: 8 additions & 6 deletions code/drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Drasil.GlassBR.Unitals where --whole file is used

import Control.Lens ((^.))

import Language.Drasil
import Language.Drasil.Display (Symbol(..))
import Language.Drasil.ShortHands
Expand Down Expand Up @@ -82,16 +84,16 @@ plateLen = uqcND "plateLen" (nounPhraseSP "plate length (long dimension)")
lA metre Real
[ gtZeroConstr,
physRange $ UpFrom (Inc, sy plateWidth),
sfwrRange $ Bounded (Inc , sy dimMin) (Inc , sy dimMax)] (dbl 1.5) defaultUncrt
sfwrRange $ Bounded (Inc , sy $ dimMin ^. defLhs) (Inc , sy $ dimMax ^. defLhs)] (dbl 1.5) defaultUncrt

plateWidth = uqcND "plateWidth" (nounPhraseSP "plate width (short dimension)")
lB metre Real
[ physRange $ Bounded (Exc, exactDbl 0) (Inc, sy plateLen),
sfwrRange $ Bounded (Inc, sy dimMin) (Inc, sy dimMax)] (dbl 1.2) defaultUncrt
sfwrRange $ Bounded (Inc, sy $ dimMin ^. defLhs) (Inc, sy $ dimMax ^. defLhs)] (dbl 1.2) defaultUncrt

aspectRatio = uq (constrained' (dqdNoUnit aspectRatioCon (variable "AR") Real)
[ physRange $ UpFrom (Inc, exactDbl 1),
sfwrRange $ UpTo (Inc, sy arMax)] (dbl 1.5)) defaultUncrt
sfwrRange $ UpTo (Inc, sy $ arMax ^. defLhs)] (dbl 1.5)) defaultUncrt

pbTol = uvc "pbTol" (nounPhraseSP "tolerable probability of breakage")
(sub cP (Concat [lBreak, lTol])) Real
Expand All @@ -100,7 +102,7 @@ pbTol = uvc "pbTol" (nounPhraseSP "tolerable probability of breakage")
charWeight = uqcND "charWeight" (nounPhraseSP "charge weight")
lW kilogram Real
[ gtZeroConstr,
sfwrRange $ Bounded (Inc, sy cWeightMin) (Inc, sy cWeightMax)]
sfwrRange $ Bounded (Inc, sy $ cWeightMin ^. defLhs) (Inc, sy $ cWeightMax ^. defLhs)]
(exactDbl 42) defaultUncrt

tNT = uvc "tNT" (nounPhraseSP "TNT equivalent factor")
Expand All @@ -109,7 +111,7 @@ tNT = uvc "tNT" (nounPhraseSP "TNT equivalent factor")

standOffDist = uq (constrained' (uc sD (variable "SD") Real metre)
[ gtZeroConstr,
sfwrRange $ Bounded (Inc, sy sdMin) (Inc, sy sdMax)] (exactDbl 45)) defaultUncrt
sfwrRange $ Bounded (Inc, sy $ sdMin ^. defLhs) (Inc, sy $ sdMax ^. defLhs)] (exactDbl 45)) defaultUncrt

nomThick = cuc "nomThick"
(nounPhraseSent $ S "nominal thickness t is in" +:+ eS (mkSet Rational (map dbl nominalThicknesses)))
Expand All @@ -133,7 +135,7 @@ probBr = cvc "probBr" (nounPhraseSP "probability of breakage")
[probConstr] (Just $ dbl 0.4)

stressDistFac = cvc "stressDistFac" (nounPhraseSP "stress distribution factor (Function)")
cJ Real [physRange $ Bounded (Inc, sy stressDistFacMin) (Inc, sy stressDistFacMax)] (Just $ exactDbl 15)
cJ Real [physRange $ Bounded (Inc, sy $ stressDistFacMin ^. defLhs) (Inc, sy $ stressDistFacMax ^. defLhs)] (Just $ exactDbl 15)

probFail = cvc "probFail" (nounPhraseSP "probability of failure")
(sub cP lFail) Real
Expand Down
4 changes: 3 additions & 1 deletion code/drasil-example/hghc/lib/Drasil/HGHC/HeatTransfer.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Drasil.HGHC.HeatTransfer where --whole file is used

import Control.Lens ((^.))

import Language.Drasil
import Language.Drasil.ShortHands
import Theory.Drasil (DataDefinition, ddENoRefs)
Expand All @@ -22,7 +24,7 @@ htVars = [cladThick, coolFilmCond, gapFilmCond, cladCond]

htInputs, htOutputs :: [QuantityDict]
htInputs = map qw htVars
htOutputs = map qw qDefs
htOutputs = map (^. defLhs) qDefs

cladThick, coolFilmCond, gapFilmCond, cladCond :: QuantityDict
cladThick = vc "cladThick" (cn''' "clad thickness")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Drasil.PDController.Body (pidODEInfo, printSetting, si, srs, fullSI) where

import Control.Lens ((^.))

import Language.Drasil
import Drasil.SRSDocument
import qualified Drasil.DocLang.SRS as SRS (inModel)
Expand Down Expand Up @@ -132,7 +134,7 @@ background = foldlSent_ [S "Automatic process control with a controller (P/PI/PD
S "cruise-control, etc"]

symbolsAll :: [QuantityDict]
symbolsAll = symbols ++ map qw pidDqdConstants ++ map qw pidConstants
symbolsAll = symbols ++ map qw pidDqdConstants ++ map (^. defLhs) pidConstants
++ scipyODESymbols ++ osloSymbols ++ apacheODESymbols ++ odeintSymbols
++ map qw [listToArray $ quantvar opProcessVariable, arrayVecDepVar pidODEInfo]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import Language.Drasil.Code (odeInfo', odeOptions, quantvar, ODEInfo,
ODEMethod(RK45), ODEOptions)

import Drasil.PDController.Unitals (qdSetPointTD, qdPropGain, qdDerivGain,
qdSimTime, qdStepTime, odeRelTolConst, odeAbsTolConst)
qdSimTime, qdStepTime, dqdAbsTol, dqdRelTol)
import Drasil.PDController.IModel(imPDRC)


pidODEOptions :: ODEOptions
pidODEOptions = odeOptions
RK45 (sy odeAbsTolConst) (sy odeRelTolConst) (sy qdStepTime)
RK45 (sy dqdAbsTol) (sy dqdRelTol) (sy qdStepTime)

pdIVP :: InitialValueProblem
pdIVP = makeAIVP (exactDbl 0) (sy qdSimTime) [exactDbl 0, exactDbl 0]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Drasil.Projectile.Body (printSetting, si, srs, fullSI) where

import Control.Lens ((^.))

import Language.Drasil
import Drasil.SRSDocument
import Language.Drasil.Chunk.Concept.NamedCombinators
Expand All @@ -25,7 +27,7 @@ import Data.Drasil.Quantities.Math (pi_, piConst)
import Data.Drasil.Quantities.Physics (acceleration, constAccel,
gravitationalAccelConst, iPos, iSpeed, iVel, ixPos, iyPos, ixVel, iyVel,
position, scalarPos, time, velocity, xAccel, xConstAccel, xPos,
xVel, yAccel, yConstAccel, yPos, yVel, speed, scalarAccel, constAccelV)
xVel, yAccel, yConstAccel, yPos, yVel, speed, scalarAccel, constAccelV, gravitationalMagnitude)

import Data.Drasil.People (brooks, samCrawford, spencerSmith)
import Data.Drasil.SI_Units (siUnits)
Expand Down Expand Up @@ -292,8 +294,8 @@ physSystParts = map (!.)
-- Various gathered data that should be automated --
----------------------------------------------------
symbols :: [QuantityDict]
symbols = unitalQuants ++ map qw [gravitationalAccelConst, tol] ++
map qw [acceleration, constAccel, iPos, iSpeed, iVel, ixPos,
symbols = unitalQuants ++ (tol ^. defLhs) :
map qw [gravitationalMagnitude, acceleration, constAccel, iPos, iSpeed, iVel, ixPos,
iyPos, ixVel, iyVel, position, scalarPos, projPos, projSpeed, time, velocity, xAccel,
xConstAccel, xPos, xVel, yAccel, yConstAccel, yPos, yVel, speed, scalarAccel,
constAccelV]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import Prelude hiding (cos, sin)
import Language.Drasil (eqSymb, LiteralC(..), ModelExprC(..), ExprC(..),
ModelExpr, square, half)
import qualified Data.Drasil.Quantities.Physics as QP (iSpeed, constAccel)
import Data.Drasil.Quantities.Physics (gravitationalAccelConst, iPos, ixVel, iyVel, scalarPos, speed, time, xPos, yPos)
import Data.Drasil.Quantities.Physics (gravitationalMagnitude,
iPos, ixVel, iyVel, scalarPos, speed, time, xPos, yPos)

import Drasil.Projectile.Unitals (launAngle, launSpeed, landPos, flightDur)

Expand All @@ -19,19 +20,19 @@ timeDeriv :: [ModelExpr]
timeDeriv = [timeDerivEqn1, timeDerivEqn2, timeDerivEqn3, timeDerivEqn4]

timeDerivEqn1, timeDerivEqn2, timeDerivEqn3, timeDerivEqn4 :: ModelExpr
timeDerivEqn1 = sy yPos $= (sy iyVel $* sy time) $- half (sy gravitationalAccelConst $* square (sy time))
timeDerivEqn2 = (sy iyVel $* sy flightDur) $- half (sy gravitationalAccelConst $* square (sy flightDur)) $= exactDbl 0
timeDerivEqn3 = sy iyVel $- half (sy gravitationalAccelConst $* sy flightDur) $= exactDbl 0
timeDerivEqn4 = sy flightDur $= exactDbl 2 $* sy iyVel $/ sy gravitationalAccelConst
timeDerivEqn1 = sy yPos $= (sy iyVel $* sy time) $- half (sy gravitationalMagnitude $* square (sy time))
timeDerivEqn2 = (sy iyVel $* sy flightDur) $- half (sy gravitationalMagnitude $* square (sy flightDur)) $= exactDbl 0
timeDerivEqn3 = sy iyVel $- half (sy gravitationalMagnitude $* sy flightDur) $= exactDbl 0
timeDerivEqn4 = sy flightDur $= exactDbl 2 $* sy iyVel $/ sy gravitationalMagnitude

--
landPosDeriv :: [ModelExpr]
landPosDeriv = [landPosDerivEqn1, landPosDerivEqn2, landPosDerivEqn3]

landPosDerivEqn1, landPosDerivEqn2, landPosDerivEqn3 :: ModelExpr
landPosDerivEqn1 = sy xPos $= sy ixVel $* sy time
landPosDerivEqn2 = sy landPos $= sy ixVel $* exactDbl 2 $* sy launSpeed $* sin (sy launAngle) $/ sy gravitationalAccelConst
landPosDerivEqn3 = sy landPos $= sy launSpeed $* cos (sy launAngle) $* exactDbl 2 $* sy launSpeed $* sin (sy launAngle) $/ sy gravitationalAccelConst
landPosDerivEqn2 = sy landPos $= sy ixVel $* exactDbl 2 $* sy launSpeed $* sin (sy launAngle) $/ sy gravitationalMagnitude
landPosDerivEqn3 = sy landPos $= sy launSpeed $* cos (sy launAngle) $* exactDbl 2 $* sy launSpeed $* sin (sy launAngle) $/ sy gravitationalMagnitude


--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@ module Drasil.Projectile.Expressions where

import Prelude hiding (cos, sin)

import Control.Lens ((^.))

import Language.Drasil
import qualified Data.Drasil.Quantities.Physics as QP (iSpeed,
constAccel, xConstAccel, yConstAccel, ixPos, iyPos)
import Data.Drasil.Quantities.Physics (gravitationalAccel, gravitationalAccelConst,
import Data.Drasil.Quantities.Physics (gravitationalMagnitude,
ixVel, iyVel, xPos, yPos, time, iPos, scalarPos, xVel, yVel, xAccel, yAccel, position,
velocity, acceleration, constAccelV, speed)
import Drasil.Projectile.Unitals (launAngle, launSpeed, targPos, tol, landPos, offset)

flightDur', iyPos, yConstAccel, iSpeed :: PExpr
flightDur' = exactDbl 2 $* sy launSpeed $* sin (sy launAngle) $/ sy gravitationalAccelConst
flightDur' = exactDbl 2 $* sy launSpeed $* sin (sy launAngle) $/ sy gravitationalMagnitude
iyPos = exactDbl 0 -- launchOrigin
yConstAccel = neg $ sy gravitationalAccelConst -- accelYGravity
yConstAccel = neg $ sy gravitationalMagnitude -- accelYGravity
iSpeed = sy launSpeed

offset' :: PExpr
offset' = sy landPos $- sy targPos

message :: PExpr
message = completeCase [case1, case2, case3]
where case1 = (str "The target was hit.", abs_ (sy offset $/ sy targPos) $< sy tol)
where case1 = (str "The target was hit.", abs_ (sy offset $/ sy targPos) $< sy (tol ^. defLhs))
case2 = (str "The projectile fell short.", sy offset $< exactDbl 0)
case3 = (str "The projectile went long.", sy offset $> exactDbl 0)

Expand All @@ -51,7 +53,7 @@ posVecExpr = vec2D

--
landPosExpr :: PExpr
landPosExpr = exactDbl 2 $* square (sy launSpeed) $* sin (sy launAngle) $* cos (sy launAngle) $/ sy gravitationalAccelConst
landPosExpr = exactDbl 2 $* square (sy launSpeed) $* sin (sy launAngle) $* cos (sy launAngle) $/ sy gravitationalMagnitude

-- Helper expressions that represent the vectors of quantities as components
positionXY, velocityXY, accelerationXY, constAccelXY :: PExpr
Expand All @@ -66,9 +68,9 @@ horizVel = sy xVel $= sy ixVel
horizPos = sy xPos $= sy QP.ixPos $+ (sy ixVel $* sy time)

vertVel, vertPos, vertNoTime :: PExpr
vertVel = sy yVel $= sy iyVel $- (sy gravitationalAccel $* sy time)
vertPos = sy yPos $= sy QP.iyPos $+ (sy iyVel $* sy time) $- (sy gravitationalAccel $* square (sy time) $/ exactDbl 2)
vertNoTime = square (sy yVel) $= square (sy iyVel) $- (exactDbl 2 $* sy gravitationalAccel $* (sy yPos $- sy QP.iyPos))
vertVel = sy yVel $= sy iyVel $- (sy gravitationalMagnitude $* sy time)
vertPos = sy yPos $= sy QP.iyPos $+ (sy iyVel $* sy time) $- (sy gravitationalMagnitude $* square (sy time) $/ exactDbl 2)
vertNoTime = square (sy yVel) $= square (sy iyVel) $- (exactDbl 2 $* sy gravitationalMagnitude $* (sy yPos $- sy QP.iyPos))

lcrectVel, lcrectPos, lcrectNoTime, lchorizVel, lchorizPos, lcvertVel, lcvertPos, lcvertNoTime :: LabelledContent
lcrectVel = lbldExpr (sy speed $= speed') (makeEqnRef "rectVel")
Expand Down
Loading