Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

LabjackPython Program Flow & Layout


  • Please log in to reply
2 replies to this topic

#1 RedSpanner

RedSpanner
  • Members
  • 37 posts

Posted 28 August 2012 - 11:11 AM

Hello, I am planning an experimental setup which will have four - UE9 devices connected via Ethernet LAN to a single host processor. The UE9 will be configured identically, and will run identical code, but each will be connected to a different test chamber, with each chamber set up with a variation on a building envelope design. We will evaluate thermal performance of these different design options with the data supplied by the UE9 devices. These are long-term trials (8-16 months or better) and our data collection rate is relatively low, certainly less than 500 samples /minute. The UE9 will operate in command/response mode, with code written using LabjackPython. My questions revolve around the software design for multiple UE9 with long-duration operation. I have developed the Python scripts interactively, on a single UE9. 1. How should I loop over the UE9 to collect long-term data? I envisage a software timer operation which would trigger a command/response sequence to perform a reading, do minor calcs, writeout data, and turn on a heater if required. This would repeat essentially "forever", so I thought of using a "While..." loop with exceptions being used to exit the loop. Is this recommended? If so, what exception(s) should I plan to exit on? 2. Do you recommend using multiple threads to run each UE9, or should I contemplate running all the UE9 within a single process thread, but do system maintenance (things like hardware monitoring, perhaps offline data magt, etc.) in a separate threads, or do you recommend using threads at all? Any suggestions, either tied to my questions, or related to some important design aspect I have completely missed, would be welcome! Regards, Red

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 28 August 2012 - 02:46 PM

1. A while loop should be fine with exception handling. Depending on how you want your program to handle errors, you can exit on an exception or if you run into socket communication based or write/read exceptions you can try closing your UE9 and reopen it again to try to reestablish the TCP connection. If you run LabJackPython on Windows, the UD driver will attempt to re-establish the TCP connection for you. 2. There should be no issue with using different threads for different UE9s. Threads would be more efficient since you don't have to wait for other UE9s, though it can add more complexity to your program.

#3 RedSpanner

RedSpanner
  • Members
  • 37 posts

Posted 29 August 2012 - 12:38 PM

This is good, thanks for the advice. I'll try to code this and then post some snippets for comment. Cheers, Dean


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users