Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components of partial type in non-partial class #3435

Open
henrikt-ma opened this issue Nov 13, 2023 · 7 comments
Open

Components of partial type in non-partial class #3435

henrikt-ma opened this issue Nov 13, 2023 · 7 comments

Comments

@henrikt-ma
Copy link
Collaborator

This is an attempt to factor out a small part about the details of what it means to be a simulation model in #2999.

It seems strange to me that we're considering a formulation where it is both required that:

  • not partial
  • no components of partial type

Couldn't we deprecate having components of partial type in classes that are not partial?

@HansOlsson
Copy link
Collaborator

This is an attempt to factor out a small part about the details of what it means to be a simulation model in #2999.

It seems strange to me that we're considering a formulation where it is both required that:

  • not partial
  • no components of partial type

Couldn't we deprecate having components of partial type in classes that are not partial?

It is somewhat useful for some template-models.

To give examples consider a model such as: Modelica.Blocks.Examples.Filter where the source is replaceable instead - starting with (skipping some parameters):

model Filter "Demonstrates the Continuous.Filter block with various options"

  replaceable 
  Modelica.Blocks.Interfaces.SO source annotation (choicesAllMatching=true);
  Modelica.Blocks.Continuous.Filter CriticalDamping(...);

Here source is a component of a partial block, but the model itself doesn't have to be partial.

That can be used as a test-bench for different sources and you can have a similar situation for sub-components, e.g.,
Modelica.Electrical.Analog.Interfaces.VoltageSource wouldn't have to be partial - since the signalSource is partial.
It is not super-necessary, but a nice existing feature.

Note that Dymola since some years allow you to check such a model (by setting Advanced.Check.TopLevelStructural = true;) to ensure that the model is balanced (e.g., it would find a missing connection in Filter). That isn't possible for partial models, since there is no balancing requirement.

@HansOlsson
Copy link
Collaborator

I would thus propose to close this without any change; see discussion of template models in https://modelica.org/events/conference2008/sessions/session1a3.pdf

@henrikt-ma
Copy link
Collaborator Author

Here source is a component of a partial block, but the model itself doesn't have to be partial.

Good point. Let me reformulate:

Couldn't we deprecate having non-replaceable components of partial type in classes that are not partial?

@HansOlsson
Copy link
Collaborator

HansOlsson commented Dec 22, 2023

Here source is a component of a partial block, but the model itself doesn't have to be partial.

Good point. Let me reformulate:

Couldn't we deprecate having non-replaceable components of partial type in classes that are not partial?

Well, it could also be that the partial type is replaceable (or part of a replaceable package or ...).

So, the issue would be using a non-replaceable component of a partial type that is transitively non-replaceable in a class that is not partial. I don't know if deprecating that case would be that helpful, and whether I missed something.

@henrikt-ma
Copy link
Collaborator Author

henrikt-ma commented Dec 22, 2023

Well, it could also be that partial type is replaceable (or part of a replaceable package or ...).

So, the issue would be using a non-replaceable component of a partial type that is transitively non-replaceable in a class that is not partial. I don't know if deprecating that case would be that helpful, and whether I missed something.

I think you are describing additional situations where a model would effectively be partial, but it might be OK to not work out the exact classification of which models are effectively partial. It's just that there is currently a big gap between being declared as partial and effectively being partial, and we can shrink this gap by requiring that more models that are clearly effectively partial are also declared as such.

Hopefully, we can eliminate the gap entirely in the end, so that a (non-package) class not being declared partial means that it can be used as-is.

@eshmoylova
Copy link
Member

With the selective model extension you can have a partial non-replaceable component and still get rid of it by the time of simulation.

@henrikt-ma
Copy link
Collaborator Author

With the selective model extension you can have a partial non-replaceable component and still get rid of it by the time of simulation.

But aren't you then extending the class so that the class you want to simulate no longer has a partial non-replaceable component?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants