Opened 10 years ago

Last modified 4 years ago

#3070 accepted defect

Noise package does not work (replaceable package + function objects)

Reported by: martin.otter@… Owned by: Adrian Pop
Priority: high Milestone: Future
Component: Frontend Version: trunk
Keywords: Cc: Andreas.Kloeckner@…, Martin Sjölund, Mahder Alemseged Gebremedhin, Peter Fritzson, Per Östlund

Description

DLR is currently restructuring the Noise package that is planned to be included in MSL 3.2.2. The package shall be very flexible ((a) the uniform random number generator to be used can be selected globally, (b) the random number according to a specific distribution can be selected for every instance and (c) this instance uses the globally selected uniform random number generator. Unfortunately, OpenModelica 1.9.1 (r22929) is not able to handle it.

Find attached several different variants in order to find a version that runs in OpenModelica. Neither of them runs in OpenModelica:

  • TestRandomFeatures.Version2 is the desired one with the desired flexibility. OpenModelica complains during flattening.
  • TestRandomFeatures.Version1,Version3,Version are simplified versions (not as flexible as desired), but still OpenModelica complains during flattening.
  • TestRandomFeatures.Version4 is a very simplified version and OpenModelica generates C-Code. However, the C-compiler reports errors (incompatible type for argument 1 of 'sub_alloc_integer_array').

Please, fix OpenModelica that at least Version5 is running. Even better, please try to generalize OpenModelica so that Version2 is running

Attachments (1)

TestRandomFeatures.mo (83.2 KB ) - added by martin.otter@… 10 years ago.

Download all attachments as: .zip

Change History (9)

by martin.otter@…, 10 years ago

Attachment: TestRandomFeatures.mo added

comment:1 by Lennart Ochel, 10 years ago

Cc: Martin Sjölund Mahder Alemseged Gebremedhin added

comment:2 by martin.otter@…, 10 years ago

Sorry forgot: There are example test models under

TestRandomFeatures.VersionX.Blocks.Examples.Noise.TestX

and all of the fail during translation.

comment:3 by Adrian Pop, 10 years ago

Cc: Peter Fritzson added
Owner: changed from Lennart Ochel to Adrian Pop
Status: newaccepted

At a first glance for model TestRandomFeatures.Version2.Blocks.Examples.Noise.Test1 there is an issue with lookup of outer model.Package.constant inside
TestRandomFeatures.Version2.Blocks.Noise.EventBasedNoise:

outer GlobalSeed globalSeed;
constant Integer nState = globalSeed.Generator.nState;

I'm not yet sure this is valid Modelica as "." notation as far as I know is restricted to variables and functions (such as gravityAcceleration) but not packages.

comment:4 by Willi Braun, 10 years ago

Component: Code GenerationFrontend

With the current trunk Version5 works fine and all other version have flattening issues.

comment:5 by Martin Sjölund, 10 years ago

Version4 is a problem with +d=scodeDep (+d=noscodeDep works fine). saveTotalModel fails since the scodeDep fails.

comment:6 by Adrian Pop, 10 years ago

Cc: Per Östlund added

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

Replying to sjoelund.se:

Version4 is a problem with +d=scodeDep (+d=noscodeDep works fine). saveTotalModel fails since the scodeDep fails.

Fixed in r24465, Version4 seems to flatten successfully now.

comment:8 by Per Östlund, 4 years ago

Current status is that version 1 and 2 are invalid due to the reason adrpo mentioned earlier, 4 and 5 simulates successfully, and 3 fails because of some weird type casting issue involving tuples.

Note: See TracTickets for help on using tickets.