Abort several parallel loops in FPGA environment

Hi all

I developed a LabVIEW FPGA code that performs two parallel loops.  The first loop monitors the external positioning sensors and the second loop provides the control for the system under test algorithm.  I am trying to incorporate a condition of 'kill' based on the positioning of external sensors that works similarly to the button cancel in the toolbar of LabVIEW, but I was not successful in finding a solution based on local variables/registrants/etc. in the FPGA coding environment.

Unfortunately, I can't provide live code; However, the loop control algorithm contains a structure rather long sequence inside the while loop, which will have to be terminated immediately arriving at a threshold of the sensor reading.

Does anyone have a suggestion on how to implement such an order of demolition?  I really appreciate the help and if I can provide any additional information, please let me know.  Thank you very much.

You will need to replace the structure of sequence with something that can be stopped.  The simplest solution is a state machine: you put a case structure within a while loop.  The while loop contains a shift register that indicates the current status.  Move each frame of the sequence in another case.  Then, add some logic that checks if the State of abandonment has been reached, and if yes, proceed to a case of "demolition" instead of regardless of the shift register contains.

Tags: NI Software

Similar Questions

  • Closure of a state machine in queue event with several parallel loops

    I am trying to find the best way to stop a program that consists of an architecture of State machine in line waiting for event with several parallel loops. Can anyone recommend the best way to achieve this in my attached VI? (To browse the forum, this seems to be a frequently asked question, but I have not found a solution that works for me.)

    I look forward to any comments on my as well code, if someone is willing to offer it.

    My program needs:

    If the user press the 'Stop' button, the program should prompt the user with "are you sure you want to stop the program?" and then return to a State of rest or move forward to stop the program. In addition if there is an error, the program should prompt the user to ' clear the error and continue, or stop the program. Then back to the idle state or move forward to stop the program.

    Architectural details:

    The program consists of 3 parallel loops: (1) a loop of event management that places different States of a queue of the State, (2) a State Machine that enters the State that is removed from the queue of the State and (3) a loop error/Shutdown, which deals with errors in the error queue management.

    During normal shutdown, where running handling loop in the case of event 'Program.Shutdown' and 'Shutdown' and the 'Idle' States are added to the queue of the State. In the state machine, the State of 'Stop' is invoked. Special "5000" error code is added to the queue of the error. In the loop of error handling and stopping, "5000" error triggered a prompt that asks the user if they want to stop the program. If the user chooses not to stop, a notifier StopNotif is sent to the State of 'Stop' and 'Program.Shutdown' event case with notification 'Go '. If the user decides to stop, the Notifier sends the notification "Stop". Loop and event management State Machine ends when they receive the notification "Stop".

    In case of error, the program behaves in the same way: If the user chooses to clear the error and continue, the program returns to the status "pending".

    HOWEVER - if the user chooses to stop the program, the program crashes. The author of the notification that is sent to stop the loop of events and State Machine management cannot be read because event Program.Shutdown and the stop State (which contain the function "Waiting to notify") are not active.

    I was able to activate the stop State by Queuing in the loop of error/Shutdown management. But I don't know how to activate the "Program.Shutdown" event by program and thus access the function "Waiting to notify" inside.

    I tried to put the function "Waiting to notify" outside the structure of the event, so the event-handling loop never ends. Placing timeouts on the "wait for declaring" and the structure of the event makes the programme of work, but I want to avoid using timeouts because I don't want to turn my event program into a program of polling stations. I would also avoid using variables or nodes property to stop loops, because that requires the creation of a control/indicator for something that the user does not need to interact with.

    Thank you!

    First of all, close the notifier outside loops with your queues.  Second, you must use a user event to send the message to the event structure loop so that it stop in the case of the stop on an error.

  • Stop several parallel loops - error & stop button status

    I have several ongoing loops run in parallel and want to arrest all a loop based on the question whether one of the two conditions are met:

    • One of the loops has an error
    • You press a stop button

    Right now I do this using a master loop that checks to see if any of the loops have a mistake or if you press the stop button.

                                                     

    The problem I have is that I do the references between the loops using indicators of State T/F. These lights if it is the judgment of loops. This means that, at the end of a test, all the lights are on, and before the program is run again each light must be unchecked. It is not easy to use and my program grows I don't want to have to uncheck 20 bulbs before each test.

    Is there a way to make the lights reset at the beginning of each test, or is there a better way to refer to the status of each loop?

    An alternative is to use a notification utility.

    Implement a notifier with a Boolean data type.

    The stop of two loops of wire to the output of a waiting for Notification (remember to set a time-out).

    If an error occurs, or you press stop then send a notification.

    By clicking on Stop stop the two loops. Or a mistake in a loop will stop both.

    It's not more complicated I think a FG.

  • I have to define several of the FIFO to synchronize a master loop at three other parallel loops?

    If I have a single loop to generate a waveform and I mean, three other parallel loops to extract the values from this first loop via a FIFO defined by VI, must I place three separate FIFO components 'Write' (essentially by defining three different FIFOs) on the first lap which correspond to the three elements of FIFO 'Read' in each of the three loops accessing data of the first loop?

    The problem with the help of a simple FIFO, is that when a value is read, the value has disappeared.  The other loops will not see this element.  And since it looks you speak too well of FPGA, you would have to worry about arbitration as well.

    You need a different FIFO for each loop that you send.

  • FPGA parallel loops

    Is there a TSE way get 2 pieces of code to run simultaneously on a PXI7853R?

    I would like to output a 1 MHz clock on one line and then after 8 clock cycles put a chip select.  I tried in a while loop, but when I look on a scope, it looks like the clock stops out when the chip starts to select then the clock restarts when the chip select code is complete.

    Do not separate the loops for this... bad.

    For protocols like that you want to set the base clock, you'll need (1 MHZ in your case) and create the state-machine-style logic to say the lines accordingly. For your example, not code hard a 40 tick wait between the edges of the DIN (this is what makes it look like, he stops... the only thing that the previous poster even helped with). Instead do DIN hit an edge after 2 iterations of the clock 20-tick. Think of it as 2 iterations of high: 2 small iterations. It will take more external logic of the case structure that holds DIN, not a parallel loop. You do like this because in parallel while loops can get out of sync for various reasons. You start start the clock speed, by changing the options of the arbitration, put the logic in a business structure that exceeds your loop timer. All (you) are bad for the digital protocols.

    Ultimately, the best way is to use a single cycle timed loop with a case structure (i.e. SCTL state-machine) for logic like that. The end of this white paper introduces the concept: http://www.ni.com/white-paper/5385/en and the other in the series goes in depth http://www.ni.com/white-paper/5411/en

  • global variable functional to read and write data from and to the parallel loops

    Hello!

    Here is the following situation: I have 3 parallel while loops. I have the fire at the same time. The first loop reads the data from GPIB instruments. Second readers PID powered analog output card (software waveform static timed, cc. Update 3 seconds interval) with DAQmx features. The third argument stores the data in the case of certain conditions to the PDM file.

    I create a functional global variable (FGV) with write and read options containing the measured data (30 double CC in cluster). So when I get a new reading of the GPIB loop, I put the new values in the FGV.

    In parallel loops, I read the FGV when necessary. I know that, I just create a race condition, because when one of the loops reads or writes data in the FGV, no other loops can access, while they hold their race until the loop of winner completed his reading or writing on it.

    In my case, it is not a problem of losing data measured, and also a few short drapes in some loops are okey. (data measured, including the temperature values, used in the loop of PID and the loop to save file, the system also has constants for a significant period, is not a problem if the PID loop reads sometimes on values previous to the FGV in case if he won the race)

    What is a "barbarian way" to make such a code? (later, I want to give a good GUI to my code, so probably I would have to use some sort of event management,...)

    If you recommend something more elegant, please give me some links where I can learn more.

    I started to read and learn to try to expand my little knowledge in LabView, but to me, it seems I can find examples really pro and documents (http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/ , http://forums.ni.com/t5/LabVIEW/Community-Nugget-2009-03-13-An-Event-based-messageing-framework/m-p/... ) and really simple, but not in the "middle range". This forum and other sources of NEITHER are really good, but I want to swim in a huge "info-ocean", without guidance...

    I'm after course 1 Core and Core 2, do you know that some free educational material that is based on these? (to say something 'intermediary'...)

    Thank you very much!

    I would use queues instead of a FGV in this particular case.

    A driving force that would provide a signal saying that the data is ready, you can change your FGV readme...  And maybe have an array of clusters to hold values more waiting to be read, etc...  Things get complicated...

    A queue however will do nicely.  You may have an understanding of producer/consumer.  You will need to do maybe not this 3rd loop.  If install you a state machine, which has (among other States): wait for the data (that is where the queue is read), writing to a file, disk PID.

    Your state of inactivity would be the "waiting for data".

    The PID is dependent on the data?  Otherwise it must operate its own, and Yes, you may have a loop for it.  Should run at a different rate from the loop reading data, you may have a different queue or other means for transmitting data to this loop.

    Another tip would be to define the State of PID as the default state and check for new data at regular intervals, thus reducing to 2 loops (producer / consumer).  The new data would be shared on the wires using a shift register.

    There are many tricks.  However, I would not recommend using a basic FGV as your solution.  An Action Engine, would be okay if it includes a mechanism to flag what data has been read (ie index, etc) or once the data has been read, it is deleted from the AE. 

    There are many ways to implement a solution, you just have to pick the right one that will avoid loosing data.

  • How to stop the 2 parallel loops

    Hi all

    I have a vi (see attached example) that can be closed in 2 ways:

    (1) user has pressed a button 'Quit' (with a LATCH action) on the GUI.

    (2) the user tries to close the cover by pressing the Red "X" in the upper right.

    The vi contains 2 parallel loops: a main loop that contains the actual code and a 2nd loop containing a stop of vi events.

    The problem is, while the "narrow Panel?" event works very well and finished the 2 loops, isn't the event "value change.

    Then, when I press the button Exit the vi does not stop.

    Any good idea how should I apply it?

    From my experience, a ValueChange event is not raised when you write to a local variable.  I see two quick options:

    You could write the value by using the Value property node (Signaling) (which raises the ValueChange event).

    Or you could simplify things a bit and just use a local variable.  I prefer this option.  See attachment.

  • Why build on average has side effects on the parallel loop

    It is a simple parallel loop to process the average value of each waveform.

    When you use tools-> profile-> find parallelizable loops, it is said:

    This loop For may or may not be safe to parallelize. Warning (s):
    -One or more nodes in the loop For can have side effects.

    So, why? It is not reentrant?

    The average function calls an internal function of NOR, which may (or may not / be reentrant.)  You can always code to the top of your own average code fairly easily and could make it reentrant - that would probably solve your problem.

    Bob Schor

  • For parallel loops run on hearts of dedicated processors?

    I don't think that this is the case; My confusion is due to the fact that the literature regarding this structure addresses using the maximum number of cores the computer in which this codemay run in the dialog box for parallelism but also loop iteration using the CPU Information function to determine the number of instances to parallelize. I suspect that parallel loops For will first of all be decomposed into Tufts/tasks of iteration which will be either in versatile collaboration & and/or multithreaded in a system of priority of execution before they ever get to be mapped to hearts dedicated instance. Is this correct? -literature, I want to talk about is Improving Performance with loops parallel http://zone.ni.com/devzone/cda/tut/p/id/9393, under the guidance of Performance or the help of LabVIEW (multiprocessing and Hyperthreading in LabVIEW). I don't see how this information applies to how the loop bodies parallelized and executed. I hope someone can enlighten me and perhaps others to read these documents.

    Thank you!

    jorgeinSD, thanks for the insightful question. Your second option is correct. Each instance of a parallel loop is in a different bouquet and schedules of delivery system of these Tufts between the available threads. LabVIEW does not bind son to cores for the parallel loop, so threads can switch between the nuclei they run.

    Mary Fletcher

    Software engineer

    LabVIEW R & D

  • What happens when you specify multiple iterations of the parallel loop that you have processors?

    I have an app that does the same things together up to 10 times for different material resources. For example, I have a list of 10 COM ports I want to send orders series. I want that they be executed as close to synchronous as possible, but up to 200 ms sync would be acceptable. Currently, I use a loop set up to 10 parallel iterations and assume that LabVIEW will juggle processors according to the needs, the iterations run it as simultaneously as possible. Experimentally, LabVIEW indeed seems to create 10 parallel loops, even when running on a computer with only 4 logical processors, otherwise you go 10-element inside the loop would only be not able to complete, right?

    My question is, I'm doing something verboten with my number of iterations of the loop? According to the help of LabVIEW for loop iteration parallelism dialog box: "If you plan to distribute the VI on multiple computers, set number of instances of parallel loop generated equal to the maximum number of logical processors, you wait for one of these computers contain never.» Clearly I'm violating this opinion and yet it seems to work. My performance will essentially be the same as if I had 10 blocks of code in parallel on the block diagram?

    "Reading'how many Threads don't LabVIEW allocates?" links to this page, it seems that, at worst, LabVIEW is hungry for thread and switching of threads between iterations, but my short demand slowing down enough to accommodate this suboptimal situation. At best, LabVIEW has allocated 4 threads per the enforcement system, so as long as I have at least 3 processors, there are at least more son than the parallelized loop iterations. It's all a bit confusing.

    RnDMonkey wrote:

    I have an app that does the same things together up to 10 times for different material resources. For example, I have a list of 10 COM ports I want to send orders series. I want that they be executed as close to synchronous as possible, but up to 200 ms sync would be acceptable. Currently, I use a loop set up to 10 parallel iterations and assume that LabVIEW will juggle processors according to the needs, the iterations run it as simultaneously as possible. Experimentally, LabVIEW indeed seems to create 10 parallel loops, even when running on a computer with only 4 logical processors, otherwise you go 10-element inside the loop would only be not able to complete, right?

    My question is, I'm doing something verboten with my number of iterations of the loop? According to the help of LabVIEW for loop iteration parallelism dialog box: "If you plan to distribute the VI on multiple computers, set number of instances of parallel loop generated equal to the maximum number of logical processors, you wait for one of these computers contain never.» Clearly I'm violating this opinion and yet it seems to work. My performance will essentially be the same as if I had 10 blocks of code in parallel on the block diagram?

    "Reading'how many Threads don't LabVIEW allocates?" links to this page, it seems that, at worst, LabVIEW is hungry for thread and switching of threads between iterations, but my short demand slowing down enough to accommodate this suboptimal situation. At best, LabVIEW has allocated 4 threads per the enforcement system, so as long as I have at least 3 processors, there are at least more son than the parallelized loop iterations. It's all a bit confusing.

    In this case (where you're interacting with the external hardware and have an appointment) there will be a delay of inheirant at each iteration.  THUS, "Oversubscibing" or by allowing the parallel proceedings as logical processors, actually improves performance by running another period of waiting during the iteration.  In fact, you're not "Violate the advice" of oversubscibing.  You use this technique correctly! Just may not have read about this.  See Esp PP 4

  • switch to another parallel loop loop

    For example, I'm trying to stop and restart a loop of a parallel loop, following the example below.

    What I want to achieve is the lower node to stop and restart the top loop using a notification utility.

    In the below, I can stop the loop, but cannot restart. What I am doing wrong?

    If your continuous loop, why don't you just do once check in this loop of data acquisition?  If the time expires, stop and let the outter loop everything reset.

    Another thing to know, since you are using USB, make sure that your power settings for the bus is for Windows never stop the power of USB hub.  By default, Windows has this "energy saving" together have to disable the USB hub if it isn't some activity.  Maybe that's what's causing your DAQ hang.

  • How image rotation parallel loop for?

    Dear all,

    I try to use the parallel loop to rotate an image 180 times, but by the time the cost was the same as without the parallel use of loops.

    Someone knows the reason?

    The parallel for loop looks like as below.

  • Parallel loops in a Subvi RT in real-time and not

    Hi all

    I seem to remember learning (obviously not well enough) on a cRIO (vxworks) that if there were a Subvi with two parallel loops and loop fell asleep due to a wait function the other loop also be forced to sleep as they are executed in the same thread.

    I have a 2 questions:

    (1) is this completely wrong?

    (2) is also true on a normal windows OS and if so how can I test it because I tried and couldn't seem to see this behavior?

    Kind regards

    Steve.

    Hello

    (1) is this completely wrong?

    Not completely. If you have to screw (or loops) set up as a time critical (priority) and the other goes to sleep, the entire wire goes to sleep, so also the other VI (or loop) goes to sleep. But notice that it is only when configured as critical moment!

    (2) is also true on a normal windows OS and if so how can I test it because I tried and couldn't seem to see this behavior?

    Lol if a standby under Windows, just the loop loop sleeps.

    Christian

  • How to start and stop two parallel loops?

    Hello

    I want to control two parallel loops with different timing in a vi. Second, it means that to start the loop 1, roll 2, stop 1 or 2 restart loop 1...

    But if loop 1 turns that I can't start looping two then reverse.

    Can someone help me and show what is bad in my example?

    Thank you

    Christian

    Hello Christian,.

    The reason why you can't do what you want is actually quite simple.

    You have an external loop which is 'on' the two inner loops.

    So when you stop one of the inner loops, the outer loop will still be in the same iteration until the other inner loop ends - stop the other inner loop.

    You can see very easily if you explore the outer loop iteration count - only when both loops internal, it is incerment.

    So, to do what you want, you need to make them independent - you need two external loops.

    Check my attachtment, see if that's what you need.

    Hope this helps,

    Paulo

  • How to handle errors in two parallel loops?

    Hello

    I have a loop that contains a structure of event and a second parallel loop that reads digital inputs.

    My question is:

    (a) how can I manage the errors of the various events? So, if in event1 is a mistake that event2 presented as input and can react to this topic. Currently, all events begin with "no error".

    (b) what can I do with the second loop? It is also always startin "without error" and doesn't know anything if there is a mistake in loop1.

    Is this only possible with a global variable?

    Thx for the help

    Create a user-defined event gets triggered whenever an error occurs. The input data to the event must be a cluster of error within another cluster - you'll see why when you go to use it.

    Now create a Subvi when it is called with its cluster of input error indicating an error, it raises the event you created above, otherwise, it does nothing. Install the Subvi in two loops after everything else.

    Register for the user on the structure of your event event and put what you want to happen when an error occurs in its event handler. Probibly should give you the option of quiting. If an error occurs in each loop the same evnt will be drawn and you will have the chance to stop.

    Mike...

Maybe you are looking for

  • What is elcrty402453?

    When I recently stayed in a hotel, I used wifi unsecured room. I've noticed since my computer slow and noticed "elcrty402453" was entered in my shared connections. I have never seen that before and I was wondering if someone had logged on to my compu

  • limited to 25% to 75% volume

    For some reason, I can only reduce my volume to 25%, or increase the volume to 75%. Last week worked well! Only since the latest updates.

  • Eve/Ru hezustand verhindert Faxempfang / Standby "Ruhezustand" prevents the receipt of fax

    Deutsch: Hallo Forum ICH habe einen HP Laserjet Color Pro MFP M476dw in Betrieb genommen. Nun ist das problem, dass different Kunden bemangeln, dass keine fax mehr an mich gesendet werden können. Wir haben noticed, dass die erst passiert, wenn der MF

  • How to prevent the launcher application

    Hello I want to block any application to launch. Suppose I'm clicking on a native application such as Blackberry Messenger. So I want to prevent that application to run through my code. What API should I use and how? Thanks in advance

  • HP Photosmart C6300 does support AirPrint for iPhone 4S? If yes how to set up the printer?

    I have a printer all-in-one Photosmart C6300 I want to use to print from my iPhone 4S. On the site web of Apple, I can see the HP printers that supports AirPrint and some of them are all-in-one printers. AirPrint is obvius only printing for an iPhone