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

Invalid access of protected elements in SmoothStep example #4383

Open
maltelenz opened this issue Apr 11, 2024 · 2 comments
Open

Invalid access of protected elements in SmoothStep example #4383

maltelenz opened this issue Apr 11, 2024 · 2 comments
Assignees
Labels
bug Critical/severe issue L: Electrical.Analog Issue addresses Modelica.Electrical.Analog V: 4.1.0-dev Issue originates in MSL v4.1.0-dev (and is not present in earlier releases)
Milestone

Comments

@maltelenz
Copy link
Contributor

This:

oLine1.C.v=zeros(N1);
oLine1.L.i=zeros(N1 + 1);
oLine5.C.v=zeros(N5);
oLine5.L.i=zeros(N5 + 1);
oLine50.C.v=zeros(N50);
oLine50.L.i=zeros(N50 + 1);

Accesses these protected elements:

protected
Modelica.Electrical.Analog.Basic.Resistor R[N + 1](
R=rm,
T_ref=fill(T_ref, N + 1),
alpha=fill(alpha_R, N + 1),
useHeatPort=fill(useHeatPort, N + 1),
T=fill(T, N + 1));
Modelica.Electrical.Analog.Basic.Inductor L[N + 1](L=lm);
Modelica.Electrical.Analog.Basic.Capacitor C[N](C=fill(c*length/(N), N));

and is hence illegal, as reported by System Modeler:

Error: Modelica.Electrical.Analog.Examples.Lines.SmoothStep Invalid lookup of protected element. When looking up oLine50.L.i in scope Modelica.Electrical.Analog.Examples.Lines.SmoothStep, L is protected.
Protected elements can only appear as the first part of a component reference or path, and cannot be imported.

Error: Modelica.Electrical.Analog.Examples.Lines.SmoothStep Invalid lookup of protected element. When looking up oLine50.C.v in scope Modelica.Electrical.Analog.Examples.Lines.SmoothStep, C is protected.
Protected elements can only appear as the first part of a component reference or path, and cannot be imported.

Error: Modelica.Electrical.Analog.Examples.Lines.SmoothStep Invalid lookup of protected element. When looking up oLine5.L.i in scope Modelica.Electrical.Analog.Examples.Lines.SmoothStep, L is protected.
Protected elements can only appear as the first part of a component reference or path, and cannot be imported.

Error: Modelica.Electrical.Analog.Examples.Lines.SmoothStep Invalid lookup of protected element. When looking up oLine5.C.v in scope Modelica.Electrical.Analog.Examples.Lines.SmoothStep, C is protected.
Protected elements can only appear as the first part of a component reference or path, and cannot be imported.

Error: Modelica.Electrical.Analog.Examples.Lines.SmoothStep Invalid lookup of protected element. When looking up oLine1.L.i in scope Modelica.Electrical.Analog.Examples.Lines.SmoothStep, L is protected.
Protected elements can only appear as the first part of a component reference or path, and cannot be imported.

Error: Modelica.Electrical.Analog.Examples.Lines.SmoothStep Invalid lookup of protected element. When looking up oLine1.C.v in scope Modelica.Electrical.Analog.Examples.Lines.SmoothStep, C is protected.
Protected elements can only appear as the first part of a component reference or path, and cannot be imported.

@maltelenz maltelenz added bug Critical/severe issue L: Electrical.Analog Issue addresses Modelica.Electrical.Analog labels Apr 11, 2024
@maltelenz maltelenz added this to the MSL4.1.0 milestone Apr 11, 2024
@maltelenz
Copy link
Contributor Author

Same thing here:

oLine1.C.v=zeros(segsPerTrunk);
oLine1.L.i=zeros(segsPerTrunk + 1);
oLine2.C.v=zeros(segsPerTrunk);
oLine2.L.i=zeros(segsPerTrunk + 1);
oLine3.C.v=zeros(segsPerTrunk);
oLine3.L.i=zeros(segsPerTrunk + 1);
oLine4.C.v=zeros(segsPerTrunk);
oLine4.L.i=zeros(segsPerTrunk + 1);

@beutlich
Copy link
Member

Broken by 839ab4d for #4306. Not sure if the protected section was modified on purpose or accident. Given the commit message it does not look a necessary change.

@beutlich beutlich added the V: 4.1.0-dev Issue originates in MSL v4.1.0-dev (and is not present in earlier releases) label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: Electrical.Analog Issue addresses Modelica.Electrical.Analog V: 4.1.0-dev Issue originates in MSL v4.1.0-dev (and is not present in earlier releases)
Projects
None yet
Development

No branches or pull requests

6 participants