3

I have a problem in that I need to run multiple simulations using a previously saved SimState with different randomness seeds. I haven't managed to get this to work yet.

I have tried using

set_param('mod/Random Number', 'Seed', '3324')

and this works if I don't use a previously saved SimState, but as soon as I try this with a SimState all simulations still end up with the same random numbers (I guess that the newly set seed is being ignored and instead the seed saved in the SimState is being used, although I have tried looking at the SimState data structure and I couldn't really figure out if it even contains the past seed and if it does how I am supposed to go about changing it).

What would be my best approach here? Ideally I would simply call a single function (shuffle_seeds) and all seeds in all random block would be reset to something new.

Note: my temporary solution is to use a custom input port (at root level) and then giving that input uniformly or normally distributed numbers for each timestep, but this is not a very nice solution (and quite tricky to get to work as the values are interpolated if a sampling time smaller than 1 is used in any other block).

o1iver
  • 1,805
  • 2
  • 17
  • 23

1 Answers1

1

Do you have "Inline Parameters" turned on or off? If you have it turned on, you can try to make the seed parameter a tunable parameter. There's more information on tunable parameters in the documentation. If Inline Parameters is off, I think it will just work because the SimState won't be in the SimState, although I'm not positive about that.

MikeT
  • 1,624
  • 8
  • 12
  • Hey. I just checked and 'inline parameters' is off. If I understand you right this means that the problem is something else right? – o1iver Feb 08 '12 at 09:16