My understanding is that when waiting for a state change event, the new state value can be accessed (matched, assigned, etc). Is there a method to access the old value?
My understanding is that when waiting for a state change event, the new state value can be accessed (matched, assigned, etc). Is there a method to access the old value?
When the event is triggered the state on the BasicFR object is still the old state, so you can detect the new and old.
Hi Jason. Thank you for the response.
Are there plans to add to/from to the event params in the future? Right now I don't see any other way to match 'from' without triggering on every state change and checking current state in a separate block, which I imagine would be a hit to performance as tokens need to be created and more events are added to the event queue.
I've attached an example model for the solution I'm thinking.
The old value is exposed in the On State Value Change event, or in the OnChange event of the state profile, if you listen to that directly. However, the UI for the Wait for Event or Event Triggered Source shows the Tracked Variable event UI, which doesn't let you work with the old value. You can set up a custom listener, if you really need those values. But it's usually bad practice to try to define model logic based on state change, for two reasons:
Usually, there's some other approach that avoids all of these issues. I'd recommend looking for some other approach. If you post a new question, and explain why you needed the old value (along with a demo model), we may be able to help you find a better alternative.
17 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved