PROGRAM SLOWS DOWN WHEN IT ENTERS A CASE STRUCTURE

OK so here is the problem i am making this pid controller the output range is 0-100  in this program i am just trying to get it to work so i  did a compair function whereby when the controller output is 0 and the constant is 0 i start a case loop which will turn the output on for one second and off for one second .   when i enter the case structure the rest of my program slows down
i have no idea why , i have tried to make a while loop and a case structure outside my main loop but i cannot get my signal from my compair statement to enter the second loop where i get my output to cycle in 1second intervals 
below is the VI please help
i am still learning how to use labview by the way
thank you
gary
GR
Solved!
Go to Solution.
Attachments:
TMP36working!vi.vi ‏225 KB

gary,
The next thing you need to learn about LabVIEW is dataflow. This is the fundamental paradigm of LV and will explain your slow down issues.
The basic dataflow concept is that any node (node = function, subVI, structure) can begin to execute when data is present on all its inputs and that no data will be present at its outputs until the node comopletes execution.
How does this affect your VI? The true case has a 1000 ms Wait (actually two, one in each case of the inner case structure = redundant code). The case structure will not complete execution until the wait completes. And, the while loop does not complete its iteration until the case structure completes. The result: When the PID.vi output = 0, the loop will run at 1 second per iteration.
What is the fix? Continue running the loop at 100 ms intervals. Keep a count in the case structure (true case) and another shift register of how many 100 ms intervals have passed. When the count reaches ten, toggle the output line.  Do not use the 1000 ms Wait.
All the code in your inner case structure is unnecessary. Wire the Remainder output directly to the Arduino Digital Write VI.
Be careful with the comparison to zero with floating point data. If the calculation which produces the data has round off errors you might get a value like 0.573E-15, but that is not equal to zero. It is better to compare to a small range of values above and below zero.
Right to left wiring is much easier to follow when trying to understand what a program does. Using the Clean Up tool occasionally will help (although it will eventually frustrate you also).
Lynn
Attachments:
TMP36working.2.vi ‏214 KB

Similar Messages

  • Program slow down / problem of memory optimization

    hi all,
    Here is my problem. I am using Labview 2011 and a NI acquisition board. In attachment are simplified VI codes I implemented to acquire analog signal and process the data. The main_VI.vi starts the RUN VI that performs data acquisition and data processing. In the RUN VI, I implemented a state machine because there are many sequential steps. The acquisition is done many times (see max iteration value) and for each acquisition, there is a processing. I used a queue structure to send data for processing in parallel. I also use a in-place element structure to manage the array.
    For real data acquisition (from NI board), the program slows down after hundreds of iteration and when I exit the program, it seems the VI has to free memory because it takes few minutes to close the VI.
    My questions are:
    -       Is the state machine structure properly implemented?
    -       Is the queue strategy optimal to do parallel processing?
    -       Is the use of in-place element structure properly implemented in my case, and is it needed for 1D array with a size of 4000 to 20000 points?
    Thank you for your help/suggestions.
    Cedric
    Attachments:
    Main_VI.vi ‏25 KB
    RUN.vi ‏88 KB
    acquisitions_data.vi ‏28 KB

    Hello Cedric,
    I noticed that in your "RUN.vi" you are calling the "acquisitions_data.vi" iteratively in a For Loop.  Everytime that For Loop iterates, you are creating the Task, running the acquisition, then closing the Task.  You don't need to create and clear the Task over and over again like that.  Instead, create and configure the Task outside of the for loop.  This way when you get inside the for loop, use the "DAQmx Start Task.vi" to start the task, perform the read using the "DAQmx Read.vi", then use the "DAQmx Stop Task.vi" to stop it.  Outside the for loop you can place the "DAQmx Clear task.vi" to clear the references.
    Perhaps this will help with your performance.
    Mason M
    Applications Engineer
    National Instruments

  • I made eight radio buttons exclusive by each other.But It made the orignal program slow down.

    I made eight radio buttons exclusive by each other. But It made the
    original program slow down. I insert them parallel to the original
    program, ie, they are excuted at the same time, I think. But I found
    that the speed before I insert it is faster than after. I think If I
    use the exclusive radio buttons made by ni , the program will execute
    faster. but there aren't eight radio buttons I can choose. How can I
    do ? Or How can I make some changes to the slide that I will get the
    result like NI does?

    You'll have to give the processor some time. In the parallel loop, put a
    'Wait (ms)' from the Time & Diaglog pallete. Wire e.g. 10 to it, and the
    computer has some time to do other processes (like the other loop, and
    updating the user interface).
    When you have something like this, you can open the task manager (win nt,
    win 2000). If it it this problem, the processor uses 100% processor time.
    Regards,
    Wiebe.
    "Rosa" wrote in message
    news:[email protected]..
    > I made eight radio buttons exclusive by each other. But It made the
    > original program slow down. I insert them parallel to the original
    > program, ie, they are excuted at the same time, I think. But I found
    > that the speed before I insert it is fa
    ster than after. I think If I
    > use the exclusive radio buttons made by ni , the program will execute
    > faster. but there aren't eight radio buttons I can choose. How can I
    > do ? Or How can I make some changes to the slide that I will get the
    > result like NI does?

  • Excel slows down when network drive is mapped

    Since a couple of months we are experiencing strange behaviour of excel (2011) on Lion 10.7.5
    Excel versions from 14.3.1. to 14.3.4 all the same behaviour.
    Symptom 1)
    When I connect the Time Capsule drive , Excel slows down by factor 100 when entering text. Needs up to 2 seconds to react on a key stroke.
    When I disconnect the handle, excel works fast again.
    (repeatable, reproducible)
    Symptom 2)
    on the network drive, always at the same place, a file named ~abcde.xls... occurs (exact name forgotten, but it is a recent file name
    preceded with a tilde sign)
    deleting of the file does not affect speed
    the file reappears occasionally (TC backup is switched off!)
    Where is the ghost??? :-D
    maybe these symptoms are uncorrelated.
    Why the heck does Excel slow down when I open the network drive??
    Why does this happen on 10.7.5 and not on 10.6.8?
    Anyone any idea?
    thanks,
    Stefan

    Thanks. Away on holiday right now, but will do it as soon as I get back next week.
    Out of curiosity, the external drive works fine when connected directly via USB to the laptop. I took that to mean that the problem wasn't to do with the drive, but probably the network. Is it possible there could be a problem with the drive which only shows up when it's used as a network drive?

  • Songs slowing down when I type

    I'm running iTunes 7.7.1 on a new computer. iTunes had no problem on my old one, but on my new one, the songs slow down when I type, which is rather annoying, since I listen to music while, you know, typing. I'm on WinXP Pro, and everthing else is working great. Any ideas?

    What tools, Mostly I work with iWeb using iPhoto, Aperture, Photoshop TeXture Adobe FormsCentral for Acrobat etc. making and editing Web Sites. Often I have many Apps open simultanously.

  • Very slow start when initially entering the service ticket in Web UI (2007)

    We seem to encounter a very slow start when initially entering the service ticket in Web UI (2007). Once in all seems speedy enough. I don't have my access arrange for the Service marketplace (OSS notes) yet so can't check if there is a known solution, which I suspect there is. Has anyone encountered this problem and possibly resolved it?.
    Jason.

    Previous posts have highlighted the following notes:
    1048388 General Performance improvements of BSP transactions
    1162605 Network performance for CRM 2007 Webclient
    1162685 SAP CRM 2007 Webclient Performance
    821045 Poor performance of MIME objects in BSP pages
    581316 BSP Delta-Handling for CRM (BASIS 620 SP17)
    However, I was wondering whether anyone has come across any other small changes that may have a major effect. A quick-win I guess you call it. From bitter experience I know there are rarely quick wins when it comes to optimisation due to the amount of re-testing etc.
    But any further advice would be welcome.
    Jas.

  • HELP - 88.2 k 24-bit wav file is slowing down when imported to garageband

    i have an 88.2 k 24-bit wav file that is slowing down when imported to garageband. How do i get around this problem?

    You need to convert it to 44.1 16 bit. You can do that with iTunes.

  • Safari browser seems to slow down when working with my wifi ASUS AC 68U router

    safari browser seems to slow down when working with my wifi ASUS AC 68U router - any ideas on why?

    Is your problem with Safari on the iPad, or some MacBook Air?
    Are you sure that the ASUS firmware is tested with the device having trouble and its operating system?
    Note: MacBook Airs do not run iOS.  They run Mac OS X, Windows or Linux.

  • Slow down when processing image clipping in photo shop with pen tool

    Adobe cs5 slow down when processing image clipping use with pen tool. The path is applying after few seconds when we draw on the image. My system supporting 4 GB memory with 64 bit.

    The main thing i use paths for in photoshop is extracting objects from photos.
    Other uses include stroking paths with the paint tools. For example, if you had
    a powerline to remove, one could trace the line with the pen tool and then stroke
    the path with spot healing brush set to content aware fill.
    more info on photoshop paths:
    http://help.adobe.com/en_US/photoshop/cs/using/WSfd1234e1c4b69f30ea53e41001031ab64-73ada.h tml
    MTSTUNER

  • Internet speed slows down when connected via airport express

    Internet speed slows down when connecting via airport express. When connecting directly via the timecapsulethe internet speed is ok, when connecting via the airport express the speed slows down.What can I do to change that? Any suggestions?

    Turn off the AirPort Express completely as a test, and move your computer very close to the location of the Express.
    As I said before, the Express can only extend the bandwidth (speed) that it receives from the Time Capsule, so the speed that you see there with the Express powered off will be the fastest speed of which the Express is capable.
    The Express will make the signal go further when it extends....but it will not make the signal go faster.
    A good location for a device that extends wirelessly is a point that is about half the distance from the Time Capsule and the general area that needs more wireless coverage.
    If you locate the AirPort Express too far from the Time Capsule or there are more than a couple of walls in the signal path, the signal will be very slow by the time that it reaches the Express....and the Express simply extends a signal that has already slowed down significantly.
    If you already have the Express located about half the distance between the Time Capsule and general area that needs more wireless coverage, how many walls, ceilings or other obstructions are there in the signal path between the Time Capsule, the AirPort Express and the area that needs more coverage?
    Often, due to obstructions, it is just not possible to achieve good performance when you try to extend a network wirelessly. The solution is connect the AirPort Express to the Time Capsule using a wired Ethernet connection.
    There is virtually no signal loss with this type of connection, so the Express can be located exactly where it is needed and it will produce a much faster wireless signal in this type of setup.

  • PSE 10 system slows down when adding files to catalog

    I recently switched from PSE 3 to PSE10 and had issues converting the catalog.  I never did resolve those so I decided to start with creating a new catalog in PSE 10.  My first session of adding photos worked fine.  When I restarted the task the next day, I was asked in participating in making the product better by sharing information about my use with Adobe.  I agreed to participate and very quickly noticed that my computer slowed considerably when adding photos from my hard drive.  The process still worked but I experienced a dramatic increase in the time it took for photos to be added (e.g. the cursor spins for a couple of minutes while the task is working).  I went under my account preferences and opted out of the product participation program but the problem has persisted.  I rebooted the computer to see if that would help but it has not.  I have turned off all media analysis and both optimized and repaired my catalog and while this has provided some improvement, there are still instances where the system slows down.  Now it seems that every other folder's worth of pictures (does not matter how many photos) I add causes this delay.
    I appreciate any help anyone can provide in determining why this slow down keeps occuring. 
    FYI, I am running a new Windows 7, 64-bit system with 8GB DDR-3-1066MHz, and 2 TB hard drive.

    Have you also edited the Preferences (Performance) to increase the amount of RAM that PSE can use?
    Do you have many background processes running?  Having a single HDD means that everything running on your computer has to wait in the queue for disk access.
    How many photos are you importing?
    What file types are the photos?
    How large are the photos?
    Ken

  • External drives cause program slow downs

    To my early 2009 iMac, I have few external drives connected through USB and Firewire. During light disk use the hard drives spin down after awhile and go into saving enregy mode (sleep).
    When doing normal functions like printing a Word doc or printing from TextEdit or working on some other programs, I get the spin wheel and programs pause until the sleepy drives wake up and pick up speed again.
    The document(s) that I am working on are on the computer hard drive.
    The external drives are contibuting nothing to the job on hand, why do they need to be awaken during this kind of processing and why do the programs need to wait for them?
    Though I have Lion installed now, this used to happen with Snow Lepoard as well.
    Thanks

    Thanks for that info on your Mini's specs.
    You have plenty of RAM reported, so I think we can rule out a bank of RAM disappearing and the Virtual Memory system being over-taxed to compensate.
    You say "Now everything is slow again, when I turn the computer, it takes minutes to come up, and then I get the spinning ball whenever I try to do anything."
    The spinning ball generally indicates that operating system is waiting for a "resource" to become available. Depending on how your Mini is/was setup vis-a-vis the external drives, some of your programs may be looking for stuff on external drives that are no longer available, or that are misfunctioning.
    The "resource" that is being waited for, could also be a network resource, like an iDisk (if you have MobileMe) or a NAS (Network Attached Storage).
    The wait for a "resource" could also be due to a hard drive starting to go bad, and the operating system needing repeated attempts to get data from it.
    Apropos NAS, it has been reported iTunes 10 doesn't play well with data stored on non-Apple NASes.
    Since you have an Intel Mini, it might also be useful to perform an SMC reset (DON'T do a PMU reset):
    http://support.apple.com/kb/HT3964?viewlocale=en_US
    +Resetting the SMC for Mac Pro, Intel-based iMac, Intel-based Mac mini, or Intel-based Xserve+
    +1. Shut down the computer.+
    +2. Unplug the computer's power cord.+
    +3. Press and hold the power button for 5 seconds.+
    +4. Release the power button.+
    +5. Attach the computers power cable.+
    +6. Press the power button to turn on the computer.+
    Be sure to perform steps 4 and 5 in the correct order.

  • HELP Program shuts down when try to capture video

    Every time I click on capture the program shuts down. I've used this program many times with no problem but now it won't even reconize my camera. And when I try to capture it shuts down completely. Anyone know what to do?

    There is nothing wrong with FCE 2 as a program - it should not be necessary to upgrade it.
    Have you tried plugging and unplugging the FireWire cable from both the computer and the camera.
    Also see if iMovie will recognise the camera. if it won't you will know the problem is probably not the fault of FCE.
    It is also possible that FCE may be corrupted in which case you should re-install it after having first uninstalled it by deleting ALL the files listed in this article:-
    http://docs.info.apple.com/article.html?artnum=93688
    Good Luck.
    Ian.

  • Loop slows down when certain parts of screen are active

    Hi, I've noticed that one of my loops, which is set to run at 50ms, slows down significantly when certain other parts of the screen are active.
    We have a dual screen setup where on the left side we have a bunch of controls and I'm also displaying the time that 50ms loop takes. On the 2nd screen, there is a tab control with several pages. When some of the pages are displayed (and those are the ones that are probably the "busiest" in terms of processing), the loop time slows down to anything in the range of 1-4 seconds.
    The loop runs at 50ms when other lower-processing tabs are showing. It will also run at 50ms when any other window (another VI, another application) is hiding that right tab display. Actually, it'll run at 50ms if another window hides about half of that right tab
    What can I do to be able to watch those tab pages and keep my loop running from slowing down? One of those tab pages is a fault message display, so it's good to watch while you're running a test!
    Thanks.

    I would start by checking what you're displaying in your pages. You might be doing something that doesn't need to be done all the time.
    I once ran into an issue where screen updates to a control in a tab would slow down the computer (100% CPU usage) even when another tab page was selected and would only stop when the tab was moved off the screen or when the control was moved out of the tab. Unfortunately, I was never able to reliably recreate that issue. In that case the problem was with updating the strings in an array of rings using a property node, but yours might be a different case.
    If what I described sounds similar to what you're seeing (increased CPU usage even when the real culprit is not displayed) I would be interested in seeing a demo.
    Try to take over the world!

  • Query slow down when added a where clause

    I have a procedure that has performance issue, so I copy some of the query and run in the sql plus and try to spot which join cause the problem, but I get a result which I can figuer out why. I have a query which like below:
    Select Count(a.ID) From TableA a
    -- INNER JOIN other tables
    WHERE a.TypeID = 2;
    TableA has 140000 records, when the where clause is not added, the count return quite quick, but if I add the where clause, then the query slow down and seems never return so I have to kill my SQL Plus session. TableA has index on TypeID and TypeID is a number type. When TablA has 3000 records, the procedure return very quick, but it slow down and hang there when the TableA contains 140000 records. Any idea why this will slow down the query?
    Also, the TypeID is a foreign key to another table (TableAType), so the query above can written as :
    Select Count(a.ID) From TableA a
    -- INNER JOIN other tables
    INNER JOIN TableAType atype ON a.TypeID = atype.ID
    WHERE atype.Name = 'typename';
    TableAType table is a small table only contains less than 100 records, in this case, would the second query be more efficient to the first query?
    Any suggestions are welcome, thanks in advance...
    Message was edited by:
    user500168

    TableA now has 230000 records and 28000 of them has the TypeID 2.
    I haven't use the hint yet but thank you for your reply which let me to to run a query to check how many records in TableA has TypeID 2. When I doing this, it seems pretty fast. So I begin with the select count for TableA only and gradually add table to join and seems the query is pretty fast as long as TableA is the fist table to select from.
    Before in my query TableA is the second table to join from, there is another table (which is large as well but not as large as TableA) before TableA. So I think this is why it runs slow before. I am not at work yesterday so the query given in my post is based on my roughly memory and I forget to mention another table is joined before TableA, really sorry about that.
    I think I learn a lesson here, the largest table need to be in the begining of the select statement...
    Thank you very much everyone.

Maybe you are looking for

  • Constraint in Materialized View misbehave

    Enviroment Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options s.o : windows 7. on laptop Intel core i7. create table product_type ( product_type_i

  • Problems after hard reset

    OK, did not get my phone booting up, and I need my phone (especially the next days) so I did a "hard reset". Programs on E: drive was not uninstalled. But all on the C: drive. Maps installed OK. And everything seems to work except 3 things: 1) Nokia

  • Skype download icon won't go away?

    Last night I downloaded Skype on my MacBook Air that I bought a few weeks ago. I downloaded it from Skype.com, and everything seemed normal. I can now call and talk to friends and family on Skype from my laptop. However, once Skype downloaded, an ico

  • Abstract class and RMI

    Hi! I have a desgin where I have an abstract class that in its constructor registers itself in a registry and define three abstract methods. Then I have a class that extends the abstract class and implements the three methods. One of the methods inse

  • Artwork   posted before but no reply, PLEASE HELP!

    Not showing up on iPod. I drag/ copy and paste or load my artwork to songs and albums on itunes and it works. I plug iPod in and it syncs it. But when I look at iPod I only see song name/ artist/ album, no artwork. Any reasons? Suggestions for help?