From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-14-2015 01:48 AM
Hi,
I know there must be some questions like this in this board, and I've tried to find for a while but got few what I'd like. My project is a little urgent so that I'm posting this question for some instant suggestions...
As the topic says, I have multiple devices, say power suppliers, and I have to tune their power automatically and independently.
Although the number of the devices are eight for now, but I do not prefer to fix the number, that is, I'd like to scale or expand the device number dynamically.
At first, I'm very stupid to put the PID.vi into the for loop...
I wondered if the parallelism-enabling can deal with my problem, but soon I knew the data spaces of each calling VI are mixed up...
I'm getting stuck about how to reserve the dataspace of the reentrant data...
The last on my mind is the open VI externally at the beginning of control, and take the advantage of the VI's references..
But I've not implemented the method, perhaps there is other tricky issue on that way...
Is there a way to sovle this kind of problem?
Solved! Go to Solution.
07-14-2015 02:15 AM
hi william,
i think producer-consumer pattern would fit here as well.
have asynchronous vis for every device (producers) and a control vi (consumer), with which you can start/shutdown/ctrl each asynch-vi.
the for-loop looks very wrong to me .. it might work, but i think having real while loops in the asynch vis is more manageable (and you can have timed-loops)
at least thats what i am doing 😉
the tricky part for the producer-consumer pattern with Queues is to build you messages.
you should have at least messages that can shutdown the producers
good luck
07-14-2015 02:56 AM
Hi William,
the PID functions support multiple control loops, just read the help for the functions!
No need for that FOR loop (which is plain wrong here)!
07-14-2015 02:59 AM
Hi, jwscs,
Very thanks to your immediate reply,
I'm a little confused how can I implement the indetermined device numbers in the producer-consumer pattern.
I have eight power suppliers and have to control their power simultaneously by PID toolkit.
Probably, I have ten power suppliers next time...
What does the real while loop means in your second paragraph?
07-14-2015 03:02 AM
in my proposition you would have to start a new asynch vi for each additional pid,
but GerdW's suggestion might be even more to your liking.
you could have one loop, and an array of inputs to your PID (one entry for each of your devices),
i haven't used it this way so i cannot comment further,
but it looks like you only have to be sure of the order in your array.
07-14-2015 03:03 AM
Thanks GerdW,
I must gonna get a better glasses @@...
Thanks your direction, I'll do it right away.:)