Use of memory in a while loop with a xy chart

Hi all

I have problems using memory with a vi that loops, records data and plots in a xy running chart.  I wrote it using shift registers and functions "subset of the table", which I assumed would reduce overhead costs, but apparently this is incorrect.  If it works for several days (which is normal, because it is above all a vi for follow-up and view a trouvreez process that runs continuously), it takes a few minutes only to stop the loop.  I guess it would eventually just stop working entirely.  I googled this problem and I see suggestions to auto-index or pre-allocate.  However, I would also like to plot each point as the tracks of the loop, so I need shift registers.  What I do use some convoluted pre-allocation, changing table and then insert into the table approach, or is there a better way?  Still working?

Thanks in advance


Tags: NI Software

Similar Questions

  • How to exit while loop with delay schedule?

    I have a pretty heavy program that iteratively takes a series of measures from a number of channels using a variety OR-Switch and OR-DMM screws that I assembled as a result of various examples and several help pages. Each channel is sampled once during each iteration with data to be saved in a text file for later analysis, after it is imported into Excel. I added to the screen 'real time' indicators and charts to see what looks like running data.

    Each iteration is performed using a While loop with a delay timer, even if a previous version, I used a timed loop. Measures for the series of channels are collected with a loop For inside the While loop. The loop For includes screws which:

    1 cut the channel and wait as debounce.

    2 Initializes the DMM and passes the configuration information.

    3. wait for a while to make sure that the DMM is set.

    4. measure.

    5. close the DMM.

    6 disconnect all the switches.

    The terms of the election of the channels is ends in 15-20 seconds and I am currently collecting data every two minutes, so he spends "wait" time "collection". Each iteration of the loop For initializes and closes the DMM to avoid the hot switch.

    Other components of the program are configuration setting controls, etc. (in front of the While loop), a "current measurement" indicator and a writing-text inside the loop file operation For, several indicators of the iteration (inside the While loop, but outside the loop For) and a bunch of operations related to the grouping and table that provide graphics of groups of time vs measures.

    I don't know there are more elegant ways to perform many functions that I do and I'm not posting the VI here because I want to concentrate on what I know, it's a big problem with my program (for now!) - I can't figure out how to get out of the While loop. I tried the combinations of Boolean control, its conditions of latch and Stop / continuous if true to nothing does not.

    I want a 'Stop' button that ends the While loop, at the next opportunity, but it is not working properly, I think, because the stop button does not play with good timing, because the program runs either the loop For or the time delay at the beginning of the While loop. 'Next opportunity' can mean 'Immediately', 'at the end of the next iteration of the loop,"or"at the end of the next delay schedule." I think that if I get one of these scenarios to work, I can get an any of them to work!

    Help, please!


  • Is there a way to manually move photos from my Mac to my iPad and iPhone?   I don't want to use photostream because I don't want to use my memory on my devices moble with my collection of photos together.

    Is there a way to manually move photos from my Mac to my iPad and iPhone?   I don't want to use photostream because I don't want to use my memory on my devices moble with my collection of photos together.

    With iTunes Sync Photo, you can copy the albums selected to your library of Photos of the iPhone or the iPad.

    See: Sync photos to your iPhone, iPad, and iPod touch in iTunes - Apple Support

    But this method is available, if you use not iCloud photo library on your mobile device.

  • 2 parallel while loops with functional overall to share data

    Hello

    I'm having a problem with the sharing of functional with globals data between two parallel while loops:

    1. One of the loop (bottom) generates a random number periodically and write the total functional sample.
    2. Another loop (above) has a structure of event and when it expires, he would read the functional global and intrigue, a chart data point.

    The problem is sometimes the functional overall seems to be 'locked' and the output becomes zero constant. It also seems that whenever I first open the VI, it works fine. But for the second time running, he begins to have the problem.

    You must initialize your VI stop FGV FRONT of your lower loop begins.  Even if you use a global variable that is functional, you have a race condition.  FGV is read in the lower loop until it had a chance to be initialized with a value of false in the upper loop.  Functional global variables do not forget their data between executions of the VI.  So it is always set on stop the last time that you ran the VI.  This works your VI the first time it's because VI does not have in memory, so when it loads, it loads with the default value False in the shift register.

  • Control and Simulation in a loop / while loop with TCP/IP reading / writing of synchronization

    Hello, I have a problem with reading TCP/IP and written in two loops. The problem is NOT to get the two loops to read and write to and from the other. This has been accomplished. My problem is when I run control and the loop simulation on my laptop and the while on a RTOS remote on the controller on-Board of LabVIEW in a remote PXI chassis, the while loop the remote system running on four 4 times faster than the loop control and simulation on my laptop. In other words, for each iteration of the loop control and simulation on my laptop, there are 4 four iterations of the while loop on the remote system. I need to know how to get a degree of kinship (1:1) with these iterations of the loop. When I run a longer simulation in real time, say 10 seconds, the control and Simulation loop begins to slow, i.e. the simulation time slows down until it is no longer in real time and the "Late Finish"? Parameter is set to true and the LED lights and continues to stay lit. At this point, the system destabilizes due to what I believe is being well sampling rate too discreet and I have to end the simulation. How can I get a ratio of one to one between the loops and also to avoid slowing the loops causing destabilization?

    To give an overview of my application, I implement a control system in a network, seen in "image2.png". This is achieved using my laptop as a subsystem 1. Reference signals are generated from the laptop and the error signal is produced. Control measures taken and the control signals are sent via TCP/IP to the remote system. Position feedback is returned, and the process repeats. My system has Core I7 Procs w / 3 GB of RAM, up to 1 GB/s speed via ethernet and LabVIEW 2011 installed with all necessary modules and networking tools. The attached VI Custom_Wireless_Controller works on my laptop. The remote system I'm working on that has the 7830 NI R Series with FPGA card. OTN runs on the PXI chassis with an enbedded controller that has networking capabilities of up to 100 MB/s via ethernet. I use the FPGA for the acquisition of data and apply control signals to my plant. The plant is the PCE twist connected to the FPGA through the cable of the ECP - RIO of NOR. Subsystem 2 is this side of the CNE. The FPGA collects position, he sends to the controller via the network, receives signals from the network drive and writes signals to the plant power amplifier that operates the plant. This process is repeated and the VI and is titled Custom_Wireless_Plant.

    I appreciate the help really and look forward for her and for any question!

    Well, the first step is to understand what you have set up right now. Your control and Simulation loop on the side of the controller is configured as 'Runga Kutta 4' and you have a loop timed on the other side. In addition, you have the primitives of TCP/IP on the control and the Simulation diagram and means he will perform (a message) on the size of each minor step, which in your case is 4.

    So, you have two options:

    1. replace the Solver side controller Runga Kutta 1 (this must synchronize loops)

    2. hold RK 4, but create a Subvi around two primitives of TCP/IP and configure from the VI to run than the major (continuous) step-size. If you do it right, you should see a 'C' on the upper right part of the VI you have created.

    Please let me know if what I said is not clear...

  • While loop with reading of text file - calendar of events in a given period

    Hello world.

    I created a program that if serial interface via a port to a syringe push in my lab. Currently, the program reads in a text file-flow rate values and sends them to the pump, one by one, through various commands. I need to ensure that whenever a new flow rate value is sent to the pump, it does in a specific/hard time for a while. I.e. every 0.1 seconds, changes in flow rate and must are active until the next period. I tried to use a timed loop and I think I've succeeded, but it hogs system resources, so I was wondering if there was a way to do it using the number of cycles or something of this nature. I just started using LabView, so I'm slowly getting the hang of it (easy when you watch my VI!)

    See attached VI. I took orders from serial port and have instead orders display in an indicator. The nested and densely populated while loop contains the commands that need to be completed/last during the period (like 0.1 second).

    Thank you for your time and help!

    -Phebotalus

    Hi, you should read some introductory material on LabVIEW to down the idea of the stream.

    Basically, the data flow in the wires from left to right, and any node will not work until it has reached all of his contributions.

    The thread of the error is the best way to run data streams.

    ***

    In your VI I use data wires, their execution through structures, and forcing the structures to run in the sequence.  Using a structure of sequence you mentioned in your next post will force the two scripts to execute in the order of (the only one we discussed to be in race condition.)

    Similarly, for brevity, I would wrap the EMO and she is business structure in a single sequence and force it to run last using stream.  In this way the user has the most possible time to decide to hit the EMO before she is called by the application.  As it is now, it most likely is interviewed at the beginning of the loop, so if it's the exchange value you won't see results until the next loop.

    When running in execution of highlight you see the order of data flow, but that is not guaranteed to be the same for a normal performance, where the use of the data stream.

    ***

    The counter tick account ms up to a very large number and then "says" reset and start counting again.  I know you want to START the loop as close to every 10 ms.  Yes, using data flow, take the number of cycles first, perform actions, then return the number of cycles.   The second time of the tick read that you are in a nested loop that does not stop until you get 10 or more difference on the number of cycles.

    And, on the off chance that you must achieve "return" on the tick counter comes stops the nested loop then move.  (if the second measurement is less than the first, then the tick counter handed.  If you miss this situation while you'd have to wait a long time for the condition of the difference > 10 in the reunion, basically locked in the loop.

    ***

    You could put the EMO sequence, we have seen, in line with data streams.  Before or after the second control of ticks will not make much difference in terms of 10ms.  I would put it after checking the tick, again give the user more time to hit the EMO if necessary.

    ***

    I put in a queue for the stream error and removed the other stuff.

    LV2010

    Check out some of the LabVIEW intro docs, they are online, they discuss these issues and much more.

  • Code Golf: stop two while loops with guaranteed ratio iteration

    Proposal

    In the vein of the tradition of Perl, I would like to see if there is any interest to solve a few puzzles programming in LabVIEW. Can someone post a problem and define the rules to solve.

    Here's a question for beginning/intermediate to sharpen your "palette".

    Description

    With a user action, how you would stop two while loops such as the relationship between iterations is the still the same? Concrete to view this situation is to take action: both instruments use the same source of synchronization to take measures, but second divides the clock down so that it is a little slower than the first whole factor. For example, if the slower instrument is four times slower, then at the end of the VI, the slower instrument takes 100 measures the fastest instrument took 400.

    Rules

    • You can use vi.lib
    • You cannot include any other subVIs
    • Your solution should pass for loop1 interval as low as 25 ms

    Model (joint in LabVIEW 2009)

     

    If people are interested in this, then we will find a way to improve future problems. Please post your suggestions and criticisms, but only if you also post a presentation ;-)

    MacNorth wrote:

    [..]

    If we choose the first suggestions, the VI has yet to recover the data at different speeds. You can dedicate a loop for each instrument to disassociate a jitter and latency introduced by their connectivity or the inner workings. This adds a margin of safety when there is a conflict of thread and the pilot. You can also implement a simple counting as altenbach loop and renounce the multiloop complexity.
    [..]

    It is a very good point. But I wanted to make sure, you should / need to discuss the benefits, but also the disadvantages of the design. Implementation of an application is most often a process of 'special cases '. If a framework/design for a single application model does not necessarily correspond to another application.

    Designs are always strongly according to the requirements and constraints. What gives here designs will result in educational services, of course, but not necessarily as reference models for specific applications.

    Advantage of simple loop:

    • No synchronization between several loops required
    • Can easily implement any whole factor between services (quotent & function remains for a case structure

    Disadvantage of simple loop:

    • Take advantage of the multi core systems (at least not much)
    • Can easily run out of the time constraints (material not "not responding" enough, fast manipulation of data takes too long,...)
    • Code will accumulate within the structures of the case, where the readability could suff

    The advantage of multiple loops:

    • See essentially the disadvantages of single loop (several loops solve those)

    Disadvantage of multiple loops:

    • More complex, especially for the sync switch (not beginner friendly, requires a more/better design)
    • May contain easily questions source such as race conditions and locks

    A little side note:

    Even if the equipment works different acquisition rate, this does not necessarily that the software must use different rates for data extraction. You can use the same model of an hour, but get X times more values for the task faster than the slower running. The 'only' thing to care of are the sizes of buffers and bottlenecks in the data transfer.

    MacNorth wrote:

    [..] The best advice published OR shutter multiple while loops (https://www.google.com/search?q=labview+stop+multiple+while+loops) are laughable (and the 'solution' in my model). [..]

    No, it's not laughable. For many applications, this approach to shutter at the same time several loops running is OK. The constraint: only for simple parallel running loops.

    More complex loops (producer/consumer and similar) with the more complex data relationship ships require more valiant approaches such as queues, declaring events or user.

    My 5 cents only,

    Norbert

  • Using asynchronous calls in a while loop. How 'Skip' node and only retrieve data as it is treated

    Maybe I'm not understand asynchronous calls... but I thought I should be able to call one another VI and essentially 'jump' it is the node and only receive data as the called VI treats.  In other words, similar to the Run of VI, I can wire a wait until done? with a fake and the main VI will not wait for the other VI end of race.  The main VI continues to function, and when it passes the called node of the VI, it will receive data if it happens to be there.

    How can I call a VI in a while loop and do not wait so he could spit out the results?  Data flow is my enemy on this one...

    The first VI treats its own figures (using the iteration count) and displays them on the PC.  Other indicators are the data of the called VI.  I want to be able to work around the blue circle node and receive data only that it will be available.

    Any help is appreciated.  Thank you.

    What I said OR the 'Start asynchronous call' is the preferred method for starting background tasks. This call is usually used to run background tasks. For example, you have a process of journal. When your application starts it would use the "asynchronous call Start" to start the process of journal and then move on to the other stuf. The process of the journal would then happily run in the background and the main application is free to do other things. Of course when implementing these types of systems you need a way to coordinate things like exit. This is where the queues and stuff come it.

  • Stop a while loop with outdoor table

    Hello

    I have a problem to stop the execution of a vi that uses a while loop and outside a table with two values of time intervals. I would like to stop the VI when the different values of the array are passed. I have attached here the code if you want to help me please, thank you in advance.


  • Update an indicator of in while loop with event driven programs

    I'm trying to update a chart shared by several events within a Structure of the event. I would like a change in value of a button (NOPE or OK buttons in the attached example images) causes the structure of the event causes a switch between the various outputs for the chart. In the example attached, clicking the OK button will send the graph random matrices, while clicking on the button NOPE will send constant tables to the curve.

    As the process within the structure of the event is underway, I use a while loop within each of the different events in the event Structure. So there is a structure of the event, and each event have while loops in them which should update the chart outside the structure of the event (see attached images).

    This does not update the graph, the graph remains static instead, why is this? How can I configure it to work as I described above?

    In my view, a question is: How can I use the same stop button in both inside while loops. In the example images, I have two that are different, one for each of the different events.

    Thank you!


  • While loop with stop unwired FPGA button?

    I've seen examples FPGA with a while loop where nothing is plugged to the stop button. On a target PC, it would throw an error. What it means?

    I think you are talking about "Timed loops" that are "single-Cycle timed loops" on FPGA.

    FPGA is intended to be run until it is powered, a 'Stop' software does not much sense.

    Norbert

  • How to pause and resume a while loop with a button

    Hi all!

    I'm back in LabVIEW, after only a few years and I cannot understand, what at first sight seems to be a simple problem!

    All I want to do is have a while loop in which, for the purposes of illustration, I have the 'random number from 0-1' function on the inside, and I want to be able to pause and resume this help from a button. There are a few other posts on the forum that are very similar and do use "event structures. The problem I encounter is that I can get the genarator random number to start the generation but the break will not stop this!

    I have the feeling that I made a stupid mistake - but I can't understand or google my way out the problem! I enclose my solution so far!

    See you soon!

    I did an example (you can drag and drop the image into a labview diagram > = 2014)

    hope this helps (I just did 2 excerpts, it's the same program)

  • loop for and while loop with empty table entry

    Hello

    I have a question with loop and loop.

    When a constant empty array (zero element) is connected to the loop For with "allowing the index", there are no interactions performed in loop For. But, if the loop is replaced by any loop, no problem.

    LabVIEW 2010

    Hello

    It is ok. I have no problem at all.

    For the 'loop' For when you connect the table thanks to indexing, the number of iterations is set to the size of the array. The iteration number assigned to N (in your case 10) is ignored.

    For the 'While' loop the number of iteration is defined by the Boolean Condition and the size of the array is ignored.

    Paul

  • Start stop while loop with tab control

    I want to be able to start and stop a while loop by entering and leaving a tab.  I use a structure of the event to do so, but it seems not elegant or the right way to do it.  The only way I could get to the kind of work is by unchecking the lock front panel in case of structure.  I have attached a sample vi of what I have so far.

    The problem is that you can't even stop the program by pressing the stop button until you exit the tab, which is not a user friendly interface.

    The event should just manage basic user events.  Any given event does not take a lot of time to run.  While you are in the diagnostics tab, your code is stuck in this while loop.  Although the setting of the front panel of the lock allows you to do other things, the LabVIEW is just put on hold all these other events of the UI (like Stop button value change) and cannot handle them inside while the loop stops and allows outside while loop to go through again.

    You should have a parallel while loop to manage waveform graph.  You can use notifiers or queues or a motor of action FGV (see Ben Action Engine Nugget) to switch the starting or stopping of the update of the chart of waveform until the parallel of while loop.

  • Cannot use median filter inside the While loop

    Hello

    I try to use the filter median insade loop some time. This seems to be a problem. I have attached the VI. Help, please.

    This entry is a number of sample as 1,1.1,1.05. This output is zero.

    Thank you

    Vincent

    Since you get only one value per iteration, you can use the point-by-point version of the median filter.

Maybe you are looking for