Page 1 of 1

close/open input and Availability control

Posted: Thursday 09 January, 2014 - 14:08
by renevandewall
Hi all.

I have a problem with using the availability control in combination with the openinput/closeinput scripts.

I want to close the inputchannel of atom 'X' in the beginning of a simulation run, and use the code

Code: Select all

closeinput(atombyname([X],model)

in the Initialize atom. This works fine when I run the model.

However, when I add an availability control atom to my model to control a different atom 'Y', the previous code doesn't seem to work anymore.
Note that I connected the Availability control atom only to atom Y, not to atom X.

Why does this occur and how can a solve this problem in such way that my openinput/closeinput commands work, in combination with the use of a availability control atom?

Thank you in advance,
René

Re: close/open input and Availability control

Posted: Thursday 09 January, 2014 - 14:50
by marlies
Hi Rene,

Is the option "On Reset" in you initialize atom selected or not (it should be not selected)?

Regards, Marlies

Re: close/open input and Availability control

Posted: Thursday 09 January, 2014 - 14:56
by renevandewall
Hi Marlies,

That is indeed the problem here,
I completely overlooked that box.

Thank you for the quick reply.

René

Re: close/open input and Availability control

Posted: Thursday 09 January, 2014 - 15:31
by marlies
Hi Rene,

Good that it has been solved. What happens is that each atom itself opens the input on reset. When you use the command closeinput in the OnReset of another atom (what happens if you select the option in the initialize) then the input will be closed, but the atom itself will reopen it again. It could work (as you said), but only when the initialize atom is placed below the atom to be controlled in the model tree.

When you deselect the option onreset, the code will be executed on the very start of the simulation but after the reset of all atoms. That's why it's working now.

Regards, Marlies