close/open input and Availability control

All topics on the Atoms in any Enterprise Dynamics Library.
Post Reply
renevandewall
Posts: 12
Joined: Thursday 19 September, 2013 - 15:45

close/open input and Availability control

Post 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é
marlies
Posts: 301
Joined: Monday 17 January, 2011 - 09:28

Re: close/open input and Availability control

Post by marlies »

Hi Rene,

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

Regards, Marlies
renevandewall
Posts: 12
Joined: Thursday 19 September, 2013 - 15:45

Re: close/open input and Availability control

Post by renevandewall »

Hi Marlies,

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

Thank you for the quick reply.

René
marlies
Posts: 301
Joined: Monday 17 January, 2011 - 09:28

Re: close/open input and Availability control

Post 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
Post Reply