Trigger Event Structure in SubVI

Here's my goal.  I have a VI that sets two analog outputs which in turn control a power supply.  One output controls voltage while the other controls Current Limit.  I created a VI which uses an event structure so that when the voltage or current limit is changed, the analog outputs are adjusted accordingly. 
Now, I'd like to turn that into a SubVI and have it running in the background while my main VI runs.  I'd like to be able to go into the subVI and change those values at certain locations within the main VI.  I tried just using the subVI with register events, but it hangs because it is waiting for the subVI to finish before continuing.  I tried using the Run VI methond with "wait until done" set to false, but then I don't see how to trigger my events because I can't link my mainVI to the events that need to be triggered.  I can set the control using Control Value Set, but that doesn't do anything for my event structure and thus stuck again. 
Maybe the event structure isn't the best way to do what I'm seeking.  But I don't want to set all this up in my Main VI because it just adds too much complications and I already have the VI working by itself and just want to turn it into a subVI.
Thanks.

You could either get a reference to the SubVI and find the specific control like the attached picture, or you could pull the SubVI out of the main loop.  If the SubVI is necessary for data flow, you are almost certainly going to have a hang up if you don't call it by reference.
edit - Another, probably less popular, option would be to have the subvi running in a parallel loop and have locals take data from the control loop and write to the command loop.  You'd have to be careful to only have one local writer, though.
Message Edited by JeffOverton on 01-30-2008 02:39 PM
=============
XP SP2, LV 8.2
CLAD

Similar Messages

  • Handling event structure in subvi

    I go through fierce problem for using event structure in subvi. 
    Main VI contains event structure in a SubVI
    Event structure is composed of two event. one is "Time Out" , the other is "Value Change".
    What I want for this VI is Time out event works without a delay time , except of case of Value Change event 
    But "Value Change" event of this VI is not working properly. Even when  Value Change event is working , "Time Out" event is still working.
    To explain in more detail,  When Value of Boolean is changed , ligh of Boolean Out must turn on.
    Please, help me.
    Attachments:
    example.zip ‏14 KB

    Hi,
    Have a look at the attached vi. your value change event is working properly but once after that event is fired it will be going to timeout there we are sending false to the boolean hence your not able to observe the value change occured.
    Attachments:
    main vi Folder.zip ‏9 KB

  • Trigger Event Structure Case on Startup

    Hello,
    Within my project, I am controlling a linear actuator via Modbus TCP, with an event structure within a loop.  I control its velocity, acceleration ... etc.  It works beautifully, but I must change the values of the mentioned parameters to trigger the event cases, after startup.  I would like to trigger the event on startup of the program and take the current values on the front panel.
    I have heard about "Property: Value(Signaling)", but I cant seem to understand it and how to implement it..
    Any guidance and help would be appreciated!
    Thanks,
    Danny

    It won't work for you because you already have something designated for the timeout case, and you want a different event case than that to run on startup.
    But, here is the explanation.
    At the top left of the event structure is the timeout terminal.  The number you wire in there tells how frequent the timeout case could execute.  If you put a 0 constant outside of your loop and wire it into that terminal through a shift register, it will execute immediately or almost so.  After the event structure, wire a -1 into the right hand shift register.  Then after successive iteration, the timeout case will be disabled.
    Attachments:
    Example_VI_BD.png ‏12 KB

  • Strange problems about my projects(efficiency,event structure,queue)

    hey,guys,i am a labview user from china,so forgive me about the chinese words of my projest. i found something wrong with my work. .
    there are two functions in my "While loop", the first one depends on "queue" and  is to get information from UART, the second one is "event structure" to send information through UART. my problems:
    1. i can not stop while loop by pressing "停止“, and i find two ways to stop it. first, i press"停止”,then, i press any buttons that can trigger "event structure"twice, at last, while loop can stop.the second way, i press buttons for "event structure" one time, then "停止”, and then the same button for"event". it also works
    2.my work does not run efficiently. you guys can try. once you press buttons for "event structure", it responses very slowly,and if you press many times,the whole program seems like suspending.i have added a LED named test at the front panel, it should light once you press "运行“. and it also shows how slow the whole program is.
    i have attached my work, and my main vi is "串口通信 主VI".
    can any body give me some suggestions? thanks a lot
    Attachments:
    Uart.zip ‏140 KB

    Your event structure will execute exactly once per loop of the main loop, thus the other three loops must stop before handlig the next event. You will also get a race condition between the top loop and the events when writing.
    I'd put the top loop as the timeout case in the event and place the loop around the event for starters.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • How do i get a boolean indicator to trigger a event structure

    I have two parallel loops running, and i need to use a boolean value, one that comes out from an OR gate, to trigger an event in the parallel, event structure loop.  I've attached a simplified version of the loop.  Is there a way to get this done?  I've tried using local variables, value(signaling), etc. and they haven't worked
    Solved!
    Go to Solution.
    Attachments:
    Parallel Loop Trigger.vi ‏10 KB

    Here is a revised version of your VI. I modified the mechanical actino of the stop button so it kept it's value until it was read. In addition, I added a delay to your upper loop. Without a delay it was running too fast to actually see the button press. I modifed the event in the the event structure to trigger on a value change of Boolean.
    You don't really need the outer loop since it will only run a single time in all instances. On the first execution of that loop it will be sitting in the turn inner loops. Once you exit the two inner loops your outer loop will always exit. Therefore, it serves no purpose.
    Your OR in the upper loop is completely uses. It serves no purpose since the result will always be equal to the value of the Stop button.
    There are better ways of triggering events. a preferred method would be to use a user event and simply generate the event at the appropriate time. This has the advantage of not requiring additional controls/indicators simply to cause an event to occur.
    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
    Attachments:
    Parallel Loop Trigger.vi ‏12 KB

  • Can I use Event structures in a subVI?

    Hi,
    I have a subVI (ProvaEv1.vi) that use an event structure inside. But when I use it in a VI (ProvaVI.vi) the event structure in the subVI doesn't catch the events.
    I tried to insert the event structure in a while loop but it doesn't work too.
    Could you help me?
    Thanks Ius
    Attachments:
    ProvaVI.vi ‏11 KB
    ProvaEv1.vi ‏15 KB

    "iusn" <[email protected]> wrote in message news:[email protected]...
    Thanks to all for your answers!
    Wiebe! I tried to do as you suggested but I am not able to link the Event Reference Number inside te SubVI with the Event Register Number of the Register for Event in Main VI. There is e class conflict. Another question: how the SubVI can know the structure of the Register event outside?My aim was to create a modular structure but it seems very difficult, wath do you think about these problems?
    The broken wire is related to your question. The event structure inside the sub vi knows about the events you register in the main, because the reference wire/control has a "strong" type. It contains information about the registered events. That is also why the wire is broken. You have to register all events, then create an indicator/control of the output. Use that control in the subvi. You have to do this every time the events change (you might use a type def if you use the control a lot).
    Usually, the events that you would want to put inside subvi's are those related to user interface objects. I've had this a lot. You make a nice interface, but it's not reuseable, because the events are mixed with all the other events. Only solotion is to manually add the needed event cases in your program, and copy the code.
    Even if you can put the events in a sub vi, I'd expect hanging vi's when more subvi's are registered for the same event. It's hard to tell without trying. So it's not a real solution either.
    Like Chrisger suggested, the event callback might help a little, but they are tricky, and actually ment for this (they are intended for activex callbacks).
    Perhaps you should look at XControls (if you use 8.2). It would be more work to replace your code to XControls, but once you're done, you have reusable code.. Haven't worked with them jet, but they are invented for this problem...
    Regards,
    Wiebe.
    I have already create my application using event structure just in Main VI but it seems very complicate to read and keep update, I would have wanted to give modularity to my application.
    Thanks Ius
    SubVIEventMain.vi:
    http://forums.ni.com/attachments/ni/170/203225/1/SubVIEventMain.vi
    SubVIEvent.vi:
    http://forums.ni.com/attachments/ni/170/203225/2/SubVIEvent.vi

  • Event structure in a subVI

    I know this problem has been posted, but I've already am passing everything by reference. I can't get my subVI to respond to my top layer VI. It runs fine as a stand alone, but when I ask it to monitor events from a reference, it won't do anything. I've attached what my sub VI looks like. My goal is to have the the event structure respond when a new file path is sent, stop button pressed, or a enum is changed. The subVI is called Read Track shown in the top VI with all the references passed.
    Top VI
    Message Edited by d1sturbanc3 on 02-27-2008 12:30 PM
    Message Edited by d1sturbanc3 on 02-27-2008 12:31 PM
    Attachments:
    event.JPG ‏163 KB
    top event.JPG ‏301 KB

    You should use dynamic events.
    Your SubVI with the event structure should run in parallel with your main code.
    What you currently have will never work.
    Here's an idea of how the subVI should look like:
    Try to use the Code Capture Tool to get images of your code...
    Good luck,
    Ton
    Message Edited by TonP on 02-27-2008 07:45 PM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    PathEventChange.png ‏5 KB

  • How to Transition to a Specific Case from an Event Structure Trigger?

    Can someone help me troubleshoot my program. I've attached my VI so you can follow along with what I am describing. So here is the scenario:
    I have a program that consists of four test states, stop test, request test info, and end program (cluster of 7 booleans). Each test state sends a serial command to a DUT, receives ACK packet, opens relays which disconnects the serial connection and DUT will continuously test by itself. If the user wants the end the test early, they can hit the "Stop current test" which will close the relay reestablishing serial communication, wait 10 secs for device to enumerate on the PC, and then send the serial command to stop the test. From here, the user can request test information from the DUT by hitting the "Request info" button.
    So my dilemma is when I try to implement a time limit for cases 2 - 4. For case "M1-Idle", the program works flawlessly since there is no time limit. The program will send the serial command, transitions to "Open Relay" case and switch back to the "Idle" state to wait for the "Stop" command. The user has to hit stop whenever to close the relay, request info and/or continue testing.
    For case 2 through 4, there is max time limit of 3 hours. This is where I am having difficulty opening the relays and then entering the timer count down case structure to start the timer. Question is, if I am using the Event Structure to trigger on a user action event (i.e. user presses "Run M2-Normal" - Menu.M 2: Value Change) it sends the command and move on to "Open relay" to break the serial connection as intended. Since the next state of "open relay" is "Idle" how can I add case selector to select "M2 - Timer" instead of "Idle" given that it was based on user selection of "Run M2" event?
    Is that even possible? I tried using the feedback node on the state enum but its coming from the case state and not the event state so it doesn't enter properly into the timer state. Any help or ideas is greatly appreciated. Thanks in advanced.
    Main_Working_Copy.vi is the main portion of the program.
    Best regards,
    Henry
    Attachments:
    Main.zip ‏106 KB

    Hi Ofek_zeevi,
    Welcome to the Support Communities!
    The article below explains how to gift a song in the iTunes Store.
    Some songs are not available as an individual purchase.
    iTunes 11 for Mac: Give music and video
    http://support.apple.com/kb/PH12293
    I hope this information helps ....
    Have a great day!
    - Judy

  • Event structure: have one event trigger another event

    I have an event structure with two events. I want the finalization of the first event to trigger the second event. Both events are triggered by a boolean value change, say "boolean 1" and "boolean 2". Can I have a local variable of boolean 2 inside event 1. By changing its value, it should trigger event 2. However, this doesn't seem to be working. (see attached example)
    any help?
    Solved!
    Go to Solution.
    Attachments:
    test.vi ‏9 KB

    Tim's reply is the answer you are looking for.
    I would like suggest that you create a sub-VI that doesw the work in the second event you want to fire so tht rather than resorting to having one event trigger another, you can simply use the sub-VI that does the work in event_2 after the sub-VI that does the work for event_1.
    If you decide to stick one event triggering another, please clearly document the sceme in BOTH events. What you want to avoid is latter deciding event_1 should be triggered by Event_2 and the next thing you know, your app hangs.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to exit event structure after a trigger occurs?

    I am acquiring some analog signals. Before the trigger occurs, I would like to be able to save the setting or load the settings. I am using an event structure to do it.
    My problem is I can't not exit the event structure after the analog acquisition is finished.
    I am attaching the vi.
    Thanks for your comment.
    Attachments:
    event.vi ‏53 KB

    Seems you are trying to fire an event using a local variable. This will not work. Events are primarily designed to handle user interactions on the front panel. If you want to programmatically fire the stop event, you can write to a "val(sgnl)" property of the stop button.
    Still, you program needs quite a bit more work than that. For example you cannot do any save or load operation before the trigger happens. Maybe you should redo the entire thing as a state machine?
    LabVIEW Champion . Do more with less code and in less time .

  • How to use a event structure in a subVI

    I am trying to use an event structure inside a subVI.  The subVI has an array builder that builds arrays, and the event structure is used so that when the program is running, it allows you to change the elements of the array.  It works, but when I implement it inside a subVI, it does not work properly.  This is going into a subVI, because it will be a part of a much larger progrram, so it needs to be modular.

    If you're using an event structure, it's not a subVI.  if you're worried about modularity, you shouldn't be using the event structure.
    You seem to have a fundamental misunderstanding of modularity.  An event structure should be placed within a while loop.  If you have a while loop within a subVI, you've handed over control of your program to the subVI.  You're not modular at this point.  Your top level GUI has no control.  You'd have to create some asinine system of variables to pass data down to that loop to stop the loop and return to your main VI.  That's not a good design decision.
    Instead of looking for a way to do something broken, you should spend effort trying to understand what you actually want to accomplish.  You should also spend some time learning how event structures work.
    This application is small right now and it's already on the path to unreadable.  That's a terrible thing to do to yourself.  Break these habits now.  se variables only when absolutely necessary.  Use subVIs to accomplish individual tasks, not run the entire application.  With event structures, use a stop button value change event to not be held hostage by the timeout.  If your variable has "2" in it, you're doing something wrong.  There has to be something different between the setpoints, put that in the name.  If you want to make subVIs, create an icon.
    But first and foremost, invest time in understanding dataflow

  • Event Structure Trigger Controller

    Hi Everyone.  I'm working on a motion control system for a flight simulator base using Labview.  My code uses a while loop with a few case structures to constantly transmit data to a second computer where it is conditioned into base motion data.  Currently, these transmissions occur in real-time: I cannot input three different commands and execute them at once.
    I want to be able to input multiple different values into a seperate controller and "start" them all together.  An event structure seems like it would be the perfect solution to my problem, but I'm having difficulty with the program timing out or receiving the wrong inputs, which causes some diasterous effects on the machine.  Any help on where I should place this event structure, how to wire the inputs to existing controls, or any helpful tips are greatly appreciated.
    Attachments:
    HostControler2.vi ‏78 KB

    1. Your event structure must be inside a while loop to trigger on more than just a single event. http://zone.ni.com/reference/en-XX/help/371361H-01/glang/event_structure/
              In your VI the event structure will only ever fire once when you click "Start 2". Then it will never fire again.
    2. Every control that you want an event to fire on must be registered and handled in an event case. They can all be in the same case, as long as they are registered in there somewhere.
    3. Try to keep your block diagram on a single screen, it makes it easier to follow. (Unless your screen is actually twice as high and wide as mine?)
    4. Try to keep all wires visible and all data flow from left to right, wires shouldn't be going backwards or behind objects etc. That will also make it easier to follow.
    5. You are already using basic state machines, you probably don't need to have a while loop in a while loop.
    6. If you need different actions performed asynchronously you will likely need more than one while loop (executing asynchronously, not nested) using queues to communicate between them.
    7. Do you really need to continuously transmit data or only on change?
    There's more but that should give you a good start.
    Troy
    CLDEach snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
    I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
    Beware of the man who won't be bothered with details. - William Feather
    The greatest of faults is to be conscious of none. - Thomas Carlyle

  • How to trigger value change in event structure

    Hii everyone, as the title, how should I trigger the value change event to pop up a message.. below is my connection..
    I want to trigger the event structure to pop up the sub-vi, when the flame and led are TRUE state... I using property node but still the event structure not able to execute.. How should I connect? Thank you very much...
    Solved!
    Go to Solution.

    There are several ways you can do it. First you have to configure your sub-vi so that it does whatever you want when it runs  (in the vi properties, top most window for example) and to make sure that it closes completely when finished (when clicking the "OK" button for example).
    You than need to make an asynchronous call to the sub-vi. There are several ways to do it. My favorite one is shown below. You go in the "Application control" sub-palette and select Static VI reference. I like this approach because it keeps track of the sub-vi path for you, as long as the sub-vi is in the same project. You then drag the sub-vi onto the empty square that will changes to your sub-vi icon. You then connect to an invoke node from the same sub-palette and select run VI. Set "Wait Until Done" to false and the main VI will keep running after starting the Sub vi. Set "Auto Dispose Ref" is the easiest way to go. Otherwise you have to keep track of the sub-vi reference and close it yourself when you're done.
    Marc Dubois
    HaroTek LLC
    www.harotek.com

  • Use Event Structure to trigger a 1 off event

    I am trying to use an event structure to trigger a 1 off event.  I thought that I could check for the condition that I want to trigger the event and wire this the Val(signaling) property of a Boolean.  I then created a Value Change event on this control expecting the event to trigger when the value changed from false to true.  what I find is that writing to the Val Signaling property triggers the event every time not just when the value changes.
    The attachment is a simple vi to try and illustrate this point using the iteration counter to try and trigger a 1 off event on the 10th iteration.  The Boolean 'Once' changes from False to True on the 10th iteration but the event is triggered for every iteration.  Need to run in debug
    Any Help much appreciated
    Ken
    Solved!
    Go to Solution.
    Attachments:
    1 off event trigger.vi ‏12 KB

    One thing that I should have pointed out. I don't know what you are
    going to do in your "one off" event. If it is a time consuming operation
    you should not use an event but send a message to another loop and have
    that loop execute the code. Otherwise your event loop will be blocked.
    You can send messages to other loops in a
    number of ways. Variables, Queues, Notifiers, Action Engines, etc..
    Attached
    is your vi modified to use a notifier. I also modified your conditional
    logic. You said you wanted to have something happen only once but you
    were using a less than comparison. I changed that to an equals comparison so that when i = 9 a notification is sent to a slave loop.
    A message box will be displayed on the tenth iteration of the master
    loop. Notice how your numeric indicator continues to increment even with
    the dialog box displayed. That would not happen if the dialog box were to be displayed in the master loop.
    =====================
    LabVIEW 2012
    Attachments:
    1 off event trigger.vi ‏15 KB

  • SubVI with while loop + event structure not working in multi tab VI

    Hello Everyone,
    I am developing an interface for the control of a prober using Labview 2012, and I am stuck with some issue.
    To start with I provide you with a simplified version of my control interface VI, and with the sub-VI used to build and manage the wafer maps.
    The VI consists of several tabs: Prober Initialization, Wafer Handling, Wafer Map, Status, Error.
    The sub-VI can:
    1/ initialize the grid to display the map (sub VI Init Grid not provided here)
    2/ import XY coordinates from a txt file (sub VI Wafer Map Import)
    3/ display the coordinates and index of the die below the cursor
    4/ and when a die position is double clicked, and the boolean "Edit Wafer Map" is true, then the user can change the state (color) of the die between On-wafer die and Selected Die
    My issue:
    If I use the sub-VI by itself, it works fine. However when I use it as a sub-VI in the tab "Wafer Map", the map does not build up and I can no further use the embedded functionalities in the sub-VI.
    I suspect the while loop + event structure of the sub-VI to be the bottleneck here.
    However I don't know which way to go, that's why I'd be glad to have some advice and help here.
    Thank you.
    Florian
    Solved!
    Go to Solution.
    Attachments:
    Control Interface.zip ‏61 KB

    Hi NitzZ,
    Thank you for your reply.
    I tried to save the VIs in LV10, please tell me if you can open them now.
    Inside he event structure there is quite some code, and since I don't want to make the main vi too bulky, I would like to keep it as a sub-VI. 
    As you can see from the sub-VI, the event structure is used for extracting cursor position and tracking the double click action. These events are linked, through a property node, to the image "Wafer Map" which is passed to the main vi through connector pane.
    All values are passed this way as well (through connector pane). Is there another way?
    Maybe "refnum", but I don't really understand how to use them...
    If I use the event structure in the main vi, the wafer map is still not working. I tried it earlier.
    To implement the multi tab front panel, I used a tab control, and a for loop + case structure. For each element of the case structure, there is a corresponding action.
    For the case where I put the code (element=2) for Wafer Map, I also control the execution of the code with a case structure activated by the button "REFRESH". Otherwise I end up with a freezing of the panel right after the start.
    I hope these comments help you understand better.
    Regards,
    Florian
    Attachments:
    Control Interface.zip ‏104 KB

Maybe you are looking for

  • Update to iTunes hung, now iTunes is gone and I can't reinstall

    I finally had time to update to the latest version of iTunes, but the install hung at about 90% and I finally killed the process. Now iTunes won't run at all, and reinstalling fails with a fairly cryptic message about reinstalling manually. Guess I s

  • Sign Dynamic Document

    Hello, I have a dynamic flowed PDF form which has calculated fields, validations and multiple digital signatures. My digital signatures are "Document Signature" type and no locking occurs for fields after signing. When I open the form, before changin

  • Printing in Word for Mac: strange result

    Today I tried a simple thing like printing a word page from app Word for mac. Usually I obtain a normal print. But today the result is quite strange: the page is printed in an over stretched form, characters seem stretched in vertical, but with some

  • DB Adapter Performance Problem

    Hello, We are trying to update oracle database using DB Adapter. The insertion into database via DBAdapter (& only with DBAdapter alone) is slow. Even for transferring 50 records of ~1K data, 5-6 seconds are spent. Environment: Oracle SOA suite 10.1.

  • Delete messages?

    Delete messages?