Opened 12 years ago
Closed 12 years ago
#2069 closed defect (invalid)
Print in initial if equation gets printed a lot of times. It should only be one.
Reported by: | Adrian Pop | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Run-time | Version: | trunk |
Keywords: | Cc: | Lennart Ochel, Jens Frenkel, Willi Braun |
Description
Running the Printing model below:
model pp parameter Boolean use_eps_Re = false; initial equation if not use_eps_Re then Modelica.Utilities.Streams.print("This message is printed a lot of times\n"); end if; end pp; model Printing pp p1; end Printing;
gets you this output:
true "" true "" record SimulationResult resultFile = "c:/bin/cygwin/home/adrpo/dev/OpenModelicaNoChanges/build/bin/Printing_res.mat", simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'Printing', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''", messages = "This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times This message is printed a lot of times ", timeFrontend = 0.9926807907810223, timeBackend = 0.02736551968387237, timeSimCode = 0.010966687646885593, timeTemplates = 0.015018372127490439, timeCompile = 1.2807719180732076, timeSimulation = 0.11194621364792114, timeTotal = 2.4388403520827198 end SimulationResult; ""
Change History (4)
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 12 years ago
comment:3 by , 12 years ago
Of course, as Martin points to me via Skype it seems to depend on how many instances of Modelica.Fluid.System are used in the Model, so our mileage might vary.
comment:4 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | accepted → closed |
Modelling error:
With the prefix keyword impure it is stated that a Modelica function is impure and it is only allowed to call such a function from within:
- another function marked with the prefixes impure or pure
- a when-equation, or
- a when-statement.
print is impure (although we do not support this feature yet, etc).
If you want to make another ticket to avoid evaluating the initial equations many times (for performance reasons), feel free to do so. The function should be called at each step to ensure it triggered no assertions.
Same happens for assert(..., "Message", warning); instead of print.
But only 7 times it seems :)
See the output of some of the AVM models.