Showing results 1 to 10 of 10

Thread: OnlineVariableContainer Bulkmode not triggering

  1. #1
    Join Date
    28.10.2020
    Posts
    10

    Default OnlineVariableContainer Bulkmode not triggering

    Hello!

    So we are working with OnlineVariableContainers to react to some Variablechanges.

    We Subscribe to our Variables like:
    project.OnlineVariableContainerCollection.Delete(c ontainerName);
    container = project.OnlineVariableContainerCollection.Create(c ontainerName);
    container.AddVariable(variables.ToArray());contain er.BulkChanged += eventHandler;
    if (!container.ActivateBulkMode())
    {errorLog.Add("Barcode Lookup FAILED (Bulkmode)");
                        Debug.Print("Barcode Lookup FAILED (Bulkmode)");
                    }

                    if (!container.Activate())
                    {
                        errorLog.Add("Barcode Lookup FAILED (Activation)");
                        Debug.Print("Barcode Lookup FAILED (Activation)");
                    }[/CODE]

  2. #2
    Join Date
    28.10.2020
    Posts
    10

    Default Re: OnlineVariableContainer Bulkmode not triggering

    Apparently "ENTER" submits a post instant... and i cannot find a edit button, so let me try it again:

    We are subscribing to Variables with following Commands:
    OnlineVariableContainerCollection.Create
    container.AddVariables
    container.BulkChanged += eventhandler
    container.ActivateBulkMode
    container.Activate

    Our Debugpoints even return that the containers are up and running (We are checking the IProject var), but when we change one of the Variables (We tripple checked the names), no event is triggered.

    Very good to know: It only happens like that in our live project. In our Testproject it works UNTIL you switch pages. When switching Pages, no more events are triggered. No Errors thrown, nothing. The Addin is still running without errors, but no events are triggered.

    Is this a Zenon issue or are we somehow missing an option in our project which stops events from happening?

    Thanks in advance!

    Best Regards,
    Markus

  3. #3
    Join Date
    28.10.2020
    Posts
    10

    Default Re: OnlineVariableContainer Bulkmode not triggering

    Adding some Details:
    Variable we are subscribing to(from Debuglog): Added Station: "STATION_1021.INTERN_Barcode[1]"
    Variablename copied from ZenonEditor: "STATION_1021.INTERN_Barcode[1]"

    Debuglogmessage after we subbed (comes from IProject var):
    Container OC_BARCODES |isActive: True |VarCount: 84
    Container OC_BARCODESDETAILS |isActive: True |VarCount: 1800

    More Detailed Information about second container:
    Scada.AddIn.Contracts.IOnlineVariableContainer
        Count: 1800
        EventMode: Bulk
        IsActive: true
        Name: "OC_BARCODESDETAILS"
        Parent: Scada.AddIn.Contracts.IOnlineVariableContainerColl ection
        Results View: Expanding the Results View will enumerate the IEnumerable

    And YES, we have tested it with less Variables. The test was done with 10 Variables instead of 1884. It has not changed the result.

    Bulkchanged Event looks like this:

    private void StationsContainer_BulkChanged(object sender, BulkChangedEventArgs e)        {            Debug.Print("StationContainer_BulkChanged called...");

    It never reaches the Debug.Print, so the rest of the code is irrelevant

    Thanks!

  4. #4
    Join Date
    28.02.2013
    Posts
    222

    Default Re: OnlineVariableContainer Bulkmode not triggering

    As for this case also a ticket with COPA-DATA support has been opened, COPA-DATA replies will be done in that ticket.

  5. #5
    Join Date
    28.10.2020
    Posts
    10

    Idee Re: OnlineVariableContainer Bulkmode not triggering

    Hey Guys!

    With the fast and good help from Copadata support we might have found a solution:

    When the Addin automatically starts with the RT, the Variables which will be added to an OnlineVariableCollection might not be ONLINE at that time. (variable.isOnline = false). If thats the case, adding the Variable to the Container still works with no Errors, BUT this Variable will never fire a changed Event.

    In order to prevent this from happening, we added a loop at the beginning of our Service to wait for the Variables to be ONLINE and then continue adding them to our OVCs.
    That worked like a charm.

    I will post any updates below, in case someone encounters a similar issue.

    Thanks and have a very nice day!
    Markus

  6. #6
    Join Date
    10.12.2007
    Posts
    260

    Default AW: OnlineVariableContainer Bulkmode not triggering

    That seems very strange to me. The reason for using an Onlinevariable is to make sure the variables inside are online. Okay, sometimes it's for the ChangeEvent. But I never heard of a need that Variables already must be online before you can add them to an Onlinecontainer.
    What about variables that don't have an alarm, are not used in pictures and not in archives etc. they will never get online if you don't put them in an OV (while .IsOnline=false)

    I know that it's somtimes a bit tricky if you want to read Variables.Value right at start of RT. They won't be online right after you add them to an OV, you first have to wait for the ChangeEvent. But I don't understand how the variables magically getting online, only by waiting... Could you please post your code?

  7. #7
    Join Date
    13.10.2017
    Posts
    30

    Default AW: OnlineVariableContainer Bulkmode not triggering

    Hello Guys,

    I have the same problem with my ProjectServiceExtension that my variables don't work.
    Unfortunately, I am not getting any help from support for code reviews.

    @VCmarkus

    What kind of loop have you built into your code that triggering then worked?
    Could you please show us.

    Does anyone else know this problem? That you have to include a waiting time when you add variables from the SPS to an online container.

    I hope anyone can help me.

    Kind regards
    Tommylik

  8. #8
    Join Date
    28.10.2020
    Posts
    10

    Default Re: OnlineVariableContainer Bulkmode not triggering

    Hey!

    Sorry for the late reply @Tommylik, but here is my solution:

    Basically i am waiting in a seperate task for one of the variables to come online and after that we create the containers (not visible in the code here).
    Also!: ZAddon is a Library made by me. ZVariable.isOnline just checks, if the variable is online. You can also ignore the ErrorLog

    Code:
    Task task = Task.Run(() =>            {                //Waiting for Variables to come online                bool containerOnline = false;                bool stationOnline = false;                while (!containerOnline && !stationOnline)                {                    if (!containerOnline)                    {                        Debug.Print("Containers offline...");                        containerOnline = ZVariable.isOnline(project, "supersecretvariablename", ref errorLog);                    }                    if (!stationOnline)                    {                        Debug.Print("Stations offline...");                        stationOnline = ZVariable.isOnline(project, "supersecretvariablename", ref errorLog);                    }                    if (!errorLog.isEmpty())                        errorLog.SubmitAll("Barcode Lookup");                    errorLog = new ErrorLog();                }

    Best Regards,
    Markus

  9. #9
    Join Date
    28.10.2020
    Posts
    10

    Default Re: OnlineVariableContainer Bulkmode not triggering

    Ok Codetag did not work, let me try this:

    supersecretvariablename
                Task task = Task.Run(() =>            {                //Waiting for Variables to come online                bool containerOnline = false;                bool stationOnline = false;                while (!containerOnline && !stationOnline)                {                    if (!containerOnline)                    {                        Debug.Print("Containers offline...");                        containerOnline = ZVariable.isOnline(project, "supersecretvariablename", ref errorLog);                    }                    if (!stationOnline)                    {                        Debug.Print("Stations offline...");                        stationOnline = ZVariable.isOnline(project, "supersecretvariablename", ref errorLog);                    }                    if (!errorLog.isEmpty())                        errorLog.SubmitAll("Barcode Lookup");                    errorLog = new ErrorLog();                }

  10. #10
    Join Date
    28.10.2020
    Posts
    10

    Default Re: OnlineVariableContainer Bulkmode not triggering

    Ok that tag is broken for me aswell...

    here you go:



                Task task = Task.Run(() =>
                {
                    //Waiting for Variables to come online
                    bool containerOnline = false;
                    bool stationOnline = false;

                    while (!containerOnline && !stationOnline)
                    {
                        if (!containerOnline)
                        {
                            Debug.Print("Containers offline...");
                            containerOnline = ZVariable.isOnline(project, "supersecretvariablename", ref errorLog);
                        }

                        if (!stationOnline)
                        {
                            Debug.Print("Stations offline...");
                            stationOnline = ZVariable.isOnline(project, "supersecretvariablename", ref errorLog);
                        }

                        if (!errorLog.isEmpty())
                            errorLog.SubmitAll("Barcode Lookup");

                        errorLog = new ErrorLog();
                    }

Similar Threads

  1. Online Container im BulkMode ?
    By hare1268 in forum VBA
    Replies: 10
    Last Post: 14th November 2014, 15:00
  2. Replies: 0
    Last Post: 10th February 2009, 13:54

Posting Rules

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