modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
466 stars 166 forks source link

Inconsistent partial model naming in Modelica.Magnetic #496

Closed modelica-trac-importer closed 4 years ago

modelica-trac-importer commented 7 years ago

Reported by christiankral on 4 Feb 2011 14:18 UTC The partial models

Current Implementation

FluxTubes.Interfaces.PartialTwoPortsElementary

partial model PartialTwoPortsElementary 
  PositiveMagneticPort port_p;
  NegativeMagneticPort port_n;
end PartialTwoPortsElementary;

FluxTubes.Interfaces.PartialTwoPorts

partial model PartialTwoPorts 
  extends FluxTubes.Interfaces.PartialTwoPortsElementary;
  SI.MagneticPotentialDifference V_m;
  SI.MagneticFlux Phi;

equation 
  V_m = port_p.V_m - port_n.V_m;
  Phi = port_p.Phi;
  0 = port_p.Phi + port_n.Phi;
end PartialTwoPorts;

FundamentalWave.Interfaces.PartialTwoPort

partial model PartialTwoPort 
  PositiveMagneticPort port_p;
  NegativeMagneticPort port_n;
end PartialTwoPort;

FundamentalWave.Interfaces.PartialTwoPortElementary

partial model PartialTwoPortElementary
  extends FundamentalWave.Interfaces.PartialTwoPort;
  Modelica.SIunits.ComplexMagneticPotentialDifference V_m;
  Modelica.SIunits.ComplexMagneticFlux Phi;

equation 
  V_m = port_p.V_m - port_n.V_m;
  port_p.Phi = Phi;
  port_p.Phi + port_n.Phi = Complex(0,0);
end PartialTwoPortElementary;

The naming of the partial models in the fundamental wave library is simply a bug.

Additional Issues

The term port used in the magnetic and thermal domain refers to a connector and it represents two pins or plugs in the electrical domains. We should come up with some clarification here. We should also unify whether or not we should used the term Partial in the class name. We have various different implementations in the MSL.

The implementation of partial models is even entirely different throughout the package Modelica.Electrical:

However, a unification of namings and implementations is highly desirable since all the differences are confusing to experienced and news users. I understand that we do need a conversion script for renaming partial models; so we do have wait for Modelica 4, I suppose.

Proposal

So here we have lot very different namings with different implementations. On my opinion we need three different partial model types:

Naming may be discussed.


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

modelica-trac-importer commented 7 years ago

Comment by dietmarw on 4 Feb 2011 15:38 UTC Christian,

if I understand your proposal correctly then the different classes would be defined as follows (taking TwoPin as an example):

modelica-trac-importer commented 7 years ago

Comment by christiankral on 4 Feb 2011 16:45 UTC Right, thats the way I meant it; the reason why TwoPin is suitable for textual programming, is because it already contains the flow balance:

partial model TwoPin
  extends TwoPinElementary;
  p.i + n.i = 0;
end TwoPin;

In this case I cannot make a graphical connection between the positive and negative pin when extending from this class.

modelica-trac-importer commented 7 years ago

Comment by dietmarw on 4 Feb 2011 21:01 UTC Right I see. Thanks for explaining. Otherwise I'm most definitely for removing Partial from the name. Since this is part of the model specifications it should be the job of the tool to highlight that if wanted and not done clumsily by putting the already present information also in the name :)

modelica-trac-importer commented 7 years ago

Comment by dietmarw on 1 Aug 2015 21:36 UTC Milestone renamed

modelica-trac-importer commented 7 years ago

Comment by dietmarw on 1 Aug 2015 21:39 UTC Milestone renamed

christiankral commented 5 years ago

I will create a PR to remove Partial from the names and fix the naming issue with of the TwoPorts.

beutlich commented 5 years ago

Reopen since #2998 did not address Magnetic.FluxTubes.

christiankral commented 4 years ago

When going through #3341 I realized that we still have two different naming conventions in the magnetic domain: TwoPort vs TwoPorts. I suppose this shall be fixed before releasing v4.0.0. @dietmarw, @beutlich and @AHaumer do you agree?

The following list shows the difference w.r.t. the elementarty ports:

At the end one question remains: TwoPorts or TwoPort? Any suggestions?

Other domains use, for example:

dietmarw commented 4 years ago

A quick search led me to https://en.wikipedia.org/wiki/Two-port_network So I'm for TwoPort.

christiankral commented 4 years ago

OK then. So I will create a PR to fix the names of

beutlich commented 4 years ago

Closing again after merge of #3426.