How to initiate two simultaneous tasks? First waits on second.

I'm looking for guidance. I feel my problem is likely very common. It involves performing two tasks simultaneously.
I have a digitizer (pxi5105) and a waveform generator (pxi5412). I need to generate a pulse and record the response simultaneously. My experiment basically works like this. Imagine that a hammer strikes an object causing it to vibrate. I need to record the resulting vibration beginning with the hammer strike. The generator is the hammer, it generates a pulse. The digitizer records the vibration.
I can imagine a couple of ways to do this. One is to first initialize the digitizer (set it up to measure voltage), then start the generator. The rising generator signal would trigger the digitizer to take a reading. The reading would be returned to the program for processing.  I'm thinking the digitizer task would have to run in a separate thread. Upon completion, the digitizer task would invoke a callback function in the main program to process the data. I think there's an example program demonstrating this kind of threaded programming. Is this the best way?
Another approach might be to first turn on the generator and let it run continuously. Then activate the digitizer to trigger off the generator signal as before. This would avoid the complexity of a separate thread. Is this a better approach?
Is there a way to trigger generator and digitizer simulaneously?
If there is documentation/example of this please point me there.
Any recommendations are greatly appreciated.
thanks!

Hi,
I do not think you have to use multiple threads.
Being very expensive devices, the digitizer and the wave gen are capable of handling most of the stuff on their own.
First, you configure the generator to generate and the digitizer to trigger and acquire.
Then, you start the wave generation by software command (digitizer starts acquiring automatically after the waveform crosses the trigger level).
Then, you wait for the acquisition to finish.
Then, you read the samples from the digitizer into your array.
Then, you process them.
As you see the flow of operations that your program should implement are sequential, not parallel.
So I do not see a point where you will need multiple threads.
If the generated waveform is very slow and thus the acquisition is supposed to last too long,
you can use a small timeout value for your "Fetch waveform" function and loop on it.
This way, since you can process events within this loop, your program will keep being responsive.
Hope this helps,
S. Eren BALCI
www.aselsan.com.tr

Similar Messages

  • How to synchrorise two workflow tasks/calls?

    Hi all,
    We are writing a Workflow client application (in Java) and having problem getting valid state of the workflow because of the delay in PL/SQL API.
    Here's are two example:
    1) First we respond to a notification (using WF_Notification.Respond). After the Respond call has returned, we use a new transaction to scan the table for open notification for the user.
    We got back the responded notification as open notification as the table values have not been changed.
    We found that the table values will only change after a certain period.
    2) Expedite the process
    First we call the handleError API. Then read the table for activity statuses. Again, the table values are not updated even the handleError API has returned. We need to wait for 1 or 2 sec before the table are in valid states.
    Anyone know how can we synchorise these? May be there's a flag we can set to force the API blocks until it completed processing or a flag we can check to find out the status of the last API call.
    Thanks.

    I had similar issues when I developed a workflow portlet. I maintained a record of recently actioned notifications and hid them from the user for the next few requests.
    Regards,
    Mark

  • Unable to initiate a Human Task after Wait

    I am using Oracle BPEL Version 10.1.3.1.0.
    Issue:
    Human task throws an javax.naming.NameNotFoundException: java:comp/env/ejb/local/TaskServiceBean not found in ActivityManagerBean when it should initiate a Human Task Service.
    Steps:
    In Oracle BPEL workflow
    1. Have a wait state for 30 seconds.
    2. Have a Human Task created after that.
    Expected result
    Create an instance
    Human task should be created after 30 seconds.
    Actual results.
    Exception is thrown
    javax.naming.NameNotFoundException: java:comp/env/ejb/local/TaskServiceBean not found in ActivityManagerBean
    If the wait condition is removed or time is set to 0, the error goes away.
    Domain.log shows
    <2007-05-04 12:00:13,421> <ERROR> <default.collaxa.cube.services> <::> ORABPEL-30029
    <2007-05-04 12:00:13,421> <ERROR> <default.collaxa.cube.services> <::>
    <2007-05-04 12:00:13,421> <ERROR> <default.collaxa.cube.services> <::> Error in invoking task service.
    <2007-05-04 12:00:13,421> <ERROR> <default.collaxa.cube.services> <::> An client side error occured in invoking the task service.
    <2007-05-04 12:00:13,421> <ERROR> <default.collaxa.cube.services> <::> Please check the exception error stack to identify the error. Contact oracle support if error is not fixable.
    <2007-05-04 12:00:13,421> <ERROR> <default.collaxa.cube.services> <::>
    Please advise.

    Yes, it works.
    I can create task and see them in the worklist application.
    Even if I put the time in wait to 0, it works.
    It should be a very simple bug to reproduce. We have been able to do that on two different machines using these steps.
    A wait of 30 seconds.
    A human workflow task.
    Initiate the process, it gives error. Remove the wait. It works.
    Use a pick activity and provide timeout in onAlarm instead of wait approach. The same issue occurs.

  • How to synchronized two Timer Task ?

    I need to execute 2 job
    job1 every sec
    job2 every min
    when one task is executing other task should wait
    so i created 2 timer
    timer1 will execute secjob every sec
    timer2 will execute minjob every min
    and one job object with synchronized execute method
    please see the code for further detail
    problem:
    before completion of secjob , minjob started excuting
    job Fired Fri Oct 10 20:45:16 IST 2008 by Timer-0 ID :7.....
    job Fired Fri Oct 10 20:45:21 IST 2008 by Timer-0 ID :7.....
    job Fired Fri Oct 10 20:45:26 IST 2008 by Timer-0 ID :7....{color:#ff0000}*job Fired Fri Oct 10 20:45:31 IST 2008 by Timer-1 ID :8*{color}*.*
    {color:#ff0000}*...*{color}
    job Fired Fri Oct 10 20:45:34 IST 2008 by Timer-0 ID :7.....
    job Fired Fri Oct 10 20:45:39 IST 2008 by Timer-0 ID :7.....
    public class Fire {
        static void secJob(Job job)  {
             Timer timer = new Timer();
             int delay = 0;  
             int period = 1000*1; 
             SecJob secJob = new SecJob(job);
             timer.schedule(secJob, delay, period);        
        static void minJob(Job job) {
             Timer timer = new Timer();
             int delay = 0;  
             int period = 1000*60; 
             MinJob minJob = new MinJob(job);
             timer.schedule(minJob, delay, period);
        public static void main(String[] args) {       
            final Job job = new Job();
            secJob(job);
            minJob(job);
    public class SecJob extends TimerTask{
        Job job;
        public SecJob(Job job) {
            this.job = job;
        public void run() {
            job.execute(SecJob.class);
    public class MinJob extends TimerTask{
        Job job;
        public MinJob(Job job) {
            this.job = job;
        public void run() {
            job.execute(MinJob.class);   
    public class Job {
        private void sleep(long count,PrintStream out) {
            try {
                for (int i = 0; i < count; i++) {
                    Thread.sleep(1000*1);
                    out.print(".");
                out.println();
            } catch (InterruptedException e) {
                e.printStackTrace();
        public synchronized void execute(Class c) {
            Thread t = Thread.currentThread();
            if(c == MinJob.class ) {
                System.err.print("job Fired "+new Date()+" by "+t.getName()+" ID :"+t.getId());
                sleep(3,System.err);
            }else if(c == SecJob.class ) {
                System.out.print("job Fired "+new Date()+" by "+t.getName()+" ID :"+t.getId());
                sleep(5,System.out);

    I'd only use one timer and write a dispatcher task that stores the time at which job2 is executed. If the last time is more than one minute past, execute job1, reset the time tracking field, and execute job2.

  • How can I make a while loop wait 10 seconds before iterations​?

    I am using labview to for an osmosis system that measures the amout of water lost from the reading on a scale.  
    I currently have the program displaying the data from 3 scales every second.
    I also need to calculate the flux through the membrane over time.
    I do this with a function that takes a change in the scale reading over time (with a shift register) followed by a series of mathematical conversions.
    The readings from the scale display OK every second, but I need to have at least 10 seconds between flux calculations.
    So my question is, how do I make a the shift register take one value from the scale, then wait 10 seconds before taking the second value?  That way I have the mass of water lost over a 10 msecond period.  
    Below is my current while loop for Flux using shift registers from data from 3 scales.  
    Any helkp would be great!
    Also, I'm new at LabVIEW...

    Bob_Schor wrote:
    Do you understand how Dataflow (a key idea behind LabVIEW) works?  If you put a Wait (ms) function (on the Timing Palette) with 10000 (10,000 milliseconds = 10 seconds) inside your While Loop, the principles of Data Flow will require all of the functions inside the While (specifically the Wait function) to finish their execution before the loop can run again.  As everything else in the loop takes approximately 0 seconds, this will make your loop run once every 10 seconds.
    Bob Schor
    I do not think that is a good idea. 
    The inner loop should be in sync with the outer loop, not run independent on it's own timer.
    If the inner loop is running independently you run the risk of using stale data.
    Actually  altenbach is right the inner loop does not need to be a for loop at all, but rather just a case like my suggestion (without the for loop) and the shift registers should be out on the main loop.
    My suggestion was a quick solution going by what little bit of the block diagram I could see, but if the entire code was posted I am sure we would see where more improvements could be made and possibly even a better solution.

  • How to read two files (one is updating every second, the other is constant) simoltaneously

    Dear All,
    I will appreciate if somebody help me.
    I want to read two files, one is temperature wich is updating every second, and the other is hysteresis energy which has specific rows and is constant.
    I got a program in discussion forum which read a file as it is updating. I checked this program in my case and it works.
    Then I added reading hysteresis energy file to the existing file. But while i am running the program, the hysteresis energy file is read with all rows.
    But the aim is that everytime which temperature updates, I need to read just one row of the hysteresis energy file.
    so, in this way in every second i have a new temperature data and one row of the other file.
    I tried to used "for loop" inside the program, but it did not work, becuase reading temperature will be stopped untill for loop ends.
    I attached the program.
    Could somebody help me how to read just one row of hysteresis energy file everytime temperature updates?
    Solved!
    Go to Solution.
    Attachments:
    Readfiles.vi ‏23 KB

    I do not understand relationship between your two files.
    You have another VI or app that is writing data to both files and when new temperature data added you wish just to read the new data and then read one new line of the hysteresis file?????
    But is one is constant, why do you need to keep reading it?
    Anyway…
    The “Read From Spreadsheet File.vi” preformed an Open and a Close for each time it is called (if you will open the VI up and drill down and you will see). So that resets the file pointer back to the beginning and there for will read in the whole file from the first to the last each time if you do not set the start of read offset or number of rows.
    Now the Read from Binary File does not reset the file pointer and leaves the file pointer just past the last byte read so it will start with any new bytes automaicly only giving you the new data.
    I do not think you need to do the math with the Previous EOF=0 and the File size to get what I think you are trying to do.
    Plus use shift reg for the Data string instead of local var
    Set the mechinacl action of the stop botton to Latched
    So you do not need to init the two controls
    Also, I do not get the End of file encountered error (4) from the Read from Binary file if I attempt to read past. It just returns and empty string.
    Omar
    Attachments:
    Readfiles.vi ‏22 KB

  • Can we create two "TS17900100" tasks in one WF to update IT with Wait time

    Hello Folks ,
                  I have scenario in which I have to update two infotypes but with some wait time .  I have created to form scenarios and attached those scenarios in my WF  binding one by one .
    I have two WF TS17900100 task * first one has scenario update_1  and has wait time and also has approval in between .
    For my other WF TS17900100 task  , I have scenario update_2  as well as approval .
    What is the issue .
    It is update Infotype but creating 2 records because of the reason I am executing u201CTS17900100u201D task twice. But my question is it has the different form scenario inside  with different set of fields which I selected back in u201CDesign time u201C .
    Any idea how to get  rid of double entries .  Note: per my requirement I need a wait time in between  process .
    Thanks.
    Khan

    I am doing it already !!
    Thanks .
    Khan
    Check out http://www.aspirehr.com/dynamicforms/

  • OIM - starting two process tasks simultaneously

    Hello,
    I have a process definition with many process tasks. If a certain trigger/event happens (eg. Change Last Name) I want to run two particular process tasks. How do I achieve this? My guess was to use the option to generate new tasks based on the response code, but I didn't manage to build such a task yet. How do I configure a new task that only initiates/generates two other tasks?
    Joost

    Hi Ryken - each background task is its own entity, so each task should get 16Mb of memory as described
    here.  Also, each task gets its own 2 seconds to execute.  The tasks do not combine resources.  I do not think that you can share statics between the processes,
    but you're welcome to test it out and prove me wrong.
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • How to VIEW two tracks's materials SIMULTANEOUSLY and SYNCHRONIZED in MONITORS?

    How to VIEW two tracks's materials SIMULTANEOUSLY and SYNCHRONIZED in MONITORS?
    "Program-monitor" shows the final edited material, and "Source-monitor" shows only one track at a time, and NOT SYNCHRONIZED with the sequence. "MultiCam-monitor" shows the tracks as I need, BUT editing is very stiff:  I want to do edits+cross-fades by hand IN THE TIMELEINE rather than by clicking the monitors. (Some of the "MultiCam-monitor's" other problems: 1) the timeline's time-inspector doesn't move while clicking the monitors, 2) vice-versa: monitor-image doesn't roll when the space-key is pressed for playback the timeline, 3) monitor doesn't show the cross-fades.....)   I understand the "Reference-monitor" doesn't help either at this.
    I would SO much like to SEE all tracks' materials simultaneously in whatever monitor, to edit efficently in the timeline.
    Software: Premiere CS3 version 3.2.0
    Operating System: Mac OS X (v10.4)

    You can only do this in the multicamera monitor.  That's what it's there for.  Proper procedure is to cut there, then go to the timeline and add transitions.
    If you're multicamera monitor playback isn't working correctly (I admit having a hard time understanding your points here), then try solving those.

  • Hi All, I have two questions. First of all my CS3 is saying that it is installed on more than one machine, is there a way of seeing what machines my serial number is registered to? If i want to buy another CS3 serial number how do i go about it? I cannot

    Hi All, I have two questions. First of all my CS3 is saying that it is installed on more than one machine, is there a way of seeing what machines my serial number is registered to? If i want to buy another CS3 serial number how do i go about it? I cannot afford to move to the creative cloud.....

    there's no way for you to identify which machines have or had cs3 activated, and you can no longer purchase a cs3 license from adobe.
    you can request an activation count reset (Contact Customer Care) and deactivate your cs3 on all your computers.  you can then install and activate on up to two computers.

  • How to use two tasks in Workflow

    Hi Everybody !
    Can Any one tell me, How to use two tasks in one activity step type of  Workflow CRM?
    My requirement is... I have to execute two tasks in single activity step in Workflow. Is it possible.if it is possible tell me the flow Please.
    Thanks in advance.
    Raghava Vakada.

    You can define one as a "Before" or "After" method if that is usable for you. (defined in tab Methods for Activity steps)
    Otherwise there is also the step flag "Advance with dialog" (tab Details on Activity steps, but the tab it is found on depends on your version) which allows one user to seamlessly execute two consecutive tasks.
    So depending on your real need there may be several options available. If all that is needed is that the same user can execute the two tasks then Advance with Dialog is perhaps the best choice. If the user then cancels execution of the second activity the work item is available for execution. If you define an After method and the user cancels execution the work item has still been completed since its (main) method has been completed.

  • How to synchronize two timer/counter tasks?

    Hi,
    I'm programming DAQmx through the nicaiu.dll with Matlab. I'm trying to start two different tasks, each controlling ctr0 and ctr1, respectively. Both timer/counter tasks should start on a common trigger, in my case /Dev/PFI0. Having searched the forum, I do understand that both tasks can't be triggered off PFI0. Instead, I probably need to trigger one of my tasks on a signal that turns on whenever the first task starts. My question is; What signal can inform my ctr1 task that my ctr0 has started? I basically want these two tasks synchronized, but not pulse by pulse since the pulse trains are quite different.
    Trying to trigger both off PFI0 results in a resource conflict. Triggering ctr1 on ctr0gate doesnt work either.
    Also, I need ctr1 to trigger on when the ctr0 tasks starts, i.e. not when the first ctr0 pulse appaers!
    Thanks,
    Per

    Thanks Ryan.
    I made some changes to my code now and it appears I CAN trigger both counters off PFIO (on an E-Series board). I only recently converted all my Traditional code into DAQmx, and got lost in my tracks. I was trying to generate finite pulse trains on both counters, and had used Finite timing on the counters to generate finite retriggerable pulse trains, without knowing that tied up the second counter. I solved this now using Pause Triggers instead. In the case where I generate single retriggerable pulses I still use a Start Trigger, and I can now Start BOTH counters using DAQmxCfgDigEdgeStartTrig and listening to PFIO with both counters (each counter running off a separate task).
    Sorry, I got things confused, and your solution isnt required anymore. Similarly to your solution, though, I have always used a (real) analog output routed externally to the PFI0 pin on my E-Series board as the synchronizing trigger. However, if I could avoid the external wiring it would be nice, so I will explore your solution a bit more
    I am not familiar with the concept of a 'dummy' task/channel. Can you point me to more documentation on this?
    I already use the analog inputs on this board from another app. Will creating a dummy AI tie up all analog inputs, so I can't then access my physical analog inputs from other applications (on the same board)?
     - Per

  • How can I combine these two DAQ tasks???

    I am using LabVIEW 11, Windows XP, cDAQ-9174 chassis, two NI-9205 modules.
    Please see my code for reference. I am very new so i will accept all suggestions.
    I am acquiring 12 volatage signals in a producer/consumer structure giving me a queue of 1-d array of waveform(dbl). Then I am acquiring 12 voltage signals in another loop giving me 2-d array of waveform(dbl).
    There is an issue creating the channels. How can I combine these two tasks?
    Thanks,
    ~Chris
    Attachments:
    WaveTest_6.2.vi ‏558 KB

    Hello chrisbe723,
    When you say that there is an issue creating the channels, are you getting a specific error message when running your code? Also are you referencing the same set of channels for the two DAQ task you are configuring?
    Paul-B
    Applications Engineer
    National Instruments

  • How to run two sub vi simultaneously??

    i need to run two sub vi simultaneously in one main vi, becasue it is a must the two sub vi run exactly at the same time, but now i find that if i put they in one diagram ,in fact they are not exactly run at the same time. if you see in high light mode Just like the attached simple example code.  any one can help me to handle this to run the two subvi exactly at  the same time ? how to do it ? thanks so much.
    Attachments:
    how to run subvi simultaneously.vi ‏11 KB

    You are correct, they will not run at exactly the same time.  What is it you are actually trying to do?  What platform are you developing on? What version of LabVIEW? What processor does your target system have? This information is vital in order for us to assist you.  In a nutshell, unless you are running a real-time OS, then the OS you are running is not deterministic.  When you say "at the same time", what are you actually referring to? As a note, when executing parrallel operations in LabVIEW, the execution order may or may not be the same with the highlight bubble on as it is when it is running without highlight execution.  It is highly unlikely that you will be able to just run two sub-vis at the exact same nS.  If you are using DAQ boards, you accomplish this through triggering.  Please give a detailed description of what you are doing, and what you see the road blocks being.
    Thanks
    Paul <--Always Learning!!!
    sense and simplicity.
    Browse my sample VIs?

  • How to initiate a call, first time

    Created an account, signed in, created community name.  "People" not showing up on my screen, so am not sure how to initiate a call.

    It sounds as if you're looking on a browser page, which won't do the trick, since Skype calling isn't accessible that way. Download the Skype application by clicking on the Downloads link at the top of this forum page. Double-click the resulting Skype.dmg file that you'll find in your Downloads folder. Drag/drop the Skype icon onto the Applications folder icon IN THAT WINDOW to install Skype. Thereafter, you'll be able to open Skype from within your hard disk's Applications folder.
    Entia non sunt multiplicanda praeter necessitatem.

Maybe you are looking for

  • HT1338 how can i run java on a Mac OS version 10.6.8?

    My company runs it's email and agent portal through Java, wen I wen through the Java web page to download the software it sends me to apple support, does anybody have an idea of how to run java on a Mac book Mac OS v10.6.8? help me please my job is d

  • Problem of variation of color between Firewoks CS5 and CS6 ?

    Hy everyone ! I have problem of variation of color between Firewoks CS5 and CS6. An Hexa color defined in a CS5 file, dont have the same Hexa component when opened with Firewoks CS6 ? Example with au GREEN color : #80BB39 (Created with Firewoks CS5)

  • HT201250 Time Machine trouble

    I'm having trouble with time machine backups on lion.  I set up one of my external drives as my backup in snow leopard weeks ago, it was working fine, now in lion it shows in the preferences that the external I was using for tm is  on the exclude fro

  • Systemd 215-4 breaks automount shares

    Hi, I use systemd automount feature to mount samba shares at boot with the following entry in /etc/fstab : //nas/partage /home/hubert/nas cifs noauto,x-systemd.automount,x-systemd.device-timeout=10,credentials=/home/hubert/.smbcredentials 0 0 This wo

  • Firefox will not open ebay pages

    For some reason firefox will no longer open the ebay page. When i type www.ebay.com.au a blank page opens, but when I use my shortcut on my desktop that will work, but when I select and item to view it opens a blank page. The item description is in t