Calling producer/consumer subvi using main vi for image grab acquire

Hi everyone,
I am not sure if I get the producer/consumer concept wrong. I tried to write a producer/consumer subvi that simulate continuously grab acquire image. When I call the subvi from the main while loop with a main vi, it seems to run into a infinite loop. I am wondering does anyone know how else can I activate a producer/consumer subvi using main vi? Thanks in advance.
Kind regards,
Han Yen
Solved!
Go to Solution.
Attachments:
MainTrial.vi ‏7 KB
ProducerConsumerGrab.vi ‏18 KB

Hi Han Yen,
a few remarks :
- your Top VI has no function what so ever.  So skip that.
- your image queue has no name, so that gives problems from the minute you're going to use more queues.
- It does not matter which command you send to the queue, it will start the bottom loop anyway
- You don't have a check whether "live trial" is true yes or no, so everytime you switch it from T=>F or F=>T is will activate the command.
I've tweeked your producer-consumer.  Maybe this will give you an idea.  I put some remarks in some places
Kind regards,
- Bjorn -
Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's
LabVIEW 5.1 - LabVIEW 2012
Attachments:
ProducerConsumerGrab.vi ‏21 KB

Similar Messages

  • What is the interaction between calling VIs and subVIs using VI Server?

    I'm studying for the CLAD and one of the lines in NI's preparation document here is this:
    What is the interaction between calling VIs and subVIs using VI Server?
    I know how to use the "Call By Reference" function to call a VI, but not necessarily a subVI. I thought a subVI is always loaded with the calling VI and has nothing to do with VI Server. What am I missing?
    Solved!
    Go to Solution.

    Hi Bmihura,
    I think this article will clear up how the VI Server works with subVIs called dynamically or statically.
    Calling a VI by Reference
    Best Regards,

  • Producer Consumer Problem using sockets

    Hello,
    Can anybody help me how to implement the Producer Consumer Problem using java sockets? Or any resources you've, pls forward it to me
    Cheers.

    Neg wrote:
    You just tell me if there is any means to do it.Yes, Just use a fixed length ArrayBlockingQueue on either end (or both ends) Use offer() to offer more data and this will return false when the queue is full.
    Note: the use of a Socket is entirely optional.

  • Consumer application using ETW events for TCPIP tarffic message

    I am planning to build a consumer application using ETW events in real time mode. My application is already set with  EVENT_TRACE_REAL_TIME_MODE for KERNEL_LOGGER_NAME. And successfully consume the Registry and file events.
    Interested in consuming Network events for TCP/UDP and looking for sample code (C++) that gets relevant data from _EVENT_RECORD structure.
    Any sample application and relevant documentation will be of great help.
    Thanks.

    I know they are in this kit
    http://www.microsoft.com/en-us/download/details.aspx?id=3138
    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com

  • Problem in using different format for Image files

    We are generating a report wherein the logo (Image File) is changed with respect to the company's location.
    Here, we are making use of a Text field using a formula column as its source for getting the file path.
    When the Size is kept as "Expand" or "Variable", then, when the image size changes considerably, it gives problem, wherein the logo is not displayed.
    Then we increased the size of the logo field and kept thte size type as Fixed. But the probnlem which we face is because of the .bmp format which the report accepts.
    This is because, when the format type is bmp, upon increasing the resolution or size of the bmp increases the size by several folds( say from 70kb to almost 1000 or 1500kb) which leads to the error "Memory cannot be read" and leads to abrupt application termination.
    Is their any way by which i can make use of GIF format for the image file and at the same time change the file name at runtime.
    Eagarly waiting for an early solution.
    Thanking you in Advance,
    Ramnath Balasubramanian

    Hi,
    You can only use one Apple ID with iTunes match. Purchasing another match subscription using wife's Apple ID is not a solution. I can only suggest that you use your ID for match and all iTunes music purchases.
    Jim

  • How should i do?when i use the sc2345 for analog signal acquired!

    please help me!
    I have to use the sc2345+NI6221 for analog signal acquired. but i don't have a analog input module such as SCC-AIXX.
    So I want to pass the signal to the DAQ device. how should i do to connect the wire on the sc2345?
    how can I use the sc2345 for a pass connector?
    Thank you very much and look forward to your reply...
    Solved!
    Go to Solution.

    What kind of signal do you want to acquire?
    If it does not need any conditioning, then, you can connect the signal to 6221 with a terminal block such as SCB-68.
    Best regards,
    NISH AE Haiping.Fei

  • Producer/Consumer problem using jtux.

    The buffer can only have 10 items which contains 2 integers. But after some time the producer starts to produce and put more than 10 items in the buffer. Here the semaphore is suppose to stop it but it seems that the producer does not care about it and continues to produce items. I have gone through the code many times i cannot see what is wrong.
    //BOUNDED_BUFFER CLASS
    import java.io.*;
    import jtux.*;
    public class Bounded_buffer extends Semaphore{
         static public void main(String[] args) {
              long pid;
              int mutex = create(1);
              int fullBuffer = create(0);
              int emptyBuffer = create(10);
              int shmid = Shared_memory.create(84);
              long memPointer = Shared_memory.attach(shmid);
              Shared_memory.write(memPointer, intToByteArray(4), 4);
              int numProd = 5;
              int numCust = 10;
              try{
              for(int i = 0; i<numProd; i++) {
                   pid = UProcess.fork();
                   if(pid == 0) {
                        producer(mutex, fullBuffer, emptyBuffer, memPointer);
                        Shared_memory.detach(memPointer);
                        //Thread.sleep(500,0);
                        System.exit(0);
              for(int i = 0;     i<numCust; i++) {
                   pid = UProcess.fork();
                   if(pid == 0) {
                        customer(mutex, fullBuffer, emptyBuffer, memPointer);
                        Shared_memory.detach(memPointer);
                        //Thread.sleep(500,0);
                        System.exit(0);
              UExitStatus status = new UExitStatus();
              for(int i = 0; i<(numProd+numCust); i++)
                   UProcess.wait(status) ;
              }catch (Exception e) {
                   System.out.print("Exception: ");
                   System.out.println(">" + e.toString() + "<");
              } //try-catch
              destroy(mutex);
              destroy(emptyBuffer);
              destroy(fullBuffer);
              Shared_memory.detach(memPointer);
              Shared_memory.destroy(shmid);
              System.exit(0);
         } //end main
         static private void producer(int mutex, int fullBuffer, int emptyBuffer, long memPointer) throws Exception{
              long pid = UProcess.getpid();
              byte[] buffer = new byte[4];
              int usedBuffer;
              for(int i = 0; i<20; i++) {
                   wait(emptyBuffer);
                   wait(mutex);
                   //Thread.sleep((int)(10*Math.random()),0);
                   Shared_memory.read(memPointer, buffer, 4);
                   usedBuffer = byteArrayToInt(buffer);
                   Shared_memory.write(memPointer+usedBuffer, intToByteArray((int)pid), 4);
                   Shared_memory.write(memPointer+usedBuffer+4, intToByteArray(i), 4);
                   usedBuffer = usedBuffer + 8;
                   Shared_memory.write(memPointer, intToByteArray(usedBuffer), 4);
                   System.out.println("Item " + i +" produced by " + pid + '\t' + '\t' + "Items in buffer: " + (usedBuffer-4)/8);
                   signal(mutex);
                   signal(fullBuffer);
         static private void customer(int mutex, int fullBuffer, int emptyBuffer, long memPointer) throws Exception{
              long pid = UProcess.getpid();
              byte[] buffer = new byte[4];
              int usedBuffer, ppid, num;
              for(int i = 0; i<10; i++) {
                   wait(fullBuffer);
                   wait(mutex);
                   //Thread.sleep((int)(10*Math.random()),0);
                   Shared_memory.read(memPointer, buffer, 4);
                   usedBuffer = byteArrayToInt(buffer);
                   Shared_memory.read(memPointer+usedBuffer-4, buffer, 4);
                   num = byteArrayToInt(buffer);
                   Shared_memory.read(memPointer+usedBuffer-8, buffer, 4);
                   ppid = byteArrayToInt(buffer);
                   usedBuffer = usedBuffer - 8;
                   Shared_memory.write(memPointer, intToByteArray(usedBuffer), 4);
                   System.out.println("Customer " + pid + " got item " + num + " from " + ppid + '\t' + "Items in buffer: " + (usedBuffer-4)/8);
                   signal(mutex);
                   signal(emptyBuffer);
         private     static final byte[] intToByteArray(int value) {
              return new byte[] {
                   (byte)(value >>> 24),
                   (byte)(value >>> 16),
                   (byte)(value >>> 8),
                   (byte)value};
    // helper function to convert an array of 4 bytes to an int.
    // This function is needed to read ints from shared memory.
    private static final int byteArrayToInt(byte [] b) {
              return (b[0] << 24)
                   + ((b[1] & 0xFF) << 16)
                   + ((b[2] & 0xFF) << 8)
                   + (b[3] & 0xFF);
    //SEMAPHORE CLASS
    import java.io.*;
    // jtux is the library that gives the POSIX interface.
    import jtux.*;
    // This is an interface to the SystemV semaphores that are
    // easier to use. The SystemV interface to semaphores is
    // very weird and hard to understand. If you're interested
    // you can take a look here, but you do not need to understand
    // the implementation, just the interface.
    abstract class Semaphore {
    // Create a new semaphore. value should be its initial
    // value. It should be 1 in most cases. It returns a
    // handle to the semaphore.
    static int create(int value) {
         int semid = 0;
         try {
         semid = USysVIPC.semget(UConstant.IPC_PRIVATE,
                        1,
                        UConstant.IPC_CREAT | 00400 | 00200);
         USysVIPC.u_semun_int arg = new USysVIPC.u_semun_int();
         arg.val = value;
         USysVIPC.semctl(semid, 0, UConstant.SETVAL, arg);
         } catch (Exception e) {
         System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
         return semid;
    // Destroy a semaphore. This will free the semaphore given
    // as argument. You should always do this when you're finished
    // with a semaphore.
    static void destroy(int sem) {
         try {
         USysVIPC.u_semun semun = new USysVIPC.u_semun();
         USysVIPC.semctl(sem, 0, UConstant.IPC_RMID, semun);
         } catch (Exception e) {
         System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    // Operation P on a semaphore. Same operation as wait below. Use P
    // if you are familiar with the lectures, and wait if you are familiar with the course
    // book
    static void P(int sem) {
         USysVIPC.s_sembuf wait[] = new USysVIPC.s_sembuf[1];
         wait[0] = new USysVIPC.s_sembuf();
         wait[0].sem_num = 0;
         wait[0].sem_op = -1;
         wait[0].sem_flg = 010000;
         try {
         USysVIPC.semop(sem, wait, 1);
         } catch (Exception e) {
              System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    // Operation wait on a semaphore. Same operation as P above. Use P
    // if you are familiar with the lectures, and wait if you are familiar with the course
    // book
    // Wait for the semaphore. It will block until the semaphore
    // is available.
    static void wait(int sem) {
         USysVIPC.s_sembuf wait[] = new USysVIPC.s_sembuf[1];
         wait[0] = new USysVIPC.s_sembuf();
         wait[0].sem_num = 0;
         wait[0].sem_op = -1;
         wait[0].sem_flg = 010000;
         try {
         USysVIPC.semop(sem, wait, 1);
         } catch (Exception e) {
              System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    // Operation V on a semaphore. Same operation as signal below.
    // Use V if you are familiar with the lectures, and signal if you are familiar with the course
    // book
    static void V(int sem) {
         USysVIPC.s_sembuf signal[] = new USysVIPC.s_sembuf[1];
         signal[0] = new USysVIPC.s_sembuf();
         signal[0].sem_num = 0;
         signal[0].sem_op = 1;
         signal[0].sem_flg = 010000;
         try {
         USysVIPC.semop(sem, signal, 1);
         } catch (Exception e) {
              System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    // Operation siganal on a semaphore. Same operation as V above.
    // Use V if you are familiar with the lectures, and signal if you are familiar with the course
    // book
    static void signal(int sem) {
         USysVIPC.s_sembuf signal[] = new USysVIPC.s_sembuf[1];
         signal[0] = new USysVIPC.s_sembuf();
         signal[0].sem_num = 0;
         signal[0].sem_op = 1;
         signal[0].sem_flg = 010000;
         try {
         USysVIPC.semop(sem, signal, 1);
         } catch (Exception e) {
              System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    //SHARE_MEMORY CLASS
    import java.io.*;
    // jtux is the library that gives the POSIX interface.
    import jtux.*;
    // This is an interface to the SystemV shared memory that are
    // easier to use.
    // If you're interested you can take a look here, but you do not need to understand
    // the implementation, just the interface.
    abstract class Shared_memory {
         // create creates a new shared memory segment.
         // Argument size is the size of the segment in bytes.
         // create returns a handle to the newly created
         // shared memory segment. When the OS is not able to create a new
         // segment, the process is terminated with exit value 1.
         static int create(int size) {
    String keystring = new String(".");
         int shmid = -1 ;
    long key;
              try {
              key = USysVIPC.ftok(".", (int) UProcess.getpid());
              shmid = USysVIPC.shmget(key, size, UConstant.IPC_CREAT | 0666);
              } catch (Exception e) {
              System.out.print("Exception: ");
              System.out.println(">" + e.toString() + "<");
              System.exit(1);
         return(shmid);
         }//create
         // destroy removes the shared memory segment in argument.
         // If the argument shm is not a valid handle to a shared memory segment
         // the process is terminated with exit value 1.
         // You should always remove a shared memory segment when you are finished
         // with it.
         static void destroy(int shm) {
              try {
    USysVIPC.s_shmid_ds shmds = new USysVIPC.s_shmid_ds();
              USysVIPC.shmctl(shm, UConstant.IPC_RMID, shmds) ;
              } catch (Exception e) {
              System.out.print("Exception: ");
              System.out.println(">" + e.toString() + "<");
              System.exit(1);
         }//destroy
         // attach "places" the shared memory segment passed in argument
         // in the address space of the calling process. This way the process can
         // access the segment. A pointer to the the block in the process address space
         // is returned.
         // If the argument shm is not a valid handle to a shared memory segment
         // the process is terminated with exit value 1.
         static long attach(int shm) {
              long shmaddr = -1 ;
              try {
              shmaddr = USysVIPC.shmat(shm, 0, 0) ;
              } catch (Exception e) {
              System.out.print("Exception: ");
              System.out.println(">" + e.toString() + "<");
              System.exit(1);
         return(shmaddr) ;
         }//attach
         // detach "detaches" the shared memory segment at shmaddr
         // in the process's address space.
         // If there is no shared memory attached at address shmaddr.
         // the process is terminated with exit value 1.
         static void detach(long shmaddr)
              try {
              USysVIPC.shmdt(shmaddr);
              } catch (Exception e) {
              System.out.print("Exception: ");
              System.out.println(">" + e.toString() + "<");
              System.exit(1);
         }//detach
    // write : writes into shared memory segment.
    // writes at address addr datasize bytes of array data
    static void write(long addr, byte[] data, int datasize){
              UUtil.jaddr_to_seg(addr, data, datasize);
    }//write
         // read : reads from a shared memory segment.
    //reads datasize bytes at address addr and stores them in
    // array data
    static void read(long addr, byte[] data, int datasize){
              UUtil.jaddr_from_seg(addr, data, datasize);
    }//write
    }//Shared_memory

    What is jtux?
    Use code tags to make your post more legible.

  • Using a laptop for image acquisition in combination with PCI-1428/PCI-8252

    I am not too confident about PCMCIA framegrabbers so that I would like to use either a cameralink camera with the PCI-1428 or a Firewire one with PCI-8252.
    Are there any obstacles accommodating the PCI cards in an PCI Expansion box?

    You could do it, but why? Just get a firewire card for the laptop and go direct. You can get them with external power supplies to power the camera. It will work just the same and you won't have to lug around a big box with all your other equipment.
    Bruce
    Bruce Ammons
    Ammons Engineering

  • Use same player for images and video

    Greetings,
    I am working on a media player using Flash Pro CS4. I am
    totally new to Flash, but I do have experience coding in C#. I have
    included a URL to a media player used by the UFC. I'm trying to
    figure out how they have a single media player that allows you to
    display either an image or have the next selection in line be a
    video that plays. I did find a tutorial on in the Flash Developers
    Center on how to create a dynamic video player with an XML
    back-end, which is very helpful, but it only covers using video. If
    anyone could help me out by pointing me in the right direction, I
    would greatly appreciate it.
    Thanks,
    PAffiliates
    PS...Below is the URL I mentioned...
    http://www.ufc.com/includes/flash/FeaturedMediaGallery.swf?4

    So fair warning, what you're asking for isn't really a supported deployment method of CRM.
    That said, you should be able to do some DNS trickery internal to your network that points your "crm.domain.com" to "crm.domain.local" and then hopefully CRM will treat the connection as if it came from an internal network.
    Otherwise, you're likely going to have to accept that everyone gets the ADFS login page internal and external to your network.
    The postings on this site are solely my own and do not represent or constitute Hitachi Solutions' positions, views, strategies or opinions.

  • How to use MatrixLayout control for Images in UI5

    I am trying to use MatrixLayout for my images but not able to do that....
    I have Grid Layout in that i have added  four images and that should be display like
    image_1           image_2
    image_3          image_4
    I used Horizontal Layout but think it is not best approach.
    Please help me if anyone know this....
    Message was edited by: Michael Appleby

    Hi Prashant,
    You can use matrix layout with number of columns pre-defined and create rows according to your images.
    var oLayout = new sap.ui.commons.layout.MatrixLayout({
    layoutFixed : true,
    columns: 2,
    Create row from you content like:
    oLayout.createRow(image1,image2);
    oLayout.createRow(image3,image4);

  • Old Producer/Consumer Example question

    how would I take this code, the old producer/consumer example, and make it for 2 consumers and 1 producer?
    basically, like this:
    Producer put 1
    Consumer #1 got 1
    Consumer #2 got 1
    Producer put 2
    Consumer #1 got 2
    Consumer #2 got 2
    etc.....
    ***********Producer.java***************
    public class Producer extends Thread {
    private CubbyHole cubbyhole;
    private int number;
    public Producer(CubbyHole c, int number) {
    cubbyhole = c;
    this.number = number;
    public void run() {
    for (int i = 0; i < 10; i++) {
    cubbyhole.put(i);
    System.out.println("Producer #" + this.number
    + " put: " + i);
    try {
    sleep((int)(Math.random() * 100));
    } catch (InterruptedException e) { }
    ***********Consumer.java***********
    public class Consumer extends Thread {
    private CubbyHole cubbyhole;
    private int number;
    public Consumer(CubbyHole c, int number) {
    cubbyhole = c;
    this.number = number;
    public void run() {
    int value = 0;
    for (int i = 0; i < 10; i++) {
    value = cubbyhole.get();
    System.out.println("Consumer #" + this.number
    + " got: " + value);
    ***********CubbyHole.java***********
    public class CubbyHole {
    private int contents;
    private boolean available = false;
    public synchronized int get() {
    while (available == false) {
    try {
    wait();
    } catch (InterruptedException e) { }
    available = false;
    notifyAll();
    return contents;
    public synchronized void put(int value) {
    while (available == true) {
    try {
    wait();
    } catch (InterruptedException e) { }
    contents = value;
    available = true;
    notifyAll();
    ***********ProducerConsumerTest.java***********
    public class ProducerConsumerTest {
    public static void main(String[] args) {
    CubbyHole c = new CubbyHole();
    Producer p1 = new Producer(c, 1);
    Consumer c1 = new Consumer(c, 1);
    p1.start();
    c1.start();

    instantiate another consumer.
    public class ProducerConsumerTest {
    public static void main(String[] args) {
    CubbyHole c = new CubbyHole();
    Producer p1 = new Producer(c, 1);
    Consumer c1 = new Consumer(c, 1);
    Consumer c2 = new Consumer(c, 2);
    p1.start();
    c1.start();
    c2.start();
    but then modify CubbyHole so that it checks that it has been consumed twice (as thats what you want, you said). Instead of using boolean available, use an integer flag that counts how many times its been consumed, and then reset the flag when it gets to 2. Something like that. Is this a college question? Do your homework. ha ha.

  • Producer Consumer Query.

    I am Testing a small example of the Producer Consumer example
    using synchronized.
    I have a very important query which I need to ask:
    class Q has 2 synchronized methods,one to get() and one to put().
    class Producer and Consumer both have a reference to this object.
    Now look at the main() class ProducerConsumer,which instantiates Q
    and passes this reference to the Producer and Consumer.
    The Producer object then calls the put() method which is defined
    in a continous loop.This means that now the Q object has a lock
    by the Producer object.
    In that case,how can the Consumer object call the get() method.
    The Q object is locked by the Producer isnt it? (as the producer
    has invoked the put() and this is in a continous loop).
    The output shud be:
    Put 1
    Put 2
    Put n
    but the output I am getting is:
    Put 1
    Get 1
    Put 2
    Get 2
    How can this be possible?
    How can the Comsumer call get(),if the Producer has locked the object
    and has not released it as the synchronized put() is in a continous loop
    Has any one understood my query?
    class Q{
         private int n;
         public synchronized int get(){
              System.out.println("Got " + n);
              return n;
         public synchronized void put(int n){
              this.n = n;
              System.out.println("Put " + n);
    class Producer implements Runnable{
         Q q;
         Producer(Q q){
              this.q = q;
              new Thread(this,"Producer").start();
         public void run(){
              int i=0;
              while(true){
              q.put(i++);
    } // End of Producer.
    class Consumer implements Runnable{
         Q q;
         Consumer(Q q){
              this.q = q;
              new Thread(this,"Consumer").start();
         public void run(){
              int i=0;
              while(true){
              q.get();
    } // End of Producer.
    public class ProducerConsumer {
         public static void main(String[] args) {
          // Instantiate the Q.
          Q q = new Q();
          Producer producer = new Producer(q);
          Consumer consumer = new Consumer(q);
    }

    I am Testing a small example of the Producer Consumer example
    using synchronized.
    I have a very important query which I need to ask:
    class Q has 2 synchronized methods,one to get() and one to put().
    class Producer and Consumer both have a reference to this object.
    Now look at the main() class ProducerConsumer,which instantiates Q
    and passes this reference to the Producer and Consumer.
    The Producer object then calls the put() method which is defined
    in a continous loop.This means that now the Q object has a lock
    by the Producer object.
    In that case,how can the Consumer object call the get() method.
    The Q object is locked by the Producer isnt it? (as the producer
    has invoked the put() and this is in a continous loop).
    The output shud be:
    Put 1
    Put 2
    Put n
    but the output I am getting is:
    Put 1
    Get 1
    Put 2
    Get 2
    How can this be possible?
    How can the Comsumer call get(),if the Producer has locked the object
    and has not released it as the synchronized put() is in a continous loop
    Has any one understood my query?
    class Q{
         private int n;
         public synchronized int get(){
              System.out.println("Got " + n);
              return n;
         public synchronized void put(int n){
              this.n = n;
              System.out.println("Put " + n);
    class Producer implements Runnable{
         Q q;
         Producer(Q q){
              this.q = q;
              new Thread(this,"Producer").start();
         public void run(){
              int i=0;
              while(true){
              q.put(i++);
    } // End of Producer.
    class Consumer implements Runnable{
         Q q;
         Consumer(Q q){
              this.q = q;
              new Thread(this,"Consumer").start();
         public void run(){
              int i=0;
              while(true){
              q.get();
    } // End of Producer.
    public class ProducerConsumer {
         public static void main(String[] args) {
          // Instantiate the Q.
          Q q = new Q();
          Producer producer = new Producer(q);
          Consumer consumer = new Consumer(q);
    }

  • Time Stamps in Producer/Consumer Setup

    I am trying to acquire signal from a Gas Analyzer, Flow Meter, and 3 RTDs.  My hardware is a NI 9215 and NI 9217.  I need to write the data to a file with a time stamp at which the sample was read.  The program is written in a producer/consumer setup in which the data is being acquired in the prodcuer loop and sent to the consumer loop to be written.  I can get the samples written to the file okay. However, I have not figured out how to put the time stamp in the data file correctly. I thought the time stamp was created with the corressponding measurement at the Data Acquisition VI. However, whenever I open the data file, there are only 0s in the time column.  So, I've tried to use Format/Date String to add the time stamp. I can get it to work if I place it in the consumer loop. However, the time stamp is not accurate.  It puts the same time stamp up to six digits of precision for two consecutive samples. I've tried to figure out how to add it to the producer  loop, but I don't know how to add it and the measurements to the queue at the same time. Please tell me the best way to acquire signals with the exact time stamp and write them to a file using a producer/consumer design.
     Example:
    Date             Time               RTD1     RTD2      RTD3     CO2      Flow
    5/26/07      5:20:01.25       57         56         56.5      100       0.5
    5/26/07      5:20:01.30       57         56         56.5      100       0.5
    5/26/07      5:20:01.35       57         56         56.5      100       0.5
    Attachments:
    Producer-Consumer From Scratch2.vi ‏75 KB

    Okay, I've put it in a For Loop and it will connect now. However, whenever it runs the time stamp increments for a couple seconds and then it just repeats. How do I correct this?
    Attachments:
    Producer-Consumer From Scratch2.vi ‏88 KB
    pleasework.txt ‏20 KB

  • Producer/consumer w/ScanEngine issue

    All,
    I have a large VI implemented with producer/consumer architecture using 10 events and uses conditional disables to select the data acquisition hardware.  The application is being developed in LV2009 with FPGA & RT on XP.  The application is intended to acquire and control analog signals in a cRIO-9073, but early development is done using LV simulated signals.  I can switch back/forth between the different configurations quickly & easily.  In the simulation mode, the front panel, controls, events, etc; all behave as one would expect.  When the conditional disable is changed to use ScanEngine and cRIO modules, then a very primary control fails to generate an event and does not function.  All other controls that can be tested are functional and generate their events.  I am at a loss and seeking suggestions on techniques to diagnose & fix the problem.  The application behaves as if the 'event structure' for primary control gets corrupted or some size threshold is been exceeded.  The whole concept, scanEngine based and simulated data, were functioning several days ago prior to numeruous edits and I can revert back to not using the scan engine and cRIO hardware with simulated data to validate correct function, but that is not the intended final path.  At the present time, I am stuck and looking for ideas.  All suggestions will be considered and appreciated.  The applicatiion is company proprietary and can't be posted.  Thanks in advance.

    I can definitely understand your confusion, and on the surface it seems like everything should transfer over.  However, when using simulated data you won't get errors that can occur once you introduce hardware.  Errors can prevent events from occuring, there is also the issue of timing, to see if when using actual hardware, the timing causes issues.  As I menationed before, there are a hundred different reasons why it would work with simulated data, but not actual hardware.  Please let me know if you need further direction in your troubleshooting.
    National Instruments
    Applications Engineer

  • Running subVI in parallel with itself using producer-consumer pattern

    I'm using the procuder-consumer pattern to create what I call threads in response to various events much like in Producer Consumer with Event Structure and Queues
    I have several physical instruments, and would like to run the exact
    same test in parallel on each of the instruments.  I have a subVI
    that takes as inputs a VISA resource and a few control references among
    other things and then performs the desired experiment.  I have a
    separate consumer loop for each physical instrument, with this subVI
    inside each consumer loop.
    My test VI worked great; each consumer loop was a simple while loop
    incrementing a numeric indicator (not using my real subVI above). 
    However, my real program can only run one consumer loop at a time much
    to my dismay.  Reworking my simple test VI to use a subVI to
    increment the indicator rather than just explicitly coding everything
    resulted in the same problem: only a single consumer loop ran at a time
    (and as I stopped the running loop, another would get a chance to
    begin). The subVI in this case was extremely
    simple taking only a ref to the indicator and a ref to a boolean to
    stop, and incrementing the indicator in a while-loop.
    Is there a way around this?  Now that I've spent the time making a
    nice subVI to do the entire experiment on on the physical instrument, I
    thought it would be fairly trivial to extend this to control multiple
    instruments performing the same experiment in parallel.  It seems
    only one instance of a given subVI may run at one time.  Is this
    true?  If it is indeed true, what other options do I have?  I
    have little desire to recode my subVI to manually handle multiple
    physical instruments; this would also result in a loss of functionality
    as all parallel experiments would run more or less in lock step without
    much more complexity.
    Thank you.

    You need to make your subvi reentrant.  Then it can run several instances at any time with each instance occupying its own unique memory space.  Click on File - VI Properties - Execution, and check the reentry execution checkbox.  Then save the vi.
    - tbob
    Inventor of the WORM Global

Maybe you are looking for

  • Can't use "save target as" feature in Firefox 7.0.1, all files are saved with .htm extension! Why?

    I'm no longe able to save a file using "save target as" feature, when I'm googling for a file. No matter what the file extension is (ppt, pdf, doc, etc.), Firefox 7 downloads a .htm useless file. I rember I had this issue in FF long time ago! Is this

  • Report inventory at Historical exchange rate

    Can any tell me if it is possible to report inventory at Historical exchange rates using standard SAP? thanks in advance for all help. -Mahantesh Nashi

  • SharePoint remote provider hosted apps - confusion around key questions

    For some time, I have been trying to get a provider hosted app setup to work, and I am afraid that I - as a relative novice - must have missed some key points despite hours of googling and reading. Here's my questions: A remote, provider hosted app,

  • DHCP and FTP issues.

    I have a server setup running server 2012 R2 with DHCP and filezilla for FTP, and a desktop running windows 7. The server can ping the desktop, but the desktop can not ping the server, however the desktop can get a DHCP address from the server. How c

  • Behavior of Basic Java Types

    My Dear Java Forum Readers, I very eager to know about what do we mean by the statement: "width of an 'integer' type should not be thought of as the 'amount of storage it consumes', but rather as the 'behavior' it defines for variables and expression