Showing results 1 to 4 of 4

Thread: Read group of tags "on demand"

  1. #1
    Join Date
    23.09.2020
    Posts
    2

    Default Read group of tags "on demand"

    Hello everybody,

    I'm trying to read around 250 tags of different types (boolen, int, string, decimal... ) for 10 different PLCs. This values only need to read it when each PLC send a boolean signal. However, it are too much tags to keep it "advice" all the time. Also, at end of the year I will add another 10 PLCs with same amount of tags each one.

    Is possible to put in "advice" the online variables container of each PLC when respective boolean signal change to TRUE, "on demand"? Already create the online container of each PLC inside if Active event handler, and also I created a event handler when boolean signal change then I check if the boolean signal is true to "advice" (.Define()) the online container, but all the tags return it that aren't Online when try to get the value of each one. When I try a second time and now the tags are online.

    When I need "advice" the online containers?
    Could use ".Undefine()" when I finish to process de tags in the online container? To not keep "advice" all containers
    Is possible only "advice" when I need to read the values of the tags and then "unadvice" the tags? On demand
    Are a steps to follow when "Define()" the online container in order to when try to get the value of tags already are online?

            void ThisProject_Active()
            {
                
                myOnlineContainerSKID = this.OnlineVariables().CreateOnlineVariables("myOnlineVariablesSKID");
                //procedure to read tags from a CSV file
                string station = "2019101";
                ReadVariablesfromFileToOnlineContainer(station);
                mOCV = this.OnlineVariables().CreateOnlineVariables("testbool");
                if (mOCV == null)
                    mOCV = this.OnlineVariables().CreateOnlineVariables("testbool");
                mOCV.Add("testbool");
            }
    void mOCV_VariableChange(zenOn.IVariable obVar)
            {
                try
                {
                    zenOn.IVariable tt = this.Variables().Item("testbool");
                    if (Convert.ToBoolean(tt.get_Value(0)))
                    {
                        myOnlineContainerSKID.Define();
                       
                        tt.set_Value(0, false);
                        
                        //Procedure to add the tags to array of IVariable and get each value
                        ReadVariablesfromFile(S_aname);
                        
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("No se pudo " + ex.Message);
                    throw;
                }
                throw new NotImplementedException();
            }

    At the moment I don't "Undefine()" the online container because the issue first try the tags aren't online.

    Thanks in advance.



  2. #2
    Join Date
    18.12.2017
    Posts
    41

    Default Re: Read group of tags "on demand"

    Hi!


    If you create a driver and create variables they are not polled automatically when you start the Runtime. They have to be used somewhere for actually being polled.
    This is where "advised" comes into the picture.

    If a variable is shown on a screen, it gets advised when the screen is opened. When the screen is closed again, it's unadvised.
    An "online container" is a way to advice variables with code.

    You can activate and deactivate the container with the methods Activate() and Deactivate(), or Define() and Undefine() if you are still using COM.
    https://onlinehelp.copadata.com/Content.html?product=addin&version=1000&lang=en&id=c_cbe8fbdd266d7a4c5088314a6204868f#show/4585

    The issue with the tags not being online could be that you have to wait for them to be polled after advising the container.
    Last edited by FredrikV : 16th July 2021 at 12:35 Reason: deleted extra line breaks

  3. #3
    Join Date
    23.09.2020
    Posts
    2

    Default Re: Read group of tags "on demand"

    Quote Originally Posted by FredrikV View Post
    Hi!





    If you create a driver and create variables they are not polled automatically when you start the Runtime. They have to be used somewhere for actually being polled.

    This is where "advised" comes into the picture.



    If a variable is shown on a screen, it gets advised when the screen is opened. When the screen is closed again, it's unadvised.

    An "online container" is a way to advice variables with code.



    You can activate and deactivate the container with the methods Activate() and Deactivate(), or Define() and Undefine() if you are still using COM.

    https://onlinehelp.copadata.com/Content.html?product=addin&version=1000&lang=en&id =c_cbe8fbdd266d7a4c5088314a6204868f#show/4585



    The issue with the tags not being online could be that you have to wait for them to be polled after advising the container.

    Thanks for the quick response.

    I tried to put the Define() method in one button and all tags process and with Undefine() at the end of the code and works. However, this is only test purpose, I need to do all the process when one boolean signal come from the PLC. 

    How much is the poll time of advising (time between is define online container and when I can access to get the value)? Is a method I can use the to loop the code until the tags are online?

    In additional info I'm using Zenon V8.2 and the PLC driver is LOGIX ODVA. Also, I'm using COM... is better to use API for this application?

    Thanks in advance.



  4. #4
    Join Date
    03.11.2015
    Posts
    34

    Default Re: Read group of tags "on demand"

    you can utilise the  'variable changed' or 'bulk variable changed' events to react on changes of a varaible. Polling the variable seems not a good idea since the AddIn or VSTA can block the main thread of the runtime.
    Also, have a look on the status of the variable to identify if the variable value is valid.

     

Similar Threads

  1. "Variable Use" list in "Project Analysis" window shown Empty
    By swamy.panakala@gmail.com in forum zenon Service Engine Supervisor
    Replies: 2
    Last Post: 30th November 2019, 08:02
  2. Replies: 3
    Last Post: 28th July 2017, 01:08
  3. Replies: 1
    Last Post: 13th March 2017, 13:51
  4. RGM - VBA - ".Save" / ".Read" - change recipe status
    By markclemens in forum zenon Service Engine Supervisor
    Replies: 12
    Last Post: 29th September 2014, 12:25
  5. I always get "Error # -60 Opening file" with the function "Read Dbase file
    By wolfgangm in forum zenon Service Engine Supervisor
    Replies: 2
    Last Post: 9th June 2009, 12:53

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •