You are here

Helpers in IOTools directory do not appear in run model environment

I was trying to figure out how to initialize a random-number generator, but ran into trouble when I could not find it in the run-time environment when I looked under the Add menu in the run-time environment. I looked at various help pages, which lead me to to IOTools folder. There I see a tool called Setrand.tcl, which I assume is what I am looking for. How do I get this to appear in my list of available tools? I am running a v6.3p2 standard, 64-bit on a Mac running Yosemite. I also see some other tools that are also not appearing in the run-time environment list.

Thanks, Dale 

Reporter: 
daler6
Created: 
Sun, 05/04/2015 - 23:48
Updated: 
Tue, 05/05/2015 - 09:47

Comments

Interesting...the tool coded by setrand.tcl should appear in the Add I/O Tools menu with the title "Initialize pseudo-random", but for some reason it isn't there. I'll look into it.

Got it -- the tool has been deactivated. In recent versions of Simile, each model runs in its own thread, while the user interface runs in the master thread, so this tool needs to set the random seed in the appropriate worker thread. I'll fix the tool up to do this (also needs some changes to Simile itself to allow access) and include it in the next release, which should be out in a week or so.

Thanks. By the way, I am using Simile in a class and would like the students to use this feature in the near future. Will this fix be applied to the Teaching version at the same time?

Dale

Yep, new release should be out tomorrow and all versions and editions will be updated

Now using version 6.4

I can now select Initialize pseudo-random under the Add menu when setting up a helper page. However, after I enter an integer value and click on Set seed, I get an error message telling me "Error: can't upvar from variable to itself". The details are provided below. Any assistance would be appreciated.

Dale S. Rothman

can't upvar from variable to itself
can't upvar from variable to itself
    while executing
"variable value"
    (object "::helper8" method "::similescript::setrand92383::Done" body line 2)
    invoked from within
"::helper8 Done"
    invoked from within
".mre2.mainpw.mainDisplayPane.notebook.fpage7.panedwindow.pane0.container.bt invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tk::ButtonUp" line 23)
    invoked from within
"tk::ButtonUp .mre2.mainpw.mainDisplayPane.notebook.fpage7.panedwindow.pane0.container.bt"
    (command bound to event)

I have absolutely no idea what happened here. I've made a new version of the tool and attach it here. You can either replace the version in your Simile installation with it, or add it in the IOTools folder under your own folder. I changed the key value and name so it does not interfere with the packaged version if both are installed.It should work OK.

Note that to be able to attach the file to this forum I had to change the extension from .tcl to .txt -- you need to change it back in order for it to work.

Thanks. This seems to be working now. By the way, I notice that each time I reset the model, I first have to click on the Set Seed button even if I have not changed the random number seed. For future versions of this tool, it would be nice if this were only necessary when the random number seed is changed.

One might not always want that behaviour, e.g., one might want the same series of values over several runs but each run different -- but it might be worth adding a checkbutton for 'load this seed every reset'.