Skip to content

Commit 3306d2b

Browse files
SebastianM-Cclaude
andcommitted
Add documentation for VariableNominalValue metadata
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent efd3958 commit 3306d2b

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

docs/src/API/variables.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,33 @@ getbounds
173173
ModelingToolkit.VariableBounds
174174
```
175175

176+
## Nominal Value
177+
178+
A nominal value represents the characteristic magnitude of a variable. This is useful
179+
for scaling constraints in optimal control problems, preventing ill-conditioning when
180+
variables have vastly different magnitudes. The default nominal value is `1.0`.
181+
182+
```@repl metadata
183+
@variables x [nominal_value = 1000.0];
184+
hasnominalvalue(x)
185+
getnominalvalue(x)
186+
```
187+
188+
Nominal values can also be specified for array variables:
189+
190+
```@repl metadata
191+
@variables x[1:3] [nominal_value = [100.0, 200.0, 300.0]];
192+
getnominalvalue(x)
193+
getnominalvalue(x[1])
194+
```
195+
196+
```@docs
197+
hasnominalvalue
198+
getnominalvalue
199+
setnominalvalue
200+
ModelingToolkit.VariableNominalValue
201+
```
202+
176203
## Guess
177204

178205
Specify an initial guess for variables of a `System`. This is used when building the

0 commit comments

Comments
 (0)