-
Notifications
You must be signed in to change notification settings - Fork 26
/
Unitals.hs
88 lines (64 loc) · 3.29 KB
/
Unitals.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
module Drasil.DblPendulum.Unitals where
import Language.Drasil
import Language.Drasil.ShortHands
import Utils.Drasil
import Data.Drasil.Constraints (gtZeroConstr)
import Data.Drasil.TheoryConcepts (dataDefn, genDefn, inModel, thModel)
import Data.Drasil.Concepts.Documentation (assumption, goalStmt, physSyst,
requirement, srs, typUnc)
import Data.Drasil.Quantities.PhysicalProperties as QPP (len, mass)
import Data.Drasil.SI_Units (metre, degree, radian)
import qualified Data.Drasil.Quantities.Physics as QP (position, ixPos, force, velocity,
angularVelocity, angularAccel, gravitationalAccel, tension, acceleration, yAccel,
xAccel, yVel, xVel, iyPos, time, position, torque, momentOfInertia, angularDisplacement,
angularFrequency, frequency, period)
import Data.Drasil.Concepts.Physics (pendulum, twoD)
import Data.Drasil.Concepts.Math as CM (angle)
import Data.Drasil.Quantities.Math as QM (unitVect, unitVectj, pi_)
symbols:: [QuantityDict]
symbols = map qw unitalChunks ++ map qw unitless
acronyms :: [CI]
acronyms = [twoD, assumption, dataDefn, genDefn, goalStmt, inModel,
physSyst, requirement, srs, thModel, typUnc]
inputs :: [QuantityDict]
inputs = map qw [lenRod, QPP.mass, QP.angularAccel, pendDisplacementAngle, initialPendAngle]
outputs :: [QuantityDict]
outputs = map qw [pendDisplacementAngle]
units :: [UnitaryConceptDict]
units = map ucw unitalChunks ++ map ucw [lenRod, pendDisplacementAngle, initialPendAngle]
unitalChunks :: [UnitalChunk]
unitalChunks = [lenRod, QPP.mass, QP.force, QP.ixPos,
QP.angularVelocity, QP.angularAccel, QP.gravitationalAccel, QP.tension, QP.acceleration,
QP.yAccel, QP.xAccel, QP.yVel, QP.xVel, QP.iyPos, QP.time, QP.velocity, QP.position, QP.torque,
QP.momentOfInertia, QP.angularDisplacement, QP.angularVelocity, initialPendAngle,
QP.angularFrequency, QP.frequency, QP.period, pendDisplacementAngle]
lenRod, pendDisplacementAngle, initialPendAngle :: UnitalChunk
lenRod = makeUCWDS "l_rod" (cn "length of rod")
(phrase len `the_ofThe` S "rod")
(sub cL lRod) metre
pendDisplacementAngle = makeUCWDS "pendDisplacementAngle" (cn "displacement angle of pendulum")
(phrase angle `the_ofThe` phrase pendulum)
(sub lTheta lP) degree
initialPendAngle = makeUCWDS "initialPendAngle" (cn "initial pendulum angle")
(S "the initial angle of" +:+ phrase pendulum)
(sub lTheta lI) radian
unitless :: [DefinedQuantityDict]
unitless = [QM.unitVect, QM.unitVectj, QM.pi_]
-----------------------
lRod :: Symbol
lRod = Label "rod"
-----------------------
-- CONSTRAINT CHUNKS --
-----------------------
lenRodCons, pendDisplacementAngleOutCons, angAccelOutCons, initialPendAngleCons :: ConstrConcept
inConstraints :: [UncertQ]
inConstraints = map (`uq` defaultUncrt)
[lenRodCons, initialPendAngleCons]
outConstraints :: [UncertQ]
outConstraints = map (`uq` defaultUncrt)
[angAccelOutCons, pendDisplacementAngleOutCons]
lenRodCons = constrained' lenRod [gtZeroConstr] (dbl 44.2)
initialPendAngleCons = constrained' initialPendAngle [gtZeroConstr] (dbl 2.1)
--gravAccelCons = constrained' QP.gravitationalAccel [gtZeroConstr] (dbl 9.8)
pendDisplacementAngleOutCons = constrained' pendDisplacementAngle [gtZeroConstr] (dbl 2.1)
angAccelOutCons = constrained' QP.angularAccel [gtZeroConstr] (dbl 0.0)