Opened 10 years ago
Last modified 4 years ago
#3070 accepted defect
Noise package does not work (replaceable package + function objects)
Reported by: | 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)
Change History (9)
by , 10 years ago
Attachment: | TestRandomFeatures.mo added |
---|
comment:1 by , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → accepted |
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 , 10 years ago
Component: | Code Generation → Frontend |
---|
With the current trunk Version5 works fine and all other version have flattening issues.
follow-up: 7 comment:5 by , 10 years ago
Version4 is a problem with +d=scodeDep (+d=noscodeDep works fine). saveTotalModel fails since the scodeDep fails.
comment:6 by , 10 years ago
Cc: | added |
---|
comment:7 by , 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 , 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.
Sorry forgot: There are example test models under
and all of the fail during translation.