How to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)
I've attached a sample VI that I just cannot figure out how to get working the way that I want. I've labeled the some sections with black-on-yellow text boxes for clarity during the description that follows in the next few sentences. Here's what I want:
1) overall -- i'm intend for this to be a subVI that will do data acquisition and write the data to a file. I want it to use a producer/consumer approach. The producer construct is the 'parallel for loop' that runs an exact number of times depending on user input (which will come from the mainVI that is not included). For now I've wired a 1-D array w/ 2 elements as a test case. During the producer loop, the data is acquired and put into a queue to be delt with in the consumer loop (for now, i just add a random number to the queue).
2) the consumer construct is the 'parallel while loop'. It will dequeue elements and write them to a file. I want this to keep running continuously and parallel until two conditions are met.
i. the for loop has finished execution
ii. the queue is empty.
when the conditions are met, the while loop will exit, close the queue, and the subVI will finish. (and return stuff to mainVI that i can deal with on my own)
Here's the problems.
1) in the "parallel for loop" I have a flat sequence structure.. I haven't had time to incorporate some data dependency into these two sequential sections, but basically, I just care that the "inner while loop" condition is met before the data is collected and queued. I think I can do this on my own, but if you have suggestions, I'm interested.
2) I can easily get the outer for and while loops to run sequentially, but I want them to run in parallel. My reasoning for this is that that I anticipate the two tasks taking very different amounts of time. .. basically, I want the while loop to just keep polling the queue to get everything out of it (or I suppose I could somehow use notifiers - suggestions welcome)... the thing is, this loop will probably run faster than the for loop, so just checking to see that the queue is empty will not work... I need to meet the additional condition that nothing else will be placed in the queue - and this condition is met when the for loop is complete. basically, I just can't figure out how to do this.
3) for now, I've placed a simple stop button in the 'parallel while loop', but I must be missing something fundamental here, because the stop button is totally unresponsive. i.e. - when I press it, it stays depressed, and nothing happens.
suggestions are totally welcome!
thanks,
-Z
Attachments:
daq01v1.vi 59 KB
I'd actually like to add a little more, since I thought about it a bit and I'm still not quite certain I understand the sequence of events...
altenbach wrote:
zskillz wrote:
So i read a bit more about the 'dequeue element' function, and as I understand it, since there is no timeout wired to the dequeue element function, it will wait forever, thus the race condition I suggested above can never happen!
Yes, you got it!
As I've thought about it a bit more, there's a few things that surprise me... first, the reason the 'dequeue element while loop' errors is not because there's nothing in the queue, it's becaues the queue has been released and it's trying to access that released queue... However the problem I have is this --- Even though there's no timeout wired to the dequeue element, I still would think that the while loop that contains it would continue to run at whatever pace it wanted -- and as i said before.. most of the time, it would find that there is nothing to dequeue, but once in a while, something is there. however, it seems that this loop only runs when something has been enqueued. the reason I say this is illustrated in the next code sample MODv2 that's attached below. I've added a stop button to the "queue size while loop" so the program runs until that is pressed. I've also added a simple conditional in the "dequeue while loop" that generates a random number if it a button is pressed... but this button is totally non-responsive... which means to me that the "dequeue while loop" isn't actually continuously running, but only when an element is added to the queue. this still seems almost like the 'dequeue while loop" waits for a notifier from the queue telling it to run. can you explain this to me? because it is different from what I expect to be happening.
rasputin wrote:
I tried to open your VIs but it doesn't work. LV
is launched, the dialog box (new, open, configure...) opens and then...
nothing. Not even an error message. I guess it isn't a problem of LV
version or a dialog box would appear saying this. Could you, please,
send a image of the code?
Thanks,
Hi Rasputin, I'm using LV8. I assume that was your problem, but who knows. I've attached a pic of of altenbach's solution since it's what I needed.
thanks
-Z
Message Edited by zskillz on 10-20-2006 11:49 AM
Attachments:
daq01v1MODv2.vi 63 KB
daq01v1MODpic.JPG 116 KB
Similar Messages
-
I am getting an error that my Disc cannot be found, may be dirty, etc... Please reinsert and try again. After retrying, I cannot download, as the redemption code indicates that it has already been used. How do I download movie now?
Thanks for the quick advice!
Unfortunately, I am still unable to open my core productivity apps, namely Skype and Evernote. Twitter, as well, could not start. But interesting quick fix though, I never knew you could do that.
Here's the error log after the restart:
What else should I try? -
How do I deinstall parallels desktop 6 and Windows 7 pro?
How do I deinstall parallels desktop 6 and windows 7 pro so as to ensure that all partitioning and space used for those programs is reinstated?
You can as Kenneth said just drag the virtual machine file to the trash. You should however run the Parallels Uninstaller, present on the Parallels installation disk or in the installer disk image, to completely remove all the Parallels components. Just dragging the Parallals app to the trash may leave components installed and possibly running.
Regards. -
How to restart base station from airport utility? I used to be able to do it remotely
I currently use a Mac Pro 10.8.4 and have a time machine for wireless 6.3 (630.34). Sometimes I cannot connect to the internet and use network preferences to diagnose the issue. This results in being told to restart the wireless. The airport utility includes the drop down option of restarting but is not clickable so I can't choose it.
With my prior macbook and same time capsule, etc if i had problems connecting to the internet I would run network diagnostics to help out. This included clicking on the airport utility ---> base station --> restart. This worked most of the time.
Bottom line, is there something I am missing in not being able to restart the wi-fi remotely? ]
Thanks in advanceYou are likely forgetting a step.
Open AirPort Utility
Click on the Time Capsule icon
Click Edit in the small window that appears
Now click the Base Station menu.....top of the screen....not the Base Station "tab" in the center of the screen
Click Restart -
Hi This is Rezwan from Bangladesh. I requests to my aunty who lives in Virginia to buy an iphone 5s country unlocked (Without Contract) for me and send to Bangladesh. Now i want to know the total costing of iphone 5s country unlocked phone and how can she send it to Bangladesh?
Note: When you buy an iPhone from another country, you do not have warranty in your country of residence. Any warranty and sevices are only valid in country of purchase.
For prices, ask your aunty or go online yourself. -
Log in to my Verizon account. Try to access Backup Assistant contacts. The website is a loop......it behaves as if I'm not logged in. I have checked and DO have the services (provided for free with my plan). Phone is set up properly and just synched it to cloud. Cannot get to the verizon web page to Manage Contacts.
It may be a situation where we all wait for things to clear up. The Verizon Cloud has been having issues for a very long time. Have you tried backing up contacts to your Gmail account, if you have one?
-
How to code a Module in NWDS and deploy
Hi ,
That is exactly my question ...
how to code a Module in NWDS and deploy
Kindly let me know if there are any step by step available
also I may not always have access to nwds
To the same in a tool like eccilpse.
P.S.
I am an abaper ...have a little working knowlege of Java..so playing around with eccilpse alot...
Kindly help>>also I may not always have access to nwds
>>To the same in a tool like eccilpse.
apart from the links provided by others , if your above statement means that you might have to use Eclipse at times in place of NWDS, then I would suggest you to have a build process independent of Eclipse. NWDS makes use of SAP specific plugins which recognizes your SAP sepcific files like application-j2ee-engine.xml and ejb-j2ee-engine.xml and you see them differently inside NWDS. So to have a better project setup
1. At least create the whole project (EJB / EAR) once in NWDS.
2. Export it and then import inside Eclipse.
3. Make changes and have a build script may be based on ANT to build your project and create EAR out of it.
4. Deploy using SDM. -
How to code a button to play and pause sound using load sound?
how to code a button to play and pause sound using load sound?I have used load sound methos to attach the sound.Can anyone help me?
Hey thnx,
I have used this code on sound's button's frame.and my stop n play button is on another screen.main sound button and stop button is on diffrent screen.
Here is my code-
stop();
adaDrut1.onRelease = function () {
mySoundC = new Sound(this);
mySoundC.loadSound("F#/Bhajni1.ark", true);
mySoundC.onSoundComplete = function() {
_root.mySoundC.start(0,999); }
gotoAndPlay("play2");
_global.myTaalLaya = "Low1";
adaDrut1 is a sound button.And there are lot of buttons with diffrent sound.
Thanks.. -
Hello... I need to authorise a new laptop after my old one completely died (before I could deauthorise it!!). I have 5 computers already authorised and cannot wait until July for the 12 month "deauthorise all computers" option to become available again. Does anyone know how can I authorise this new laptop as one of the 5, in place of the old one? Any help gratefully received!
Go to one of the authorized computers and de-authorize it individually.
The one year limitation is ONLY for the de-authorize all option. -
I just received a iPod Touch 5th generation for xmas and it acts like it is locked, when you slide the slider it says unlock button and nothing happens. Can't slide the power off either. It tells you the time, unlock button, power off button but nothing happens. Voice just tells you the unlock button, time, poweroff button.
Please help also itunes says I need to enter on iPod the passcode to reset to factory. I can't get it open to enter passcode, slider doesn't work. It is one day old and this happen xmas afternoon. PLEASE Help someoneTry:
- iOS: Not responding or does not turn on
- Also try DFU mode after try recovery mode
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
- If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
- Try on another computer
- If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
Apple Retail Store - Genius Bar -
Hi, just need to know how to get my music, video, pictures and apps form my iPhone to my new laptop as the old computer, which I used before was stolen. I only have my phone left and if I try to conect it to my new laptop it's trying to delete everything.
I have also noticed all my settings won't stay set, example....I removed the check mark from "third party cookies", the when I close Firefox and reopen the check mark is back, also my tool bar has screwed up....can't reset, been having trouble the up grade.
-
After change to Mavericks my Mac become too slow e I can't use it because stays asking passwords for "talagent" and "messages agent" as icloud keys. I got changed the icloud password many times and still doesn't work. I can't open any program.
Back up all data.
Launch the Keychain Access application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad. Click Utilities, then Keychain Access in the icon grid.
Select the login keychain from the list on the left side of the Keychain Access window. If your default keychain has a different name, select that.
If the lock icon in the top left corner of the window shows that the keychain is locked, click to unlock it. You'll be prompted for the keychain password, which is the same as your login password, unless you've changed it.
Right-click or control-click the login entry in the list. From the menu that pops up, select Change Settings for Keychain "login". In the sheet that opens, uncheck both boxes, if not already unchecked.
From the menu bar, select
Keychain Access ▹ Preferences ▹ First Aid
If the box marked Keep login keychain unlocked is not checked, check it.
Select
Keychain Access ▹ Keychain First Aid
from the menu bar and repair the keychain. Quit Keychain Access. -
Just looking steps for Lenovo and HP each model example what is link to download the driver files
DELL offers cab file and lenovo,HP what type of driver files just looking steps for Lenovo and HP each model example what is link to download the driver files and other settings used in task sequence or package
This should help you out:
Lenovo: http://support.lenovo.com/en/documents/ht074984
HP:
http://www.deploymentresearch.com/Research/tabid/62/EntryId/55/HP-takes-the-next-step-and-provides-ready-made-driver-packages-for-MDT-and-SCCM.aspx
My Blog: http://www.petervanderwoude.nl/
Follow me on twitter: pvanderwoude -
I got a new ipad2 for Christmas and I am unable to get it to accept my password for my wifi. I am using the same password that I have always used for all of my other devices. Can somebody help me????
Hi there
I had the same trouble today, I kept entering the sky password but would not accept, my iMac and iPod work ok but just could not get my iPod to work. But I found the fault, the password is case sensitive and mine on sky is in caps, the up arrows on the keypad put the caps on,but after each letter you must put the caps back or it wil revert to lower case, I hope this may help you -
How do you download attachments in iPad and once downloaded, where do you open it?
do you have the evernote app?
ok, well if you open a doc in mail app to preview it, it should say export to evernote, or another app that allows you to open files like good reader, ibooks, so it really just depends on the file type.
if it is a picture then hold down on the photo and it will ask if you want to save it.
Maybe you are looking for
-
ACS 5.4 How to change CLI password?
Anyone know how to change the ACS 5.4 CLI password? I found the command "acs reset-password". But it seems to reset the GUI password instead of CLI password. Thank you very much!
-
As far as my understanding : The usage of ADOBE Forms can be classifies as :- Kindly confirm whether the following are correct or not. 1. Print Forms: This type of usage involves in generation of reports, some confirmation pages and receipts. We can
-
Supplier ******* not intended for purch. org error in S Cart
Hi - We have set up a Dev SRM system using Extended Classic Scenario When we create shopping carts and we try to assign a vendor we get message Supplier A111111 not intended for purch. org. The vendor exists in our ECC 6.0 system under purchase organ
-
How to extract the list of BOM materials through ABAP query?
Hello Experts I want to extract a report from SAP which should contains the following, 1). Main Material with description 2). Sub material with description and quantity I have tried with the tables MAST, STKO AND STPO but i couldn't able to create th
-
Special effects problem. Can anyone help me?
I have Adobe Premiere Elements 7 and I want to import media into the program from www.detonationfilms.com but when I look for the right effect I need and take it back to adobe premiere elements 7. The pop up says the file is not supported or you need