I want to create a thread and let FlexSim report some data to another server once a second. Is it possible to create a separate thread that does this job?
To create a thread you would have to use C++. See this answer for an example of using a thread.
You might be able to do this with the setticker(node thenode[, num tickspersecond]) command.
Here are some links about using c++:
Also, I am not looking for the exact thread concept. Anything with the behavior that executes a FlexScript snippet once a second on the side is enough
@Yue Y That's what setticker() does. It executes a flexscript / cpp node x times per second.
Is this command executed separately from the the simulation process? Will it block the whole simulation?
Could you give an example of using setticker? Especially what does the first parameter look like?
Hi @Yue Y,
Please find attached a sample model showing usage for setticker(). In my testing, it appears that the tickspersecond parameter must be >=1.
Call setticker() after the model run has started - for instance on some object or model trigger, or on a scheduled user event.
The command executes the node for "tickspersecond" times every second of physical time. Is there any similar function that works for simulation time(eg. execute once every 5 simulation time units)? I am considering using physical time x speed in this function but if the simulation is stopped or blocked, this function will still be executed. Any other command that I can use?
If you want to repeatedly execute a function in simulation time, use a repeating User Event:
Could you please give an example of creating an user event that can execute custom code repeatedly in FlexScript? Thank you!
13 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