I am developing a MATLAB App Designer GUI for a measurement system
Show older comments
The GUI needs to:
- connect to multiple instruments:
- Keysight P5001A VNA IVI-c (and TCP/IP commands?)
- Pyrometer (RS-485 serial)
- Amplifier HBH (TCP/IP)
- Powermeter Anritsu (TCP/IP)
- perform continuous measurements using a timer
- update plots in real time
- allow start/stop of measurements safely
- handle connection/disconnection
My question is about software architecture:
Should I:
• implement each instrument as a separate MATLAB class?
• store instrument objects as properties of the app?
• use a single timer or multiple timers?
• separate GUI and measurement logic?
I already got told that there is a problem using two TCP/IP devices simultanius, as its overwrites the connection. I Already have a class for the two VNA´s i am using and a little example codes. Nonetheless i am still confused how to beginn and what to look for. So are there recommended design patterns or examples?
Thanks for Kind help in advance!
5 Comments
Walter Roberson
34 minutes ago
I do not recall hearing about problems with using multiple TCP/IP simultaneously. Would you happen to have links about that problem?
Ajas
9 minutes ago
dpb
about 1 hour ago
I don't know of any specific examples that illustrate more than just one but I don't see anything in the doc for tcpclient that indicates you can't a connection on different ports for each instrument. Presuming you have the device(s), can't you just try that? It would seem maybe you already have from the sample code you do have written?
As for the generic questions, my recommendation is to not worry overmuch about the GUI initially; you can call any MATLAB code from the app although certainly you will want to maintain all the pertinent instrument instances in the globall "app" structure for easy reference throughout the app and in the callbacks.
As for timer(s), since each of these instruments is going to be running independently, it depends a little on whether they are triggered or polled to return readings and whether there's a triggering event that occurs before reading a response or if you are just polling continuous data streams. If you had the parallel TB, it might be possible to spawn each instrument into its own thread and then broadcast a trigger to each from a single timer; there will still be a slight time skew owing to the different latency and response time of each instrument. Otherwise, the choice would seem to be to have the time trigger a poll request to each device.
I wouldn't see there being a need nor any advantage in adding complexity of trying to have multiple independent apps; that just adds yet another level of complexity.
Ajas
7 minutes ago
Walter Roberson
about 1 hour ago
Typically it is better to run the device asynchronously and have them serviced by callbacks.
Unless, that is, the devices need to be polled for current values
Answers (0)
Categories
Find more on Interface-Based Instrument Communication in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!