Runtime termination of user Event

Runtime termination of user Event

aaditya_j
Not applicable
54 Views
6 Replies
Message 1 of 7

Runtime termination of user Event

aaditya_j
Not applicable

Can we disable user event in run time? after some iterations or model time?

0 Likes
Accepted solutions (1)
55 Views
6 Replies
Replies (6)
Message 2 of 7

joerg_vogel_HsH
Mentor
Mentor

have you tried to wite the condition directly in the user event code like

if(time() < 1000)
{ 
   // execute your previous FlexScript source code 
}
0 Likes
Message 3 of 7

aaditya_j
Not applicable

but the event will always be fired right?

0 Likes
Message 4 of 7

joerg_vogel_HsH
Mentor
Mentor

yes. You have an option to repeat in the user event? Perhaps you can change the flag or value in an attribute node dynamically. But I am not sure that you can manipulate this after hitting run.

0 Likes
Message 5 of 7

aaditya_j
Not applicable

Anyways the model is speed up with using time()<XXX thanks for the support

0 Likes
Message 6 of 7

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

The Repeat event option is a variable. You can activate and deactivate the value by FlexScript source code. You need the reference to the Event Object in the model tree in the subtree Tools.

setvarnum(userEvent,"repeat",0);

This deactivates the repeat option. If you need the ability to repeat the event after reset you have to activate it manualy in the user event properties, or by an OnReset trigger and source code.

0 Likes
Message 7 of 7

aaditya_j
Not applicable

Thanks this seems to be better option for me.

0 Likes