09-24-2013 06:21 AM
Hi,
I just want to ask you guys and girls, I'm writing application to control 10+ machines via tcp/ip. I have prepared producer consumer with events and notification. There is main loop for gui control, 2nd loop is engine_loop where Im executing commands and do decode msg that are sent from tcp handle, in third loop im just waiting form msg from remote machines. I have used cluster to bundle controls ref, data queue, notificators, clients ips. Queues are used for sending commands and data from tcp/ip, notification is used to stop loops. What do you think is it ok? Or should I change something?
Thanks
09-24-2013 10:06 AM
From what I see, and what you've written, it looks like you have a good foundation for your code.
The only thing I can comment on right now is that since you are looking at 10+ machines, keep that in mind as you go forward so that what you do is scalable. How do you identify the different machines and are certain the machines are getting the right message meant for it? How do you know which machine has sent a particular message? Having some sort of identifier will be critical. If you need to have multiple queues, or multiple message streams, you'll need to store the data for each machine in some sort of array. That may be TCP/IP connection references, or queue references or ..... A functional global variable would be useful to store this data and retrieve it from different areas of code.
I'm sure someone here will join in and say this is an ideal application for using classes. But I've never programmed in LabVIEW with object-oriented tools or classes to be able to comment there.
09-25-2013 01:15 AM
Thank you for replay.
About scalable, I had to prepare it for production line in factory so in next few years it wont change in number of clients, in case if we add some new machines I think it will be easy to modify. If you look at front panel you will see 18 boolean controls, I have prepared VI to get references for boolean control named SWD XX and put them to array, in each sub VI this array of references is used to identify, communication, etc.. So if we add new SWD 99 it will work. All IP are saved to ini files. Also communication is just simple command>execute on client>response. machine_number:command_recived 05:OK and if there is response requaired 05:OK:RESPONSE
Best Regards