Opened 9 years ago

#3228 new enhancement

Error message and expandable connectors

Reported by: anonymous Owned by: somebody
Priority: normal Milestone: Future
Component: *unknown* Version: trunk
Keywords: Cc:

Description

Consider the following code:

package ExpandableConn
  model IntegConn
    Modelica.Blocks.Continuous.Integrator integrator;
    Conn conn;
  equation
    connect(integrator.u, conn.signal);
  end IntegConn;

  expandable connector Conn "Control bus that is adapted to the signals connected to it"
    extends Modelica.Icons.SignalBus;
    annotation(Diagram(graphics));
  end Conn;

  model Master
    Conn conn;
    Modelica.Blocks.Sources.Step step(startTime = 0.5);
  equation
    connect(step.y, conn.signal);
  end Master;

  model Combined
    IntegConn integConn;
    Master master;
  equation
    connect(master.conn, integConn.conn);
  end Combined;
  annotation(uses(Modelica(version = "3.2.1")));
end ExpandableConn;

If we check model "Combined" I get 5 equations and 5 variables. Correct.
Now let us change Master so that the signal name in the connector becomes wrong:

model Master
  Conn conn;
  Modelica.Blocks.Sources.Step step(startTime = 0.5);
equation
  connect(step.y, conn.signal_);
end Master;

When checking Combined we get the following message:

Class ExpandableConn.Combined has 6 equation(s) and 7 variable(s).
5 of these are trivial equation(s).
"

This is clearly because the name "signal" and "signal_" are different.
This is true but it is not enough: imagine the same behaviour on a real-life simulation with hundreds of equations. A message saying that we have, let's say 500 equations and 501 variables might be VERY discouraging.

However I suppose that the message can be much more selective: OM can understand that there is a variable that is taken from an expandable connector "conn.signal" that no other models has sent to that given connection set.

So I thing a better error message could be envisaged. Just as an example it could be something like the following one

ERROR: The input signal "integrator.u" is connected to the expandable connector signal "conn.signal" but no variable with this name is available in the given connection set

Change History (0)

Note: See TracTickets for help on using tickets.