Simple Network Streams - Example VIs

In the example VI: Simple Network Streams - Host.vi the receive loop has a choice two timers: 10 and 20 milliseconds.  In addition the Read Single Element from Stream VI has a timeout of 100 milliseconds connected to it.
In Simple Network Streams - Target.vi the receive loop has no timer, but the Read Single Element from Stream VI has a timeout of 1000 milliseconds connected.
How can the target receive loop work without a timer?  What is the purpose of the 100 millisecond timeout of the Host receive loop if the loop has a timer of at most 10 milliseconds?  I have this example working on my cRIO-9030, but I don't understand it.  I think this gets down to my lack of understanding of the timeout function of reads and writes for streams and FIFOs.  Does the VI sleep until just before the timeout to check for data, or does it hog the processor the entire time looking for data?  It doesn't seem to be the latter since the processors on the target are only partially occupied in this example.

gary_janik wrote:
In the example VI: Simple Network Streams - Host.vi the receive loop has a choice two timers: 10 and 20 milliseconds.  In addition the Read Single Element from Stream VI has a timeout of 100 milliseconds connected to it.
In Simple Network Streams - Target.vi the receive loop has no timer, but the Read Single Element from Stream VI has a timeout of 1000 milliseconds connected.
How can the target receive loop work without a timer?  What is the purpose of the 100 millisecond timeout of the Host receive loop if the loop has a timer of at most 10 milliseconds?  I have this example working on my cRIO-9030, but I don't understand it.  I think this gets down to my lack of understanding of the timeout function of reads and writes for streams and FIFOs.  Does the VI sleep until just before the timeout to check for data, or does it hog the processor the entire time looking for data?  It doesn't seem to be the latter since the processors on the target are only partially occupied in this example.
First of all, where is this example?  You didn't post the code, and I didn't find it in the LabVIEW Examples, so it's difficult to explain "invisible" code.
However, "sight-unseen", I may be able to explain some of your issues.  If you think about Network Streams as a Producer/Consumer pattern "across the network", the Consumer (the receive loop) might not need a timer, as it is being "driven" (and hence "timed") by the Producer sending data to it.  It probably should have a time-out just in case the Consumer just stops sending (say, it exits).
Functions such as dequeues and receives "block" and don't do anything if they have no input.  Recall that LabVIEW uses data flow, and can have multiple parallel processes (loops) running at the same time.  When a function blocks, the code section (let's call it a "loop") containing the function stops using CPU cycles, allowing the other parallel loops to use the time.  This lets processes run "at their own speed" as long as they are sufficiently "decoupled" by being placed in parallel loops.  When there is no data, the loop essentially "waits", and lets all the other loops use the time instead.
Bob Schor

Similar Messages

  • Error 42 on Create Network Stream Reader Endpoint

    I'm trying to use Network Streams.  I had no problem on my Windows 7/LabVIEW 2011 system at work.  However, when I tried the same code on my laptop or home desktop (both Windows 7/LabVIEW 2011), I got an Error 42 on trying to create the Reader Endpoint.
    I'm very puzzled!  The code is similar to that in the examples, it works on one PC, but fails on two others.  I figure it's something to do with either the LabVIEW setup or a Windows configuration.  I thought they were all set up similarly, however.
    Does anyone have an insight into this error?  This is the code that fails ...
    Solved!
    Go to Solution.

    Well, thanks to some hard work, I now know what is happening, but not yet why it is happening.
    From my Home PC (Windows 7 PC/LV 2010 and 2011 system that throws Error 42 when executing the NI Example Target Fullness code) I can Remote Desktop in to my Work PC (similar system, but this one can execute the Example code without errors).  Some observations:
    1) Viewing all the TCP connections when the system is idle, the Work PC shows four connections to lkads.exe, one of which is marked "Listening", while the Home PC shows none.  I think this is precisely the problem ...
    2) There does not seem to be an explicit Firewall rule for lkads on the Work PC.  I made such a rule for the Home PC, but it had no effect (and there still is no active TCP/UDP port associated with it).
    3) The Work PC is in a more "active" LabVIEW environment.  For example, there's a camera on the Network and NI Vision routines are installed (IMAQdx), but I don't recall "actively" doing anything special to enable ports or services.
    4) This problem seems to only affect my home Windows 7 system(s).  If I try to run the Network Stream examples on these home PCs, but in a Windows XP VM, they run fine (so it's not the hardware, per se).
    5) Something that would be "interesting" to try (but I'm not sure I want to waste any more time blundering around in the dark, trying to fix this problem) would be to see what would happen to a Windows 7 in a VM on both the Home and Work PCs.
    Here's a question whose answer I do not know, but which I think is at the heart of this difficulty.  When setting up LabVIEW 2010 or LabVIEW 2011 on a Windows 7 PC, what steps need to be taken so that lkads is automatically started at a service.
    I should say that when I set (all of) these systems up, I did a "standard" Install of LabVIEW 2010/2011, also installing LabVIEW RealTime.  In the Options, I enabled TCP/IP in VI Server, and accepted the default 3363 port.  I installed the OpenG software, which needs to have TCP established, and have also been able to use VI Server on both Home and Work machines.

  • Dudas Network Stream

    Hola a todos,
    Estoy intentando compartir variables entre mi Host (PC) y el programa que tengo en Real Time en mi cRio.
    Lo estoy haciendo con Network Streams. He pillado el ejemplo que viene en Labview "Simple Network Streams.lvproj"
    y me he puesto ha hacer cambios en él, ya que no he encontrado ninguno más.
    Me podeis por favor indicar cual es la mejor manera de compartir múltiples variables en este tipo de funciones?
    y por otro lado, no se muy bien que es lo que hago mal, pero sólo consigo realizar la comunicación en un sólo sentido (Host to RealTime), en el otro sentido no me funciona el programa.
    Podeis por favor indicarme que hago mal, y algún otro ejemplo para estas funciones?
    Un saludo y muchísimas gracias
    Adjuntos:
    Ejemplo.zip ‏171 KB
    Host.png ‏70 KB
    RT.png ‏59 KB

    Por si ha alguien le ayuda, al final he conseguido solucionarlo sustituyendo el  "Event Structure" mediante la gestión de arrays. Adjunto ambos subvis para que veais como lo he hecho.
    Agradecería si alguien me pudiera mandar más ejemplos sobre "Network Stream" o ideas de como gestionar, de una manera más eficiente un gran número de variables de distinto tipo.
    Un saludo y muchísimas gracias.
    Adjuntos:
    Host2.png ‏58 KB
    RT2.png ‏48 KB

  • Error -1950678945 (Network Streams)

    I coded up a local network streams example where a reader enpoint waits on the writer and got error -1950678945.  My firewall is turned off, so this article wasn't much help.  Since I plan on supporting multiple endpoints across multiple applications on multiple targers, I'm trying to make the wrapper API flexible.  So, I'm using the full URL to designate endpoints.  I discovered that if you're wiring to the "reader name" terminal of a Create Reader Endpoint node with a URL, that URL cannot contain the local IP address.
    Certified LabVIEW Architect
    Wait for Flag / Set Flag
    Separate Views from Implementation for Strict Type Defs
    Solved!
    Go to Solution.

    Dear Luis,
    1.You post the link is this article.
    2.I already use TCP/IP for one server multiple clients as attached images. My application is server query data from clients and server broadcast data to clients. Clients always generate data and sometime when user press the button, it will send addition data to server. However, my server use state machine to query clients. So in most situation server will not reveive clients data. How can I resolve this problem? Thank you.
    B/R
    Ancle
    Attachments:
    server.PNG ‏42 KB
    client.PNG ‏38 KB

  • Visa Resource Name in cluster passed to Network Stream writer causes error 42.

    If I try and pass this "motor data" cluster with an embedded VISA resource name:
    to a Network Stream Writer in this manner:
    Then I get this error from the "Write Single Element to Stream" VI
    If I change the motor data cluster TypDef so that a string control is used instead of the VISA reference, the error disappears and the data passes over the Network Stream without problem.
    Is this expected behavior? 
    I thought that the "data in" (type = "POLY"?) like the one found on the "Write Single Element to Stream" VI was supposed to accept pretty much anything...
    Solved!
    Go to Solution.

    Doug
    I would consider this a bug, as the memory location (more precisely the VISA refnum or session) of a VISA resource means nothing on a potentially remote system. Also I was under the impression that most streaming methods like binary file IO, but also the network streams would use the LabVIEW flattened format for data clusters and for that the VISA resource name would be the only logical choice instead of the underlaying VISA refnum, but I might be wrong in this specific case and the default behaviour for flattening VISA resources might always have been to the VISA refnum.
    Considering that the VISA control can resurect the VISA session from a VISA resource name if it is already opened, flattening to the VISA resource name instead would be more logical, but using a string control in the cluster type definition is a reasonable work around of course.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Network stream using 64-bit and 32-bit VIs on same computer

    I have a project where I'm forced to use a VI written in 32-bit LV2012 (because I need mathscript, which isn't supported in 64-bit) to communicate via network streams with a VI written in 64-bit LV2012 (they only version I can use an externally written 64-bit toolkit for my camera communication) on the same PC.
    I need a network stream target to run on the 32-bit VI, and a host to run on 64-bit VI.
    It kept not working, and finally I checked using the example host.vi and target.vi, and discovered if I open both in either 32-bit or 64-bit, they work, but if I open one in 32-bit and the other in 64-bit it won't connect, giving error -314100 (specified endpoint doesn't exist).
    So question: is there any inherent reason this happens, since both 64-bit and 32-bit should support Network Streams? My first obvious alternative would be rewriting the mathscript code in native LV so i can all be on 64-bit VI's, but it's quite big (based on old, proven Matlab script) and that would be a significant effort I don't have time for now.
    The reason I'm using net streams is that I also get data from 2x other networked PC's at the same time. Is there an alternative to network streams that can communicate data over a network in real(ish)-time?
    Cheers
    Dan

    I just tested this and was able to get it to work.  Were you running both reader and writer applications on the same computer?  If so, I suspect you might be running into context naming issues with multiple application instances running on the same computer.  See this link for more info how to specify a context in the URL.  I suspect you might find it easier to create your own test VI for this rather than modify the shipping examples.

  • FPGA to Real Time using DMA to Host using Network Stream

    Hi All,
    So I am working on a project where I am monitoring various characteristics of a modified diesel engine being driven by a dynamometer. I am trying to log different pressures, temperatures, and engine speed. It basically breaks down into two streams of data acquisition.
    Fast (125kS/ch/s): 
         In cylinder pressure using an NI 9223
         Engine speed via shaft encoder/MPU using same NI 9223
    Slow (1kS/ch/s)
         Other pressures (oil, coolant, tank, etc...) using an NI 9205
         Various temperatures using an NI 9213
    My basic architecture is simultaneous data acquisition on the FPGA for both streams. Each Stream is feed into a separate DMA FIFO where it is fed to the RT side. On the RT side each DMA FIFO is simultaneously read and transferred into two separate network streams where it is fed to the host PC. Then the Host PC does all of the analysis, and logs the data to disk. I had this code working on Thursday with great success, then I tried to package the RT VI as an executable so that it could be deployed to the rio and called pragmatically from the host VI. After trying this approach I was told that we needed to do some testing, so I undid the changes and now the slow stream is not working properly. 
    Since then I have installed LV2013 and installed NI RIO 13 so that I could have a fresh slate to work with. It didn't help however, and now I'm having issues just working in scan mode and with simple FPGA applications. Does anyone know if there are some settings that I could have messed up either building the executable application or deploying it? Or why the fast acquisition is still working while the slow doesn't, even though they are exactly the same?
    Sorry to be so scatter brained with this whole issue. I really have no idea how it could be broken considering the fast stream is working and the code is practically identical. Let me know if you need more information. I'll upload my code as well.

    Hopefully these files work. 
    The "fast" stream gives data points every 8us without fail, as that is the scan period of a 125kHz sample rate. The "slow" stream on Thursday was giving out data points every 1ms, however, now it gives out data points in a very sporadic interval. Also, the data that it does give out doesn't make any sense, tick count going in the negative followed by positive direction for example. 
    I did uninstall all of the old rio drivers before installing the new set as well. Ill give it another shot though. :/
    Thanks for the reply.
    Attachments:
    Pressure-HighSpeedRT.vi ‏665 KB
    Pressure-HighSpeedFPGA.vi ‏680 KB
    Pressure-Comp.vi ‏28 KB

  • How to run/test application using network streams

    Hello,
    I'm confused on what steps to follow to test an application using the network streams feature. After reading a lot and going through other discussions I found 2 simple VIs on the last post here http://forums.ni.com/t5/LabVIEW/Network-streams-problem-with-cRIO-9022/td-p/1401576 (I attached the VIs, which I modified just a bit) which I believe have been tested before and work so I was trying to do the same in my desktop and it does not work. I get the same scenario when I was trying to test the code I wrote: no bugs, both VIs run but nothing happens.
    According to the link above this is what is supposed to happen: "a PC hosts a GUI (see mainGUI.VI) that sends an array of doubles to the cRIO via one stream and reads a double value back via another. The cRIO, via the scan interface, reads the array via the first stream and writes an analog value to the host via the second (see mainRT.VI). "
    The current set up is: 
    1. Add both VIs to the blank project with the target device cRIO (see attached screenshot)
    2. Deploy mainRT.vi on the cRIO
    3. Run both at the same time
    Am I missing something?
    Also, I have been reading that there are two ways of testing this. One running both VIs on the PC and the other actually using the targeted device, in this case cRIO. Is that correct?
    Please help!
    Thank you
    Attachments:
    project explorer.jpg ‏36 KB
    mainRT.vi ‏62 KB
    mainGUI.vi ‏20 KB

    Connections have TimeOuts, so you have a little "wiggle room" in deciding which to load first.
    In my situation, one side is a Remote Real Time system ("Remote"), which has the behavior that when it starts up, it runs the code that I want, which includes establishing the Remote side of the Network Stream.  I make all (four) streams use the Remote as the site whose URL (or IP) I need to know.  I set them up so that if they time out (I think I may use 15 seconds), they simply close the connections and try again, exiting when all four connections are established, and going on to run the rest of the Remote code.
    On the Host, the expectation is that the code is already running on the Remote.  Accordingly, on the Host side, the Initialization sequence establishes the four connections, all using the IP (URL) of the Remote.  I also use a 15-second timeout, but run it inside a second loop to allow three tries before I give up (and generate an Error Exit).  Otherwise, if all the connections get made, I've got my Network Streams connected and can continue.
    In this scheme, both the Host and Remote code are in the same Project.  What I typically do is to Build the Remote code, deploy it, and set it to run as the Startup.  If you are not dealing with a Real Time System, you might not have that option.  But you should deploy your Remote code, and start both programs within each other's respective TimeOut windows.  Since in my scheme the Remote Window is infinite, I (automatically) start it first, then start the Host.  I haven't timed it, but I'd guestimate that the connections are established in at most a few tenths of a second.
    Bob Schor

  • Network stream between myRIO end PC

    I want to publish myRIO between variable and real PC Temp. I try with Network stream but I could not. who can help me with a simple example and thank you 

    Khaled,
    This help documentation shows the basics of what would be on your PC and your myRIO
    http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/usingstreams/
    In this case, either computer 1 or computer 2 will be your myRIO.  There is also much more information in the white paper below.
    http://www.ni.com/white-paper/12267/en/
    It's a big information dump but if you are able to attach a zip of a simple project where you are trying to set up a network stream we can take a look and possibly figure out what might be happening.  If you post code also tell us what errors you are running into.

  • Network Stream Error -314340 due to buffer size on the writer endpoint

    Hello everyone,
    I just wanted to share a somewhat odd experience we had with the network stream VIs.  We found this problem in LV2014 but aren't aware if it is new or not.  I searched for a while on the network stream endpoint creation error -314340 and couldn't come up with any useful links to our problem.  The good news is that we have fixed our problem but I wanted to explain it a little more in case anyone else has a similar problem.
    The specific network stream error -314340 should seemingly occur if you are attempting to connect to a network stream endpoint that is already connected to another endpoint or in which the URL points to a different endpoint than the one trying to connect. 
    We ran into this issue on attempting to connect to a remote PXI chassis (PXIe-8135) running LabVIEW real-time from an HMI machine, both of which have three NICs and access different networks.  We have a class that wraps the network stream VIs and we have deployed this class across four machines (Windows and RT) to establish over 30 network streams between these machines.  The class can distinguish between messaging streams that handle clusters of control and status information and also data streams that contain a cluster with a timestamp and 24 I16s.  It was on the data network streams that we ran into the issue. 
    The symptoms of the problem were that we if would attempt to use the HMI computer with a reader endpoint specifying the URL of the writer endpoint on the real-time PXI, the reader endpoint would return with an error of -314340, indicating the writer endpoint was pointing to a third location.  Leaving the URL blank on the writer endpoint blank and running in real-time interactive or startup VI made no difference.   However, the writer endpoint would return without error and eventually catch a remote endpoint destroyed.  To make things more interesting, if you specified the URL on the writer endpoint instead of the reader endpoint, the connection would be made as expected. 
    Ultimately through experimenting with it, we found that the buffer size of the create writer endpoint  for the data stream was causing the problem and that we had fat fingered the constants for this buffer size.   Also, pre-allocating or allocating the buffer on the fly made no difference.  We imagine that it may be due to the fact we are using a complex data type with a cluster with an array inside of it and it can be difficult to allocate a buffer for this data type.  We guess that the issue may be that by the reader endpoint establishing the connection to a writer with a large buffer size specified, the writer endpoint ultimately times out somewhere in the handshaking routine that is hidden below the surface. 
    I just wanted to post this so others would have a reference if they run into a similar situation and again for reference we found this in LV2014 but are not aware if it is a problem in earlier versions.
    Thanks,
    Curtiss

    Hi Curtiss!
    Thank you for your post!  Would it be possible for you to add some steps that others can use to reproduce/resolve the issue?
    Regards,
    Kelly B.
    Applications Engineering
    National Instruments

  • Network Stream Fails Before Timeout

    Is there any reason why a network stream would fail before the timeout?  I was using streams on an sbRIO-9632 and all throughout testing I had no problems.  But, when I hooked the network up to NASA's dedicated network cable (which goes through one or two switches to eventually connect to my router, the same one used for testing; at NASA's Lunabotics Mining Competition; I think they said it was a virtual network), the streams, as far as I could tell, were failing between immediately and the 15 second timeout.  If I recall correctly, it rarely made it beyond the timeout value.
    Unfortunately, I did not have the time to successfully debug the system while connected to that network cable and switches so I was not able to get the exact error that was occuring.  I do know that the error was originating from the sbRIO because on my computer it was showing that the network streams were closed.
    If you are curious about the architecture being used, it was very similar to "Teleop - Host Acquisition" in the robotics module project wizard.

    Unfortunately, I've been unable to recreate the issue without being connected to the NASA setup (something I won't be able to do for the next year).  The best that I can tell you is that the "fix" that I implemented was to simply re-establish the network stream and prevent it from stopping the rest of the program using a simple state machine for each end of each stream.  It was able to re-connect fairly quickly so I never lost the connection for an appreciable amount of time (which would be required to see a loss in connection in MAX I'm assuming; maybe I'm wrong assuming this?).
    Anyways, because I cannot replicate the issue and therefore test it again, I will try to not take up too much of your time on this one.  I was just hoping to find out if there was any known circumstance that would cause the stream to fail/timeout prematurely. 

  • Can't create Network Stream connections between Win and RT

    In the attached example, why can't I get all four links to connect without errors? Here's a representative example of the result I'm getting:
    Attachments:
    network_stream_test.zip ‏18 KB

    Hi Bob -
    Yes, one pair of the streams failed to connect. That's what I'm asking about. The timeout is more than enough for them to connect if they will, as evidenced by the pair that did successfully make a connection. (I've also used Network Streams in a couple of applications already, and even across subnets they normally connect within 1 second, so a 10 second timeout isn't an issue here.)
    Yep, I'm aware of the Context Name. But as the Network Streams whitepaper says, and as you reiterated, the default context is assumed when it's ommitted from the URL. That's why one pair of the stream was able to connect in my screenshot. And I'm running my example  in the dev environment anyway, so contexts shouldn't be necessary in the URL at all.
    If you like, you can grab the example I attached and run it yourself to help me investigate. Do all the endpoints connect successfully on your Win/RT setup?
    On a side note, can anyone tell me how to query the current VI's context? I'm certain there's a Server or Scripting node somewhere that does it, but I can't find it at the moment...

  • LV2010 Network Streams Bug

    It appears that you cannot create a Network Stream datatype of a cluster that contains a variant.
    For example a datatype of a cluster containing a string, a variant and a boolean does not work correctly.
    I am not sure if this is a bug or a restriction in the range of valid datatypes for this API.

    This appears to be an editor bug with LV 2010 in regards to how the data type of the terminal gets updated.  While I can't reproduce the issue you've described exactly, there's definitely issues with getting the cluster to update when changing the names of the cluster elements after wiring the cluster to the data type terminal of the Create VI.  I'm generally able to get the cluster to update when adding elements to the cluster, but it's certainly possible I'm missing something from how you're interacting with the diagram.  We hope to fix this issue for the LV 2011 release.  In the meantime, you should be able to use the unbundle instead of unbundle by name to work around the problem.  Also, I believe another work around would be to delete the wire from the data type terminal of the Create VI, save the VI, close LV, and restart LV.  After restarting LV, the unbundle by name should update appropriately once you wire the data type of the Create VI again (at least it did in the few tests I conducted). 

  • Network Streaming data acquisition (PC-cRIO)

    Hello,
    I have written some code using Labview's network streaming option to transfer data from the cRIO to my computer and then save this data in a .csv file. I wanted to test it but I'm confused on how to run or deploy it.
    Right now I have the code divided into two VIs, one for each endpoint. I'm assuming the writer endpoint corresponds to the cRIO and the reader to my PC. 
    So my questions are:
    - Where exactly in the project explorer am I supposed to add these files? (please check the attachment and tell me if it is correct).
    - What do I need to deploy into the cRIO? and How do I run the whole application?
    - Can I build a UI for both VIs (writer and reader)? or because the writer is running in the cRIO I could only see the front panel of the reader?
    Thank you very much!
    Attachments:
    project explorer.jpg ‏37 KB

    It looks like you have the files in the right place.  Just try to run each VI in their proper context.  If you are connected to your cRIO, it will deploy and run for you.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Why do I get Network Streams Error -314351 (xFFFB3411​)?

    I've had network streams working great (love them!!) for a while with a type def cluster of some numerics and strings.  I've changed the type def numerous times and haven't had a problem.  The last time I changed it, however, I started getting this error from the "Write Single Element to Stream" primitive.
    "LabVIEW: Unable to read or write the stream endpoint with the specified data type.  The data type isn't compatible with the data type used to create the stream."
    I don't get an error when I initialize the stream with "Create Network Stream Writer Endpoint".  Yes, the same datatype is being passed to both primitives.  It's the same code that has worked hundreds of times until now.
    My best guess is that the Network Streams Engine is somehow caching the old datatype.  I've restarted both the local and remote (LV RT) computers multiple times, to no avail.
    Maybe this is a red herring, but I'm using LV 2010 SP1 with LV RT 2010 (no SP1).  The computer is in another state and not easily upgraded, but I'm working on that as a possible solution.  I doubt that's the problem, however, since it has worked up till now.
    What would cause me to get this error even though I'm using the same type def for both the initialize and write?
    Robert C. Mortensen
    Certified LabVIEW Architect
    Certified LabVIEW Embedded Systems Developer
    Endigit
    Solved!
    Go to Solution.

    Hi Robert,
    It very well might be that the Network Stream is somehow still registering the old data type. If this is the case, try deleting the Create Network Stream, the Write Single Element, and one of the type defs. Then, place down a new Create Network Stream and Write Single Element, and ensure that it's a copy of the type def. that you're wiring for both the initialization and the write. If replacing the Network Stream VIs fails to do the trick, I'd like to see if I can't replicate the error your getting on my end. To replicate your setup, can you tell me the data type of your type def.?
    On a final note, I searched through the 'Known Issues' for LabVIEW 2010 and 2010 SP1, and found that there is a known issue which might help explain the error you're receiving:
    233205
    Network Streams do not support enums, data types w/ units, substrings, subarrays, & fixed-size array...
    Sanjay C.
    Embedded Software Product Manager| National Instruments

Maybe you are looking for