1

I am working on a large model that includes multiple subsystems, and a fairly large number of variables/equations. I have been using the protected attribute on subystems so that only the system level results are visible in the simulation results. This makes it easier to find system level results in the Dymola simulation tab or in FMU inputs/outputs. But there are cases where it would be nice to be able to see the full level of detail for the subsystems also.

Is it possible to conditionally apply the protected attribute based upon a Boolean parameter, or some other way?

For instance, is it possible to do something like the pseudocode below?

// Parameter that sets whether or not to use the protected attribute on subsystems.
parameter Boolean useProtected = true;

// Conditionally define the subsystem with or without protected attribute
if (useProtected) then
  protected subsystem subsystem1 = ...
else
  subsystem subsystem1 = ...
end if;

Thanks, Justin

Justin Kauffman
  • 423
  • 3
  • 10
  • related: http://stackoverflow.com/questions/7583567/searching-for-a-concept-like-verbosity-in-modelica – matth Aug 09 '16 at 08:17

2 Answers2

2

See HideResult annotation: https://modelica.org/documents/ModelicaSpec33Revision1.pdf

subsystem subsystem1 annotation(HideResult = true / false);
Adrian Pop
  • 4,034
  • 13
  • 16
1

Using HideResult is one possibility - another is to always make it protected, and store the protected variables ("Simulation Setup>Output>Store Additional variables") when you want to investigate it.

Hans Olsson
  • 11,123
  • 15
  • 38