Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - PJonHar

Pages: [1] 2
1
Beta 35 may possibly fix this

I have just tested Beta 36, and i can confirm this is now working (i.e. the subscriptions are working as expected).
Thanks.

2
Is there a way to enable logging on the comms driver?

Regarding the above, does anyone know?

3
I already have a work around for the unknown issue with my subscription method.
I have a timer based on a given timespan that uses the same code.

Code: [Select]
private void tagTimer_Tick(object sender, EventArgs e)
        {
            string tag;
            PropertyInfo[] properties = typeof(K_AutoExternal).GetProperties();
            foreach (PropertyInfo property in properties)
            {
                tag = String.Format("{0}.{1}", AEXParentTag, property.Name);
                ParseData(tag, PLC.Read(tag));
            }
        }

I would still like to try and identify why my subscription does not work.

4
Is there a way to enable logging on the comms driver?

5
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.

6
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.

7
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

8
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?

9
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.

10
Tips & Tricks / Re: Improved INI file processor in version 3.99k
« on: February 18, 2020, 12:33:10 PM »
Just for clarity, if you are using a driver via code, you need to do a BeginInit and EndInit, as per below:

Code: [Select]
PLC = new EthernetIPforCLXCom();

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

11
Support Questions / 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?

12
Support Questions / Re: Subscribe Method
« on: June 13, 2017, 05:48:31 PM »
bump

13
Support Questions / Re: Subscribe Method
« on: May 26, 2017, 09:35:52 AM »
Hi Archie,

I am using the ClxDriverV111R766.

14
Support Questions / Subscribe Method
« on: May 23, 2017, 08:04:50 AM »
Hi,

I am using the Subscribe on certain tags that a user can define via XML, which is then read in and the subscriptions made.
Code: [Select]
Private Sub QCompositeButtonPLCMessages_ItemActivated(sender As System.Object, e As Qios.DevSuite.Components.QCompositeEventArgs) Handles QCompositeButtonPLCMessages.ItemActivated
        Try
            Dim frmPLCMessages As New frmPLCMessages()
            If frmPLCMessages.ShowDialog(Me) = DialogResult.OK Then
                ApplicationPLCMessages = New PLCMessages().Load
                SubscribePLCMessages()
            End If
            frmPLCMessages = Nothing
        Catch ex As Exception
            Log.ErrorMessage(ex.TargetSite.Name, ex.Message, "1410")
        End Try
    End Sub

    Private Sub UnsubscribePLCMessages()
        For Each i As Integer In SubscriptionIDs
            PLC.UnSubscribe(i)
        Next
        SubscriptionIDs.Clear()
    End Sub

    Private Sub SubscribePLCMessages()
        UnsubscribePLCMessages()

        For Each pm As PLCMessage In ApplicationPLCMessages
            If pm.Message.Length > 0 Then
                SubscriptionIDs.Add(PLC.Subscribe(pm.Tag, 1, AddressOf SubscriptionCallback))
            End If
        Next

    End Sub

Upon initial loading of the main form the method SubscribePLCMessages is ran and the subscription works.
If i open the form frmPLCMessages and then click OK to the form the SubscribePLCMessages is re-ran to ensure any changes made to the XML file take place. However, upon this second call to SubscribePLCMessages my program hangs on the line 'PLC.Subscribe(pm.Tag, 1, AddressOf SubscriptionCallback)'.

Any Ideas?

Thanks.

15
Support Questions / Re: Cannot Separate components
« on: March 16, 2017, 04:32:18 AM »
Hi,

I have now added my forms and modules to the AdvancedHMI project it self.
Is it possible to have these projects separate?

Thanks

Pages: [1] 2