02-02-2023 02:36 AM
Hi all,
1. During my work in DQMH projects I found my self again and again asking the following question:
Let's assume that I send a request from module A (the CML UI for example) to module B, and then I need module B to do a second task after the first one ends. The question is what from the following options is the reccomended one for doing this:
a. Self mesaging - the "traditional" way (until I start with DQMH I used this a lot. I know that for repeatedly task the preffered way is using a helper loop but when it is not a repeatedly task I am not sure if this option is OK or not).
b. A Broadcast of module B and then a second request from module A to module B - it will work but maybe it's too complicated.
c. A request from module B to itself after the first task ends (Self request)
2. A second question is about helper loops:
When I have a repeatedly task that is a quering of a HW (for example - a position of a motion control). Is it OK to insert a while loop into the timeout event? If I do so, the event structure of the helper loop is busy every iteration until the loop ends. is there another way to do it?\
Thank you,
Roey
02-02-2023 05:45 AM
@Roey wrote:
Hi all,
1. During my work in DQMH projects I found my self again and again asking the following question:
Let's assume that I send a request from module A (the CML UI for example) to module B, and then I need module B to do a second task after the first one ends. The question is what from the following options is the reccomended one for doing this:
a. Self mesaging - the "traditional" way (until I start with DQMH I used this a lot. I know that for repeatedly task the preffered way is using a helper loop but when it is not a repeatedly task I am not sure if this option is OK or not).
b. A Broadcast of module B and then a second request from module A to module B - it will work but maybe it's too complicated.
c. A request from module B to itself after the first task ends (Self request)
Combine the first "task" with the second "task" into one MHL case - so that one happens after the other. That's what I would look to do. If necessary, you could create a mini state machine sub VI that runs inside the MHL case that does task one, followed by task two.
2. A second question is about helper loops:
When I have a repeatedly task that is a quering of a HW (for example - a position of a motion control). Is it OK to insert a while loop into the timeout event? If I do so, the event structure of the helper loop is busy every iteration until the loop ends. is there another way to do it?
What is the while loop doing?
02-02-2023 07:36 AM
1.I will explain myself..
Let's assume that the two tasks have to be at two separate cases in the MHL (for example, they are not always occur together), so I do have 2 requests for each of them. Now the question is whether or not I should request from the first task to the 2nd task (and if so should I do it from the CML UI (option b) or from the module itself (option c)) or maybe I should message the 2nd case without a request (option a). I hope now it is more understandable
2. The helper loop queries a motion control for its position (inside a while loop) and send a request to another module every defined interval (and then continues to query).
Roey
02-02-2023 03:28 PM
Let's assume that the two tasks have to be at two separate cases in the MHL (for example, they are not always occur together), so I do have 2 requests for each of them. Now the question is whether or not I should request from the first task to the 2nd task (and if so should I do it from the CML UI (option b) or from the module itself (option c)) or maybe I should message the 2nd case without a request (option a). I hope now it is more understandable
I would create a sub VI for task one and a sub VI for task two. Then you can have a MHL case to perform task one and a MHL case to perform task two, and you can also have a MHL case that performs task one and two together.