Author Topic: Object does not match target type  (Read 3707 times)

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Object does not match target type
« on: July 14, 2016, 10:23:03 AM »
I have been getting the object does not match target type error for some reason in my project. I am making a Human Interface using AdvancedHMI on Microsoft Visual Studios. I made a template for each of my forms hoping this would solve some of the issues I've been having. Tried many different things and have no clue how to fix the issue. The project will run for a short time period, then just quit and give me this Object does not match target type error.

I am new to this program and don't really know how to code in C#.

Any recommendations on what to do?

Thank you

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Object does not match target type
« Reply #1 on: July 14, 2016, 02:03:12 PM »
What version of AdvancedHMI are you using and what driver and controls?

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Object does not match target type
« Reply #2 on: July 14, 2016, 03:58:24 PM »
Version 399k for the AdvancedHMI. We are using and Allen Bradley PLC and connected using the serialDF1foSLCMicroCom. There are several Digital Panel meters, stack lights, pilot lights, switches, check boxes, and form change buttons.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Object does not match target type
« Reply #3 on: July 14, 2016, 05:39:51 PM »
When you get the exception, you should see a link for "Show Details". Click on that , then post the stack trace that it shows.

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Object does not match target type
« Reply #4 on: July 19, 2016, 11:05:19 AM »
The problem has been fixed oddly. Rebuilding the solution about 3 or 4 times cleared up the problem.

The new problem that is occurring now is that the CPU usage is at 100% most of the time for some reason. Specifically when the mainform is open. Any suggestions?

Thank You

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Object does not match target type
« Reply #5 on: July 19, 2016, 11:54:04 AM »
What is the PollRateOverride setting on your driver? Do you have any code behind the form?

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Object does not match target type
« Reply #6 on: July 19, 2016, 12:06:43 PM »
The PollRateOverride = 5000. I apologize for the ignorance but don't know what you mean by behind the form?

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Object does not match target type
« Reply #7 on: July 19, 2016, 12:36:52 PM »
I have uploaded my entire project here: https://drive.google.com/open?id=0B3ksYA15iAfManFjcEtIQ0NveG8

For some background I am trying to use the SerialDF1forSLCMicroCom driver.  I have 8 Forms in all including the main form.  This is the first time I've used visual studio, so I've been trying to learn as I go.

When I did a Performance Profile on CPU usage the following function was shown to be utilizing near 100% of my CPU after opening all of the forms and going back to the main form.
MfgControl.AdvanceHMI.DriversAllenBradely.PCCC.PCCCforHMI.a

I believe it's either a polling issue or something to do with forms not actually closing when switching to a different form.

Your help is greatly appreciated.  Thank you!

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Object does not match target type
« Reply #8 on: July 19, 2016, 06:23:10 PM »
It looks like your PollRateOverride is 500 (0.5 seconds). So it is trying to refresh all of your values every 500ms. This may be a bit much for a serial connection unless you have a 38400 baud rate. I would try changing the PollRateOverride to 2000

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Object does not match target type
« Reply #9 on: July 20, 2016, 08:18:23 AM »
I changed the PollRateOverride to 2000 and it had only a small effect on the CPU usage.

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Object does not match target type
« Reply #10 on: July 20, 2016, 03:25:53 PM »
If I try to open your solution as it is, it is missing HMI.vb file and the MainForm doesn't show either (even though it is present in the AdvancedHMI folder).

Once I added the MainForm to the project then I could see the controls you have on that form (including EthernetIPforCLXCom1 driver). This form is set as startup form for your project.

Can you post HMI.vb file?

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Object does not match target type
« Reply #11 on: July 20, 2016, 05:27:57 PM »
Didn't realize that was saved elsewhere on my computer.  I've attached them to this post.

I do not know how well visual studio handles references (I'm used to the difficulties of solidworks), but these files were located at C:\Rockwell\Ovens on my system if that is where visual studio is going to look for them.

On a side note I am not sure why it added the EthernetIPforCLXCom1 driver on your system.  The driver I am using is the SerialDF1forSLCMicroCom1.

Thank you.
« Last Edit: July 20, 2016, 05:33:11 PM by eci »

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Object does not match target type
« Reply #12 on: July 20, 2016, 08:16:24 PM »
The project opens properly now that I put those files in the C:\Rockwell\Ovens folder.

You can try a few simple things:

1) If you already don't have it then create a working copy of your project and use it for testing

2) Delete MainForm files from AdvancedHMI folder (MainForm.vb, MainFormDesigner.vb and MainForm.resx)

3) Disable subscriptions for the driver on each form and test the project (it works OK on my end since I don't have your PLC to connect to). Your pages do take a few moments to load since they are graphics intensive. If your CPU usage remains high while testing then there is something else causing the issue.

  ** Remember to enable subscriptions once you are done with this step **

4) If you know the exact baud rate of your connection then set it on each driver (also set the PollRateOverride to 2000 for each driver on each form). As Archie suggested, anything below 38400 might need additional adjusting.


Somewhat similar issue was discussed in this topic http://advancedhmi.com/forum/index.php?topic=861.0.
The driver architecture has changed since but the gist of the conversation could apply in your case.

What is the exact PLC that you are using?

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Object does not match target type
« Reply #13 on: July 21, 2016, 07:09:14 AM »
I am using a Allen Bradley SLC 500. I have a SLC 5/03 processor, a 115 VAC input card, TRIAC output card and two thermocouple input cards.

Thank you for the assistance, I will let you know if it works.

eci

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Object does not match target type
« Reply #14 on: July 21, 2016, 07:42:17 AM »
When the Subscripts are disabled the program runs without using a lot of the processor and also won't connect to the PLC, but once I re-enable the subscripts it does the same thing again.