Opened 9 years ago

Last modified 7 years ago

#3925 assigned defect

Protected variables are incorrectly written to the result file

Reported by: Francesco Casella Owned by: Per Östlund
Priority: low Milestone: 2.0.0
Component: Run-time Version:
Keywords: Cc:

Description

I have some models where I am trying to make the size of the result file more manageable by making protected the internal variables of a model which are not of interest. I can do it in two ways:

  • put some variables in a model inside the protected section
  • for composite model, declare the sub-models in the protected section, so that their entire contents become protected

In both cases, the corresponding variables are correctly marked as isProtected = "true" hideResult = "false" in the _init.xml file. However, the variables from the first set are correctly not written to the result file, while the variables from the second set are written to the file.

Q1: Why is this happening?

Q2: Shouldn't the simulation runtime use the attributes from the XML file to decide whether or not a variable needs to be saved onto disk?

I can provide the test case privately to any interested developer.

Change History (8)

comment:1 by Rüdiger Franke, 8 years ago

PR1156 should do it.

comment:2 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:3 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:4 by Francesco Casella, 7 years ago

Milestone: 1.12.02.0.0
Owner: changed from somebody to Per Östlund
Status: newassigned

@perost, can you make sure all variables from protected model instances are not written to file with the new front-end? As of today, the new FE produces wrong generated code.

in reply to:  4 ; comment:5 by Per Östlund, 7 years ago

Replying to casella:

@perost, can you make sure all variables from protected model instances are not written to file with the new front-end? As of today, the new FE produces wrong generated code.

The new frontend currently does not mark elements of a protected class instance as protected, because from the point of view of the instantiation they aren't protected. If they were marked as such the check for access of protected variables wouldn't work correctly. The old frontend did mark such elements as protected, but this didn't cause any problems since it didn't check the visibility during lookup anyway.

But it should be fairly easy to pass protected downward during the conversion to the DAE, so that components become protected if any of their parents' are protected. Then it won't interfere with the instantiation since it's done after, and should have a negligible impact on performance.

Also, in the description you say that you declare sub-models for composite models in the protected section, but I assume you mean sub-model instances?

in reply to:  5 ; comment:6 by Francesco Casella, 7 years ago

Priority: highlow

Replying to perost:

The new frontend currently does not mark elements of a protected class instance as protected, because from the point of view of the instantiation they aren't protected. If they were marked as such the check for access of protected variables wouldn't work correctly. The old frontend did mark such elements as protected, but this didn't cause any problems since it didn't check the visibility during lookup anyway.

OK.

But it should be fairly easy to pass protected downward during the conversion to the DAE, so that components become protected if any of their parents' are protected. Then it won't interfere with the instantiation since it's done after, and should have a negligible impact on performance.

Good. It's not high-priority as of today, but it could be useful later on

Also, in the description you say that you declare sub-models for composite models in the protected section, but I assume you mean sub-model instances?

Of course.

in reply to:  6 ; comment:7 by Per Östlund, 7 years ago

Replying to casella:

Good. It's not high-priority as of today, but it could be useful later on

I implemented it anyway in e163ff57, because it will save me time when comparing flat models between the old and new frontend.

But I'm not sure what the issues with the old frontend are, so I don't know if this actually solves this particular issue.

in reply to:  7 comment:8 by Francesco Casella, 7 years ago

Replying to perost:

But I'm not sure what the issues with the old frontend are, so I don't know if this actually solves this particular issue.

I need the NF to be good enough to flatten my test cases in order to tell

Note: See TracTickets for help on using tickets.