Executing several StateDiagram VIs in Parallel

Hello,
I have searched and read up on the topic until mye eyes go red.
I have the following scenario: I have several (5 to be exact) StateDiagram Processes that I need to execute in Parallel.  Each StateDiagram is created using the StateDiagram Toolkit and reside in its own VI.
For the sake of structure and reuse, I do not want to break up this structure!
I have a cFP 2120 and I have the VI's executing in Parallel using High Priority for each VI. So what's the problem?
The problem is to ensure deterministic response times. I need about 5 ms response time; it's not a fast system.
Each VI is running its own loop that never ends. I have a 5 ms wait in the loop in each VI.
I cannot set Time Critical Priority to each of these loops, as the RTOS do not do any Round Robin among Time Critical Priority VIs even though they relinquish prosessing time by calling Wait. (see: http://forums.ni.com/ni/board/message?board.id=170&message.id=62696&requireLogin=False)
If I set High Priority to each VI, the code seems to run fine, but I have not measured any Response Times yet.
The goal of the whole project is to write Control Systems in a more structured way, which I feel I have managed. But will the Priority system of the Phar Lap (RTOS)
Unfortunately I do not find any articles on how to structure code and at the same time achieve deterministic response times. And I mean deterministic within 5 msec!
Please , I am not prepared to throw all code into one Time Critical Priority loop, as this tears down the structure I have been working hard to develop.
What is the general way to do this?
Can I expect very long response times due to other High Priority System tasks run by the RTOS?
Geir Ove

Hello Robert,
I cannot tell you how much I appreciate your answer and the fact that you are doing what I am doing :-)
It is very late in Norway now, and I am tired. I am sitting here running a test that I wrote where I measure the "determinism" of the system using 6 parallel processes:
- Process 1 Pulse DO-0 high for 100 msec, then go low for 1500 msec: DO-0 is hooked up to DI-0 (High Prior)
- Process 2 reads DI-0 and writes its value to DO-1 in a loop that pauses for 5 msec. (High Prior)
- The 4 other processes do similar stuff with other channels, but are only there to pose more load on the system (High Prior)
- I also have a communication process that using Shared Variables communicate som status to the Host every 500 msec. (Normal Prior)
I measure the time delay from DO-0 Hight to DO-1 High. I subtract these two signals on my Digital Yokogawa DL 1620 scope and ask it to calculate max, min and stdv of the signal: So far it says 12.46 min and 12.55 max so the jitter is small.
I am currenty using "Wait until next MS" and set up the timings so that everything tries to rund at the same time. This gives more consistent timings it turns out.
I tried to use just Wait which would tend to scatter the run of each process out over the cycle time: This however effectively "locked out" communication process and also caused much more jitter: from 6.5 msec to 10 msec.
I will let the test run tonight and continue testing tomorrow. Will keep you updated.
Would also appreciate if an NI Engineer could comment on this !
Geir Ove

Similar Messages

  • Select one of several FPGA VIs at runtime under RT program control

    I need a CRIO RT controller to select one of several FPGA VIs (or bitfiles) at runtime based on an operating mode parameter.
    The application requires the FPGA to acquire and process data using several different techniques based on a user supplied mode parameter.  Each individual technique will fit into the FPGA, but there is not enough room to fit all of the techniques into the FPGA at the same time.  Therefore, I need a way to programmatically select one of the FPGA VIs or bitfiles at runtime.  The processed data is transferred to the RT through a common DMA FIFO, and all controls and I/O can be the same for each of the VIs.
    I tried using a Case Structure on the RT to select the appropriate Open FPGA VI Reference call based on the current operating mode.  When I wired the RefNum output from each case to the common output tunnel, I got an error stating that the RefNums were of different types.
    I then tried binding the Open FPGA VI Reference calls to TypeDef or StrictTypeDef controls.  In both cases there was an error stating that some of the Open FPGA VI Reference calls were bound to a TypeDef control which had changed.
    Is it possible to select an FPGA VI or bitfile at runtime?
    If not, is there a way to force the FPGA compiler to layout multiple VIs with the same interface structure so that the RT VI doesn't care which version is running?
    If not, any suggestions short of duplicating the entire RT VI for each FPGA instance?
    Thanks!

    JohnZ wrote:
    Is it possible to select an FPGA VI or bitfile at runtime?
    Yes, using the FPGA Open VI Reference function as you are already doing, but you need a separate Open FPGA VI reference for each version of the FPGA VI or bitstream.
    If not, is there a way to force the FPGA compiler to layout multiple VIs with the same interface structure so that the RT VI doesn't care which version is running?
    No, the FPGA VI reference for each FPGA VI will be unique due to information about the interface and VI that is stored as part of the reference. If you are not using DMA in the FPGA VI, then you can use the Upcast function to convert the FPGA Reference into a more generic form which can be used interchangably with other FPGA references that have the same front panel configuration.
    If not, any suggestions short of duplicating the entire RT VI for each FPGA instance?
    Unfortunately no.
    Christian Loew, CLA
    Principal Systems Engineer, National Instruments
    Please tip your answer providers with kudos.
    Any attached Code is provided As Is. It has not been tested or validated as a product, for use in a deployed application or system,
    or for use in hazardous environments. You assume all risks for use of the Code and use of the Code is subject
    to the Sample Code License Terms which can be found at: http://ni.com/samplecodelicense

  • How should I share a cluster across several sub .vis? Best practices? Current problems...

    I'm trying to share a cluster across several sub .vis.  I've written a save / load settings function that basically stores these settings in a static variable (full .vi attached):
    Questions: 
      1. Is this an appropriate practice?  (using a sub vi to share data)
      2. My program settings appear to be lost occasionally and reset to their default values.  This bug is rare, and it's hard to see what's causing it.  Could this be caused by my "save / load settings"?  Would this .vi result in race conditions or something weird if I use it in many places (and sub vis)?  I've disabled reentrant execution.  
    The "save / load settings" vi above uses a sub vi to initially read the settings from a binary file and save them each time they are changed (saved).  I initialize the "save / load settings" by loading the settings from text the first time this function is called.  
    Thanks!
    Attachments:
    Save and Load Settings.vi ‏82 KB
    Save and Load Binary File.vi ‏62 KB

    What you are doing is generally called a LabVIEW 2 Style Global or an Action Engine. It is a valid way to store data for use across subVIs. Rather than use first call why not have a specific action to initialize the data? The code is a bit more readable. Though you can use first call as you have.
    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

  • Using several Sun Java Versions parallel

    I want to use several Sun Java Version parallel - is this possible and if yes how can I set this. I want to use for one program / or one website (like www.0815.com) the version 1.4.2_06 and for an other program / or website (like www.sample.com) the version 1.3.2_06 ?
    The problem is that we are using a terminal server application (3rd party) what is running better with the 1.3.2_06 and we are using an web based software which must use the 1.4.2_06 - I only know how I set one of this as an standard but not using one for this and another for this.
    thanks for your help
    c3po
    thanks for your help
    c3po

    ...just a joke...
    thanks for your help
    c3poWhy do you write that two times ?
    Why do you write that two times ?

  • Making executable files from vis

    Hi,
    I am trying to make an executable file from vis. I have four subvis inside a main vi. Four booleans opens up my each individual subvis. Now when I make an executable,its works withoiut an error. Now when I run the program, my main vi opens up with four boolean. Now two of the boolean works perfect but the other two gives the window error. Can someone help me in this regard. I dont see why the two booleans would give me error. What could be the possible cause?
    Thanks
    SAL

    Have you installed the patches for LabVIEW 6.0? The latest patch is LabVIEW 6.0.2 and is available free for download from here. You should definitely have the latested patch installed.
    Also, can you check your Application Builder settings to make sure that the front panels for your 2 subVIs that cause the crash aren't being removed? LabVIEW 6.0 would sometimes mistakenly remove the panel, which would of course cause the crash if you tried to call the subVI and view its front panel. Also, VIs that Property Nodes or Invoke Nodes shouldn't have their front panels removed, since these rely on front panel data.
    You can check these settings from the VI Settings tab of the Application Builder as seen below:
    To modify these settings, click the Edit Build Settings button to see the following dialog:
     Message Edited by Jarrod S. on 03-22-2006 02:37 PM
    Jarrod S.
    National Instruments
    Attachments:
    RemovePanelSettings.JPG ‏52 KB
    ChangeRemovePanelSettings.JPG ‏53 KB

  • How do I run two sub-VIs in parallel and have the faster VI continue to execute while the slower one completes?

    I have two sub-VI's - one that makes a laser distance measuring device turn on and return a distance, and another that moves a platform upon which a target is mounted that the laser reflects against. The laser VI takes well under 5 seconds to complet. The platform-moving VI, on the other hand, requires about 30 second. I would like to be able to have the laser on AS the platform moves. Of course, I can accomplish this by running the VIs seperately. However, I would like to control them from a master VI. Currently, the laser turns on as the platform begins to move but then turns off, since the master VI waits on the platform-moving VI to
    complete. Any help with this seemingly simple dilemma would be greatly appreciated.

    In order to synchronize the two VI's I would recommend using a global variable. By creating a global boolean, you can make reference to it in both programs, and control when your "laser" subVI terminates.
    Basically, have your "laser" subVI wait until the global boolean goes true to stop execution. Have the boolean initialized false, and then have your "platform" subVI write a true to the global boolean when it has finished running. This will keep you laser running until the platform has completed its move. Good luck!

  • Problem when executing the same subVI in parallel.

    Hey!
    I have created a subVI that I am using in two applications that executes in parallel. For some reason the applications is using the same instance of the subVI, which creates conflicts when the applications are trying to use the same subVI at the same time. Is it possible to solve this problem?
    /Jakob

    Open the SubVI and go to File>>VI Properties. Select Execution and check "Make VI reentrant". This should solve your problem. You should read more about reentant VIs and how they work in the site. They have different kind of uses.
    Try to take over the world!

  • Executables crash if VISA sessions are implemented

    I'm using LabView 6i version 6.0 on a Windows XP machine.  I have several applications I've created which run fine under LabView, but the executables I build from them all crash.  I don't get any compiler errors.  I tried to build one of the serial communications examples which came with LabView, and that exe also crashes when I attempt to run it.  This leads me to believe that the problem isn't specific to what I've written.
    I wrote a very simple piece of test code that doesn't have any VISA functions, and the exe I generate from that runs OK.  I have other executables I've built in the past that don't have any VISA code, and their executables still run OK as well.
    Any known issues with VISA and building executables with LabView 6i V6.0?
    Solved!
    Go to Solution.

    B_Harmon:
    I haven't used v6 in years, I can't recall how to include the Visa RTE.
    Below is a link to NI's ftp site for 6.0.2, I am not sure what exactly to download from there, hopefully it will help you.
    ftp://ftp.ni.com/support/labview/updates/windows/6.0.2/
    -AK2DM
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~

  • How to execute several ROUNDS in a single transformation file?

    Hi everybody,
    I've put several transformation files into one transformation file but I have the following problems:
    - when I look at the log after validating the transformation file, it only shows values for the last combination of OPTIONS / MAPPING / CONVERSION
    - when I execute the package for loading dat into the cube, it ONLY loads data for the last combination of OPTIONS / MAPPING / CONVERSION that appears in the transformation file
    The number of 'Submit record count' is always the same as the number of accepted records of the last round. And if I create a view from the target cube, it only has data for the last combination of OPTIONS / MAPPING / CONVERSION.
    What is happening? Do I must change any parameter?
    It's critical for the project as we are loading a lot of key figures and we must simplify the administration of the load process
    Thanks a lot in advance for your support,
    Albert Mas

    Hi,
    Please try (for Windows):
    Double click printer icon on desktop,
    Select Scan a Document or Photo,
    Put the first page on the glass (face down),
    Check options (size, dpi ...), and select Scan document to file,
    Click Scan - machine will scan the first page
    Remove the first page on the glass, put the second page,
    Click + (plus sign) It sits on the left hand side of a red x
    Machine will scan the second page, put 3rd page on the glass and click + again ..... to the end then click Save
    Click Done after Save
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How to execute multiple sql statements in parallel ?

    Hi There,
    I have 10 stored procedures, each one will take approximately 5 seconds to run individually.
    Now I need to combine the results of these 10 stored procedures into single result set.
    So I have created one more stored procedure "proc_AllSPs" to get the single result set.
    The procedure "proc_AllSPs" is taking one minute to run because all the procedures inside the "proc_AllSPs" are running
    one after the other and taking 5 seconds each.
    If there is any other way that all the procedures run parallelly, then the procedure "proc_AllSPs" can run in 5 seconds time.
    Sorry if I am not being elaborated.
    PLease get back to me if any piece of information is needed.
    Any kind of help is truly thankful.
    Thanks,
    SequelBug

    Could you tell me how to execute two stored procedures or two sql statements in parallel
    For eg:
    First procedure name is proc_sp1 which takes 1 minute to run
    Second procedure name is proc_sp2 which takes 1 minute to run
    I want to accomplish the below query in 1 minute by executing statement1 and statement2 parallelly.
    go
    select * from openrowswt('sqloledb','server','exec proc_sp1')    --statement1
    union
    select * from openrowset('sqloledb','server','exec proc_sp2')     --statement2
    go
    OR
    go
    Select * into #Temp1  from openrowswt('sqloledb','server','exec proc_sp1') --statement1
    select * into #Temp2 from openrowset('sqloledb','server','exec proc_sp2') --statement2
    Select * from #Temp1
    UNION ALL
    Select * from #Temp2
    go
    Thanks,
    SequelBug

  • Running two sub vis in parallel

    I need to run two sub vis of a main vi simultaneously in parallel.
    one sub vi is to run a demo and the other subvi is an application.The demo should run as a small window and the application should run in background

    As i said
    "If you have the demo vi as floating and the other vi as Default (not floating), the demo vi will allways stay on top"
    If you still have problems, just post your vis, (without any unnecessary code), or ask something specific
    Message Edited by Pnt on 04-21-2009 08:18 PM
    Attachments:
    Clipboard-2.jpg ‏44 KB

  • Several teams working in parallel in ChaRM

    Hi All,
    We have a requirement where we want to gather inputs / assign the ChaRM request to multiple teams at a time in the same status of ChaRM (for example u2013 say my CHaRM ticket is pending for effort estimate and I want to gather the inputs from development, Functional and security ticket). One of the ways we can think of is create tasks with reference to the ChaRm Change requiest / change document.
    Is there anyone who has come across this type of scenario where you need several teams to work in parallel at some particular status of ChaRM.
    Please let me know if I am not able to clarify my situation. Thanks a lot.
    Best regards,
    Vithal

    Hi Vithal,
    I'm trying to answer your question but this forum keeps saying
    "We are sorry but your message can not be posted since you have used forbidden words/phrases. Please edit your post according to the forum guidelines and re-post. " After 5 minutes of trying to reword my response, I give up. I'll send it to your email.
    regards,
    Jason

  • How to execute "gather schema stats" in parallel?

    Hi,
    I've a 11.2 Standard Edition and I need to gather stats for about 20 schemas.
    It's possible to execute with a plsql (or other) dbms_stats.gather_schema_stats in parallel?
    I want to execute 4 schema stats at time, and when one finish another one starts.
    It's possible?
    Thanks

    Mr.D. wrote:
    Hi,
    I've a 11.2 Standard Edition and I need to gather stats for about 20 schemas.
    It's possible to execute with a plsql (or other) dbms_stats.gather_schema_stats in parallel?
    I want to execute 4 schema stats at time, and one finish another one starts.
    It's possible?
    Thanks
    yes it is possible by opening 4 different   sessions
    which system resource will be saturated first?

  • Executable with Dynamic VIs

    LV 8.6.1f1
    I'm having a hard time figuring out the ALWAYS INCLUDE field under the SOURCE FILES section of the BUILD properties in my BUILD SPECIFICATION.
    My app uses "plug-ins".  You configure a channel (in my editor) as a plug-in channel, you give it a name "X".
    The code looks for "X.vi" in a certain folder, runs it once to check out if it exists, figure out its prerequisites, and gets ready to run it for real. 
    These plugins do things like compute a power channel from a speed and torque channel, or things involving chemistry.  Basically, they're fake channels, but the user can treat them just like real channels by adding alarms, graphing them live, etc.
    These plugins use certain subVIs, and control typedefs (ENUMS, mostly) that are in the main program.
    All this works fine in the development system.
    If I build the app, my config puts the app alongside the main VI's library file, and the executable works just fine.
    However, If I move the app (and the supporting folders with the plugins) to a different place (without the main source code present), I have trouble.
    Specifically, when I make a channel ACTIVE (and thus try to dynamically load it), I sometimes get an error 1003, meaning the VI is not executable (broken).
    When I flip the ACTIVE switch, I can see the LOADING dialog appear for just a tenth of a second or so. If I keep trying, I can eventually read the name of the VI it's looking for (some subVI, or control, used by the VI I'm loading).
    If I modify the build spec to include that control in the project, it doesn't change anything.  I don't really expect it to, since the main VI already knows it needs this particular control (in a lot of places besides the plug-in).
    However, if I add this control to the ALWAYS INCLUDE list, then things work just fine.
    The question is: WHY?
    I can guarantee that this control is in the EXE; it's used in a lot of places (including the editor that checks out the plugins).  I just did a search and found 807 instances of it. 
    The help for ALWAYS INCLUDE says "Specifies the dynamic VIs and support files always to include in the application, even if the startup VIs do not contain references to the files".
    I just confirmed that if i remove it from the ALWAYS INCLUDE list, it fails; if I add it back in, it succeeds.
    Maybe it has to do with paths - in the development folder, I have :
    Root\Main.llb\Main.vi                  { the main VI } 
    Root\Libraries\Units.llb\Units.ctl   {the control in question }
    Root\User\Plugins\Whatever.vi    {a plugin that uses it }
    When I build the app, it goes into the root:
    Root\Main.exe
    and everything else is the same. 
    I move the app into a testbed:
    Root\Testbed\Main.exe    {the main program } 
    Root\Testbed\User\Plugins\Whatever.vi   { a plugin }
    and there's where the failure occurs.
    So the questions are:
    1... Why is this happening?
    2... What rules do I need to follow so that it doesn't happen again?
    I don't want to just dump stuff into the ALWAYS INCLUDE bucket until I understand what's what.
    Ideas? 
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks
    Solved!
    Go to Solution.

    The control is in the exe, but if you only have your plugin vi without the control, then the vi is not executable.
    --- I don't understand what you're saying.  The control does exist in the EXE, it's used in lots of other places in the EXE.  So I was expecting the plugin to be able to find it. 
    Every vi, you want to load dynamically, has to be executable independently from the exe which calls them.
    --- That's not exactly true, specifically the "independently" part. 
    More testing with lots of these plugins has yielded the following rules for my case:
    The plugin itself does NOT have to be in the ALWAYS INCLUDE list.  That's obvious, or it wouldn't truly be a dynamic VI.
    If the plugin uses a typedef control, then that control must be in the ALWAYS INCLUDE list.  It doesn't matter if it's used in the main already, even 800+ times.  It simply has to be in the list.
    Any subVIs that the plugin calls have to either A) be already used in the main, so that they're in the EXE, or B) in  the ALWAYS INCLUDE list.
    My confusion comes from the difference between 2 and 3.  Controls are fundamentally different from VIs in this treatment, and I didn't (don't) understand why. 
    I said that your "independently" comment was not true because of #3.  These plugins are capable of finding subVIs in the parent EXE.  They're dependent on the EXE, but they can still work if that dependency is resolvable.  
    For some reason, they're not capable of finding typedef controls in the parent. 
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Execute several UNIX OS commands from inside Java program

    Greetings,
    I would like to be able to execute from a Java program several of the following UNIX commands
    script filename
    cd
    date
    grep
    diff
    I have been able to get a single command to work with
    Runtime rt = Runtime.getRuntime();
    Process p = rt.exec("dir");
    My goal here is to accomplish a Java program which will use JDBC to access an Oracle database with SQL and then compare the resultant flat file with a diff command in Unix to another delimited file from an Excel spreadsheet. Your input is appreciated.
    Thank you

    I would suggeat to use JDBC to get the data from database and then read your file and then use existing java diff program from following link to find the differences between the files
    http://www.bmsi.com/java/
    I hope this helps
    VAN

Maybe you are looking for