Move plotting to inside a while-loop

Hi I have a plot that occurs outside a whileloop, and another that is constructed inside the whileloop.
How do I get the plots to run synchronously in the same waveform chart?
I've tried looptunnels, I've tried shiftregisters but neither solves it.
Below is a picture of my attempt to get'em together.
Hoping for some help.
Kindest regards,
Lasse
Attachments:
Multi-Function-Synch AI-AO Test B.vi ‏44 KB

This should do what you requested, but it will keep adding data until you hit stop or memory is full.
You'd have to add some sort of data truncate function to limit how much history is displayed.
(The hidden case is 0, it adds the first acquired chunck of data to the shift register)
Troy
CLDEach snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
Beware of the man who won't be bothered with details. - William Feather
The greatest of faults is to be conscious of none. - Thomas Carlyle
Attachments:
plot inside.png ‏35 KB

Similar Messages

  • How can I vary a PWM´s duty cycle inside a while loop?

    Hi,
    I'm using the "Generate Pulse Train.vi" to generate pwm signals in counters 0 and 1 in order to drive a DC motor both ways.
    The problem is, I need to control the movement of the dc motor with my PI controller which is inside a while loop. I've tried letting the "generate pulse train.vi" outside the while loop, but the problem is, it only changes the value of the duty cycle when the loop is stopped. I also tried putting it inside the loop, but then it doesn't even work.
    So, how can I vary a PWM´s duty cycle inside a while loop?
    I'm attaching the VI with the PI controller.
    Thanks for your help!
    Guilherme
    Attachments:
    controleValvula.vi ‏332 KB

    Here's some code I threw together a while back to change a duty cycle on the fly. It generates a fixed 5KHz or 25KHz frequency depending on laser selection, then allows duty cycle to be changed continously. Maybe you can use the premise of it for your application.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    Attachments:
    Pulse_Width_Modulator.llb ‏197 KB

  • Open and close visa inside a while loop

    Hi,
    I need to read a position from a control unit device continuously or even by click a button, for this I have to put "visa configure serial port" and" "visa close" inside a while loop. Dose it make any problem?

    You shouldn't need the VISA Event nodes.  Get rid of those.
    Why are you using Concatinate String just to build up a constant.  Just create a single string constant.  It is a lot cleaner.
    Is the antenna constantly sending data to you or only when you request it?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Can we place Analog in Read(AI-RE​AD) Vi inside the while loop for high sample rate like 22ks/s?

    I am using E-series Card for data acquisition.My requirement is to sample the channel, and check the 10 samples for certain condition.both at a time.What should be done can we place the AI-READ vi inside for or while loop for this purpose?

    Hello,
    Yes, you can include the AI Read.vi inside the while loop, you would just need to specify the number of scans to read for every iteration of the loop. Then, after AI Read.vi has read the data, you can do what ever kind of manipulation of the data you would like, before the next iteration of the loop. The one thing to watch out for is what ever manipulation of the data you do, be sure that it doesn't take to long whereas the buffer holding the data starts to back up. That can be checked by looking at the scan backlog output of the AI Read.vi, which will tell you how many scans have been acquired but haven't been read into your program.
    Hope this helps!
    Regards,
    Steven B.
    Applications Engineering, NI

  • SubVi with feedback nodes used more than once inside a While Loop

    All,
    I have a subvi that does a set of operations and uses 3 feedback nodes. I am using this subvi inside a While Loop a total of 4 times. I've noticed that all instances used share the same result at each corresponding feedback node but I would like to have an individual result from each of them. Is there an easy way to go around this problem? I have come up with ways to avoid this: a) create a different vi for each time the subvi was used. b) use global variables instead of feedback nodes. Is there any easier way to go around this issue?
    ExamplePlease note that both subvi's are the same) If on my first subvi I calculate a maximum value and get 1.29 (then goes to feedback node) on my second subvi i get 1.01 my feedback node at the second subvi still registers the maximum value to be 1.29. (and I want it to be 1.01!)
    Hope this is not too confusing, I've been scratching my head with this for a while, can't find the "easy" button. Thanks in advance.
    -Pop
    Im using 9.0.
    Solved!
    Go to Solution.

    Attaching the code would be helpful. Anyway, I am not sure how multiple feedback nodes are supposed to operate so I will defer that to others to answer. As far as being able to use distinct values or instances if you are using a subVI you could mark it as reentrant. That way each call to it will behave as it it were a copy of the VI and it will have its own memory space. This should include the feedback node. You may be ending up with a single subVI and in reality a single feedback node. If you need to pass data between calls than simply wire the data through. You could also use an Action Engine to store and retrieve values. An AE is a MUCH better solution than a global variable.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Unxepected behaviour with clusters inside of while loop with shift register

    Colleagues,
    I just would like to post here small, but important bug (I guess this is the bug), which was found by coworker today morning. Just would like to share knowledge, and probably this will save some debugging time for you...
    So, the problem that you can get wrong content of the cluster in some cases. The cluster used inside of while loop with shift register (we using this construction for functional globals), and after bundle operation you can get data, which are not expected:
    See also attached code for details (LabVIEW 8.6.1, WinXP Prof SP3).
    best regards,
    Andrey.
    PS
    Bug report already sent to NI.
    Message Edited by Andrey Dmitriev on 10-16-2008 12:30 PM
    Attachments:
    BugwithClusters.png ‏15 KB
    BugwithClusters.zip ‏10 KB

    Thanks Andrey for brining this to our attention!
    The "Show Buffer Allocations" reveals that LV is not processing the code in the right order.
    Under ideal conditions, all of the data should be manipulated using the buffer "A". But as this demo shows the data is being processed in the wrong order.
    The previously posted workaround get around this by forcing the array operation to happen first, but this resluts in two additional buffers "C" and "D" and then copy this back into "B".
    Using an "Always Copy" is another workaround that uses a seperate buffer "F" to hold the data being moved from the first cluster to the second inside "E".
    I think you won a shinny new CAR* Andrey!
    Ben
    CAR = Corrective Action Report
    Message Edited by Ben on 10-16-2008 08:05 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Cluster_Bug.PNG ‏57 KB

  • Stopping a while loop inside a while loop

    Hello,
    I have a while loop which is inside a while loop which houses my enetire application, When stopping the inner while loop portions of my outer loop stop working, How do I setup the inner while stop that it will not interfeer with the outer while loop?
    Thanks,
    Gil,

    It sounds like he is using a simple archetecture.  But switching to a different archetecture may not be necessary.  Simply because it doesn't work, doesn't mean scrap the whole thing and start over.  He's got a bug and needs to fix it.  Is it the best archetecture to use, absolutely not, but simple or general archetectures can be effective based on the application.
    Post your VI so we can take a look and give you some pointers and suggestions for improvement.
    Reese, (former CLAD, future CLD)
    Some people call me the Space Cowboy!
    Some call me the gangster of love.
    Some people call me MoReese!
    ...I'm right here baby, right here, right here, right here at home

  • For loop inside  a while loop, what order is that in big o??

    If say I have a for loop inside a while loop, then is that suppose to be in the order of O(n^2) right?? Is there any possibilities to change this into the order of O(n)??

    the other size and the temp size is abstact, which can be defined. This is actually for my union method, my teacher asks me to write this method using the order of O(n) which I think it is not possible. What do you guys think??
    Below is the code I have made:
    public Set<E> union(Set<E> other) {
              int count = 0;
              Iterator<E> iterator1 = other.iterator();
              while (iterator1.hasNext())
                   count++;
              Object[] temp = new Object [data.length+count];
              n = data.length+count;
              for (int i = 0; i<count; i++)
                   temp[i] = data;
              for (int j = count; j<temp.length; j++)
                   temp[j] = iterator1.next();
              data = temp;
              return null;
    but it still has same elements on it and I am thinking of a way on how to remove those same elements

  • How can I update cluster items from inside a while loop that does not contain the cluster?

    I have a VI that contains front panel clusters and two while loops. The main cluster contains items such as a doubles "distance" and "stepsize" and boolean "step" (a whole buch of this type stuff). The first loop contains an event structure to detect front panel changes and the second contains code and sub VIs to perform operations based on detected events.
    The operator can enter data into either double or click the boolean. If distance is changed the second loop does what is required to process the change. The same happens with stepsize. If step is clicked the ±stepsize value is added to distance and the result is processed. In each case the front panel should track the result of the input and subsequent processing.
    Because the clusters are outside the while loop, they are not updated unless I click 'highlight execution' which seems to allow updating each time the execution highlight is updated. There are other issues if I move the clusters into one of the loops.
    I've tried referencing the clusters and using local variables and nothing works. It looks like overkill to use shared variables for this.
    Any ideas would be greatly appreciated.
    Thanks,
    Frank    

    Hi Ben,
    Thank you for the response. I followed the link and tried reading everything you posted on AEs but I'm afraid that I didn't understand it all. It seems that each AE example had a single input and a single output (e.g. a double). Is this the case? 
    What I have is a couple of front panel clusters containing (approximately) 18 control doubles, 8 indicator doubles, 5 boolean radio button constructs and 26 boolean control discretes. I clusterized it to make it readable. In addition I'll eventually have a cluster of task references for hardware handles.
    All I want to do is update the front panel values like I would do in a C, VB or any other language. I've tried referencing the cluster and using the reference from inside the loops. I've tied using local variables. Neither works. I'm experimenting with globals but it seems that I have to construct the front panel in the gloabal and then I wouldn't know how to repoduce that on the front panel of the main VI.  Sometimes it seems that more time is spent getting around Labview constructs than benefitting from them.
    I hope the 'Add Attachment' function actuals puts a copy of the VI here and not a link to it.
    Thanks again for the suggestion,
    Frank 
    Attachments:
    Front Panel Reference.vi ‏33 KB

  • Plot XY graph from while loop

    I am trying to make a curve tracer with a DC power supply, DAQ, and Labview 7.1. Everything is ok, until I want to plot an x-y plot from a while loop. I can do this function fine using a for loop and cluster cells, but I need the while loop for the interruption function. When I change to the while loop, it had data formating issues, but I believe I have it to something that should work. It seems like my xy plots want to graph (the auto scale moves the axis respectively) but I do not get a line. I'm not sure if Labview is seing this as just one point and not an array, or if there is a labview bug. Attached is my code with a few different trials to make an xy plot. If anyone can be of help I would be very thankful.
    -Jon
    Attachments:
    Curve_trace_w_relays_while.vi ‏122 KB

    If it works in a FOR loop, but nor in a while loop, most likely your output tunnels are not autoindexing (FOR: on by default, WHILE: off by default). Right-click on the output tunnels and select "enable indexing".
    If you want to watch your graph update during the while loop, you could accumulate your x and y data in a shift register and graph it. (See attached modification).
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Curve_trace_w_relays_whileMOD.vi ‏74 KB

  • How to pass a value from inside a while loop outside the loop

    Hello to everybody, I have been searching through the forum but I have not found a certain answer for my problem. I would try to explain my problem as breefly as posible:
    I have to send by a BNC2120 two signals and acquire an other one thats comes from a preassure sensor. That part is done by introducing simulating and acquiring DAQmx inside while loops.It is sycronized by my self, proving such diferent values (is not the optimum, but is only the first prototype) and works as I expected. Well, then I want to sample some of the values of these signals, that is done with relays and local variables to get the value in the instant I want to sample. Here begin my problems: I want to extract the sample values out of the while loops without restarting them, I mean: I do not want to stop the while loops because the acquisition and the generation of the signal must be continuous, but I do not know if it is posible to put the while loops in "standby" until I operate with the values I have sampled and then the signal generator and the acquiere continues from when it has stoped before. Particulary I want to obtain the value of the top while loop (inside a case) when the counter arrives at 15.
    I have proved to do with local variables, global variables, making a state machine, with event cases, with flat secuences...I have been reading about and proving diferent posible solutions for this week and the whole past week and I have not found the solution.
    If any of you know how I can do this thing, I would be loved to listen your opinions. My proyect is above: 
    Thank you a lot in advance.
    Sinceresly,
    Miguel.
    Attachments:
    maq_estados_event_case.vi ‏239 KB

    It definately sounds like what you really want is a Producer/Consumer.  It is an architecture that uses Queues to pass data from a data generation loop (producter, your DAQ loop) and a data processor (consumer).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to make a graph inside a while loop maintain previous values

    In the beginning I was trying to use an the XY Graph Express VI to create a plot of points.  However, the graph is making a linear retrace between the first point of the new line, and the last point of the previous line.  It then creates the new line as desired.
    I have tried using a for loop with to bundle a cluster to the graph, but the graph resets the plot on each iteration (as expected) and I cannot find a way to make it maintain the previous data.  I tried using shift registers but was unable to find out how to do this, and I have also tried bundling the cluster to an array, but cannot figure out how to make the cluster go to a 1D array of a cluster of 2 elements.
    One option is having is finding a way to make it maintain previous data, but the preferred option is to make it create a new plot on each iteration so as to see the color change for each new plot.
    Solved!
    Go to Solution.
    Attachments:
    shift register attempt.JPG ‏64 KB
    original attempt.JPG ‏42 KB
    Output only current iteration data.JPG ‏86 KB

    I'm taking a stab at this because I'm not exactly sure what you want. But I think it is what I have shown here. You need to use a shift register on your outter while loop as I have shown. Your image where you tried using a shift register shows a misunderstanding of shift registers and how they work though, so I would take a look at these tutorials.
    CLA, LabVIEW Versions 2010-2013
    Attachments:
    plot with SR.png ‏29 KB

  • Error -50103 occured with timed loop inside a while loop

    Hello everyone,
    i wrote an application to sample analog voltage from  DAQ6024E card (see the attachments).
    I have a big while loop in the VI because a I want to add some other functions later.
    In the "WHILE_Cont Acq&Graph Voltage-Int Clk.vi" I use a while loop inside the big while loop to read the samples. It's working properly.
    but when I use a timed loop inside the big while loop (see "TIMED_LOOP_Cont Acq&Graph Voltage-Int Clk.vi"), I get an error -50103 from the timed loop.  It seems that the first cycle is ok, but after the first cycle the error occurs.
    I don't know what happens with the timed loop, anyone can help me? what does the error -50103 mean? thanks a lot!
    PS: I am using LabVIEW 8.0
    Message Edited by molo511 on 10-22-2006 05:21 AM
    Message Edited by molo511 on 10-22-2006 05:23 AM
    Attachments:
    TIMED_LOOP_Cont Acq&Graph Voltage-Int Clk.vi ‏143 KB
    WHILE_Cont Acq&Graph Voltage-Int Clk.vi ‏75 KB

    hi molo511,
    I tested your program but only with simulated devices. I had to delete the wire to the timing, so that the timed while loop runs with 1kHz. Did you already try this? Because this works on my PC.
    I also found a link in our database that might be interesting for you.
    http://digital.ni.com/public.nsf/websearch/04BEDD9E9E91ED3486256D180048116D?OpenDocument
    Greets
    Philipp N.
    NI Application Engineer

  • Ending a while loop inside a while loop

    How do I make a while loop run as long as the while loop that contains it is running? I tried wiring both conditional terminals to a stop button in the outer loop, but that doesnt seem to work? Is there another way?
    Thanks.

    Hi Jasonalan,
    I am not sure what you are trying to implement, but it is true that the loops are not terminating because of data dependency. The stop button in the outer loop will not be read until the inner loop terminates.
    If you wish to terminate the two nested loops using a single stop button, you should read the stop button inside the inner loop and wire it to the conditional terminals in both the inner and outer loop. Again, there is no point in doing this unless you have some other logic along with the stop button to stop the loops. If only the stop button is being used to stop both the inner and outer loops, the outer loop will only execute once. In that case, you can just use a sequence structure followed by a single while loop.

Maybe you are looking for

  • Query related to Printers

    Dear All, I am new to SAP. I have following queries related to printers which are to be configured in SAP. 1. Whether all the printers model are same ? 2. We may take printing on Dot Matrix or on laster jet or deskjet, will it be create problem if th

  • A program to change default fonts for templates in Keynote

    Has anyone written a utility to change the default on Keynote templates. Doing it manually seems like a lot of repetition.

  • Adding Webpart zone dynamically

    I am trying to create a tab component which bring tabs title and content from sharepoint list. In a tab content, I also want to show files from document libraray. I am currently using SPServices to bring data of Tab Title, Content and Documents. But

  • WFMLRSVCApp.ear file missing

    Hi All, I am install Oracle RAC 11g . my CRS installation went fine. during RAC 11g binary installation , i am facing strange error. it is saying INFO: 8/2/09 11:14:02 PM PDT: Starting install Install Phase 1 of component Oracle 11g Warehouse Builder

  • Regular Expression Search in Forms Builder

    Hi everyone, can anyone help me out? I'm working on a legacy forms migration project (3 to 10g) where item references often do not include the block name. eg. :stock_level := :default_level; instead of :stk.stock_level := :ctrl.default_level; There a