synchronization of two loops for...

HII...

I am using two loops for and I want each iteration for both loops start at the same time...

in fact I want to sync between these two loops...

so when the each iteration of the two loops will start at the same time then these will be synchronized...

also if a loop takes more time in an iteration the other loop should suspend until the end of the iteration of the other...

please me... thanks hlp...

Hi samir,.

two options:

1: when both FOR loops should have same time iteration why not just put all the code in a loop FOR?

2nd: when 1 is not possible/wanted, you can use a notification utility. Set the notifier early iteration of the first for a loop and wait for the signal in the second loop...

3rd: use call loops and synchronize them...

Tags: NI Software

Similar Questions

  • synchronize two loops for written tdms data acquisitions

    Hello

    I have two loops of different data acquisition. A slow acquisition of CAN (10 s/s) and an analog acquisition faster (30 samples taken at a frequency of 300 Hz), I need to synchronize these data for tdms writes for later analysis in DIAdem.

    My example and the result in the DIAdem channel list is attached.

    Thanks in advance!

    Magnus

    Magnus,

    for a professional solution, you do not want to synchronize the devices on a hardware level. Since the material CAN work differently to 'traditional' DAQ devices, there are important things to take care of.

    Please look in the viewfinder to LV example for the word "CAN". For example, you can choose the example 'several cards CAN and DAQmx map Wfm Input'.

    Norbert

  • Output graphics of two loops for

    I would like to see a graph of the output generated in both loops for.

    X: steps (i x I have two loops)

    Y: Y1 should graph the polar output

    Y2 should chart the Azimuthal output

    Probably very simple to resolve/upgrade in place.  (The output file works fine).

    Thank you

    Kevin

    Good work Kevin.

    I have some suggestions for you (I don't know what it will be eventually, because then maybe they're based):

    • If the data do not change over time, you can use a graphic instead of a graph; Whatever it is, reduce the necessary processing power by updating the two parcels only once for a full run of the outside loop (see below)
    • You have a lot of indicators that are not obviously necessary (they simply out what puts out control - off 4;) Stop 5; Polar; Azimuthal, etc.).  When you submit here, the code is more it is easy to understand and faster you get an answer (minimal document also helps understand us what all is for).
    • Use the decrement vi but don't take it off 1 (reduced the increase in code).
    • Avoid strain - explicitly cast I32 to double so that no appeal should be made to the Manager of memory running (will reduce your footprint of memory of codes).
    • Written file are intensive and bays of building CU generally allocate dynamically memory - try to avoid these as much as possible.  In your VI, you can write to the file once when all iterations are complete.  This will reduce the runtime of the VI.

    Anyway, there are a whole bunch of thoughts that you probably care to hear, but I hope they have been helpful.

    Cheers, Matt

  • loop of two producers for quick DAQmx and the user controls?

    Hello

    Sorry if my question is maybe a bit too general (I don't have a VI implementation yet).

    I think about the solutions for a Structure of producer-consumer with event loop in the part of the producer.

    So far, if I had to do a project with DAQ, data analysis, data recording and enter the user controls, I've followed usually this kind of approach:

    I used the producer part to capture interactions with the user, and I also had a state machine in the part of the producer, with registry change. I also buy (any faster then 10ms) DAQmx device data in the part of the timeout of the structure of the event in the loop of the producer. I have several consumer loops down, such as data analysis, data recording, etc... I send the data measured in a cluster with the enumerations of the State of the loop from producer to consumer with queue loop.

    I'm not happy with my approach for the following reasons:

    1,

    If I need device acqure faster DAQmx data that the operating system clock can handle (like 1 MHz), so I can't put it in the part of time out of the structure of the event of the producer loop, because here I can go through the while loop with minimum 1 ms.

    2,

    If I put this part DAQ in a loop for quick consumption, it is not admissible for orders from the QUEUE line after that it starts to run (assuming that I use the standard structure of producer-consumer, so consumer loop every time iterates once, when a package comes from the Dequeue).

    Then say, how can I control a young (timed by DAQmx device internal clock) loop of data acquisition of the structure of the producer of the event loop? As loop DAQ to start, stop, restart, etc...

    Thank you very much for the advice!

    You can certainly have several loops of producer.  Have a User Interface, loop driven events to send commands and a separate data acquisition loop to send data are not a problem.  Each loop has a separate queue. (You might be able to make it work with a single, but using two queues avoids many problems).  Often, I used a system of three loops long before that everyone was talking about calling it a producer/consumer.

    Lynn

  • Synchronization between two periods loops FPGA

    First of all, I appreciate the forums here and have read a lot of interesting topics. This is the first time I can't solve it with research and I hope for your entry.

    Information:

    I'm using LabVIEW 2009 f3, PXI-1033 with the PXI-7813R.

    Problem:
    In my FPGA program, I have two loops, where you need to run as fast as possible (has) and the second just quickly (B). Has turns 20 MHz to 40 MHz and B . These are for the two loops limiting speeds. B cannot run faster and Has should not run more slowly.
    Loop has captures the sensory information and integrates data as many loops as indicated by the user. When completed, please send a trigger to B, which calculates the new position information and sends it to the machine. Only at certain times, B must achieve something and said nothing to the rest of the time.

    I thought of two ways, but doesn't work for me.

    (i) with the help of a Boolean trigger. As in a loop, the Boolean value of A can become true and switches to the next loop to false, B is not capture all the triggers and a 50% chance of getting the triggers and isn't perfectly synchronized.

    (II) using the occurrences. Sounds very interesting, but these are prohibited between the periods differently loops.

    I played with many scenarios, but may not understand proper. Someone at - it suggestions?

    This seems to be a fairly simple producer/consumer scenario.

    I would like to use a device worn FIFO to transfer data from the loop of producer (top) to the loop of consumer (bottom).

    Depending on how often the producer generates data (each cycle or every nth cycle?) the case around the write FIFO structure will allow him to write only when your requirements are met.

    The consumer loop reads the FIFO with a timeout of '0 '. When the FIFO is to expire, the consumer runs to the case which does nothing. When the FIFO does not expire, who processes the data and sends it to the side of Windows runs.

    In my example, I used 2 structures of cases to illustrate the two different modes. In your code, you must use a single structure of matter.

    There is no advantage to set a loop "sleep", even if no data exists on the FPGA. Because you are running in hardware and the non-profit CPU cycles these loops can operate simultaneously at no increase in the latency of a

  • How to call two variables that are to keep several value in loop for

    Hello

    I have 4 point, two list and two checkbox select. ID and class Section are select list and student id and the id of the object are check .i want to insert more id then a topic in the table corresponding to the student id then a plus.

    for example. When I select the IDs of class 1 and section A then student of class 1 and section has come into student card (checkbox element) and all the object corresponding to the class 1 comes in the object id (item checkbox).

    now I want to insert several selected for what is, multiple student topics in at table when I press submit Button.

    My table is

    CREATE TABLE 'STUDENT_SUBJECT_DETAIL '.
    (NUMBER OF 'S_NO',
    NUMBER OF "STUDENT_ID,"
    VARCHAR2 (50) "SUBJECT_ID",.
    "SESION' VARCHAR2 (50)
    )
    /


    I use this Code

    DECLARE
    STU wwv_flow_global.vc_arr2;
    VOID wwv_flow_global.vc_arr2;

    Start
    STU: = wwv_flow_utilities.string_to_table(:P57_STUDENT_ID);
    SUB: = wwv_flow_utilities.string_to_table(:P57_SUBJECT_ID);
    I'm looping 1.STU.count
    I'm looping 1.SUB.count
    insert into STUDENT_SUBJECT_DETAIL
    values (CLA_SUB_ID_SEQ.nextval, Stu (i), (i) Sub,: p57_SESION);
    end loop;
    end loop;
    END;

    Published by: Ed on November 20, 2009 22:10
    DECLARE
        STU wwv_flow_global.vc_arr2;
        SUB wwv_flow_global.vc_arr2;
    BEGIN
        STU:= wwv_flow_utilities.string_to_table(:P57_STUDENT_ID);
        SUB := wwv_flow_utilities.string_to_table(:P57_SUBJECT_ID);
        FOR i in 1..STU.count LOOP
            FOR i in 1..SUB.count LOOP
                insert into STUDENT_SUBJECT_DETAIL
                values(CLA_SUB_ID_SEQ.nextval,STU(i),SUB(i),:p57_SESION);
            end loop;
        end loop;
    END;
    

    None good for me:

    1. you have 2 loops, and they are both using the variable I as a counter.
    2. your insert must be in the form: insert into table (column names) values (to be inserted)
    3. why not use a trigger to get the nextval in the sequence?

    Trent

    Published by: tr3nton on November 21, 2009 16:16

  • I'm trying to move a song to my iPhone music library to the iTunes library on my MacBook Air.  I do not want to synchronize the two, so how do I simply copy/migrate the song on my computer?

    I'm trying to move a song to my iPhone music library to the iTunes library on my MacBook Air.  I do not want to synchronize the two (and they have never been synchronized), so how can I simply copy/migrate the song on my computer?  Is there a way to do, without having to re-purchase the song on the iTunes Store on my Mac?

    E-mail (for yourself) click on it in the email

  • Order to internal model with cRIO, synchronization of time loop

    Hello

    I work with control design Simulation & toolkit and I want to implement an internal model control to a real-time target. I want to implement my simulation (as an attachment) to the real target (cRIO-9024 OR cRIO-9112). I removed the transfer function of the process, I broke the line and I added my input/output of the cRIO modules. I put a 1ms, Euler ode solver step size and synchronize the time loop. Unfortunately it does not work properly. The loop decreased the speed a lot and I can't get 1 ms response time and, finally, a good answer for my system. This means that I can not 1ms response for loop? What is the problem of the computer, windows or hardware real-time or software? Simple or I did something wrong? All the advice you will enjoy.

    Kind regards

    Kamil


  • Synchronization of 2 loops while one with a structure of the event.

    Hi fellow users of LabVIEW

    I try to incorporate a structure of the event in my current exisiting VI to Save certain values of control as shown in this post

    http://forums.NI.com/T5/LabVIEW/using-the-quot-make-current-values-default-quot-as-a-control-on/TD-p...

    It's the VI that I use as model with my exisiting VI.

    http://forums.NI.com/NI/attachments/NI/170/547715/1/defaults%20Demo.LLB

    In case the 'stop, change the value' I use in the main VI and a 'real' constant instead of Boolean control of wire structure. While the loops are not connected. The table that I use in my exisiting VI (another while loop) is indexed and unbundled to be used here.

    The work combined well screw and it gives me the results, my question is, in the long run it will give me issues. Do I still need to synchronize?

    Thanks for all the help.

    There's no problem because loop additional lower with the structure of the event.

    Personally, I worry about the top loop. Why so complicated? Why so much duplicate code? Why all these hidden indicators serve as local variables?

    Why don't simply place you the table in the entire cluster in a shift register and the index and ungroup by name wharever value, that you need to access. No hidden local variables or indicators.

  • two loops of consumer a producer, dequeue even item in two consumer

    Hello!

    What is the best way for the following:

    I have given in my loop of producer enqueu. I need this data dequeue-d in both loops of my intake, but I want to dequeu the same element in two loops.

    Of course if I take off in two loops, then the second loop of consumer will lose the odd elements and the first loop of consumer will lose the same elements.

    Thank you!

    Hello

    Create two queues or use notifiers...

  • How can I distribute randomly addition or subtraction in a loop for?

    Someone at - it ideas for how can I randomly assign a loop for to add or subtract from the random numbers throughout the various itterations?  My current code generates two random numbers and added together for a number of itterations.  I need a few itterations randomly to be subtraction.  Thanks in advance!

    Add another random number generator and compare the result against 0.5. Use a case around your addition/subtraction operator.

    Looks like you might also want to exit what operation is in fact taken.

  • VI is jump a loop "For".

    Zipped VI is fixed, the upper level has "7_AD-DC producer consumer" as the title.  You will have to dig into the folder for access.

    I have attached a picture of the Vi, highlighted in red is the loop in question.

    The problem I have is that when I run the vi has the range of 0.25 to 0.5 Volt (chosen in the loop of producer not shown), it works fine, but if I run the vi put on the beach of 1 volt, it ignores all highlight loop, and finishes just the event.

    The program aims to help the particular device calibration.  If you follow the path of the error, it crosses the upper part (1605, 1605 mode range, range of AC - DC, the factor N, etc.) all the way through the indicators for "1 k reference in ' and ' 1 k reference on.  The program runs right up through these measures of reference, but when it is in range Volt 1 (shown in the picture) it ignores the entire for loop.  I son of error in all, and I thought that those who would prevent race conditions and they would oblige the Vi to run as expected, but apparently not.

    It's kinda a Vi spaghetti, I'm not the best with LabView, but it seems so strange to me that it works when the value 1/2 a volt but don't not 1 volt value.  I put the indicators on the elements that fuel the loop For, the number of frequencies and the tables of frequencies look good and I can't really think what causes violence to ignore the loop for.

    The for loop is not in 'jumps' it of executing 0 times and out of default data for all tunnels.

    You have an entrance tunnel auto-indexé why wire terminal N at all? The loop will be the least number of iterations it can.  N times, either the smaller auto-indexd table is something less.

    EVEN worse: the indexed table auto comes from a tunnel exit case structure value "Use default if unwired" so you have two options.  There is a hidden code clear the Board before being sent out of the cases showed, OR the value of the number of frequencies is<>

  • Loop for taking too long to execute

    Hello fellow users of LabVIEW

    I've met a huge problem that follows since loop takes too long to run, I have to run two for loops as the next, and they both take together horribly long - 18 seconds on average. Surprisingly, when I combined the two loops it took even more time.

    The for loop above is done (or should do) after the part of the code:

    for i = 1 : 11850
        signalAvr(i) = signal(i);
        for j = 1 : 149
            signalAvr(i) = signalAvr(i) + signal(i + j);
        end
    end
    

    Is it possible to speed up this loop? What I am doing wrong?

    Thank you

    Smdx

    I have not fully tested, but see if it works for you.  It is much simpler.

    EDIT: Ok, dkfire got beat to it.  At least we came with the same solution independently.  I just used the tunnel autoindex where he preallocated table and replaced elements.  The two ways you will get the same result.

  • control of time of two loops

    Hi all

    Here, I'm a little stuck. I'm trying to control the execution of the two loops to display a picture, I need run the upper loop for example for 30 seconds, after that he needs to stop and the lower loop starts to run for 15 seconds and stop. and then the upper loop run again for 30 seconds and then the process continue in this way.

    So please, if you can share me your trick, which will be appreciated.

    Thank you

    Hello

    something like this should work.

    Best regards

    K

  • Control reference 1055 error when you use a loop for

    Hello

    I'm having a problem using control references to accomplish the following: I a VI that reads data from a text file, and then uses that automatically update the value of a control on front panel on two live different, then set the default values, and then save them. Comes from the array of control references, I tried looping on text labels until I have find the one corresponding to the order, I want to change and then update its value. The problem I have is that if I use a loop for, then 9times of LabVIEW 10 complains error 1055: "LabVIEW: object reference is not valid. If instead I the wiring to the index table and manually extract the reference, then it works every time and for each index of the reference of the order.

    Can someone take a look at my code and just see if its obvious what the problem is? In this case, I have a simple solution, but I would really like to understand what I did wrong. I have included as a code snippet, but also attached the files if that helps (Its Import_Colormap.vi, which is the problem). Persons with disabilities code fails, the active code works but I can't see what is really the difference between them - I can change the index of array 0,1,2, 3. and no mistake.

    Thank you.

    Your "Colormap.ctl" is a strict type def that contains a ring.  You define the elements programmatically, make the default values, and then save the "Colormap.ctl"?   I was never practicing this but here is a thread that covers this in detail. I do not understand what you expect reach by running.
    The next thing: at the same time (at the same time!), you open the Colormap.vi (this is what we see in yout PNG) that contains an instance of the Colormap.ctl on the front panel. I'm not pretty sure if LabVIEW can handle this correctly. This could be the reason why you sometimes get the error 1105.
    I prefer StringsAndValues and eventually the value of the ring running.  There is no need to do it with a def of strict type.

Maybe you are looking for