Skip to content

Commit aa1fd7c

Browse files
committed
Include discussion of the fixed attribute
This closes #133.
1 parent 8008b8f commit aa1fd7c

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

text/source/behavior/equations/population.rst

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,33 @@ completely ignore it. Next, whether it will be ignored is also hard
151151
to predict since different tools may make different choices about
152152
which variables to treat as states.
153153

154-
Finally, the ``start`` attribute is also "overloaded". This means
155-
that it is actually used for two different things. If the variable in
156-
question is not a state, but is instead an "iteration variable"
157-
(*i.e.*, a variable whose solution depends on a non-linear system of
158-
equations), then the ``start`` attribute may be used by a Modelica
159-
compiler as an initial guess (*i.e.*, the value used for the variable
160-
during the initial iteration of the non-linear solver).
154+
One way to avoid both of these disadvantages is to use the ``fixed``
155+
attribute (also discussed in the section on :ref:`builtin-types`).
156+
The ``fixed`` attribute can be used to tell the compiler that the
157+
start attribute **must** be used as an initial condition. In other
158+
words, an ``initial equation`` like this:
159+
160+
.. code-block:: modelica
161+
162+
Real x;
163+
initial equation
164+
x = 5;
165+
166+
is equivalent to the following declaration utilizing the ``start`` and
167+
``fixed`` attributes:
168+
169+
.. code-block:: modelica
170+
171+
Real x(start=5, fixed=true);
172+
173+
Finally, one additional complication is that the ``start`` attribute
174+
is also "overloaded". This means that it is actually used for two
175+
different things. If the variable in question is not a state, but is
176+
instead an "iteration variable" (*i.e.*, a variable whose solution
177+
depends on a non-linear system of equations), then the ``start``
178+
attribute may be used by a Modelica compiler as an initial guess
179+
(*i.e.*, the value used for the variable during the initial iteration
180+
of the non-linear solver).
161181

162182
Whether to specify a ``start`` attribute or not depends on how
163183
strictly you want a given initial condition to be enforced. Knowing

0 commit comments

Comments
 (0)