08-12-2010 08:46 PM
Hi,
I have two working VIs with me and now i wish to integrate them together. Let me briefly explain the role of each VI.
Dynamic VI: This VI simulate the dynamic of a vehicle. It starts from position 0,0,0 (X,Y,Z) and ends at a user defined target position. The output of this VI is the position and velocity. I am using a 'control and simulation loop' for this simulation.
TCP VI: This VI establish the TCP communication/transmission with an external device. I am using a flat sequence structure for this VI. This is because i need to first send an initialization message (only once) then follow by a 30s delay and then sending the 'dynamic' message (in a while loop, till velocity =< 0).
Now i need to incorporate both VIs together because the output of the Dynamic VI is meant for the "dynamic message" in the TCP VI. If i put both the control and simulation loop and the flat sequence structure together in a single VI, i will not get what i want. This is because once the run button is depressed, both function will start at the same time. Remember that the TCP requires at least 30s (because of the 30s delay needed) to establish connection with the external device, therefore the output from the control and simulation loop (dynamic output) in the first 30s will not be send via TCP to the external device.
Therefore, i would like to ask how i can incorporate my two VIs together into a single VI and also create a delay in the control and simulation loop whereby it will only start to simulate about 60s after the run button has been activated. Please advise. Thank you.
08-12-2010 10:34 PM
have a look at this state machine tutorial. This is what you want. It will allow you to wait 30 seconds without using a flat sequence structure. It will also allow for the user to press stop and have your program quit immediately. I'm guessing now if you press stop it has to wait 30 seconds before it will end.