Skip to content

Well-formed or illegal mutual dependency between discrete-valued variables? #2639

@henrikt-ma

Description

@henrikt-ma

In appendix C, equation (C.1b), it is said that the discrete-valued variables m should be possible to determine by evaluation of fm(v, c). Even though this is some sort of high level informal description, the fact that this equation is given in the form of an assignment seems to suggest that given the other variables, one should be able to determine m in a straight-forward manner.

Does this mean that the following model does not fit this description, and therefore is invalid?

model MutualDiscreteValued
  Integer x;
  Integer y;
algorithm /* Use of algorithm instead of equation will become clear below. */
  x := y;
equation
  y = x;
end MutualDiscreteValued;

(SystemModeler currently rejects this model.)

If the model above is invalid, then what about this one?

model MutualDiscreteValuedUnused
  Integer x;
  Integer y;
algorithm
  x := y; /* Use of 'y' has no impact on the algorithm outputs. */
  x := 1;
equation
  y = x;
end MutualDiscreteValuedUnused;

The reason I ended up wondering is because of this model, where pre(x) takes the role of y during initialization:

model AlgorithmWithUnusedPre
  Integer x;
initial algorithm
  x := 1; /* Overwrites the value pre(x) formally assigned at the start of the algorithm. */
equation
  /* When-equation for x, resulting in
   *   x = pre(x)
   * during initialization, expected to be solved for pre(x).
   */
  when false then
    x = pre(x);
  end when;
end AlgorithmWithUnusedPre;

Of course, one of the assumptions in this last example was that the default equation for the inactive when-equation is really allowed to be solved for pre(x), which would actually need clarification in the specification considering that x is a discrete-time variable. Perhaps a clarification would be good either way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions