What architecture for loop to hour of time timed with responsiveness front

I cannot consider this application planning.  I was originally using an Event Driven Architecture with a State Machine in queue to analyse Panel UI changes and react accordingly.  (Something like the solution found here).

Datalogging should be done in its own loop with the data passed by a queue.

If you want, you can have multiple queues and several loops of consumer.

Tags: NI Software

Similar Questions

  • What architecture for my application?

    Hello!

    For my test bench, I developed the LabVIEW software. In the last months, I asked several questions in this forum, but always about the details of my application. Until now, I never really questioned the general architecture (which is certainly a mistake, that I want to learn).

    What drives this desire to review my work, it's that I am currently not able to interrupt the complete progam or subfeatures of controlled prematurely or if errors occur.

    I hope you could give me some suggestions which would fit my application better. I'm not really experienced in structured programming, use for example architectures producer/consumer etc and I'll read up on them, but first I need a general boost in the right direction.

    First a brief overview of my hard - and software:

    HW:

    • 3 different controllers control of actuators
    • 2 different cameras

    SW:

    • Front for the interaction with the user
    • Several measurement routines that use different combinations of actuators and cameras. For example "move to position 1 and take a picture, then move on to position 2, etc.. These routines can be quite long, including the analysis of the images and decisions based on the results. These routines must sit in event of an event structure that in turn lies in my main program (the program of the façade).
    • Void / screw (lowest level in my software) who send the actual orders for controllers, for example 'move', 'read the current position' etc. These Sub VIs are separated from my Panel VI and consist of structures events themselves, an event for every basic function. These event structures are controlled from the front panel via the dynamic user events. So basically a push of button on the remote.

    Finally a very brief example of workflow in my software:

    1. Façade is started. Along the SubVIs for controllers are also started
    2. Lance user measure routine N1 with a button
    3. Start of the event in the front panel. In this case, other events are generated sequentally, according to the algorithm of measure.
    4. These remote events live Sub point 1, for example remote press the buttons for the basic functions in the desired order (move, take photo etc.).

    Problem is that the user cannot terminate measurement routines before they are completed, because the program is locked up in the case of corresponding event.

    In addition, when a controller reports an error (e.g., loss of power), as routine orders keep coming which results in more errors.

    This should be possible with my new architecture:

    • The user in the front panel (as before)
    • Premature termination of all auxiliary program if the user wants or if the error occurs. Then a defined State must be entered (including closure of all references, power off all devices, etc.)

    I'm not at work right now, but I'll upload some screenshots later because let's face it – which was a wall of text

    But maybe it's enough for a few first thoughts of you?

    Thank you!

    I tend to like to have HAL - so I tend to create a module that is designed just to communicate with the instrument and then my main loop of the program (e.g. routine measurement / logic program) interact with that and sends updates to the user interface. This is because if I want to use this material in another application, I can re - use the 'module '. It's perfectly OK to have your material combined with your message loop - loop, but if it takes a long time to read the data of the instrument, your application would be not as sensitive to the façade events (because it must wait to finish first).

    So, you could have:
    -UI event loop
    -The main Message loop (responds to user interface events and your program 'flow')
    -Hardware Loop (to initialize and communicate with the instrument)

  • The scaner of safety program run for almost two hours and did not have detected what regardless of whether what is this microsoft scan?

    Operating system: Microsofti¿½ Windows Vista? Home (it shows that I have this Setup on my computer)

    My computer is corrupt the scaner microsoft run for almost two hours and did not find anyting.

    I have siscis Trojan, Skype worm PEKSE aver 1300 errors discovered by the other's signed starup program...

    Port 80 and 123 corrupt... I'm on hollow connection DSL my modem wireless (and connected to some infrastructure 5 GHz) and 2.4 Ghz wireless where I search I'm somehow hacked via the wireless I guess...

    Any program which tells you that you have 1300 errors is almost certainly a scam.

    Try to scan with Malwarebytes free

    http://www.Malwarebytes.org/products/malwarebytes_free

  • What is the problem in this code for loop? Help, please

    I have 9 text boxes Dynamics txt1, txt2, txt3... txt9 and I want to track the number of these dynamic text boxes that contain text only

    var i: Number;
    for (i = 0; i < 10; i ++) {}
    If (cela ['txt' + i] .length > 0)

    trace (i);
    }

    This code shows the numbers from 1 to 9 If the text boxes contained a text or not, how can I do find only filled? Thank you

    You can have a lot of problems using the variable of the textfield object and there is no advantage to using it.

    But if you choose to ignore this advice, you must ensure that your textfields and not html enabled, are not multi-line, and did not apply kerning.

    It is for beginners.  If this is ok with you, you can use:

    var nonEmptyTFNum:Number = 0;

    for (var i: Number = 1; i<>

    {If (cela ["txt" + i]! = undefined & {this ["txt" + i] .length > 0})}

    nonEmptyTFNum ++;

    }

    }

    trace (nonEmptyTFNum);

  • For loop within a while loop

    I have for loop within a while loop... admission to the for loop N comes from the VI selection... the while loop I a condition essentially statement it stops just after to finish all the iteration in loop...

    Entrance to the N loop is bascially driven by a local variable... that's the problem Iam having:

    When I press the Start button to run the program... regardless of the output of the select VI is gives the N of the for loop, then the loop starts and then ends in place... and when the output of the select statement takes a different value (the N of the loop for) loop not work until I restart the program again... What can I do so that the for loop runs again for another value of N, the RUN program button is enabled.

    1. clean your diagram.  Style guides suggest keep the pattern of a single screen.  With a little effort, I was able to get your DB less than 1600 x 1000 pixels.

    2 then I can see (some) it happens all at once. This thing does nothing?

    3. local variables can lead to race conditions.  Output in Angle position may be a race condition, although is probably not what you wanted to do.  What does the wired local time at the moment present terminal meter? (Ooops! Two controls with the same name - which can be quite confusing as well!)  If you need or want two components of façade having the same text, use the legends.  Make the labels is different so the comic is more readable.

    4. having more than one Dequeue function on the same queue will lead to unpredictable results.  When an item is removed, it is removed from the queue and is not accessible to any other Dequeue function.  In parallel loops, you have no way of guessing which Dequeue will seize any particular element.

    5 use Boolean reverse instead of Select with wired False to true and true cable at the entrance to false entry. Better, just make the case of forgery in the structure of the case within the for loop the real deal. No required reversal.

    6. I was not looking for to determine the logic of the code within the structure of this case. It seems I could have posted a much simpler way to do this several weeks ago.

    7. use multiply from the Digital Palette rather than a node form multiply by 4 or 1.8. Uses less space BD and is much easier to read.

    8. as has been suggested, learn how to work the machine architecture and the State of producer/consumer.  They can make your life much easier.  Do not try to convert immediately to these models.   It's too much bite to at some point.  Learn how they work first.  Make a few simple examples.  Then rewrite this program in this format.  Probably faster than fixing what you have now.

    Lynn

  • parallel for loops does not

    Hello.

    I'm learning the multi - thread programming. To start, I use "parallel for loops" and I was surprised that it does not work. One - thread loop work a few times faster (depending on settings) that multi - thread. I don't know why, and it is my request to correct my Vi to work properly.

    Lenovo, G580, Windows 7, 64-bit computer

    Intel Core i7 3632QM
    Ivy Bridge
    Specification Intel (r) Core i7-3632QM CPU @ 2.20 GHz
    Package (platform ID) Socket 988 B rPGA (0x4)
    Number of hearts 4
    Number of threads 8

    LabView 2011.

    Altenbach says:

    Gibbon wrote:

    What was 'strange' behavior?  In "linia dluga" when inside the loop is on '1' of the "spreed up' between one and multi-fil is about 3 times, when I put it in '20' this grow to 6.2. It was strange form me, becourse I expect a similar value.

    A parallel FOR loop has an overhead for parallelization (split the problem, then go back the results, etc.). If the code is very fast, the overhead is proportionally larger. If the Subvi takes a long time to complete, the overhead of parallelization is insignificant. It is often not worthwhile to parallelize the loops with a very simple and fast code.

    Gibbon wrote:

    Altenbach - I have another question if you can help me - how did you "seconds relative high resolution." VI "? -I want to say how did you know that there is this 'vi '. And thanks a lot for your modyfications.

    You can find it in vi.lib\utilities. It is well known.

    Maybe not well known enough!  the 'Hidden gems' package adds to your palattes.  It has also been considered by a nugget of the community

  • Maintain a solenoid open for a certain period of time

    Hello

    I have a NI 9472 with a solenoid attached. I developed a simple vi to operate the solenoid valve (normally closed) when a preset pressure (i.e. pressure) is reached, that is, the valve opens when the pressure exceeds the set value and closes when it falls below the set value.  However, what I really want the vi to do is open the tap for a certain period of time (say 1 dry), so that the built-up pressure may be entirely liberated before the tap is closed, so pressure is composed from zero again and the cycle repeats. I have read some threads already, but I haveen can't has found an answer that works for my application. Please check and looking forward for your help!

    Try this... Make sure you put a wait function in your loop, otherwise you use 100% of your CPU

  • Timing of a FOR loop

    Hello

    What is the best way to the period in which runs a loop FOR.

    I have a piece of code in a loop FOR and he runs 500 times. What is the best way to make the duraction of execution of time?

    Thank you

    Nevica

    Attached is a small example as described.

    Synchronization using probes helps as well.  Usually survey you a thread of error to start the timer, then another thread of the error of the probe and probe calculates the time difference between them.

  • FOR loop does not update the local Variable

    I am newer to labview, and I can't wrap the head around why not a habit of local variable to update in the code if it updates on the dashboard. Anything im missing?

    Assume that you are talking about the local variable of the 'State of the cell. The terminal updates every 500ms in the small top loop, the local variable indicates simply that the indicator and thus updates also.

    The problem is "dataflow" and you need to familiarize yourself with the concept!

    Once the while loop starts, the local variable is reading and inside the loop begins. Most likely, the local variable is read before it is updated in the small loop, so most likely returns the value of a fade on the first iteration of the while loop. Now the small loop continues to go twice per second for about five seconds. Only after the loop FOR (and everything else inside the while loop) completed, the while loop will go to the next iteration, date on which the local variable is read once more, this time with the last value of the last for loop iteration of the previous iteration of the while loop.

    In summary, the local variable updates very well, it's just that the code does not read the new value around most of the time.

    Your VI is full also potential competition conditions caused by the over-use of the local variable. You need to respect the proper execution order by eliminating local variables.

    So what is the solution? Hard to say without knowing what the VI is supposed to do. Most likely, you will need to remove the inside OF the loop and use it outside while loop for everything.

  • Notifier - for loop

    Hello

    I do a parallel program, so I need to use a notifier to tell this process that was an event.

    For convenience, I'm building a simple program.

    I have a loop FOR who travels to 1000 times. I need that every iteration is executed once a loan (OK) is pressed, the button is pressed and if it does not need to wait. Also, I need to have a STOP button if you press on at any time, stop the program.

    I built one Notifier while structure to make the wait until ready is key and structure of the EVENT to question LOANS and STOP buttons.

    can you tell me what I am doing wrong?


  • for loop in while loop

    To all,

    I have a question, I have a loop within a while loop. The loop runs and displays the log data. It seems that, until I have stop the while loop that log data display. It almost seems that the for loop runs until the while loop is stop.

    The following accessory is an example of what I have in my code. But the because the loop runs in this example. My code is the same idea, but the loop seems to run when I start my program with execution of climax. Otherwise, it runs once I left the while loop.

    All entries?

    Thank you

    Cosmica

    I tried your VI and there is nothing wrong the way in which it executes. Nothing happens until the second tab is selected and you press the 'off' button, date on which the loop FOR runs until the indicator shows a "9". In subsequent runs, again, it count up to nine, but it is so fast that you never see. For the observer, the indicator remains at nine.

    Of course you would see things a little bit better if you place the small waiting inside various parts of loops. At present, the VI consumes all CPU do nothing but turn empty loops for always while spending from time to time some nanosecods to iterate through the loop FOR. You also destroy your resource VISA with tunnels of default output, so the fence at the end probably will fail. Overall, the code seems too complicated for what you want to do. Do you really need to link a case control tab structure? Seems unnecessary. The for loop should run when the button is pressed, since this implies automatically that Your ' e on the second tab, you don't need to read the tab control. It's redundant!

  • How to create parallel tasks using parallel for loops

    Hello

    I'm going to put in place a program that communicates with the six logical controllers and must read the status of the system every 100 Ms. we use OPC datasockets for this, and they appear a bit slow.

    I created a uniform method of comm. for all controllers, and now I find myself this method of programming six times to communicate with each system. I was wondering if it could be done more elegant using the parallel for loop, in which case I program an Exchange once and then six workers running simultaneously. Since a picture is clearer than a thousand words, what I'm asking is:

    Is it possible to replace something like

    by

    and that for performing these tasks in parallel loop (on different cores / in different threads)?

    I have configured the loop to create instances of the 8 to the compilation, so I would 2 surplus available when running instances if I find that I need an additional system.

    The benefits of the Show method in the second photo for me are:

    * takes less space

    * changes need be made only once

    * less blocks, son and other things makes it clearer what is happening.

    * flexibility of the actual number of tasks running (8 available runtime instances)

    * If multiple tasks are necessary, I need only update the maximum number of instances and recompile, i.e. no cutting and pasting necessary.

    Unfortunately, I don't have these available system yet, so there is no way to test this. Yet, I would like to know if the above works as I hope - unfortunately the help of labview is not quite clear to me on that.

    Best regards

    Frans

    Frans, the parallel for loop will work as expected in this situation. The six tasks will run simultaneously in different threads. What part of the aid could be made clearer?

  • executes a select statement, each minute for half an hour

    Hi all

    I want to run a SELECT statement on a table every minute for half an hour.

    Something like this:

    Begin

    Do all the 1 minute for 30 Min

    Select col1, col2 from mytable

    End

    I thought about PL/SQL loop. But no matter what example with timekeeping.

    I don't care?

    Thank you and best regards.

    Hello

    As John said, you can use DBMS_SCHEDULER for this. That being said, you just can't run a query and do nothing with its result. You must do something with it.

    Here is an example showing how to create a task that runs every minute for a total of 30 min

    BEGIN

    DBMS_SCHEDULER. Create_Job (job_name-online 'MY_JOB',

    job_type-online "PLSQL_BLOCK."

    job_action => ' DECLARE val1 number; val2 number; BEGIN SELECT 1, 2 INTO val1, val2 FROM DUAL; END;',

    start_date => SYSDATE,

    End_date => SYSDATE + 30 /(24*60),

    repeat_interval => ' FREQ = MINUTELY ",

    auto_drop => TRUE,

    enabled-TRUE online

    );

    END;

    /

    It will start immediately and end 30 minutes later (it will be automatically abandoned). As you can see, the result of the query is placed in the variables. Thus, this work is useless.

  • File modified date and time compare with 24 hours of return.

    Hi all

    I want to check the 1 day before the processed files, (for example, the user running the tool time and check 24 hours return).

    I tried the JS code below, please check and guide me.

    var myFolder = File("~/Desktop");
    var myFiles = (myFolder.getFiles("*.eps"));
    for(i=0; i<myFiles.length; i++){
        var myFile = myFiles[i];
        var myFileDate = myFile.modified;
        var myCurDate = new Date();
        alert(DateCheck(myFileDate, myCurDate, myFile));
        }//for loop
    
    function DateCheck(DtVal1, DtVal2){
        var DtDiff;
        Date1 = new Date(DtVal1);
        Date2 = new Date(DtVal2);
        DaysDiff = Math.floor((Date1.getTime() - Date2.getTime())/(1000*60*60*24));
        if(DtDiff < 0){
        alert(myFile)
        return true;
        }
        else
        return false;
        }
    
    

    Thanks in advance.

    small update...

    var myFolder = File("~/Desktop");
    var myFiles = (myFolder.getFiles("*.pdf"));
    for(i=0; i		   
  • nested for loop in the collection

    Hi Experts,

    Collection1

    ============

    SELECT o.object_id

    LOOSE COLLECTION l_obj_info

    FROM (SELECT n.node_id, n.object_id

    N nodes

    START WITH n.node_id = 100

    N.node_id CONNECT BY PRIOR = n.parent_node_id) n

    JOIN IN-HOUSE

    objects o ON o.object_id = n.object_id

    WHERE o.object_type_id = 285;

    s Collection2

    ============

    SELECT *.

    LOOSE COLLECTION l_tab

    OF ((SELECT REGEXP_SUBSTR (i_l_text, "[^,] +', 1, NIVEAU)))

    OF THE DOUBLE

    CONNECT BY REGEXP_SUBSTR (i_l_text, "[^,] +', 1, LEVEL") IS NOT NULL));

    END;

    collection3

    ============

    SELECT o.object_id

    LOOSE COLLECTION l_fin_tab

    Of objects o JOIN ATTRIBUTES att

    ON o.object_id = att.object_id

    WHERE o.object_id = collection1.object_id

    - AND att. VALUE = collection2.val;

    Please tell me how to implement for loop in the collection3 to get the values of collection1 and s collection2.

    I tried in the way below

    CREATE or REPLACE TYPE LIST_OF_ATTRIBUTES_TYPE AS TABLE OF THE varchar2 (4000);

    /

    CREATE or REPLACE TYPE LIST_OF_OBJECT_IDS_TYPE AS TABLE OF THE number (9);

    /

    (F_get_objects_by_type_id) CREATE or REPLACE FUNCTION

    i_object_type_id in NUMBERS

    i_l_text IN VARCHAR2,

    i_scope_node_id NUMBER

    )

    RETURN list_of_object_ids_type

    AS

    CURSOR objs_info

    IS

    SELECT o.object_id

    FROM (SELECT n.node_id, n.object_id

    N nodes

    START WITH n.node_id = i_scope_node_id

    N.node_id CONNECT BY PRIOR = n.parent_node_id) n

    JOIN IN-HOUSE

    objects o ON o.object_id = n.object_id

    WHERE o.object_type_id = i_object_type_id;

    l_tab list_of_attributes_type: = list_of_attributes_type ();

    -l_obj_info list_of_object_ids_type: = list_of_object_ids_type ();

    l_fin_tab list_of_object_ids_type: = list_of_object_ids_type ();

    BEGIN

    BEGIN

    SELECT *.

    LOOSE COLLECTION l_tab

    OF ((SELECT trREGEXP_SUBSTR (i_l_text, "[^,] +', 1, NIVEAU)))

    OF THE DOUBLE

    CONNECT BY REGEXP_SUBSTR (i_l_text, "[^,] +', 1, LEVEL") IS NOT NULL));

    END;

    IF l_tab. COUNT > 0

    THEN

    BECAUSE me IN objs_info

    LOOP

    FOR j IN l_tab. FIRST... l_tab. LAST

    LOOP

    SELECT o.object_id

    LOOSE COLLECTION l_fin_tab

    O JOIN ATTRIBUTES att OBJECTS ON o.object_id =

    att.object_id

    WHERE

    att. VALUE = l_tab (j) and o.object_id = objs_info (i);

    END LOOP;

    END LOOP;

    END IF;

    RETURN l_fin_tab;

    END f_get_objects_by_type_id;

    /

    What this different problem from that of pls 00382 expression is incorrect, as they were returning a record type ?

    Please do not raise the same question several times. The answer is always the same. Your data model is seriously wrong - and that's the reason why you can't get data from it.

Maybe you are looking for

  • Need driver more recent card ATI Radeon 3650 - Satellite Pro A300-1NT

    Hi all I'm looking for the latest drivers for ATI Radeon HD 3650 onboard Satellite Pro A300-1NT.During the game, Transformers: Revenge of the Fallen game (2009) by Beenox Inc.... I get squares pixelated on the screen (instead of dust) and possibly a

  • LaserJet M1217

    Hi guys,. I have a HP Laserjet M1217 MFP nfw. I only seem to be able to order black toner cartridges. I can't order color?

  • Why my icons are doubling on my screen? Why I can't delet from a set of icons?

    each icon on my desk is doubled.  Why every thing is doubly? And why can't I delete the extra set of icons?

  • How to recover Windows Defender

    Remember - this is a public forum so never post private information such as numbers of mail or telephone! Ideas: You have problems with programs Error messages Recent changes to your computer What you have already tried to solve the problem By mistak

  • 1163w network printer problem

    So, my first post, Hello! I have a 1163w printer that works fine - except that it times out and decreases the network.  I have to physically restart the printer to run loose employment, which somewhat defeats the purpose of a wireless printer.  I wen