Skip to content

Commit 91942a5

Browse files
refactor: mark several variable metadata keys as public
1 parent eb5f1fd commit 91942a5

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

docs/src/API/variables.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ help?> u
5656
```@docs
5757
hasdescription
5858
getdescription
59+
ModelingToolkit.VariableDescription
5960
```
6061

6162
## Connect
@@ -83,6 +84,7 @@ getconnect(k)
8384
```@docs
8485
hasconnect
8586
getconnect
87+
ModelingToolkit.VariableConnectType
8688
```
8789

8890
```@docs; canonical=false
@@ -112,6 +114,8 @@ isinput
112114
isoutput
113115
ModelingToolkit.setinput
114116
ModelingToolkit.setoutput
117+
ModelingToolkit.VariableInput
118+
ModelingToolkit.VariableOutput
115119
```
116120

117121
## Bounds
@@ -144,6 +148,7 @@ hasbounds(x[2])
144148
```@docs
145149
hasbounds
146150
getbounds
151+
ModelingToolkit.VariableBounds
147152
```
148153

149154
## Guess
@@ -232,6 +237,7 @@ isirreducible(important_value)
232237

233238
```@docs
234239
isirreducible
240+
ModelingToolkit.VariableIrreducible
235241
```
236242

237243
## State Priority
@@ -245,6 +251,7 @@ state_priority(important_dof)
245251

246252
```@docs
247253
state_priority
254+
ModelingToolkit.VariableStatePriority
248255
```
249256

250257
## Units
@@ -261,6 +268,7 @@ getunit(speed)
261268
```@docs
262269
hasunit
263270
getunit
271+
ModelingToolkit.VariableUnit
264272
```
265273

266274
## Variable type
@@ -286,6 +294,7 @@ getmisc(y)
286294
```@docs
287295
hasmisc
288296
getmisc
297+
ModelingToolkit.VariableMisc
289298
```
290299

291300
## Dumping metadata

src/ModelingToolkit.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,9 @@ export DynamicOptSolution
339339
@public AbstractSystem, CheckAll, CheckNone, CheckComponents, CheckUnits
340340
@public t, D, t_nounits, D_nounits, t_unitful, D_unitful
341341
@public SymbolicContinuousCallback, SymbolicDiscreteCallback
342-
@public VariableType, MTKVariableTypeCtx
342+
@public VariableType, MTKVariableTypeCtx, VariableBounds, VariableConnectType
343+
@public VariableDescription, VariableInput, VariableIrreducible, VariableMisc
344+
@public VariableOutput, VariableStatePriority, VariableUnit
343345

344346
for prop in [SYS_PROPS; [:continuous_events, :discrete_events]]
345347
getter = Symbol(:get_, prop)

src/variables.jl

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
1+
"""
2+
$TYPEDEF
3+
4+
Symbolic metadata key for storing the unit associated with a symbolic variable.
5+
"""
16
struct VariableUnit end
7+
"""
8+
$TYPEDEF
9+
10+
Symbolic metadata key for storing the type of connector that a variable is.
11+
"""
212
struct VariableConnectType end
313
struct VariableNoiseType end
14+
"""
15+
$TYPEDEF
16+
17+
Symbolic metadata key for storing whether a symbolic variable is an input or not.
18+
"""
419
struct VariableInput end
20+
"""
21+
$TYPEDEF
22+
23+
Symbolic metadata key for storing whether a symbolic variable is an output or not.
24+
"""
525
struct VariableOutput end
26+
"""
27+
$TYPEDEF
28+
29+
Symbolic metadata key for storing whether a symbolic variable is irreducible or not.
30+
"""
631
struct VariableIrreducible end
32+
"""
33+
$TYPEDEF
34+
35+
Symbolic metadata key for storing the priority a variable has for being selected during
36+
state selection.
37+
"""
738
struct VariableStatePriority end
39+
"""
40+
$TYPEDEF
41+
42+
Symbolic metadata key for storing miscellaneous information about a symbolic variable.
43+
"""
844
struct VariableMisc end
945
# Metadata for renamed shift variables xₜ₋₁
1046
struct VariableUnshifted end
@@ -227,6 +263,11 @@ function default_toterm(x)
227263
end
228264

229265
## Bounds ======================================================================
266+
"""
267+
$TYPEDEF
268+
269+
Symbolic metadata key for specifying the bounds of a symbolic variable.
270+
"""
230271
struct VariableBounds end
231272
Symbolics.option_to_metadata_type(::Val{:bounds}) = VariableBounds
232273

@@ -436,6 +477,11 @@ function getbounds(p::AbstractVector)
436477
end
437478

438479
## Description =================================================================
480+
"""
481+
$TYPEDEF
482+
483+
Symbolic metadata key for storing the description of a symbolic variable.
484+
"""
439485
struct VariableDescription end
440486
Symbolics.option_to_metadata_type(::Val{:description}) = VariableDescription
441487

0 commit comments

Comments
 (0)