Author Topic: Subscribe - EIPTransport.SendData Error, No Callback  (Read 3628 times)

PJonHar

  • Newbie
  • *
  • Posts: 28
    • View Profile
Subscribe - EIPTransport.SendData Error, No Callback
« on: February 18, 2020, 11:36:42 AM »
Hi,

Version:3.99y Beta 34

I have the following program that subscribes to tags via code (ignore the IPAddress).

Code: [Select]
        private EthernetIPforCLXCom PLCComms = null;
        private List<int> SubscriptionIDs = new List<int>();
        public K_AutoExternal AEX { get; set; } = new K_AutoExternal();
        private string AEXParentTag = "Robot1";
       
        public MainWindow()
        {
            InitializeComponent();

            DataContext = this;

            PLCComms = new EthernetIPforCLXCom();

            PLCComms.BeginInit();
            PLCComms.IniFileName = "CLX.ini";
            PLCComms.IniFileSection = "PLCComms";
            PLCComms.EndInit();

            PLCComms.ComError += this.PLCComms_ComError;

            SubscribeAEXTags();

            PLCComms.ReadClock();
        }

        private void UnsubscribeAEXTags()
        {
            foreach (int i in SubscriptionIDs)
                PLCComms.Unsubscribe(i);
            SubscriptionIDs.Clear();
        }

        private void SubscribeAEXTags()
        {
            try
            {
                UnsubscribeAEXTags();

                PropertyInfo[] properties = typeof(K_AutoExternal).GetProperties();
                foreach (PropertyInfo property in properties)
                    SubscriptionIDs.Add(PLCComms.Subscribe(String.Format("{0}.{1}", AEXParentTag, property.Name), 1, 5000, SubscriptionCallback));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.TargetSite.Name);
            }
        }

        private void SubscriptionCallback(object sender, PlcComEventArgs e)
        {
            if (e.ErrorId == 0 && e.Values != null && e.Values.Count > 0)
                ParseData(e.PlcAddress, e.Values[0]);
        }
       
        private void ParseData(string tag, string value)
        {
            try
            {
                PropertyInfo[] properties = typeof(K_AutoExternal).GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    if (String.Format("{0}.{1}", AEXParentTag, property.Name) == tag)
                    {
                        TypeConverter typeConverter = TypeDescriptor.GetConverter(AEX.GetType().GetProperty(property.Name).PropertyType);
                        object propValue = typeConverter.ConvertFromString(value);

                        AEX.GetType().GetProperty(property.Name).SetValue(AEX, propValue, null);
                        AEX.UpdateProperties();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.TargetSite.Name);
            }
        }

        private void PLCComms_ComError(object sender, PlcComEventArgs e)
        {
            Console.WriteLine(e.ErrorId + " - " + e.ErrorMessage);
        }

The tags get updated, but only on the initial execution of the program.

The following error messages appear at each poll:
Code: [Select]
0 - EIPTransport.SendData-No Response
-22 - No Response from PLC(22)

The pollrate is quite high (5000ms), so i think this is okay.

Any ideas what it could be?
« Last Edit: February 18, 2020, 01:38:20 PM by PJonHar »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #1 on: February 18, 2020, 01:20:15 PM »
In your other post you asked about a BeginInit and EndInit.

You should try adding those to the section where you set the properties of the EthernetIPforCLXCom driver.

See this also: https://www.advancedhmi.com/forum/index.php?topic=2207.msg12718#msg12718

PJonHar

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #2 on: February 18, 2020, 01:39:29 PM »
Please see revised post.

The Callback works now, but again only for the initial program execution.
I still get the same errors messages after the first subscription.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #3 on: February 18, 2020, 02:12:56 PM »
As a test, use fresh AdvancedHMI solution and, instead of the code, use existing components and visual controls to try to communicate with your PLC.

PJonHar

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #4 on: February 19, 2020, 04:27:30 AM »
I have used the original project and added a BarLevel looking directly at a tag in the PLC, and this communicates fine.

So, what am i doing wrong with the Subscribing?

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #5 on: February 19, 2020, 03:21:04 PM »
Put breakpoints at these lines and see what values are in those blue variables:

*                foreach (PropertyInfo property in properties)
*                    SubscriptionIDs.Add(PLCComms.Subscribe(String.Format("{0}.{1}", AEXParentTag, property.Name), 1, 5000, SubscriptionCallback));

Also put a breakpoint in the callback to see if it stops there:

*            if (e.ErrorId == 0 && e.Values != null && e.Values.Count > 0)


PJonHar

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #6 on: February 20, 2020, 04:55:54 AM »
Hi,

Checked all the variables in the Class and they exist as tags within the PLC.

Please see console output:
Code: [Select]
------------ Start Application ------------

Finished Subscribing.

------------ Frist Callback ------------

Robot1.AUT - False
Robot1.AlarmStopExternal - True
Robot1.AlarmStopInternal - True
Robot1.ApplicationRunning - False
Robot1.Calibrated - True
Robot1.CommandDWord0 - 1073741874
Robot1.CommandDWord1 - 0
Robot1.ConfirmMessage - False
Robot1.ControllerReady - True
Robot1.CouldStartMotion - True
Robot1.CycleStart - True
Robot1.DriveEnable - True
Robot1.DrivesOff - True
Robot1.DrivesOn - False
Robot1.EXT - True
Robot1.EnableIn - True
Robot1.EnableOut - True
Robot1.ExternalStart - False
Robot1.FaultReset - False
Robot1.HeartBeat - False
Robot1.HeartBeatFault - True
Robot1.HeartBeatReflect - False
Robot1.Home - True
Robot1.Home1 - False
Robot1.Home2 - False
Robot1.Home3 - False
Robot1.Home4 - False
Robot1.Home5 - False
Robot1.IOActive - True
Robot1.IOActiveConfirmation - True
Robot1.MoveEnable - True
Robot1.NearPositionReturn - True
Robot1.OnPath - True
Robot1.ParityMode - 0
Robot1.PeriReady - True
Robot1.ProgramActive - True
Robot1.ProgramMoving - False
Robot1.ProgramNumber - 0
Robot1.ProgramNumberReflect - 0
Robot1.ProgramNumberRequest - True
Robot1.ProgramNumberValid - False
Robot1.QuickStop - False
Robot1.RobotReadyInternal - True
Robot1.SPSRunning - True
Robot1.StatusDWord0 - 1658783608
Robot1.StatusDWord1 - 0
Robot1.StopMessage - False
Robot1.Stopped - True
Robot1.T1 - False
Robot1.T2 - False
Robot1.UserSafety - True
Robot1.WaitingDriveEnable - False
Robot1.WaitingErrorAcknowledge - False
Robot1.WaitingExternalStart - False
Robot1.WaitingProgramNumber - True
Robot1.WaitingProgramNumberEcho - False

------------ Second Callback ------------

SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
SubscriptionCallback - -22 - No Reponse from PLC 10.44.16.192, slot=0
PLC_ComError - -22 - No Response from PLC(22)
SubscriptionCallback - -22 - No Response from PLC(22)
SubscriptionCallback - -22 - No Response from PLC(22)
SubscriptionCallback - -22 - No Response from PLC(22)
SubscriptionCallback - -22 - No Response from PLC(22)
SubscriptionCallback - -22 - No Response from PLC(22)
SubscriptionCallback - -22 - No Response from PLC(22)
PLC_ComError - 0 - EIPTransport.SendData-No Response
« Last Edit: February 20, 2020, 05:33:52 AM by PJonHar »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #7 on: February 20, 2020, 05:12:22 PM »
You cannot be stuck with this issue, just try a different approach like to comment out your subscription line of code and add a new line where you directly subscribe to a tag or two.

Or try adding and using the DataReceived event of the driver while setting the callback to null:

PLCComms.Subscribe(String.Format("{0}.{1}", AEXParentTag, property.Name), 1, 5000, null)
« Last Edit: February 20, 2020, 05:32:12 PM by Godra »

bachphi

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #8 on: February 20, 2020, 07:10:29 PM »
Since when subscribing your own code become a support issue with AAHMI?
Have a little self respect and post it in the 'Open' forum.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #9 on: February 20, 2020, 10:14:15 PM »
It could also be that your poll rate is too high and the driver is timing out.

Try setting the poll rate to 250 and/or set the driver's Timeout to a higher value than the poll rate.

PJonHar

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #10 on: February 24, 2020, 11:42:39 AM »
You cannot be stuck with this issue, just try a different approach like to comment out your subscription line of code and add a new line where you directly subscribe to a tag or two.

Or try adding and using the DataReceived event of the driver while setting the callback to null:

PLCComms.Subscribe(String.Format("{0}.{1}", AEXParentTag, property.Name), 1, 5000, null)


Tried this and i got the attached error.

It could also be that your poll rate is too high and the driver is timing out.

Try setting the poll rate to 250 and/or set the driver's Timeout to a higher value than the poll rate.


I tried this and I got the same errors as before.



I have found that if i only subscribe to 15 tags, the callback works fine?
Code: [Select]
private void SubscribeAEXTags()
        {
            try
            {
                UnsubscribeAEXTags();

                int _subscribeTotal = 15;
                int _subscribeCount = 0;

                PropertyInfo[] properties = typeof(K_AutoExternal).GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    if (_subscribeCount < _subscribeTotal)
                    {
                        Console.WriteLine(String.Format("{0}.{1}", AEXParentTag, property.Name));
                        SubscriptionIDs.Add(PLC.Subscribe(String.Format("{0}.{1}", AEXParentTag, property.Name), 1, 250, null));
                        _subscribeCount++;
                    }
                }

                Console.WriteLine("Finished Subscribing.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.TargetSite.Name);
            }
        }

Since when subscribing your own code become a support issue with AAHMI?
Have a little self respect and post it in the 'Open' forum.

Everything okay over there?? This is a support question as the subscribe isn't working.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #11 on: February 24, 2020, 03:26:44 PM »
Maybe try using multiple instances of the DataSubscriber2 component.

Make sure to read all the posts in this topic:

https://www.advancedhmi.com/forum/index.php?topic=2451.0


PJonHar

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #12 on: February 26, 2020, 04:29:18 AM »
I have tested subscribing to the raw data (i.e. the IO data) and this successfully subscribes and calls back 32 bits.

Code: [Select]
        private void SubscribeTestTags()
        {
            try
            {
                string _testTage = "Robot1:I.Data[0]";
                int _subscribeTotal = 32;
                int _subscribeCount = 0;

                UnsubscribeTags();

                for (int i = 0; i < _subscribeTotal; i++)
                {
                    string tag = String.Format("{0}.{1}", _testTage, i.ToString());
                    Console.WriteLine(tag);
                    SubscriptionIDs.Add(PLC.Subscribe(tag, 1, 250, SubscriptionTestCallback));
                }
                _subscribeCount++;
               
                Console.WriteLine("Finished Subscribing.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.TargetSite.Name);
            }
        }

So, I tried subscribing only to the properties of type bool, however i still get the same original errors.
If i change it to subscribe to only 15 bool properties, it worked again.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #13 on: February 26, 2020, 09:48:42 PM »
Just keep trying.

You can still consider using multiple DataSubscriber2 components.


PJonHar

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: Subscribe - EIPTransport.SendData Error, No Callback
« Reply #14 on: February 27, 2020, 06:06:42 AM »
Is there a way to enable logging on the comms driver?