Performance of Modbus using DSC static Variables

I'm fairly new to using Modbus with LabVIEW.  On some dozens tools and APIs that can be used for a project, I train, I decided to try using an alias of shared Variables in Modbus registers in the project, which is a tool of DSC.  It seemed like a smart to go way.  I used Variables shared in the past, however, and I am aware of some of the questions that surround them, especially when the number of them begins to increase.  I will have only about 120 variables, so I don't think that's not too bad, but I'm getting a little worried...

The way I started to do this was to create a new shared variable for each data point.  What I have noticed since then is that there is a mechanism to process multiple records at once using a table of values.  (Unfortunately, even if I wanted to use the table method, I probably couldn't.)  Modbus points that I am interfacing are for a custom device and the programmer does not disturb the consecutive use records...)  But anyway, I was wondering what might be performance issues that surround this API.

I guess:
(1) all caveates of shared variables apply.  These are really shared variables, but only DSC taught the engine of the SV to go read.  Is this fair?

And I wonder:

(2) there is no improvement in performance for reading a table of variables consecutive rather than reading each variable individually?

(3) there performance above problems what shared variables have normally when you use Modbus specifically?  (E.g. how many times can you read a few hundred points of the device even Modbus?)

Thank you

DaveT

Hi Dave,.

Thanks for your good questions!

(1) you are right that the caveates of shared variables apply. Generally, the major issues (conditions of race etc.) are not met because these variables are generally used as I/O.

(2) with a large number of shared variables that are located on separate machines, it is best to use a table. However, with 120 variables read consecutively will not affect your overall performance, especially if you don't need to read everything at the same time.

(3) overall, there is no any concerns of performance outside normal common variable concerns. Modbus and DSC are designed to be efficient and do a good job to maximize performance for you.

I hope this helps.

Best regards

Anna L

Tags: NI Software

Similar Questions

  • Static variables in the Page of the OFA

    Hello

    We have a requirement to show the popup message when changes are made in the page of the OFA. We use the static variable in the OPS page to store the initial values of some fields and whenever the popup needs to be shown, it compares the value of the static variable for the current value. If they are different then we are the message. It works perfectly fine when the page is accessed by the single user. But when several users access a single screen, it shows the message to a user even if the values are not changed by this user, but the other user has changed. My question is-

    1. do we need to use variables of session always for users multiple scenarios?
    2. How does the static variable in java? It is not unique to the session? If so, above the question shouldn't come.
    3. how to solve the problem above?

    Pointers on this would be a great help.

    Thank you
    Shree

    I did not understand the part same page can be accessed by different users. In any OA framework Page, the same page is accessible by several users. If you think abt the same data updated at the same time, then search functionality of Version number of the object in the context of OSTEOARTHRITIS.

    All instances of the VO are unique for each session. So no need to worry about this side here.

    Concerning
    Sumit

  • How to use a static const variable while loop collection ArrayCollection?

    Hello

    I have an arraycollection collection which I get to main system, that has two columns named, 'Id' and 'Desc '.

    I created a static const variable:

    public static FIELD_DESC_NAME:String const = 'Desc ';

    I have been using this variable const everywhere in my code, for example:

    super.dataProvider = model.acVariants;
    super.labelField = FIELD_DESC_NAME;  instead of using super.labelField = "Desc";

    But unfortunately, there is one place where I'm not able to use it. And it's all in the loop as shown below:

    for (var i: uint = 0; i < model.acVariants.length; i ++) {}

    If (value.label is model.acVariants [i]. DESC) {/ / I want to use the FIELD_DESC_NAME variable, instead of using 'Desc' model.acVariants [i]. / / DESC}
    super.selectedItem = model.acVariants [i];
    break;
    }

    }

    Can you please let me know how can achieve us?

    Appreciate your help...

    <! - Deepak - >

    Can you put a debug statement and draw the value returned by model.acVariants [i] [FIELD_DESC_NAME] and value.label

    Hope that there must be a difference.

    If this does not solve then please let me know

    -Vikash

  • with respect to an application to turn with the help of a global static variable

    Hello. I've read a few articles on JavaFX competition, and as a beginner, so I have to practice on this subject. Now, I'm trying to implement a turn-based application which can be played between 3 to 6 players. Furthermore, I use a scene from a .fxml file and I need to update it properly depends on certain calculations of each thread (in other word players). My main problem is, I don't want to use a while loop that checks the status of similar game;

    While (GameState! = State.GAME_OVER) {}

    currentPlayer = GameBoard.getNextPlayer ();

    perform certain actions, calculations, etc.

    }

    So, I want to use threads to work instead while loop. I guess only with the help of the Service used to iterate class and assign the next player will be adapted to instead of using the while loop and the tasks for the calculation of each player, or waiting for a few responses of human players on the UI account, however, I am faced with two problems.

    1. It has a global static variable (like the GameState which is an Enumarator) determines the State of the game, so it should be updated and must be verified by each round. Is it possible to do this?
    2. How can I get rid off this while loop?

    I would like for each answer. Thanks anyway.

    It shouldn't make too much difference. The basic idea is that you have a model class that represents your state of the game (the class of game in example jsmith). When a player makes a move, you update the game state. Because this will result in changes to the user interface, this update must be performed on the Thread of the FX Application.

    If the player makes the passage is a human player, the move would be done by a user action (mouse click or press button, etc.); This will be handled on the FX Application thread in any case.

    When the State of the game changes so it is in an "artificial" player's turn to move, have the object representing the artificial player calculate his next move and then update the game state. Since it is a response to the evolution of the game state (it is the artificial player's turn), it will also be on the Thread of the FX Application.

    The only (slight) complexity comes if the calculation of displacement for the artificial player takes a long time. You don't want to perform this calculation of long duration on the Thread of the FX Application. To handle this, the cleaner is to start a task that computes the desired pass and then updates the status of the game when travel is ready. So, something like this:

    GameState game = ... ;
    // UI is bound to the game state.
    ExecutorService executorService = ... ;
    // ...
    
    final Player currentPlayer = game.getCurrentPlayer() ;
    final Task calculateMoveTask = new Task() {
         @Override
         public Move call() {
              Move move = // compute next move...
              return move ;
         }
    };
    
    calculateMoveTask.setOnSucceeded(new EventHandler() {
         @Override
         public void handle(WorkerStateEvent event) {
              gameState.makeMove(currentPlayer, calculateMoveTask.getValue());
         }
    });
    
    executorService.submit(calculateMoveTask);
    

    If you make a thread more than that, you're probably do badly... Also, there should be no need anything it either, will be held in a "global" static variable (the idea above is the only structural change you the example posted by jsmith).

  • Access the static variable...

    Hello

    I need a static variable which holds a QMap, for this example I'll use QMap.

    I created fresh new project and I changed in applicationui.cpp:

    ...ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
            QObject(app)
    {
    ....
    
        initDatabase( 1 );
        initDatabase( 2 );
        initDatabase( 3 );
        initDatabase( 4 );
    }
    
    bool ApplicationUI::initDatabase( int index )
    {
        QString database = QString( "Db%1" ).arg( index );
        QString value = QString( "data/db%1.sqlite" ).arg( index );
    
        ApplicationUI::m_databases[database] = value; // undefined reference to `ApplicationUI::m_databases'
    
        return true;
    }
    
    ApplicationUI::~ApplicationUI()
    {
        if( ApplicationUI::m_databases.count() ) // undefined reference to `ApplicationUI::m_databases'
        {
            foreach( const QString &key, ApplicationUI::m_databases.keys() ) // undefined reference to `ApplicationUI::m_databases'
            {
                QString db = ApplicationUI::m_databases[key]; // undefined reference to `ApplicationUI::m_databases'
    
                qDebug() << "Closing [" << db << "]";
            }
        }
    }
    

    and in applicationui.hpp:

    ...
    
    class ApplicationUI : public QObject
    {
        Q_OBJECT
    public:
        ApplicationUI(bb::cascades::Application *app);
        ~ApplicationUI();
    
        static QMap m_databases;
        bool initDatabase( int index );
    ...
    };
    
    #endif /* ApplicationUI_HPP_ */
    

    As you can see commented in the code above, I get error:
    no reference to 'ApplicationUI::m_databases' applicationui.cpp

    I thought to access static variables that ApplicationUI::m_databases would work.

    Can you please guide me here.

    Kind regards

    Andy

    Hello! That's what I saw:

    (1) #include is present in the header file?

    ' (2) ' void ' is the syntax error:

    void MyClass::~MyClass()
    

    3)

    static QMap variable;
    

    is a declaration, you also need to create the variable in the .cpp file. Add to the .cpp:

    QMap MyClass::variable;
    

    4)

    MyClass::variable["one"] = "value One"; // doesn't work...
    

    "MyClass:" is not necessary. ['a'] variable should work too.

    UPD: this compiles (I replaced QMap QString with std::map with std::string for quick test):

    #include 
    #include 
    
    class MyClass
    {
    public:
          MyClass();
          ~MyClass();
    
          void someMethod();
    
          static std::map variable;
    };
    
    std::map MyClass::variable;
    
    MyClass::~MyClass()
    {
         // do some cleanup... using MyClass::variable, doesn't work
    }
    
    void MyClass::someMethod()
    {
         variable["one"] = "value One"; // doesn't work...
    }
    
    int main(void)
    {
            return 0;
    }
    
  • definition of variables in packages and using the same variables in charge Plans as a case statement in Odi

    Hello

    I am trying to use a global variable 'Global.test' in my ODI "pkg_test" package and step declaration type as a variable that is defined with the value 1 when my package evaluates the condition successfully run and with 0 if the fails.now condition I will carry out the same "pkg_test" package in my load "LP_TEST" and using the variable 'Global.test' Plan as a case statement in terms of load "LP_TEST".

    It's workload Odi is unable to understand the value of the variable 'Global.test', which is defined in my pkg 'pkg_test' and my case statement is put down in my care Plan.

    Thank you

    Hi Santosh Pradhan,

    What kind of story do you have in your variable?

    If you have not selected any antecedent, the scope of the variable is limited to the session. As the execution of the package is a session in its own (independent of the workload performance), the value of the variable is not accessible after his execution.

    You can also try assigning / updating of the value of the variable directly from your plan, instead of in the package:

    It will be useful.

    Best regards

    JeromeFr

  • The use of bind variables (in &amp; out) with sql dynamic

    I have a table that contains code snippets to make postings on a set of pl/sql database. what the code does is basically receives an ID and returns a number of errors found.
    To run the code, I use dynamic sql with two bind variables.

    When codes consists of a simpel query, it works like a charm, for example with this code:
    BEGIN
       SELECT COUNT (1)
       INTO :1
       FROM articles atl
       WHERE ATL.CSE_ID = :2 AND cgp_id IS NULL;
    END;
    However when I get to post more complexes that must perform calculations or run several queries I run into trouble.
    I have boiled down the problem into that:
    DECLARE
       counter   NUMBER;
       my_id     NUMBER := 61;
    BEGIN
       EXECUTE IMMEDIATE ('
          declare 
             some_var number;
          begin
          
          select 1 into some_var from dual
          where :2 = 61; 
          
          :1 := :2;
          end;
    ')
          USING OUT counter, IN my_id;
    
       DBMS_OUTPUT.put_line (counter || '-' || my_id);
    END;
    This code is not really make sense, but it's just to show you what is the problem. When I run this code, I get the error
    ORA-6537 ON bind variable linked to a position IN

    The error doesn't seem wise,: 2 is the only one IN bind variable and it is only used in a where clause clause.
    As soon as I remove this where clause, the code works again (giving me 61-61, in case you want to know).

    Any idea what goes wrong? I just use bind variables in a way that you're not supposed to use it?

    I'm using Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit

    Correction. With immediate execution , the binding is in position, but binds do not need to be repeated. My statement above is incorrect...

    You must link only once - but bind by position. And the connection must correspond to the use of the variable binding.

    If the connection never variable assigns a value in the code, link by in.

    If the binding variable assigns a value in the code, link as OUTPUT.

    If the binding variable assigns a value and is used a variable in another statement in the code, link as IN OUT.

    For example

    SQL> create or replace procedure FooProc is
      2          cnt     number;
      3          id      number := 61;
      4  begin
      5          execute immediate
      6  'declare
      7          n       number;
      8  begin
      9          select
     10                  1 into n
     11          from dual
     12          where :var1 = 61;       --// var1 is used as IN
     13
     14          :var2 := n * :var1;     --// var2 is used as OUT and var1 as IN
     15          :var2 := -1 * :var2;    --// var2 is used as OUT and IN
     16  end;
     17  '
     18          using
     19                  in out id, in out cnt;  --// must reflect usage above
     20
     21          DBMS_OUTPUT.put_line ( 'cnt='||cnt || ' id=' || id);
     22  end;
     23  /
    
    Procedure created.
    
    SQL>
    SQL> exec FooProc
    cnt=-61 id=61
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • Ensure this soft analysis the use of Bind variables

    Hi Experts,

    I have a request when the query is prepared dynamically in Java code and if I take the query and run it from SQL Navigator, it takes a long time to prepare the statement and then execute it quickly. I think we can use dynamic SQL statements and bind variable to improve performance here. However, I tried to do a PDS to check my understanding. I created 2 procedures

    1. mode of operation
    CREATE OR REPLACE PROCEDURE sp_static
    (id IN NUMBER, 
     name in VARCHAR2)
    IS 
    TYPE r_curs_type is REF CURSOR;
    C1 r_curs_type;
    BEGIN
    
    OPEN C1
    FOR
    SELECT * FROM TABLE WHERE columname = id
    
    CLOSE C1;
    
    END;
    2. mode of operation
    CREATE PROCEDURE sp_dyanmic
    (id IN NUMBER, 
     name in VARCHAR2)
    IS 
    TYPE r_curs_type is REF CURSOR;
    C1 r_curs_type;
    BEGIN
    
    OPEN C1 FOR 'SELECT * FROM TABLE WHERE columnanme = :U1' 
    USING ID;
    
    CLOSE C1;
    END;
    To my amazement, there is no difference in the duration of execution of these procedures when I ran the with multiple entries.

    Please note-
    1. I have not access to trace files :-(
    2. I want to just make sure there will be improved performance before starting the real work, given that some efforts provided by moving the logic of all its activities inside and the use of bind variables.

    If you can suggest a strategy to ensure performance gains, it will be extremely useful...

    Thanks in advance!
    Concerning

    Hello

    (1) it's true, procedure 1 also uses a variable binding
    (2) you seem to be confused about the very basic concepts here

    Dynamic SQL is something like this:

    create or replace FUNCTION f (l_table_name VARCHAR2) RETURN NUMBER
    IS
      l_result NUMBER;
    BEGIN
      EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || l_table_name  INTO l_result;
      return l_result;
    END;
    

    In this example, since you do not know the name of the table to the execution table, everything you can
    is dynamic SQL. As you can see, neither of your two procedures is like that.

    Dynamic SQL is used when you do not know what columns you want to select, or who
    etc. to the execution table. You can also use dynamic SQL statements to force analysis. You can not use
    to avoid parsing, binding or not binding.

    Best regards
    Nikolai

  • Why not use the static methods - example

    Hello world

    I would like to continue the below thread about "why not use static methods.
    Why not use the static methods
    with the concrete example.

    In my small application, I need to be able to send keystrokes. (java.awt.Robot class is used for this)
    I created the following class for these "operations" with static methods:
    public class KeyboardInput {
    
         private static Robot r;
         static {
              try {
                   r = new Robot();
              } catch (AWTException e) {
                   throw new RuntimeException(e + "Robot couldn't be initialized.");
              }
         }
         
         public static void wait(int millis){
              r.delay(millis);
         }
         
         public static void copy() {
              r.keyPress(KeyEvent.VK_CONTROL);
              r.keyPress(KeyEvent.VK_C);
              r.keyRelease(KeyEvent.VK_C);
              r.keyRelease(KeyEvent.VK_CONTROL);
         }
    
         public static void altTab() {
              r.keyPress(KeyEvent.VK_ALT);
              r.keyPress(KeyEvent.VK_TAB);
              r.keyRelease(KeyEvent.VK_TAB);
              r.keyRelease(KeyEvent.VK_ALT);
         }
    
                   // more methods like  paste(), tab(), shiftTab(), rightArrow()
    }
    You think it's a good solution? How could it be improved? I saw something Singleton vs somewhere of static methods. Wouldn't be better to use Singleton?

    Thanks for your comments in advance.
    lemonboston

    maheshguruswamy wrote:

    lemonboston wrote:

    maheshguruswamy wrote:
    I think a singleton might be a better approach for you. Just kill the public constructor, and provide a getInstance method to provide late initialization.

    Maheshguruswamy thanks for the tips on the steps create a singleton of this class.
    Perhaps you could say also why do you say that it would be preferable to use singleton? What is behind it? Thank you!

    In short, it seems to me that a single instance of your class will be able to coordinate actions across your entire application. If a singleton should be sufficient.

    But who doesn't answer why he expected prefer a singleton instead of a bunch of static methods. Functionally, the two are almost identical. In both cases, there is that a single 'thing' to call methods - either a single instance of the class or the class itself.

    To answer the question, the main reason to use a Singleton on a class of static methods is the same reason readers much of not static vs static decisions: polymorphism.

    If you use a Singleton (and and interface), you can do something like this:

    KeyboardInput kbi = get_some_instance_of_some_class_that_implements_KeyboardInput_somehow_maybe_from_a_factory();
    

    And then everything calling public methods of KBI has to know that there an implementor of this interface, without worrying about what concrete class is, and you can replace some implementation is appropriate in a given context. If you do not need to do, then the approach of the static method is probably enough.

    There are other reasons that may suggest a Singleton - serialization, persistence, use as a JavaBean pop to mind - but they are less frequent and less convincing in my experience.

    And finally, if this thing keeps updated a State between method calls, even if you can manage it with static member variables, it is more in line with the OO paradigm to make them non-static fields of an instance of this class.

  • Is it possible to use a statically defined appearance streams in a dynamically created annotation?

    Hello

    I want to create a document with cascade "popups".  Not the popup only integrated text, but an annotation that contains a stream of appearance that sets the text and images.  I am currently using widget annotations based on a push button field.

    Each page of my document has many citations referring to other pages in the document.  When a user hovers over the quote, I want a "popup" appear containing a representation of the destination.  However, as the destination itself will be quotes, I also want the "popup" to contain citations that the user can fly over, triggering another popup, etc.  In this way, a user can navigate the entire document without leaving the page, or by clicking the mouse.

    Of course, with even a small number of citations per page, pre calculation and statically define all these widgets causes a combinatorial explosion, making it slow and very large document.

    Instead, I want to statically define workflow appearance once per document, and then dynamically create annotations and affect the seemingly appropriate flow using JS when the user navigates.

    So far, I created an access point named in the dictionary of names, but I was not able to use it to dynamically set a dynamically created the appearance of a widget annotation workflow.

    Also, I called Doc.getIcon (), passing the AP named, which returns an Icon object.  However, after field.buttonSetIcon () and passing the AP named, the button does not appear the icon.

    Is it possible to use a statically defined appearance streams in a dynamically created annotation?

    Thank you

    Dave

    Using getIcon/buttonSetIcon must work, but you must make sure that the button is set up that it be set in page is not 'Label Only.

    Also, it is best to store the icons of hidden buttons and recover them with buttonGetIcon due to a bug that causes the icons at the level of the document get wiped out when performing a save as operation file.

  • Definition of static Variables dynamically

    I have an application that instantiates a class several times. Many variables for the class is loaded from a XML when running and may vary each time the program runs, but will not change once the program is running.

    I want to initialize static variables in this category once and then rely on their values through the program. I could do this in the constructor function, but then I think that I do whenever I have to instantiate the class and so will suffer an excessive workload.

    1. is there a way to define static variables once and then let him go without a check in the manufacturer each time to see if they are a null value (and therefore put them)?

    2. do I create an instance of the class to set?

    Any help is appreciated.

    Bob

    > 1. Is there a way to define static variables once and then let it go
    > without
    > a check in the manufacturer each time to see if they are a null value (and
    > so
    (> Set them)?

    Just use dynamic variables. Keep all the in a class as follows:

    class myVariables
    {
    Objects: variables vars private;

    public void readVariable(name:String)
    {
    return variables [name];
    }

    public void myVariables (init:XML = null)
    {
    variables = new Object();

    default init
    variables.xxx = 5;
    variables. ABC = "test";

    If (init)
    {
    set variables for the values passed in the XML strcture;
    }
    }
    }

    MV = new myVariables();
    trace (MV.readVariable ("ABC")); Returns "test".

    You can keep the instance of this class as a global object is accessible for
    other classes without initializing it.

  • Static variables in OAFramework

    Hello

    I'm stuck here seriously using static variables in my page. I have developed a few pages in OAFramework. I used more than 200 static variables in all pages. All is well for a single user. If more than 1 user using the page, the values are overlap between users. Now, I realized that its due to declare the values as static. How can I solve this problem?

    I would appreciate if someone can me advice on that.


    Jim.

    First solution to this problem is to convert all static variables to instance variables.
    However please provide details of the issue and why it is necessary to make them static.

    Abdul Wahid

  • Using a Global Variable for the input recorder DisplayRange

    I'm assuming; Since I can't do it; that you cannot change the display range of a graphic recorder by using a variable.  If there is a way I'd love to know how.

    Thank you!

    Determine if you can use a global variable is to click right in the parameter field. If the global variable is available in the context menu, then you can use a variable y.

    You can use a variable of the y-axis from the settings.

    You cannot use a variable for the display range of the x-axis parameter. This is because DASYLab needs to know the amount of memory to be allocated at the beginning of the measure.

  • pure example to compare the performance of reading for a local variable, a declarant and a queue element (looking for)

    Dear users,

    I came across an example of the operation and the disadvantages of using a local variable, a declarant and a queue for the collection and handling of data these last time. But I can't find him.

    I try to describe what and I hope someone can give me a hint:

    A sinus values were generated periodically and were sent to an indicator, a declarant and a queue. In the other loops, the local variable (of the indicator), the authors of notifications and of the elements of the queue were plotted graphs. Time of the playback loop loops can be set separately for each of them and depends on the sync settings (time: equal to the generator, half of the generator and copy of the generator), we can observe omitted elements or duplicate. Very useful to observe the behavior of loops in a local variable, a declarant and a part of the reading queue.

    Does anyone have an idea where this VI is placed, please?

    Hello ghighuphu,

    Do you mean this example?

    With the help of local Variables, queues and notifiers to synchronize data with parallel loops.

    http://www.NI.com/example/28717/en/

    Best regards

    Maha

  • Publish a queue using the shared variable

    I have a 2D table queue and I would like to publish (the reference) in a shared variable, so that I can pay the items in the queue in an another vi. I tried to create a queue control and used the custom of the shared variable control option, but it gives me an error "invalid data type.

    You try to read from the queue to another computer? Passing the reference to the queue on the network to a another computer will not allow the application to read data from the queue. The queue data is stored only locally.

    I honestly don't know why you get an error trying, however. Other options to access a queue in the world on the same machine are to use a Global Variable, rather than a shared Variable, or to get your reference queue by using a well-known name who know the other parties of the request.

Maybe you are looking for