Uso de subVI's

Olá a todos, criei um PI para uso pessoal, porém na hora de tentar implementar uma subVI para tornar o uso mais prático, a resposta da ação de controle fica diferente da resposta sem o uso da subVI. Alguém pode me explicar como consertar esse erro?
Obs1: Segue em anexo os dois arquivos, usando e não usando a subVI.
Obs2: Os valores dos ganhos e setpoint são os setados como constantes no arquivo uso_da_subVI.
Anexos:
subVI.vi ‏37 KB
uso_da_subVI.vi ‏16 KB

hvscherer escreveu:
Olá a todos, criei um PI para uso pessoal, porém na hora de tentar implementar uma subVI para tornar o uso mais prático, a resposta da ação de controle fica diferente da resposta sem o uso da subVI. Alguém pode me explicar como consertar esse erro?
Obs1: Segue em anexo os dois arquivos, usando e não usando a subVI.
Obs2: Os valores dos ganhos e setpoint são os setados como constantes no arquivo uso_da_subVI.
Ola hvscherer....
O mau funcionamento de seu conjunto, esta ligado ao fato de que sua Vi principal fica esperando uma resposta de saida de um loop que unca para de executar, ou seja, seu vi principal somente inicia a subVi mas essa ultima nunca termina suas interações .
Para o seu problema existem varias soluções possiveis, mas antes de apresentalas ai vão algumas dicas uteis:
Tente evitar possiveis subVI's que executem loops eternos, sempre existe uma outra forma de fazer;
Quando for necessario a utilização de loops, lembre-se que os dados so seram ixibidos ao fim de cada interação, se esse fim nunca chega , seus dados nunca serão exibidos.
Vamos as soluções possiveis, (acredito que seu código contenmha varios pontos possiveis de melhorias mas vou me atentar em resolver o problema apresentado por você).
Eliminando o WHILE LOOP:
subVI
VI PRINCIPAL
2. Utilizando GLOBAL VARIABLE. (essa solução evita grandes modificações em seu código original, mas a utilização em grande escala pode causar problemas em sua aplicação).
subVI
 VI PRINCIPAL
Caso tenha duvidas de como trabalhar com GLOBAL VARIABLE esse link pode ajudar:
https://decibel.ni.com/content/docs/DOC-2143
Maycon Lazarin

Similar Messages

  • El uso del cpu se va al 100% sin siquiera estar corriendo una aplicacion

    K tal  a todos en el foro
    Tengo un problema muy extrano, espero y me puedan ayudar de favor, estoy usando una version de evaluacion de labview 8.2.1, y le estoy haciendo unos cambios a un vi que hice en la  version 7.1, no entiendo cual es la razon pero sin siquiera correr el programa el uso del cpu se va al 100% cada vez que muevo algo en el block diagram, por ejemplo cuando arrastro de un lado a otro (distancia muy corta) un property node, o cuando conecto un hilo, el cpu se va al 100%, pudiendo  realizar otra operacion hasta casi 8 segundos despues, en otras aplicaciones que he empezado desde un blank vi en labview 8.2.1 no me pasa eso,
    saludos y gracias de antemano

    Rock Howard,
    He visto este problema con otro usuario de LabVIEW y el problema fue el tamaño del diagrama de bloques.  Reduciendo el numero de objetos en el diagrama elimino el problema.  En el caso del otro usuario, creando subVIs y reduciendo el numero de variables locales, etc. lo resolvio.
    Saludos,
    Erin B.
    English: This problem is usually caused by the memory usage of the block diagram.  Reducing the number of objects by creating subVIs and using more efficient data structures (i.e. less local variables) eliminated the block diagram slowness after an upgrade from LV 7.1 to 8.x.

  • Open file in main vi, write in subvi and close in mainvi

    Hi,
    Im opening a file in the main vi , passing the reference number to the
    write to text file which is located in the subvi and passing the refnum
    out from this vi to the main vi again to close the file.
    But, I always have only the last value of the measurement stored.
    Im getting data from the serial port.
    what am I doing wrong?
    Can someone help me.
    Thanks and regards.

    You probably have forgotten to set the "Write" function to APPEND the data to the file.
    This has nothing to do with where you are writing the file.  Check the inputs for the write function and make sure you set it up to append.
    Shane.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • Open and Close Front Panel of SubVI

    Hi all,
    Running LabVIEW 2011 on Windows 7 x64.  I am trying to get a subVI front panel to open from my main FP with the press of a button and then close with a button press in the subVI.  Here is the piece from my main FP that calls the VI and opens the FP 
    Plots is defined in another loop and all of the loops are in a flat sequence.  I did it this way because I want it to start with the first press and not stop my main loop from running.  I have moved the item in the left loop around a lot so I'm not sure if I can run that in the same loop as the event or not.  Either way opening the VI seems to work fine.
    The problem shows up when trying to close the subVI for the SECOND time.  The code is here:
    As I said, the first time I open and close the VI everything works as I expect it should.  I am then able to open it again but now the "blank button" doesn't function and I can't close the window or even open the block diagram to probe anything.  I have been trying to figure this out for awhile, any insite would be greatly appreciated!
    Thanks
    Solved!
    Go to Solution.

    Its good that you found the bug.
    This code may serve as a way for you to compare notes.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How can I display data gathered in a subVI in a graph of the main VI?

    I have written a largish application (~50 VI's) which acquires, analyzes, display and saves data from an instrument with a built-in DAQPad. My problem is that my block diagram is rather messy by now. I'm using an event structure in my main VI which reacts to buttons being pressed on the front panel. During data acquisition (one frame of the event structure), I need to do a lot of data processing, and I'm displaying both raw data and analyzed data on the front panel. I'm using a lot of subVI's for this, but I always need to get data out of the subVI's again to display it on the front panel, cluttering my block diagram. It would be much nicer if the subVI could update the main VI's graphs and indicators. I just found two examples with control references which show how a subVI can modify e.g. a 3Dgraph of the main VI, but I'm unable to use this with normal graphs and charts - I can't find a way to update the actual data in the plots (I can scale the plot or color it blue etc - but I really want to change the data it's displaying, not color it blue). Is there anything I'm missing? Is there example code for this kind of problem?
    best regards
    Martin

    im assuming that you want to update your graphs and indicators as you are performing your DAQ, otherwise, you can pass out your value/s when the DAQ completes.
    I have attached a very simple example of using a reference to update your front panel graph.
    Hope this helps.
    Attachments:
    Reference Example(LV7.1).zip ‏17 KB

  • Avoiding data memory duplication in subVI calls

    Hi,
    I am on a Quest to better understand some of the subtle ways of the LabVIEW memory manager. Overall, I want to (as much as practically possible) eliminate calls to the memory manager while the code is running.
    (I mainly do RT code that is expected to run "forever", the more static and "quiet" the memory manager activity is, the faster and simpler it is to prove beyond reasonable doubt that your application does not have memory leaks, and that if will not run into memory fragmentation (out of memory) issues etc. What I like to see as much as possible, are near static "used memory" and "largest contiguous block available" stats over days and weeks of deployed RT code.)
    In my first example (attached, "IPE vs non-IPE.png"), I compared IPE buffer allocation (black dots) for doing some of the operations in an IPE structure vs. "the old way". I see fewer dots the old way, and removed the IPE structure.
    Next I went from initializing an array of size x to values y to using a constant array (0 values) with an "array add" to get an array with the same values as my first version of the code. ("constant array.png")
    The length of the constant array is set to my "worst case" of 25 elements (in example). Since "replace sub-array" does not change the size of the input array even when the sub-array is "too long", this saves me from constantly creating small, variable sized arrays at run-time. (not sure what the run-time cpu/memory hit is if you tried to replace the last 4 elements with a sub-array that is 25 elements long...??)
    Once I arrived at this point, I found myself wondering "how exactly the constant array is handled during run-time?". Is it allocated the first time that this sub-vi is called then remains in memory until the main/top VI terminates, or is it unloaded every time the SubVI finishes execution? (I -think- Mac's could unload, while windows and linux/unix it remains in memory until top level closes?)  When thinking (and hopefully answering),  consider that the the code is compiled to an RTEXE runningg on a cRIO-9014 (vxWorks OS).  
    In this case, I could make the constant array a control, and place the constant on the diagram of the caller, and pipe the constant all the way up to the top level VI, but this seems cumbersome and I'm not convinced that the compiler would properly reckognize that at the end of a long chain of sub-sub-sub VI's all those "controls" are actually always tied off to a single constant. Another way would perhaps be to initialize a FG with this constant array and always "read it" out from the FG. (using this cool trick on creating large arrays on a shift register with only one copy which avoids the dual copy (one for shift register, one from "initialize array" function)).
    This is just one example of many cases where I'm trying to avoid creating memory manager activity by making LabVIEW assign memory space once, then only operate on that data "in-place" as much as possible. In another discussion on "in-place element" structures (here), I got the distinct sense that in-place very rarely adds any advantage as the compiler can pick up on and do "in-place" automatically in pretty much any situation. I find the NI documentation on IPE's lacking in that it doesn't really show good examples of when it works and when it doesn't. In particular, this already great article would vastly benefit from updates showing good/bad use of IPE's.
    I've read the following NI links to try and self-help (all links should open in new window/tab):
    cool trick on creating large arrays on a shift register with only one copy
    somewhat dated but good article on memory optimization
    IPE caveats and recommendations
    How Can I Optimize the Memory Use in My LabVIEW VI?
    Determining When and Where LabVIEW Allocates a New Buffer
    I do have the memory profiler tool, but it shows min/max/average allocations, it doesn't really tell me (or I don't know how to read it properly) how many times blocks are allocated or re-allocated.
    Thanks, and I hope to build on this thread with other examples and at the end of the thread, hopefully everyone have found one or two neat things that they can use to memory optimize their own applications.  Next on my list are probably handling of large strings, lots of array math operations on various input arrays to create a result output array etc.
    -Q
    QFang
    CLD LabVIEW 7.1 to 2013
    Attachments:
    IPE vs non-IPE.png ‏4 KB
    constant array.png ‏3 KB

    I sense a hint of frustration on your part, I'm not trying to be dense or difficult, but do realize that this is more towards the "philosophical" side than "practical" side. Code clarity and practicalities are not necessarily the objectives here.
    Also, I have greatly appreciated all your time and input on this and the other thread!
    The answer to your first question is actually "yes, sort of". I had a RT application that developed a small memory leak (through a bug with the "get volume info.vi' from NI), but to isolate it and prove it out took a very long time because the constant large allocation/deallocations would mask out the leak. (Trace's didn't work out either since it was a very very slow leak and the traces would bomb out before showing anythinng conclusive.) The leak is a few bytes, but in addition to short term memory oscilations and  long term (days) cyclical "saw-tooth" ramps in memory usage, made this very hard to see. A more "static" memory landscape would possibly have made this simpler to narrow down and diagnose. or maybe not. 
    Also, you are missing my point entierely, this is not about "running out of memory" (and the size of 25 in my screen-shot may or may not be what that array (and others) end up being). This is about having things allocated in memory ONCE then not de-allocated or moved, and how/when this is possible to accomplish.  Also this is a quest (meaning something  I'm undertaking to improve and expand my knowledge, who said it has to be practical).
    You may find this document really interesting, its the sort of thing you could end up being forced to code to, albeit, I don't see how 100% compliance with this document would ever be possible in LabVIEW, thats not to say its worthless: JPL Institutional Coding Standard for the C Programming Language (while it is directed at C, they have a lot of valid general points in there.)
    Yes, you are right that the IPE would grow the output if the lenght of my replacement array is not the same, and since I can't share the full VI's its a bit of a stretch to expect people to infer from the small screen dummp that the I32 wires on the right guarantee the lengths will match up in the IPE example.
    Once, on recomendation of NI support, I actually did use the Request deallocation primitive during the hunt for what was going on in that RT app I was debugging last year. At that particular time, the symptom was constant fragmentation of memory, until the largest contiguous block would be less than a couple of kB and the app would terminate with 60+MB of free memory space.. (AKA memory leak, though we could not yet prove that from diagnostic memory consumption statistics due to the constant dynamic behavior of the program)  I later removed them. Also, they would run counter to my goal of "allocate once, re-use forever" that I'm chasing. and again, I'm chasing this more as a way to learn than because all my code MUST run this way. 
    I'm not sure I see what you mean by "copying data in and out of some temporary array". Previously (before the constant array) at every call to the containing sub-vi, I used to "initialize array" with x elements of value y (where x depends to a large degree on a configuration parameter, and y is determined by the input data array). Since I would call to "initialize" a new array each time the code was called, and the size of the array could change, I looked for a way that I could get rid of the dynamic size, and get rid of dynamically creating the array from scratch each time the sub-vi was called. What I came up with is perhaps not as clear as the old way I did it, but with some comments, I think its clear enough. In the new way, the array is created as a constant, so I would think that would cause less "movement" in memory as it at that point should be preventing the "source" array from (potentially) moving around in memory?  Considering the alternative of always re-creating a new array, how is this adding an "extra" copy that creating new ones would not create?
    How would you accomplish the task of creating an array of "n" elements, all of value "y" without creating "extra" copies? -auto-indexing using a for loop is certainly a good option, but again, is that sure to reuse the same memory location with each call? Would that not, in a nit-picking way, use more CPU cycles since you are building the array one element at the time instead of just using a primitive array add operation (which I have found to be wicked fast operations) and operate on a constant data structure?
    I cannot provide full VI's without further isolation, maybe down the road (once my weekends clear up a bit). Again, I appreciate your attention and your time!
    QFang
    CLD LabVIEW 7.1 to 2013

  • Firefox 29 con un terrible uso de CPU al reproducir un video (plugin-container)

    Para probar lo mal que este navegador se despempeña al reproducir un video: usar una computadora con Intel Celeron D, 2 Gigabytes de RAM y una nivida GeForce 7200 GS/7300 SE, si no se cuenta con una computadora similar... entonces probar la ineficiencia TOTAL de este navegador seria imposible.
    En fin, ya que se tenga un precesaor de un solo nucleo y pocos gigabytes de RAM, se comienza la prueba.
    para probar hay que entrar a este sitio desde firefox: http://cnnespanol.cnn.com/2014/05/12/nasa-la-contraccion-de-glaciares-en-la-antartida-es-irreversible/
    bueno, en fin el problema que tengo es que Firefox usa DEMASIADO CPU, para reproducir un solo video de flash... mientras resproduzco un video ese proceso desagradable y maldito llamado "plugin container" usa el 100 % de la CPU y he tenido temperaturas barbaras tanto en Windows 7 32 bit como Ubuntu 64 bits que llegan a los 71 grados celsius, todo por ese MALDITO e INEFICIENTE proceso que se llama plugin-container y como no! el INEFICIENTE api que ellos llaman NPAPI...
    Si ustedes, Mozilla reciben dinero... en lugar de usarlo en cosas inutiles como Australis, deberian usarlo para mejorar la eficiencia de ese maldito plugin-container.
    ¿En que momento decidieron que su navegador tenga que funcionar solo en computadores con 12 nucleos?
    En fin he tratado inutilmente lo que aqui se sugiere, desactivar la aceleracion por hardware tando de firefox como de flash... e incluso empeora, teniendo desactivado la aceleracion por hardware, hay videos que simplemente no puedo ver, el video es entrecortado y los controles del reproductor embebido son irresponsivos.
    En fin... mi computadora puede parecer muy pobre para ustedes señores de Mozilla, pero a me srive todavia y creo que puede durar mucho mas, al menos hay otros programas con lo cuales no tengo este problema y me son utiles... y la verdad no necesito gastar dinero para comprar una computadora con la caracteristica que he descrito anteriormente, pero ¿en verdad necesito tirar mi dinero a la basura para poder ver videos decentemente?
    Aqui esta la informacion que siempre piden:
    Configuración básica de la aplicación
    Nombre: Firefox
    Versión: 29.0
    Agente de usuario: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0
    Informes de fallos de los últimos 3 días
    Todos los informes de fallos
    Extensiones
    Nombre: Adblock Plus
    Versión: 2.6
    Activada: true
    ID: {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}
    Nombre: Exif Viewer
    Versión: 2.00
    Activada: true
    ID: [email protected]
    Nombre: FEBE
    Versión: 7.3.0.1
    Activada: true
    ID: {4BBDD651-70CF-4821-84F8-2B918CF89CA3}
    Nombre: Ubuntu Firefox Modifications
    Versión: 2.8
    Activada: true
    ID: [email protected]
    Preferencias importantes modificadas
    accessibility.typeaheadfind.flashBar: 0
    browser.cache.disk.capacity: 358400
    browser.cache.disk.smart_size_cached_value: 358400
    browser.cache.disk.smart_size.first_run: false
    browser.cache.disk.smart_size.use_old_max: false
    browser.places.smartBookmarksVersion: 6
    browser.sessionstore.upgradeBackup.latestBuildID: 20140428193813
    browser.startup.homepage_override.buildID: 20140428193813
    browser.startup.homepage_override.mstone: 29.0
    dom.mozApps.used: true
    extensions.lastAppVersion: 29.0
    network.cookie.prefsMigrated: true
    places.database.lastMaintenance: 1399925151
    places.history.expiration.transient_current_max_pages: 52439
    plugin.disable_full_page_plugin_for_types: application/pdf
    plugin.importedState: true
    privacy.sanitize.migrateFx3Prefs: true
    storage.vacuum.last.index: 1
    storage.vacuum.last.places.sqlite: 1397861177
    Gráficas
    Descripción de Adaptador: nouveau -- Gallium 0.4 on NV46
    GPU acelerada de Windows: 0/1 Basic
    ID de Vendor: nouveau
    ID del dispositivo: Gallium 0.4 on NV46
    Procesador WebGL: nouveau -- Gallium 0.4 on NV46
    Versión del dispositivo: 2.1 Mesa 10.1.0
    windowLayerManagerRemote: false
    AzureCanvasBackend: cairo
    AzureContentBackend: cairo
    AzureFallbackCanvasBackend: none
    AzureSkiaAccelerated: 0
    JavaScript
    Recogida de basura incremental: true
    Accesibilidad
    Activado: false
    Prevenir accesibilidad: 0
    Versiones de bibliotecas
    NSPR
    Versión mínima esperada: 4.10.3
    Versión en uso: 4.10.3
    NSS
    Versión mínima esperada: 3.16 Basic ECC
    Versión en uso: 3.16 Basic ECC
    NSSSMIME
    Versión mínima esperada: 3.16 Basic ECC
    Versión en uso: 3.16 Basic ECC
    NSSSSL
    Versión mínima esperada: 3.16 Basic ECC
    Versión en uso: 3.16 Basic ECC
    NSSUTIL
    Versión mínima esperada: 3.16
    Versión en uso: 3.16
    Nota: no sabia que los foros en español no estaban disponibles... puedo proveer mi descripcion en ingles, pero no tengo tiempo, asi lo escribi asi se queda.

    Hola,
    Gracias por su pregunta. A este momento si la plugin napi estaba usando mas de 100% de la CPU, por favor desactivar la plugin.
    Por favor actualice sus controladores y WebGL también. [[Upgrade your graphics drivers to use hardware acceleration and WebGL]]
    Muchos gracias.

  • How can I make a control inside a loop in a subVI change value when the calling VI's control changes?

    Hi.
    I think this is a pretty basic LV question, but I have not been able to find a good solution.
    I am attaching VIs that show the problem I am having, but obviously, the real application is a lot complicated, which forces me to try to do it this way.
    The issue is: I have a subVI with a Boolean control inside a loop.  When the control is true I want some action to take place.  When the subVI is run on its own, it works fine, acting properly when I set the boolean control to true via the LV FPGA interface from the host.  However, when I use it as a subVI, in which the top-level VI calls several instances of the subVI, I have the Boolean controls in the top level VI.  What is happening is that the false Boolean value with which the top-level VI starts is passed into the subVIs, and not updated, even though the control is inside the loop.
    Can any one suggest a good solution?
    Thanks,
    AlejandroZ
    Attachments:
    CallingVI.vi ‏7 KB
    subVI.vi ‏8 KB

    Hi.
    I know the example I posted might seem silly, but it was just to illustrate the problem I am having.  In reality this is the application:
    I have some LV FPGA code which uses a few FPGA IO to implement a serial link to communicate with a device.  Most of the time we are getting data from the device, so the serial link is used to send a read command, read in the data and put it into a FIFO.  However, I also wanted the VI to support sending data to the device, so I added an array control to put the data you want to send, and a boolean control to tell it you want to send it.
    Since sending and receiving data are done using the same FPGA IO, they cannot be independent operations, because they would garble each other. Therefore, in the subVI I have a loop in which I first read data if there is any to read, then check the boolean write control to see if there is data to write.
    As I mentioned, this works perfectly for talking to a single device.  However, we run into the issue of this topic when trying to replicate this for several devices.
    One easy solution is to not have the loop in the subVI, and have it in the calling VI (I am favoring this simple solution right now).  The only reason why I have not done this yet, is that the subVI has more than one loop, so I am going to have to create several subVIs.  I just posted to see if there was an even simpler solution...
    There have been some other possibly good solutions proposed here, though I am not sure if they work in LV FPGA.
    Thanks for all your responses.
    AlejandroZ

  • How do I use the same SubVIs in the different VIs? Those VIs have to run at the same time.

    Hello,
    If I have two VIs.And both of them has the same SubVIs.
    For example
    VI1 contains:
    SubVI1: Initialize Instrument
    Data acquisition
    SubVI2: Close Instrument
    VI2 contains:
    SubVI1
    Monitoring the Board and VI1
    SubVI2
    When I run those two VIs at the same time, why can't I use SubVI2(which is in the VI1) to close the Instrument?
    The function has been run correctly, but it didn't work. The VI1 did closed, but the instrument didn't closed, neither did data acquisition.
    In order to close instrument, I have to run SubVI2(which is in the VI2).
    What I want to do is that when I run SubVI2(which is in the VI1), then, the instrument closed and data acquisition stopped.
    Is there any problem between the thread? Or anything wrong with SubVI's VI property?
    Thanks a lot!

    Hi, everyone
    Thanks!
    It seems that I didn't solve this problem, but now I maybe understand why it happened.
    GerdW  said:
    Why do you want to initialize an instrument in 2 different places?
    Why do you want to close an instrument in 2 different places?
    Graziano  said:
    i guess the problem is that, running two times SubVI1 you initialize instrument two times (it is not desirable...), and, worst, running SubVi2 you close instrument twice!
    That makes me think about the number of doing init & close. My project calls on that there must be a strict requirements about the number of calling those function in one process.
    That is to say,when running them, if VI1 and VI2 are in different process but not in the same one, the program is going to run successfully. But now, VI1 and VI2 are threads which in the same process, so my project's strict requirements makes them run failue.I used SPY++ to analysis, and found those two threads are actually in one process.
    Graziano  said:
    I suggest to put SubVI1 and SubVI2 outside VI1 and VI2, and you run them once, at the start and stop of your measurement.
    I believe that is a good idea, I can deal the problem in this way. Thank you!
    But if anybody has the idea which can deal with the problem between the threads, I will be so glad......
    What does that called, Synchronized between threads.....maybe......
    To altenbach
    I am afraid showing the code doesn't work, because all the VI SubVIs and code is base on the japanese system.and all of them must call the functions form DLL which is protected by my company. I am sorry about that......
    Thanks a lot!! Everyone.

  • Subvi terminals in loops

    I'm trying to create a subVI from a VI in which most of the controls and indicators (that will become the terminals of the subVI) reside in loops. I then connect the resulting subVI into a wrapper VI.
    One boolean control within a while loop in the subVI is assigned to a terminal. If I connect a button in the wrapper VI to this terminal, the subVI doesn't seem to notice the input from the button at all. If I push the button on the subVI front panel, however, this works fine.
    For indicators that reside in loops, the corresponding output terminals do not seem to reflect the subVI outputs either.
    What am I doing wrong?

    Barry_Wealand wrote:
    What am I doing wrong? 
    You don't understand dataflow yet.
    A subVI receives values on all inputs when called and returns values on all outputs after it completes. The callling VI cannot continue with anything depending on the subVI output and thus it will also not read the control you are changing until the next iteration. Once called, all operations are local to the subVI. You can do what you are trying to do by wiring control references into the suVI and read values via value propety nodes wired to the references, for example. There are many other ways, though. Some better than others.
    It would probably help i you could describe what you are trying to achieve with all this. Most likley there are much better solutions. Why is there a loop in the subVI?
    Can you attach a simplified version of your architecture (i.e. toplevel VI and subVI)?
    LabVIEW Champion . Do more with less code and in less time .

  • Set/get attribs via SubVI (revisited)

    Greetings. This question was asked about a month ago (See "How to
    set/get..." by John Cruz, 3/20/00 in this newsgroup), but the ensuing
    discussion didn't address a similar question that I have.
    The question is the same: Is there a way to set/get attributes of a control
    (like "Visible" or "Disabled") on the front panel of a VI directly from
    within a subVI?
    The solutions given last month all appeared to require an output of the
    subVI wired to the attribute node inside the calling VI, and I'd like to
    avoid that. E.g. I would like to set an attribute of a top-level control
    using a subVI, but using a subVI that has NO OUTPUTS.
    Another way to think of it is that I'd like to discover something like a
    "Global Attribute
    Node" for a control which itself is not global. I.e. an
    attribute node which could be referenced from any VI but would still affect
    only one control on a different VI's front panel. Obviously that specific
    creature doesn't exist, but that's the idea I'm after.
    Sufficiently confused? My main goal here is really to enable and disable
    buttons through a subVI, and to avoid using more wires whenever possible. I
    guess I'm a LabView neat-freak. :-)
    Thanks in advance for any advice!
    Justin Goeres
    Indio Systems, Inc.
    Pleasanton, CA

    A "creature" such as a Global Attribute Node for a control does not exist
    yet in LabVIEW. My guess is that sooner or later you will be able to open a
    "Control Reference" to a VI FP control and use it to call "Property Nodes"
    and "Invoke Nodes" to sets its attributes from anywhere in your application
    or even from another application, as it is currently possible for VIs with
    the VI Server.
    For the moment, a VI must set its attribute nodes on its own diagram. To set
    attribute nodes from outside the VI you must provide a method to communicate
    with the VI and tell it which value to set its attribute.
    For example, the VI can read a global variable in a while loop to update the
    attribute node to whatever value have been written to by other running VIs,
    even by its subVIs. provided that the loop execute in parallel with the
    subVI call.
    Instead of using a global, you can wire a front panel control to the
    attribute node. A VI that wants to modify the attribute node then uses VI
    Server method "Set Control Value" on this front panel control to write the
    new value.
    Basically, all you need is a technique to pass data between VIs; you can use
    any other you like (notifiers, TCP/IP, etc).
    Of course, when you design your VI, you must know in advance which attribute
    nodes will eventually need to be externally updated and wire them
    accordingly. Hopefully, this won't be necessary if a "Control Reference"
    ever come to be implemented in LabVIEW.
    Regards,
    Jean-Pierre Drolet
    Scientech R&D inc
    Trois-Rivieres-Ouest (Quebec)
    CANADA G8Z 4H1
    John Lum a �crit dans le message :
    [email protected]...
    > Justin Goeres wrote:
    >
    > > Greetings. This question was asked about a month ago (See "How to
    > > set/get..." by John Cruz, 3/20/00 in this newsgroup), but the ensuing
    > > discussion didn't address a similar question that I have.
    > >
    > > The question is the same: Is there a way to set/get attributes of a
    control
    > > (like "Visible" or "Disabled") on the front panel of a VI directly from
    > > within a subVI?
    > >
    > > The solutions given last month all appeared to require an output of the
    > > subVI wired to the attribute node inside the calling VI, and I'd like to
    > > avoid that. E.g. I would like to set an attribute of a top-level
    control
    > > using a subVI, but using a subVI that has NO OUTPUTS.
    > >
    > > Another way to think of it is that I'd like to discover something like a
    > > "Global Attribute Node" for a control which itself is not global. I.e.
    an
    > > attribute node which could be referenced from any VI but would still
    affect
    > > only one control on a different VI's front panel. Obviously that
    specific
    > > creature doesn't exist, but that's the idea I'm after.
    > >
    > > Sufficiently confused? My main goal here is really to enable and
    disable
    > > buttons through a subVI, and to avoid using more wires whenever
    possible. I
    > > guess I'm a LabView neat-freak. :-)
    >
    > Unfortunately, Jean-Pierre Drolet's discussion from the thread in March is
    > exactly right. In the current incarnation of LabVIEW, there is simply no
    direct
    > way to access panel object attribute nodes from a secondary VI. The
    suggestion
    > to use VI Server and the Set Control Value method with a control wired to
    the
    > attribute node of choice sounds like an excellent idea to me.
    >
    > I'm pretty sure that the LabVIEW developers have long since identified
    this as a
    > very pivotal bit of functionality for LabVIEW, so stay tuned.
    >
    > Regards,
    > John Lum
    >

  • Main VI stops fucntioning after i open and close a subvi from an event structrue.

    Hi,
    I am trying to open a pop up vi from an event. I have been struggling with this for a while now. When i open a pop up vi and close it, the main vi stops running properly.
    I have narrowed it down to the fact that the event which calls the subvi never finishes when the subvi is closed.
    The attached image is an example of what I am currently doing. When I run this, i never see the dialog box that says 'here'
    maybe useful as a hint to the problem...
    This does work properly if I run the vi, click to open the subvi, close the subvi, (here the main vi is not working properly, cant click anything)  then stop the main vi, run the main vi again, open and close the subvi, and then i see the 'here' dialog, and my main vi functions properly.
    thanks
    J
    Solved!
    Go to Solution.

    What is actually happening is you hit the Ok button and your panel closes and you set the Stop 2 to True.  Ok, that is fine except for the fact that the Stop 2 terminal has already been read during that iteration of the loop.  So the loop will go again.  This time is has read the Stop 2 at a TRUE, but the event structure needs an event before the loop can complete.  But the front panel has been closed already and you are stuck.
    As Dennis said, get rid of the Stop 2 and just wire the TRUE constant straight out of the event case.  Wire a FALSE for all of the other event cases.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Reading main VI front panel in SubVI

    Hi,
    I'm trying to create a subVI that writes a header text file containing info on essential parameters in my measurements. My mainVI front panel has a few dozen controls, some of them contained in a handful of clusters. 
    What I'd want is just to be able to access and read the values at the subVI to construct the string I want to write to the file.
    I wouldn't like to proceed the dumb way, i.e., building an array of clusters or individual controls or references to them and passing that to my subVI (and, obviously not passing each individual control/cluster as a subVI input).
    I figured I'd like to have some kind of refnum of the mainVI frontpanel passed to my subVI and dig use a big pile of property nodes to dig out the info that i need, inside the SubVI. Is this a feasible solution and if so, what's the way to conduct it? If not, what would be a better way?
    As before, I'm using LV7 so in case you answer with block diagram examples, I'd appreciate screenshots of them.
    Thanks,
    Lauri

    Vostokki wrote:
    I'm trying to create a subVI that writes a header text file containing info on essential parameters in my measurements. My mainVI front panel has a few dozen controls, some of them contained in a handful of clusters. 
    What I'd want is just to be able to access and read the values at the subVI to construct the string I want to write to the file.
    I wouldn't like to proceed the dumb way, i.e., building an array of clusters or individual controls or references to them and passing that to my subVI (and, obviously not passing each individual control/cluster as a subVI input).
    Lauri
    Actually that is the preferred way to do. Why you may ask? It is because you decouple the functionality (creating your log file header) from your specific user interface. By doing so you can reuse this VI in other places or applications. By using the references directly this ties the subVI to the calling VI. Unless the subVI is specifically doing something to the UI itself a subVI should avoid accessing data it needs via direct references. It should require the data to be wired in with the appropriate clusters, arrays or whatever your data needs are.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Conditionally include Front Panel of a Subvi in an EXE

    I want to make two versions of an EXE, one "normal" version and a debug version. I know how to set conditional disable symbols via pre/post build actions (btw. NI: these variables should REALLY be defineable per build specification; even bare command line C compilers are easier to use in that regard than Labview).
    The "normal" version won't show anything but the main vi. The front panels shouldn't even be included in the exe. For the debug version I want to show the front panels on request (I've queues for sending that to the subvis). Simply calling "FP.open" does not work with an compiled exe, because I get a "resource not found" error (the front panel of the subvi is not compiled into the exe). I tried setting show "frontpanel when called" which forces the FP to be compiled into the exe, but then the FP will shortly flash on the screen, even when the first command of the subvi is hiding the frontpanel.
    How can I make a subvi depending on a conditional disable symbol include its front panel into the exe without forcing it to show its frontpanel at the same time?

    There are a number of things which cause LV to keep a FP when building. These include things like open when called (which you understandably don't like), but also various things which statically require the front panel. Things like changing the scrollbar settings or creating a property node for a control on the FP. Personally, my preference is for the latter because you can document it better.
    If you don't actually mind whether the FP is included, you can just do that and be done with it. If you really do mind, you can check whether placing the property node for the control in a conditional disable structure has an impact on this or not. I have no idea whether it does or not, since I don't know exactly how LV will treat the code in the disabled case.
    The other alternative is making two builds and configuring it for each VI:
    The disadvantage here is that you have to manage two builds and do this manually for each VI.
    If you want, there's a related idea on the idea exchange, but it won't actually help in your case, because it's not conditional:
    http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Add-a-property-to-guarantee-that-the-front-panel-of-a-...
    Try to take over the world!

  • It is possible to open the front panel of a subVI more then one time at the same moment?

    I want to open a subvi´s front panel several times with each one operating independently. The subvi has a ring with several variables to choose to show in a graphic. The subvi is called from a button on the Main Front Panel. It is possible to, for instance, open the subvi and set it to show a temperature graphic and click again on the button to call another instance of the same subvi and select pressure for the graphic, keeping both new windows side by side? Will I still be able to access the Main Front Panel?

    Yes you can. You have to use a .vit (VI template file). There's an example here. There's also been lot's of discussion on the subject. I think if you do a search for vit, you'll be able to find additional information and examples.

Maybe you are looking for

  • How to improve performance of DSO activation

    Hi all, We have created a DSO which is updated daily from another DSO. The extraction is from the Active table of the source DSO, so all records are extracted, in this case roughly 1,000,000 records. (we cannot use delta update for this particular DS

  • Write bounds attribute in a XY graph property node

    Hello, i want to write the bounds size using the XY graph property node or something else. I want to determine the bound XY graph size. It is possible? Thanks!! LArson

  • Can't delete ipod for windows

    I have an old ipod for windows (95) I just got a new ipod and when I tried to download and install version 7 it says Error 1921 service iopd service could not be changed. Verify that you have sufficent privlages to stop services. The same thing comes

  • Yahoo Groups messages not rendered correctly

    Is there some issue between FF and Yahoo Groups ?? I'm a member of several Yahoo groups, one of them often sends messages with graphics in them; and lately these messages are mostly blank when I look at them in FF. If I use IE or 'Chrome' they appear

  • Restrict Plant Posting

    Hi, I have a scenario in which I have to restrict plant posting when i am posting company codes. Lets us say, I have to post a journal entry for a company code A and plant 1 only. We should not allow users to post journal entries other than Plant 1 w