Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sets #3846

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
cb36a02
Constraint.hs
NoahCardoso Jul 3, 2024
bd54dac
WIP adding elem
NoahCardoso Jul 3, 2024
ed51ac5
WIP lang
NoahCardoso Jul 3, 2024
e91ca6d
Set Space
NoahCardoso Jul 4, 2024
8c9ad14
WIP
NoahCardoso Jul 4, 2024
5ce87c2
added Set to Lang
NoahCardoso Jul 8, 2024
5cb3e21
update physc and sfwrc
NoahCardoso Jul 8, 2024
5ff1a61
added Sets in lang
NoahCardoso Jul 9, 2024
0f1bbe9
added Sets in convert
NoahCardoso Jul 9, 2024
0e36ebb
added Sets in extract
NoahCardoso Jul 9, 2024
1459c3a
add sets to expr
NoahCardoso Jul 10, 2024
fffb8b7
mkSet into expr
NoahCardoso Jul 10, 2024
b1f5fe3
Sets as a space
NoahCardoso Jul 10, 2024
d65b144
Sets as a space
NoahCardoso Jul 10, 2024
c3d99d8
passing version
NoahCardoso Jul 10, 2024
5503a9c
lang changes. Fix Set Expr
NoahCardoso Jul 10, 2024
a3f5f89
name change
NoahCardoso Jul 10, 2024
8e3c22e
Expr name change
NoahCardoso Jul 11, 2024
ae3524c
add new expr to printing
NoahCardoso Jul 11, 2024
fcf736b
rm is_Elem
NoahCardoso Jul 11, 2024
c8a0f15
making sets as constraints
NoahCardoso Jul 11, 2024
b8feaf7
adding mkSet
NoahCardoso Jul 11, 2024
de0c498
added nomThick back to constrained
NoahCardoso Jul 11, 2024
a709741
mkSet
NoahCardoso Jul 12, 2024
42affe8
working with printing constraints
NoahCardoso Jul 12, 2024
88d7ff4
gen glassbr.py example
NoahCardoso Jul 12, 2024
c5132cc
GOOL WIP
NoahCardoso Jul 15, 2024
03ed19e
WIP inOp
NoahCardoso Jul 16, 2024
6bc7824
adding isin into java
NoahCardoso Jul 16, 2024
2eb9205
fix CLike issue
NoahCardoso Jul 16, 2024
4c8d2e4
Adding more sets and isin
NoahCardoso Jul 16, 2024
aa59660
in Op working in python
NoahCardoso Jul 16, 2024
a233f54
Changed import
NoahCardoso Jul 16, 2024
8dd8c38
C and shift changes
NoahCardoso Jul 16, 2024
00f9a39
Adding Sets to Java
NoahCardoso Jul 16, 2024
7cc371c
WIP adding sets to java
NoahCardoso Jul 16, 2024
3d8c9b6
rm unused code
NoahCardoso Jul 18, 2024
ff1eb3e
Update contain func
NoahCardoso Jul 18, 2024
a3bf3da
Add Sets in Java
NoahCardoso Jul 18, 2024
53677ed
CSharp example
NoahCardoso Jul 19, 2024
9fff4ef
WIP attempt to define obj in code
NoahCardoso Jul 19, 2024
514e031
C++ example working
NoahCardoso Jul 22, 2024
76f37f7
added back 'in' in Python
NoahCardoso Jul 22, 2024
ec3fccc
clean up code
NoahCardoso Jul 23, 2024
51c6c77
Added Sets in Swift
NoahCardoso Jul 23, 2024
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
41 changes: 27 additions & 14 deletions code/drasil-code/lib/Language/Drasil/Code/Imperative/Import.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ module Language.Drasil.Code.Imperative.Import (codeType, spaceCodeType,
import Language.Drasil (HasSymbol, HasUID(..), HasSpace(..),
Space (Rational, Real), RealInterval(..), UID, Constraint(..), Inclusive (..))
import Database.Drasil (symbResolve)
import Language.Drasil.CodeExpr (sy, ($<), ($>), ($<=), ($>=), ($&&))
import Language.Drasil.CodeExpr (sy, ($<), ($>), ($<=), ($>=), ($&&),in')
import qualified Language.Drasil.CodeExpr as CE (int)
import Language.Drasil.CodeExpr.Development (CodeExpr(..), ArithBinOp(..),
AssocArithOper(..), AssocBoolOper(..), BoolBinOp(..), EqBinOp(..),
AssocArithOper(..), AssocBoolOper(..), AssocConcatOper(..), BoolBinOp(..), EqBinOp(..),
LABinOp(..), OrdBinOp(..), UFunc(..), UFuncB(..), UFuncVV(..), UFuncVN(..),
VVNBinOp(..), VVVBinOp(..), NVVBinOp(..))
VVNBinOp(..), VVVBinOp(..), NVVBinOp(..), ESSBinOp(..), ESBBinOp(..))
import Language.Drasil.Code.Imperative.Comments (getComment)
import Language.Drasil.Code.Imperative.ConceptMatch (conceptToGOOL)
import Language.Drasil.Code.Imperative.GenerateGOOL (auxClass, fApp, ctorCall,
Expand All @@ -37,17 +38,7 @@ import Language.Drasil.Mod (Func(..), FuncData(..), FuncDef(..), FuncStmt(..),
Mod(..), Name, Description, StateVariable(..), fstdecl)
import qualified Language.Drasil.Mod as M (Class(..))

import GOOL.Drasil (Label, SFile, MSBody, MSBlock, VSType, SVariable, SValue,
MSStatement, MSParameter, SMethod, CSStateVar, SClass, NamedArgs,
Initializers, OOProg, PermanenceSym(..), bodyStatements, BlockSym(..),
TypeSym(..), VariableSym(..), OOVariableSym(..), VariableElim(..), ($->), ValueSym(..),
Literal(..), VariableValue(..), NumericExpression(..), BooleanExpression(..),
Comparison(..), ValueExpression(..), OOValueExpression(..),
objMethodCallMixedArgs, List(..), StatementSym(..), AssignStatement(..),
DeclStatement(..), IOStatement(..), StringStatement(..), ControlStatement(..),
ifNoElse, ScopeSym(..), ParameterSym(..), MethodSym(..), OOMethodSym(..),
pubDVar, privDVar, nonInitConstructor, convTypeOO, ScopeTag(..), CodeType(..),
onStateValue)
import GOOL.Drasil hiding (Set, get)
import qualified GOOL.Drasil as C (CodeType(List, Array))

import Prelude hiding (sin, cos, tan, log, exp)
Expand Down Expand Up @@ -297,6 +288,7 @@ convExpr (AssocA Add l) = foldl1 (#+) <$> mapM convExpr l
convExpr (AssocA Mul l) = foldl1 (#*) <$> mapM convExpr l
convExpr (AssocB And l) = foldl1 (?&&) <$> mapM convExpr l
convExpr (AssocB Or l) = foldl1 (?||) <$> mapM convExpr l
convExpr (AssocC SUnion l) = foldl1 (#+) <$> mapM convExpr l
convExpr (C c) = do
g <- get
let v = quantvar (lookupC g c)
Expand Down Expand Up @@ -336,6 +328,8 @@ convExpr (OrdBinaryOp o a b) = liftM2 (ordBfunc o) (convExpr a) (convExpr b)
convExpr (VVVBinaryOp o a b) = liftM2 (vecVecVecBfunc o) (convExpr a) (convExpr b)
convExpr (VVNBinaryOp o a b) = liftM2 (vecVecNumBfunc o) (convExpr a) (convExpr b)
convExpr (NVVBinaryOp o a b) = liftM2 (numVecVecBfunc o) (convExpr a) (convExpr b)
convExpr (ESSBinaryOp o a b) = liftM2 (elementSetSetBfunc o) (convExpr a) (convExpr b)
convExpr (ESBBinaryOp o a b) = liftM2 (elementSetBoolBfunc o) (convExpr a) (convExpr b)
convExpr (Case c l) = doit l -- FIXME this is sub-optimal
where
doit [] = error "should never happen" -- TODO: change error message?
Expand All @@ -347,6 +341,11 @@ convExpr (Matrix [l]) = do
-- hd will never fail here
return $ litArray (fmap valueType (head ar)) ar
convExpr Matrix{} = error "convExpr: Matrix"
convExpr (Set l) = do
ar <- mapM convExpr l
-- hd will never fail here
return $ litSet (fmap valueType (head ar)) ar
--convExpr Set{} = error "convExpr: Set"
convExpr Operator{} = error "convExpr: Operator"
convExpr (RealI c ri) = do
g <- get
Expand Down Expand Up @@ -380,6 +379,7 @@ convCall c x ns f libf = do
-- | Converts a 'Constraint' to a 'CodeExpr'.
renderC :: (HasUID c, HasSymbol c) => c -> Constraint CodeExpr -> CodeExpr
renderC s (Range _ rr) = renderRealInt s rr
renderC s (Elem _ rr) = renderSet s rr

-- | Converts an interval ('RealInterval') to a 'CodeExpr'.
renderRealInt :: (HasUID c, HasSymbol c) => c -> RealInterval CodeExpr CodeExpr -> CodeExpr
Expand All @@ -392,6 +392,9 @@ renderRealInt s (UpTo (Exc, a)) = sy s $< a
renderRealInt s (UpFrom (Inc, a)) = sy s $>= a
renderRealInt s (UpFrom (Exc, a)) = sy s $> a

renderSet :: (HasUID c, HasSymbol c) => c -> CodeExpr -> CodeExpr
renderSet e s = in' s (sy e)

-- | Maps a 'UFunc' to the corresponding GOOL unary function.
unop :: (OOProg r) => UFunc -> (SValue r -> SValue r)
unop Sqrt = (#/^)
Expand Down Expand Up @@ -442,6 +445,7 @@ eqBfunc NEq = (?!=)
-- Maps an 'LABinOp' to it's corresponding GOOL binary function.
laBfunc :: (OOProg r) => LABinOp -> (SValue r -> SValue r -> SValue r)
laBfunc Index = listAccess
laBfunc IndexOf = indexOf

-- Maps an 'OrdBinOp' to it's corresponding GOOL binary function.
ordBfunc :: (OOProg r) => OrdBinOp -> (SValue r -> SValue r -> SValue r)
Expand All @@ -464,6 +468,15 @@ vecVecNumBfunc Dot = error "convExpr DotProduct"
numVecVecBfunc :: NVVBinOp -> (SValue r -> SValue r -> SValue r)
numVecVecBfunc Scale = error "convExpr Scaling of Vectors"

-- Maps a 'ESSBinOp' to it's corresponding GOOL binary function.
elementSetSetBfunc :: ESSBinOp -> (SValue r -> SValue r -> SValue r)
elementSetSetBfunc SAdd = error "convExpr Adding an Element to a Set"
elementSetSetBfunc SRemove = error "convExpr Removing an Element to a Set"

-- Maps a 'ESSBinOp' to it's corresponding GOOL binary function.
elementSetBoolBfunc :: (OOProg r) => ESBBinOp -> (SValue r -> SValue r -> SValue r)
elementSetBoolBfunc SContains = contains

-- medium hacks --

-- | Converts a 'Mod' to GOOL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Language.Drasil.Code.CodeQuantityDicts (inFileName, inParams, consts)
import Language.Drasil.Code.DataDesc (DataDesc, junkLine, singleton)
import Language.Drasil.Code.ExtLibImport (defs, imports, steps)
import Language.Drasil.Choices (Comments(..), ConstantStructure(..),
ConstantRepr(..), ConstraintBehaviour(..), ImplementationType(..),
ConstantRepr(..), ConstraintBehaviour(..), ImplementationType(..),
Logging(..), Structure(..), hasSampleInput, InternalConcept(..))
import Language.Drasil.CodeSpec (CodeSpec(..))
import Language.Drasil.Expr.Development (Completeness(..))
Expand Down Expand Up @@ -389,6 +389,9 @@ printConstraint c = do
printConstraint' (Range _ (UpFrom (_, e))) = do
lb <- convExpr e
return $ [printStr "above ", print lb] ++ printExpr e db ++ [printStrLn "."]
printConstraint' (Elem _ e) = do
lb <- convExpr e
return $ [printStr "an element of the set ", print lb] ++ [printStrLn "."]
printConstraint' c

-- | Don't print expressions that are just literals, because that would be
Expand Down
4 changes: 3 additions & 1 deletion code/drasil-code/lib/Language/Drasil/CodeSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Language.Drasil.Chunk.ConstraintMap (ConstraintCEMap, ConstraintCE, const
import Language.Drasil.Chunk.CodeDefinition (CodeDefinition, qtov, qtoc, odeDef,
auxExprs)
import Language.Drasil.Choices (Choices(..), Maps(..), ODE(..), ExtLib(..))
import Language.Drasil.CodeExpr.Development (expr, eNamesRI)
import Language.Drasil.CodeExpr.Development (expr, eNamesRI, eDep)
import Language.Drasil.Chunk.CodeBase
import Language.Drasil.Mod (Func(..), FuncData(..), FuncDef(..), Mod(..), Name)

Expand Down Expand Up @@ -193,3 +193,5 @@ getConstraints cm cs = concat $ mapMaybe (\c -> Map.lookup (c ^. uid) cm) cs
constraintvars :: ConstraintCE -> ChunkDB -> [CodeChunk]
constraintvars (Range _ ri) m =
map (codeChunk . varResolve m) $ nub $ eNamesRI ri
constraintvars (Elem _ ri) m =
map (codeChunk . varResolve m) $ eDep ri
4 changes: 2 additions & 2 deletions code/drasil-data/lib/Data/Drasil/Constraints.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ module Data.Drasil.Constraints where
import Language.Drasil

gtZeroConstr, probConstr :: ConstraintE
gtZeroConstr = physc $ UpFrom (Exc, exactDbl 0)
probConstr = physc $ Bounded (Inc, exactDbl 0) (Inc, exactDbl 1)
gtZeroConstr = physRange $ UpFrom (Exc, exactDbl 0)
probConstr = physRange $ Bounded (Inc, exactDbl 0) (Inc, exactDbl 1)
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,4 @@ pendDisAngle = cuc' "pendDisAngle"
(nounPhraseSP "dependent variables")
"column vector of displacement of rods with its derivatives"
lTheta' radian (Vect Real)
[physc $ UpFrom (Inc, exactDbl 0)] (exactDbl 0)
[physRange $ UpFrom (Inc, exactDbl 0)] (exactDbl 0)
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,11 @@ mmntOfInCons = constrained' QP.momentOfInertia [gtZeroConstr] (dbl 74.5)
gravAccelCons = constrained' QP.gravitationalConst [] (lit $ QP.gravitationalConstValue ^. defnExpr)
posCons = constrained' QP.position [] (dbl 0.412) --FIXME: should be (0.412, 0.502) vector
veloCons = constrained' QP.velocity [] (dbl 2.51)
orientCons = constrained' QM.orientation [sfwrc $ Bounded (Inc, exactDbl 0) (Inc, exactDbl 2 $* sy QM.pi_)] (half $ sy QM.pi_) -- physical constraint not needed space is radians
orientCons = constrained' QM.orientation [sfwrRange $ Bounded (Inc, exactDbl 0) (Inc, exactDbl 2 $* sy QM.pi_)] (half $ sy QM.pi_) -- physical constraint not needed space is radians
angVeloCons = constrained' QP.angularVelocity [] (dbl 2.1)
forceCons = constrained' QP.force [] (dbl 98.1)
torqueCons = constrained' QP.torque [] (exactDbl 200)
restCoefCons = constrained' QP.restitutionCoef [physc $ Bounded (Inc, exactDbl 0) (Inc, exactDbl 1)] (dbl 0.8)
restCoefCons = constrained' QP.restitutionCoef [physRange $ Bounded (Inc, exactDbl 0) (Inc, exactDbl 1)] (dbl 0.8)

posOutCons = constrained' QP.position [] (exactDbl 0)
veloOutCons = constrained' QP.velocity [] (exactDbl 0)
Expand Down
29 changes: 13 additions & 16 deletions code/drasil-example/glassbr/lib/Drasil/GlassBR/Unitals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Language.Drasil
import Language.Drasil.Display (Symbol(..))
import Language.Drasil.ShortHands
import Language.Drasil.Chunk.Concept.NamedCombinators

import Prelude hiding (log)

import Data.Drasil.Concepts.Math (xComp, yComp, zComp)
Expand All @@ -17,7 +16,6 @@ import Drasil.GlassBR.Concepts (aR, annealed, fullyT, glaPlane, glassTypeFac,
stdOffDist)
import Drasil.GlassBR.References (astm2009, astm2012, astm2016)
import Drasil.GlassBR.Units (sFlawPU)

--FIXME: Many of the current terms can be separated into terms and defns?

{--}
Expand All @@ -33,7 +31,7 @@ modElas = uc' "modElas" (nounPhraseSP "modulus of elasticity of glass")

constrained :: [ConstrainedChunk]
constrained = map cnstrw inputDataConstraints ++
[cnstrw probBr, cnstrw probFail, cnstrw stressDistFac]
[cnstrw probBr, cnstrw probFail, cnstrw stressDistFac, cnstrw nomThick]

plateLen, plateWidth, aspectRatio, charWeight, standOffDist :: UncertQ
pbTol, tNT :: UncertainChunk
Expand Down Expand Up @@ -74,17 +72,17 @@ inputDataConstraints = map uncrtnw inputsWUnitsUncrtn ++
plateLen = uqcND "plateLen" (nounPhraseSP "plate length (long dimension)")
lA metre Real
[ gtZeroConstr,
physc $ UpFrom (Inc, sy plateWidth),
sfwrc $ Bounded (Inc , sy dimMin) (Inc , sy dimMax)] (dbl 1.5) defaultUncrt
physRange $ UpFrom (Inc, sy plateWidth),
sfwrRange $ Bounded (Inc , sy dimMin) (Inc , sy dimMax)] (dbl 1.5) defaultUncrt

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

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

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

tNT = uvc "tNT" (nounPhraseSP "TNT equivalent factor")
Expand All @@ -102,13 +100,12 @@ tNT = uvc "tNT" (nounPhraseSP "TNT equivalent factor")

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

nomThick = cuc "nomThick"
(nounPhraseSent $ S "nominal thickness" +:+ displayDblConstrntsAsSet
nomThick nominalThicknesses)
(nounPhraseSent $ S "nominal thickness")
lT millimetre {-Discrete nominalThicknesses, but not implemented-} Rational
[{- TODO: add back constraint: enumc nominalThicknesses -}] $ exactDbl 8
[sfwrElem $ mkSet (map dbl nominalThicknesses)] $ exactDbl 8 -- for testing

glassTypeCon = constrainedNRV' (dqdNoUnit glassTy lG String)
[{- TODO: add back constraint: EnumeratedStr Software $ map (abrv . snd) glassType -}]
Expand All @@ -127,7 +124,7 @@ probBr = cvc "probBr" (nounPhraseSP "probability of breakage")
[probConstr] (Just $ dbl 0.4)

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

probFail = cvc "probFail" (nounPhraseSP "probability of failure")
(sub cP lFail) Real
Expand Down Expand Up @@ -420,7 +417,7 @@ actualThicknesses :: [Double]
actualThicknesses = map snd glassThickness

nominalThicknesses :: [Double]
nominalThicknesses = map fst glassThickness
nominalThicknesses = map fst glassThickness

glassTypeFactors :: [Integer]
glassTypeFactors = map fst glassType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ipPropGainUnc = uq ipPropGain defaultUncrt
qdPropGain = qw ipPropGain

ipDerivGain
= constrained' (dqdNoUnit derGain symKd Real) [physc $ UpFrom (Inc, exactDbl 0)]
= constrained' (dqdNoUnit derGain symKd Real) [physRange $ UpFrom (Inc, exactDbl 0)]
(exactDbl 1)
ipDerGainUnc = uq ipDerivGain defaultUncrt
qdDerivGain = qw ipDerivGain
Expand All @@ -90,14 +90,14 @@ qdSetPointTD = qw ipSetPt
--FIXME: the original timeStep is 0.01, this will trigger an error in Java ODE solver
--change it from 0.01 to 0.001 is a temporary fix to make ODE solver working
ipStepTime = constrained' (uc stepTime symTStep Real second)
[physc $ Bounded (Inc, frac 1 1000) (Exc, sy ipSimTime)]
[physRange $ Bounded (Inc, frac 1 1000) (Exc, sy ipSimTime)]
(dbl 0.001)
ipStepTimeUnc = uq ipStepTime defaultUncrt
qdStepTime = qw ipStepTime

ipSimTime
= constrained' (uc simulationTime symTSim Real second)
[physc $ Bounded (Inc, exactDbl 1) (Inc, exactDbl 60)]
[physRange $ Bounded (Inc, exactDbl 1) (Inc, exactDbl 60)]
(exactDbl 10)
ipSimTimeUnc = uq ipSimTime defaultUncrt
qdSimTime = qw ipSimTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ flightDurUnc = uq flightDur defaultUncrt
flightDur, landPos, launAngle, launSpeed, offset, targPos :: ConstrConcept
flightDur = constrainedNRV' (uc C.flightDur (subStr lT "flight") Real second) [gtZeroConstr]
landPos = constrainedNRV' (uc C.landPos (subStr lP "land" ) Real metre ) [gtZeroConstr]
launAngle = constrained' (ucStaged C.launAngle (autoStage lTheta ) Real radian) [physc $ Bounded (Exc, exactDbl 0) (Exc, half $ sy pi_)] (sy pi_ $/ exactDbl 4)
launAngle = constrained' (ucStaged C.launAngle (autoStage lTheta ) Real radian) [physRange $ Bounded (Exc, exactDbl 0) (Exc, half $ sy pi_)] (sy pi_ $/ exactDbl 4)
launSpeed = constrained' (uc C.launSpeed (subStr lV "launch") Real velU ) [gtZeroConstr] (exactDbl 100)
offset = constrainedNRV' (uc C.offset (subStr lD "offset") Real metre ) [physc $ UpFrom (Exc, neg $ sy targPos)]
offset = constrainedNRV' (uc C.offset (subStr lD "offset") Real metre ) [physRange $ UpFrom (Exc, neg $ sy targPos)]
targPos = constrained' (uc C.targPos (subStr lP "target") Real metre ) [gtZeroConstr] (exactDbl 1000)

---
Expand Down
4 changes: 2 additions & 2 deletions code/drasil-example/ssp/lib/Drasil/SSP/Unitals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ outputs = [fs]

{-
monotonicIn :: [Constraint] --FIXME: Move this?
monotonicIn = [physc $ \_ -> -- FIXME: Hack with "index" !
monotonicIn = [physRange $ \_ -> -- FIXME: Hack with "index" !
(idx xi (sy index) $< idx xi (sy index + 1) $=> idx yi (sy index) $< idx yi (sy index + 1))]
-}

Expand Down Expand Up @@ -152,7 +152,7 @@ effCohesion = uqc "c'" (cn "effective cohesion")
fricAngle = uqc "varphi'" (cn "effective angle of friction")
("the angle of inclination with respect to the horizontal axis of " ++
"the Mohr-Coulomb shear resistance line") --http://www.geotechdata.info
(prime vPhi) degree Real [physc $ Bounded (Exc, exactDbl 0) (Exc, exactDbl 90)]
(prime vPhi) degree Real [physRange $ Bounded (Exc, exactDbl 0) (Exc, exactDbl 90)]
(exactDbl 25) defaultUncrt

dryWeight = uqc "gamma" (cn "soil dry unit weight")
Expand Down
Loading