Skip to content

Commit 38676a4

Browse files
committed
vectors displayed in bold
1 parent fbb7bef commit 38676a4

File tree

1 file changed

+34
-25
lines changed
  • code/drasil-example/dblpend/lib/Drasil/DblPend

1 file changed

+34
-25
lines changed

code/drasil-example/dblpend/lib/Drasil/DblPend/Unitals.hs

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Language.Drasil
88
import Language.Drasil.Display (Symbol(..))
99
import Language.Drasil.ShortHands
1010
( lM, lP, lV, lA, lF, lW, lAlpha, lTheta, cL, cT )
11-
import Language.Drasil.Space (ClifKind(Vector))
1211
import qualified Language.Drasil.Space as S
1312
import Language.Drasil.Chunk.Concept.NamedCombinators
1413
import Data.Drasil.Constraints (gtZeroConstr)
@@ -18,44 +17,53 @@ import Drasil.Metadata (dataDefn, genDefn, inModel, thModel)
1817
import Data.Drasil.Quantities.PhysicalProperties as QPP (len, mass)
1918
import Data.Drasil.SI_Units (metre, radian, kilogram, newton)
2019
import qualified Data.Drasil.Quantities.Physics as QP (position, force, velocity,
21-
angularVelocity, angularAccel, gravitationalAccel, acceleration, tension, time)
20+
angularVelocity, angularAccel, gravitationalAccel, acceleration, tension, time, gravitationalAccelConst)
2221
import Data.Drasil.Concepts.Physics (twoD)
2322
import Data.Drasil.Concepts.Math as CM (angle)
2423
import Data.Drasil.Quantities.Math as QM (unitVect, pi_)
2524
import Drasil.DblPend.Concepts (firstRod, secondRod, firstObject, secondObject)
2625
import Data.Drasil.Units.Physics (velU, accelU, angVelU, angAccelU)
27-
import Data.Drasil.Quantities.Physics (gravitationalAccelConst)
2826

2927
----------------------------------------
3028
-- ACRONYMS, SYMBOLS, INPUTS, OUTPUTS
3129
----------------------------------------
3230

3331
symbols :: [DefinedQuantityDict]
34-
symbols = map dqdWr unitalChunks ++ unitless ++ [dqdWr pendDisAngle] ++ map dqdWr constants
32+
symbols = map dqdWr unitalChunks ++ unitless ++ map dqdWr constants
3533

3634
acronyms :: [CI]
3735
acronyms = [twoD, assumption, dataDefn, genDefn, goalStmt, inModel,
3836
physSyst, requirement, refBy, refName, srs, thModel, typUnc]
3937

38+
-- USER-PROVIDED INPUTS
4039
inputs :: [DefinedQuantityDict]
4140
inputs = map dqdWr
42-
[lenRod_1, lenRod_2, massObj_1, massObj_2, pendDisAngle_1, pendDisAngle_2]
41+
[ lenRod_1, lenRod_2
42+
, massObj_1, massObj_2
43+
, pendDisAngle_1, pendDisAngle_2
44+
, angularVel_1, angularVel_2
45+
]
4346

47+
-- SOFTWARE-COMPUTED OUTPUTS
4448
outputs :: [DefinedQuantityDict]
45-
outputs = map dqdWr [posVec_1, posVec_2, mvVel_1, mvVel_2, mvAccel_1, mvAccel_2, mvForce_1, mvForce_2]
49+
outputs = map dqdWr
50+
[ posVec_1, posVec_2
51+
, mvVel_1, mvVel_2
52+
, mvAccel_1, mvAccel_2
53+
, mvForce_1, mvForce_2
54+
, angularAccel_1, angularAccel_2
55+
, tension_1, tension_2
56+
]
4657

4758
constants :: [ConstQDef]
48-
constants = [gravitationalAccelConst]
59+
constants = [QP.gravitationalAccelConst]
4960

5061
----------------------------------------
5162
-- CLIFFORD (GEOMETRIC) ALGEBRA HELPERS
5263
----------------------------------------
5364

54-
vecDim :: S.Dimension
55-
vecDim = S.Fixed 2
56-
57-
realVect :: S.Dimension -> Space
58-
realVect d = S.ClifS d S.Vector Real
65+
realVect :: Space
66+
realVect = S.ClifS (S.Fixed 2) S.Vector Real
5967

6068
----------------------------------------
6169
-- UNITAL CHUNKS
@@ -66,17 +74,18 @@ unitalChunks =
6674
[ lenRod_1, lenRod_2
6775
, massObj_1, massObj_2
6876
, pendDisAngle_1, pendDisAngle_2
77+
, angularVel_1, angularVel_2
6978
, posVec_1, posVec_2
7079
, mvVel_1, mvVel_2
7180
, mvAccel_1, mvAccel_2
7281
, mvForce_1, mvForce_2
73-
, angularVel_1, angularVel_2
7482
, angularAccel_1, angularAccel_2
7583
, tension_1, tension_2
7684
, QPP.mass, QP.force, QP.gravitationalAccel
7785
, QP.acceleration, QP.time, QP.velocity, QP.position, QP.tension
7886
]
7987

88+
8089
-- Rod lengths
8190
lenRod_1, lenRod_2, massObj_1, massObj_2, pendDisAngle_1, pendDisAngle_2 :: UnitalChunk
8291
lenRod_1 = uc' "l_1" (len `ofThe` firstRod)
@@ -102,41 +111,41 @@ pendDisAngle_2 = uc' "theta_2" (CM.angle `ofThe` secondRod)
102111
posVec_1, posVec_2 :: UnitalChunk
103112
posVec_1 = uc' "p_1" (QP.position `ofThe` firstObject)
104113
(phraseNP (QP.position `the_ofThe` firstObject))
105-
(vec lP `sub` label1) (realVect vecDim) metre
114+
(vec lP `sub` label1) realVect metre
106115

107116
posVec_2 = uc' "p_2" (QP.position `ofThe` secondObject)
108117
(phraseNP (QP.position `the_ofThe` secondObject))
109-
(vec lP `sub` label2) (realVect vecDim) metre
118+
(vec lP `sub` label2) realVect metre
110119

111120
-- Clifford velocities
112121
mvVel_1, mvVel_2 :: UnitalChunk
113122
mvVel_1 = uc' "v_mv1" (QP.velocity `ofThe` firstObject)
114123
(phraseNP (QP.velocity `the_ofThe` firstObject))
115-
(sub lV label1) (realVect vecDim) velU
124+
(vec lV `sub` label1) realVect velU
116125

117126
mvVel_2 = uc' "v_mv2" (QP.velocity `ofThe` secondObject)
118127
(phraseNP (QP.velocity `the_ofThe` secondObject))
119-
(sub lV label2) (realVect vecDim) velU
128+
(vec lV `sub` label2) realVect velU
120129

121130
-- Clifford accelerations
122131
mvAccel_1, mvAccel_2 :: UnitalChunk
123132
mvAccel_1 = uc' "a_mv1" (QP.acceleration `ofThe` firstObject)
124133
(phraseNP (QP.acceleration `the_ofThe` firstObject))
125-
(sub lA label1) (realVect vecDim) accelU
134+
(vec lA `sub` label1) realVect accelU
126135

127136
mvAccel_2 = uc' "a_mv2" (QP.acceleration `ofThe` secondObject)
128137
(phraseNP (QP.acceleration `the_ofThe` secondObject))
129-
(sub lA label2) (realVect vecDim) accelU
138+
(vec lA `sub` label2) realVect accelU
130139

131140
-- Clifford forces
132141
mvForce_1, mvForce_2 :: UnitalChunk
133142
mvForce_1 = uc' "F_mv1" (QP.force `ofThe` firstObject)
134143
(phraseNP (QP.force `the_ofThe` firstObject))
135-
(sub lF label1) (realVect vecDim) newton
144+
(vec lF `sub` label1) realVect newton
136145

137146
mvForce_2 = uc' "F_mv2" (QP.force `ofThe` secondObject)
138147
(phraseNP (QP.force `the_ofThe` secondObject))
139-
(sub lF label2) (realVect vecDim) newton
148+
(vec lF `sub` label2) realVect newton
140149

141150
-- Angular velocity / acceleration
142151
angularVel_1, angularVel_2, angularAccel_1, angularAccel_2 :: UnitalChunk
@@ -160,11 +169,11 @@ angularAccel_2 = uc' "alpha_2" (QP.angularAccel `ofThe` secondObject)
160169
tension_1, tension_2 :: UnitalChunk
161170
tension_1 = uc' "T_1" (QP.tension `ofThe` firstRod)
162171
(phraseNP (QP.tension `the_ofThe` firstRod))
163-
(sub (vec cT) label1) Real newton
172+
(sub cT label1) Real newton
164173

165174
tension_2 = uc' "T_2" (QP.tension `ofThe` secondRod)
166175
(phraseNP (QP.tension `the_ofThe` secondRod))
167-
(sub (vec cT) label2) Real newton
176+
(sub cT label2) Real newton
168177

169178
----------------------------------------
170179
-- UNITLESS, SYMBOLS
@@ -201,5 +210,5 @@ pendDisAngle :: ConstrConcept
201210
pendDisAngle = cuc' "pendDisAngle"
202211
(nounPhraseSP "dependent variables")
203212
"column vector of displacement of rods with its derivatives"
204-
lTheta radian (ClifS (VDim "2") Vector Real)
205-
[physRange $ UpFrom (Inc, exactDbl 0)] (exactDbl 0)
213+
lTheta radian realVect
214+
[physRange $ UpFrom (Inc, exactDbl 0)] (exactDbl 0)

0 commit comments

Comments
 (0)