Question about executing two loops simultaneously

Hi,
I have a problem executing two loops 'simultaneously'.
Let me first describe what I want:
I have one loop that contineously acquires data (at 1kHz) and sends feedback
signals (to the valves at a rate of 50 Hz). On the other hand there's a high
frequency acquirement (at at least 250 kHz) for a duration of, let say, up
to 10 secs.
The high frequency acquirement is not contineous, but it should be executed
at a time that I want to. It should be executed multiple times also.
What I have used is a notifier to execute the other loop at a time that I
want. It's ok when I run the other loop for only 0.5 seconds, but when I do
it for 10 sec. then the other control loop doens't function anymore. The
valves stay at the
same opening position because it doesn't get any feedback
from this loop.
How can I fix this problem ?
Many thanks,
Chang-Kwon Kang

Mark,
thanks for your kind answer.
I think I get what you mean. I'll try to use DAQ occurence VI.
Thank you again,
Chang-Kwon
"markwysong" wrote in message
news:[email protected]..
> Chang-Kwon,
>
> I believe that your problem doesn't really lie in the fact that you
> have two loops, I think it is rooted in how you are doing your data
> acquisition.
>
> First, let me make the assumption that you are using buffered
> acquisition for your data (you must be to get 250 kHz). When you do
> your buffered acquisition, are you using DAQ occurrences to see when
> the buffer is full (or has a specific amount of data in it) before you
> perform your AI Read?
>
> What I'm getting at is when you perform a buffered
acquisition, you
> call the AI Read VI to get the data out of the buffer and into
> LabVIEW. If you ask the AI Read for an amount of data that is not
> available in the buffer yet, it will consume the "data acquisition"
> thread until the data IS available. Therefore, any other data
> acquisition VI's that you are trying to run will be halted until this
> operation completes.
>
> The way to get around this is to use the DAQ occurrence VI. This VI
> will halt until the amount of data is available in the buffer, but it
> doesn't consume the data acquisition thread while it is waiting; when
> it returns that the data is ready, then you can perform your AI Read.
> This allows you to have more than one data acquisition going on in
> either one or more loops.
>
> Hope you understood that. Let me know if I can help you further.
>
> Mark

Similar Messages

  • Question about using for-loop to generate array from DAQmx. Thanks!

    I have a laser system with a frequency of 1kHz, I am using this 1kHz signal to trigger the DAQmx and get the data from a photodetector, e.g. I will get 1000 data points during 1 second from DAQmx, but I need to separate this 1000 data points into the even and odd list, which is two list of 500 data points, e.g.. The 1st, 3rd, ... 99th data is one array, the 2nd, 4th,... 10th data is another array, then I will do further calculations based on these two arrays.
    To seperate the even and odd data, the only way I can find is put these 1000 points into an array and then seperate them afterwards.
    Can I do things like this pic?
    I don't know the speed of the for loop, because the 1kHz trigger is always there, once it is triggered, the DAQmx read will give a data point, if the speed of the for-loop( the time from the end of a loop to the beginning of the next loop) is slower than the 1kHz trigger, then the for-loop will miss data point, then the ordering of the 1000 points in 1 second will be changed.
    Or I need to put everything, e.g. AI Voltage, Trigger, sample clock, into the for-loop and then return a Y? Thanks! 

    Clarification:
    The VI you have posted will work as following:
    1) The task will read 2 analog inputs (ai0, ai3).
    2) The acquisition starts, oncece digital signal (trigger) is detected on PFI0
    3) The sampling rate will be as specified in "rate" control - it is continuous analog input acquisition, which means that after trigger is received (point 2), the board will start to generate hardware clock with frequency you specify as "rate"
    4) with each rising edge of that hardware clock, the measurement is taken, and stored into buffer of driver.
    5) DAQmx read will try to read "number of samples per channel" number of samples each time is called - and if there is not enough measurement stored in buffer (step 4), then DAQmx read will wait until DAQ card will measure reaquested number of samples (or timeout occurs before requested number of samples has been acquired)
    6) DAQmx read will be then called 1000 times - so totaly you will read 1000 * "number of samples per channel"  number of samples.
    You do not have to be worried about speed of the loop. In fact, if you need to read just 1000 samples, with 1kS/s, then you can remove for loop and you can change measurement mode from continuous to finite samples, and specify number of samples to read to be 1000. You will read them all properly. I recomend you to read User Manual for your DAQ device - lets say M Series User Manual.
    I hope it is clear now.
    regards,
    stefo

  • Question about syncing two different iPads on 1 iMac?

    Hey all, I bought two iPad 2's today (both gifts, 1 for my mom and 1 for my dad). Bought it for them because they're probably too old at this stage for me to teach them to use a desktop efficiently. iPad is so easy for them to use the internet and listen to their music which is most important.
    My question is, I don't have an iPad myself nor any iOS devices. Maybe I'll buy an ipad in a few months or so. However I do own the only computer in the house and that's my iMac. I was going to sync both my mom and dad's iPads to my Mac, and put their songs from my iTunes library on their iPads respectively. Will I incure any problems trying to do this?
    I don't want my mom and dad's iPads to be identical and I want to sync different pictures and songs and stuff on their ipads. I want it to be their own individually.
    What steps should I take to do this? I've never really synced any iOS products before but I pick up on this stuff pretty quickly. Made the transition from a Windows desktop to a Mac easily and would do it all over again!

    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • A few questions about executable Jar files

    Hi,
    I have to make an a tutorial system and was going to make it using applets embedded in webpages. This approach causes certain limitations so decided to make it using JPanels that open up as windows on the users computer.
    I intend on compressing all the files (java, images, sound etc) within a Jar file and would like a few questions answering.
    1. How would I make an executable Jar file that when clicked on will load the program on the users computer. Is there some software to do it for me or do I have to do it from the command prompt?
    2. Is using a Jar file the best approach or is there a better way to get my java program to run on other peoples pc's
    3. If I create an executable Jar file on windows xp, will it run on a Linux machine?
    Cheers

    1. How would I make an executable Jar file that when clicked on will load the program on the users computer. Is there some software to do it for me or do I have to do it from the command prompt?The SDK contains all the tools you need. Use the jar command. To make your jar executable, include a manifest file that references your main class.
    2. Is using a Jar file the best approach or is there a better way to get my java program to run on other peoples pc'sA jar will work just fine.
    3. If I create an executable Jar file on windows xp, will it run on a Linux machine?Yes.

  • Question about tunnel two WLAN from the same foreign WLC to the same anchor

    Hi all,I met following customer request:
    one anchor WLC 4402-12 put in the DMZ of perimeter firewall, one WiSM in the internal network to controll all the AP1252. two WLAN created at the WiSM and anchor WLC: guest wlan(web-auth+lobby admin created guest accounts) and untrusted wlan(web-auth+ACS+AD user database). Both WLANs want to be tunneled from WiSM to Anchor WLC. Guest WLAN has not much users, untrusted WLAN has a lot of users which may be thousands. My question is if this design can work?(I know definately one WLAN can be tunneled, but not sure if there's any potential issues if tunnel two WLANs)
    Is there any performance issue? What WLC version is suggested to use?
    Thanks for any help!

    I haven't ever tried this but suspect that you can form only one tunnel outbound per WLC. The anchor supports multiple inbound tunnels but outbound is the question. When you find out for sure please post it here.

  • Question about connecting two monitors to Mid 2010 MBP

    I have a Mid 2010 MacBook Pro (running OS X, 10.6.8), and I want to connect it to two ASUS monitors (VS228H-P) that have HDMI, DVI, and VGA interfaces.
    1) Is this possible?
    2) What parts will I need to make the connection?
    3) Will I be able to close the lid without the MBP going to sleep?
    4) Any recommendations for an external mouse and clickety-clack keyboard? (My preference is for wireless, but I'm open to wired, too).
    If there are other recommendations for configuration (I'd like to spend less than $150/monitor. They won't be used for gaming, but for working from home and watching various media...)
    THANKS!!!

    Hi kishap8,
    Have you made changes in the display settings to make the PC use both monitors? It doesn't extend the screen on it's own.
    Here is an HP Support document on how to change display settings: http://h10025.www1.hp.com/ewfrf/wc/document?docname=c03366869&cc=us&dlc=en&lc=en&product=5309983
    And here are a couple videos (for Windows 7 that is very similar to Win 8) on how to work with multiple monitors:
    https://www.youtube.com/watch?v=Nj0RT8yVlUA
    https://www.youtube.com/watch?v=WDQCXOSJGM0
    ...an HP employee just trying to help where I can, but not speaking on behalf of HP.

  • Question about "Enhanced for loop"

    public class NewLoopTest{
         public NewLoopTest(){
              int result=0;                      
              int[] a=new int[20];           
              for(int i=0;i<a.length;i++){
                   a=i++;
              for(int i:a){  
    System.out.println("i="+i+";"+"a["+i+"]="+a[i]+";result="+result+"+"+i+"="+(result+i));
                   result+=i;           
              System.out.println("-------------");
              result=0;
              for(int i=0;i<a.length;i++){
                   System.out.println("i="+i+";"+"a["+i+"]="+a[i]+";result="+result+"+"+i+"="+(result+i));
                   result+=i;
    This code counts sum of the elements of a array.
    At first I use the enhanced for loop and at second I use the traditional for.
    Enhanced for loop in sdk1.5 returns only even elements of array, am I right?

    Enhanced for loop in sdk1.5 returns only even
    elements of array, am I right?No. It covers them all.
    The i in the enhanced for loop is not the index. It's the element at the current index. You don't have access to the index in the new loop because you don't need it.
    for (int item : arr) {
        System.out.println(item);
    // is equivalent to
    for (int ix = 0; ix < arr.length; ix++) {
        int item = aa[ix];
        System.out.println(item);
    }The i in your new loop is the same as a [ i ] in the old loop.

  • Question about suming two columns from different tables in Subquery?

    Hello everyone,
    I have a subquery that works great for getting the total SUM of a Billing table, but I also need to add to that SUM the total surcharges or additional charges from a separate table.  I tried this by doing something like so:
    (SELECT SUM(SUM(Amount) FROM Billing WHERE Billing.JobID = Jobs.ID AND Billing.BillingType = 'Invoice' AND Billing.InvoiceCanceled = 'No', SUM(Payment) FROM Payments WHERE Payments.JobID = Jobs.ID AND Payments.Type = 'Bill')) as [Amount],
    But it doesn't work as there is an incorrect syntax near 'FROM'.  I'm assuming this is because of the two FROM's in the Subquery?  But I am not sure how else I would be able to do this then?  
    Any help would be greatly appreciated.  I just noticed this bug and am hoping to get a fix out as quickly as possible.
    Thanks Again,

    Hi, sorry for taking so long to get back to this post. 
    I tried this example like so:
    (SELECT SUM(A1) AS Total1, SUM(A2) AS Total2
    FROM
    (SELECT
    (SELECT SUM(Amount) FROM Billing WHERE Billing.JobID = Jobs.ID AND Billing.BillingType = 'Invoice' AND Billing.InvoiceCanceled = 'No') AS A1,
    (SELECT SUM(Payment) FROM Payments WHERE Payments.JobID = Jobs.ID AND Payments.Type = 'Bill') AS A2),
    However, get an error that an Incorrect Syntax exists near the ','.  I remove the comma (Which I think should be there), and I get an error that an Incorrect Syntax exists near the '.'...
    I also tried doing it like this (Based on other suggestions I've found online:
    (SELECT SUM(SELECT SUM(Amount) FROM Billing WHERE Billing.JobID = Jobs.ID AND Billing.BillingType = 'Invoice' AND Billing.InvoiceCanceled = 'No') as [Amount],
    (SELECT SUM(Payment) FROM Payments WHERE Payments.JobID = Jobs.ID AND Payments.Type = 'Bill') as [Additional]),
    And I get an error that an Incorrect Syntax exists near 'SELECT'...
    I also tried doing something like this with the SQL I already had...
    (SELECT SUM(Amount) FROM Billing WHERE Billing.JobID = Jobs.ID AND Billing.BillingType = 'Invoice' AND Billing.InvoiceCanceled = 'No') as [BilledAmount],
    (SELECT SUM(Payment) FROM Payments WHERE Payments.JobID = Jobs.ID AND Payments.Type = 'Bill') as [Additional],
    SUM(BilledAmount + Additional) AS [TotalBilled],
    But I get an error that the alias' are Invalid Column Names...  I have used Alias' before so I'm not sure why this would be an issue here...
    As you can see, I've been trying to figure this issue out, but haven't had much luck...  :(

  • Question about Executable JAR Files

    Is it possible to make an executable JAR file that has all of the *.class files, all of the *.jar archives used, etc. packaged into one file that doesn't need these external files within the same directory? I've been having a ton of trouble finding the answer to this. (If it's blatantly obvious, please forgive me.)

    Hello,
    I went through the same thing recently. Here is a piece of the build file I use:
    <project name="MyProj" basedir="." default="main">
        <property name="src.dir"     value="src"/>
        <property name="build.dir"   value="build"/>
        <property name="classes.dir" value="${build.dir}/classes"/>
        <property name="jar.dir"     value="${build.dir}/jar"/>
        <property name="main-class"  value="MyProj.Main"/>
        <property name="lib.dir"     value="lib"/>
        <path id="classpath">
            <fileset dir="${lib.dir}" includes="**/*.jar"/>
        </path>
        <target name="compile">
            <mkdir dir="${classes.dir}"/>
            <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
        </target>
        <target name="jar" depends="compile">
            <mkdir dir="${jar.dir}"/>
            <jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
              <zipfileset src="lib/commons-codec-1.3.jar"/>
              <zipfileset src="lib/commons-fileupload-1.1.1.jar"/>
              <zipfileset src="lib/commons-httpclient-3.0.1.jar"/>
                <manifest>
                    <attribute name="Main-Class" value="${main-class}"/>
                </manifest>
            </jar>
        </target>
        <target name="main" depends="clean,run"/>
    </project>Note the <zipfileset> tags that contain the .jars.
    There are, however, many good reasons to not do this. Some were already mentioned, another is in the case of update external libraries, you might not want to rebuild your whole project, replacing a jar may be easier.
    Good luck,
    -Sam

  • Question about executing a procedure what what is replicated

    With Logical Standby Apply, if I execute a procedure on Primary database that changes data, is the execution statement replicated or just the changes made in the primary database by the execution?

    Hi,
    As per my understanding related to standby database architecture,
    whatever changes happening on primary database, will apply on physical database also on logical database using SQL APPLY technique...it could be DDL, DML changes...
    Regards,
    GRB

  • HT204053 Question about merging two iCloud accounts?

    Before I understood how to use iCloud properly I set up two completely different iCloud accounts (one for work and one for personal) but now I want to merge the two into one. How do I do that and keep all app purchases and all information?

    Unfortunately, you can not merge two accounts. See also: Apple IDs and iCloud FAQ: http://support.apple.com/kb/HT4895?viewlocale=en_US&locale=en_US

  • Question about combining two tables

    I have two tables that I want to combine them together:
    Table A: ID x
    49 3
    127 1
    Table B: ID y
    49 1
    83 2
    127 1
    Expected combined table C: ID x y
    49 3 1
    83 0 2
    127 1 1
    Seems I have to do two out join and them union them together. Any better ways?
    Thanks
    gary

    The tables are not displayed properly. try it again:Use the {noformat}{noformat} tag for that.
    Put it before and after your example.
    So, when you type or paste your formatted code like this:
    {noformat}select *
    from dual;{noformat}
    it will appear as:select *
    from dual;on this forum                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Questions about these two IO classes....

    1)
    OutputStreamWriter
    An OutputStreamWriter is a bridge from character streams to byte streams: Characters written to it are encoded into bytes using a specified charset.
    i dont understand. Converting characters into bytes is understandable, but what does it mean by "using specified charset"?? I mean, isn't that the other way around?? ie, you convert bytes into characters using a specified charset??
    2)
    BufferedWriter, BufferedWhatEver...
    What does that makes code cleaner, when OutputStreamWriter and PrintWriter have basically same methods as they do??
    3)
    For top efficiency, consider wrapping an OutputStreamWriter within a BufferedWriter so as to avoid frequent converter invocations. For example:
    Writer out
    = new BufferedWriter(new OutputStreamWriter(System.out));
    What does it mean by "to avoid frequent converter invocations"?
    thanks for any responses.

    so, what is "buffering" then?
    I dont understand the explanation... lower code
    invocation??
    maybe in a plainer sentence will help??
    so sorry for not understand it.The following is not necessarily accurate in every technical detail, but it's close enough to demonstrate the principles.
    Let's say I'm going to write 10 bytes. I can do this: stream.write(b0);
    stream.write(b1);
    stream.write(b9);Each of those will cause stream to acces whatever native code it uses which will cause an I/O operation to happen at the hardware level--it will write a byte to the disk controller. It will do this once for every byte.
    Doing that physical I/O carries an overhead. The time taken to actually get the one byte written may be vastly overshadowed by the time taken to access the controller.
    You wouldn't want to establish a connection to a web server, read a byte, close the connection, establish antoher connection, read a byte, et.c. ... right?
    Now, instead, if I put the bytes in an array and call something like bufStream.write(arr, fromByteZero, tenBytes); then I make one call to the stream, it makes one call to the disk controller, pays the overhead cost only once, and writes all ten bytes.
    So instead of 10*overhead + 10*byte_write_time I pay 1*overhead + 10*byte_write_time

  • Question about synchronizing two methods...

    i have 2 methods:
    writeData() //method 1
    createNewDataFile() //method 2
    the main thread will be using method 1 quite frequently. In method 2, a separate thread will be waking up every 10 minutes or so and doing some maintenance on the file written to in method 1. So, when the thread is in method 2 i need method 1 to standby and wait. I also want the opposite, that when the main thread is in method 2 method 1 will stand by.
    Any help is appreciated!

    799454 wrote:
    So wait,
    i thought synchronized only worked on the actual methods where it is declared:Using the synchronized keyword obtains a lock. Each object has exactly one lock associated with it. Once a thread has obtained an object's lock, no other thread can obtain that lock (and hence cannot enter a sync block on that lock) until the first thread releases it by leaving its sync block or calling wait().
    so, you're saying that if i declare:
    synchronized method 1
    synchronized method 2
    then i have a single object with 2 synchronized methods, so if thread A is in EITHER of those methods, the other method will be locked as well?The method isn't "locked" per se, but yes, 1 object, 2 synced methods, if T1 is in either method, then T2 cannot enter either method.
    I strongly urge you to go through that tutorial and/or a book on Java concurrency, thoroughly.

  • Have a question about execute swing

    hello,
    Sometimes I use addWindowListener to exit JFrame, but it don't work until I CTR+C.
    Please tell me what's the problem.

    Depends on what you do once you add that window Listener. Do it like so:
    class MyFrame extends JFrame
        public MyFrame()
            setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
            addWindowListener(new WindowAdapter()
               public void windowClosing(WindowEvent e)
                   exit();
        private void exit()
            // you may wish to ask "Are you sure?" MS style.
            System.exit(0);
    }Cheers,
    Radish21

Maybe you are looking for

  • How do i disable iMessage on my macbook air?

    I keep receiving my texts from my iphone on my macbook air and i do not want it to do that, incase someone else is using my computer, i do not want them to see my texts

  • Problems with encoded parenthesis in URL of BSP application

    Hi, our BSP application has following url: http://sap-host/sap/bc/bsp/sap/zapp/index.html After login we addionaly get a parentheses-part in the url (url mangling): http://sap-host/sap(bD4JHFSIBSF==)/bc/bsp/sap/zapp/index.html Everything works fine a

  • EJBQL IN or not IN?

    I'm trying to develop an EJBQL query, and I can't seem to express what I want - there may be a way, please let me know what you think. The schema: I have a table called 'Vouchers', and a table called 'Courses'. There is a many-to-many relationship be

  • Data Upload error!

    Hi, While uploading hierarchy from flat file, i got the following error: 'Syntax error in template RSTMPL9C, Row 80' i checked the 80 th row in falt file, it is just normal as like any otehr record in flat file. may i know what is this error and why

  • Print and dbms_output.put_line

    wats the diff between prin and dbms_output.put_line