modelica / ModelicaSpecification

Specification of the Modelica Language
https://specification.modelica.org
Creative Commons Attribution Share Alike 4.0 International
104 stars 40 forks source link

Expandable connectors: specification mistake? #1853

Closed modelica-trac-importer closed 6 years ago

modelica-trac-importer commented 6 years ago

Reported by olga.silantyeva on 10 Dec 2015 09:52 UTC I refer to Specification for Modelica 3.3 revision 1 https://www.modelica.org/documents/ModelicaSpec33Revision1.pdf/view.

On page 103 there is an example of using expandable connector:

Engine system with sensors, controllers, actuator and plant that exchange information via a bus (i.e. via
expandable connectors):
import SI=Modelica.SIunits;
import Modelica.Blocks.Interfaces.*;
// Plant Side
model SparkPlug
 Real spark_advance;
 …
end SparkPlug;
expandable connector EngineBus
 // No minimal set
end EngineBus;
expandable connector CylinderBus
 Real spark_advance;
end CylinderBus;
model Cylinder
 CylinderBus cylinder_bus;
 SparkPlug spark_plug;
 ...
equation
 connect(spark_plug.spark_advance, cylinder_bus.spark_advance);
end Cylinder;

it can be seen that connect equation in this case connects Real value from spark_plug! but according to p.99

The connect-equation construct takes two references to connectors [a connector is an instance of a connector class],

so the tool gives an error for the example above.

There should be probably some clarifications on this case.


Migrated-From: https://trac.modelica.org/Modelica/ticket/1853

modelica-trac-importer commented 6 years ago

Comment by dietmarw on 10 Dec 2015 11:58 UTC In addition I strongly recommend to remove the wildcard import statement

import Modelica.Blocks.Interfaces.*;

As we really don't want to encourage that use and as far as I can see it's not even necessary in that example.

modelica-trac-importer commented 6 years ago

Comment by hansolsson on 6 Sep 2016 12:30 UTC Replying to [comment:1 dietmarw]:

In addition I strongly recommend to remove the wildcard import statement

import Modelica.Blocks.Interfaces.\*;

As we really don't want to encourage that use and as far as I can see it's not even necessary in that example.

With the correction to "RealInput spark_advance;" it would be used. The simplest idea is thus to replace it by import Modelica.Blocks.Interfaces.RealInput;

This is also reported in #1763 and thus I close this as duplicate.