09-17-2021 10:54 AM
Hi,
I just learned about DQMH a few days ago have decided to use it for my next project. My project is pretty standard one - testing product in a thermal chamber and controlling stimulus test equipment and monitoring, displaying, logging data from measurement test equipment.
I've come up with a rough architecture of the program and wanted to get some feedback from the DQMH community to determine whether this will work.
My goal from using the DQMH is to make my program as modular as possible.
Here are the modules I want to create:
CONFIGURATION MODULE - This is used by the operator to set configuration data for instruments, file data paths, etc.
CHAMBER CONTROLLER - Get config data from CONFIGURATION MODULE and set instr config settings. Sets ramp rate, set temp set point, enables/disables chamber, acquire temp data.
DMM MODULE - Get config data from CONFIGURATION MODULE and set instr config settings. Get measurement readings
PSU MODULE - Get config data from CONFIGURATION MODULE and set instr config settings. Enable/disable PSU.
DISPLAY MODULE - Provides live graph/chart of data (temp, voltage, current) to a GUI during runtime. Gets data from CHAMBER, DMM, PSU MODULES.
LOGGER MODULE - Logs data to file. Gets data from CHAMBER, DMM, PSU MODULES.
MAIN MODULE - Controller for system. My goal would be that for future projects, all I would need to do is revise this program/module and just reuse the other modules and not have to modify the other modules at all.
Does anyone see any issue with my current architecture? Any tips for improvement? My program needs to be ran for up to a month, 24/7 so I need this to be robust.
Also I'm still trying to understand how the Round Trip event would be useful? What are typical use cases?
Any feedback is appreciated. Thank you!
09-17-2021 11:11 AM
Sounds like a good general start.
I would draw some bubble diagrams similar to what Anti-doc generates. It will help you manage dependencies.
I would certainly change some of your terminology.
Instead of the DMM getting the configuration data (which implies it knows where to get it from), I would have the Main Module supply the configuration data to the various modules.
If the display and logger modules aren't intended to be reused then having them register directly for broadcasts from the various modules might be ok.
You really just want to give thought to your message routing and your dependencies.
See these:
https://www.sasworkshops.com/simple-dqmh-dos-donts/
09-17-2021 11:19 AM
thank you for the advice!
09-17-2021 05:30 PM
I second what Sam said.
Be purposeful in your design and the relationships between each module. Once you establish, try not to break that design.
Try to avoid having all modules talk to any module they choose. This leads to circular dependencies, which results in some tricky debugging challenges. And it won't make things reusable.
Follow Sam's advice from his article: "Do be very cognizant of coupling"
09-17-2021 05:59 PM
The other thing that helps is to run AntiDoc often. It will easily show your dependencies and where you have issues like circular dependencies.
That lets you do a little less design upfront. You can almost use it like an iterative design tool. Say you have some feature where you need to add a bunch of messages. You can quickly add a bunch of messages and get it working with some tests in place. Then you can run Antidoc and make sure the dependencies look ok and if they don't then just refactor until they do.
09-18-2021 07:47 AM
Suggestions:
You're more likely to get reusability from your three hardware modules than your other ones, so pay most attention to making them independent. Consider letting those modules handle allowing the User to adjust configuration parameters, with the Main module handling reading and writing to a config file (eliminating the "configuration module" entirely).
09-20-2021 03:10 PM
I think what I am going to do for the logger module is have it send request and wait for reply events to the instrument modules and have them return the measurements (temp, current/voltage, etc.). Is there any problem in doing this? Acquisition rate is probably at most 1 acquisition per second.
Can someone please explain the use case for the "wait for reply" terminal of the Request event? I understand it has something to do with async vs synchronous communication but can some one explain when I would set the "wait for reply" terminal to true/false?
Also, what is an example of when would you use the "Round Trip" event?
Thank you!!!
09-20-2021 04:14 PM
Why something synchronous?
also does your logger need to know about the instruments? Adding an instrument would then require changing your logger.
Couldn't your logger have a request that says log this piece of data (with some kind of identifier telling you what channel)?
Then whatever launches your logger and instruments registers for the broadcasts from the instruments and forwards them to the logger.
The wait for reply flag is just that, do you want to wait for a reply or not? Depending on the context the caller (module sending the request) may care about the return or may not. If you don't care about the return data, no sense in waiting.
for the round trip: (from the DQMH help)
So you have a module, say a power supply and you have a request that sets the voltage. You may want that to be synchronous because you want to make sure that is set correctly before you do the next thing. So you would make it a request and wait for reply event. But let's say you also want other modules in your program to be notified when the voltage changes. If you make it a roundtrip message, then the module will also broadcast the new voltage in addition to returning it as part of the wait for reply data.
It's honestly mostly a convenience, because you could just create the broadcast yourself.
09-23-2021 02:32 PM
Why is that called a "Roundtrip"? That seems non-intuitive. I would have guessed that something called a roundtrip would involve circular message passing like A-->B-->C-->A.
09-23-2021 03:45 PM
@drjdpowell wrote:
Why is that called a "Roundtrip"? That seems non-intuitive. I would have guessed that something called a roundtrip would involve circular message passing like A-->B-->C-->A.
Ask Fab.