Author Topic: Make Global object  (Read 4498 times)

Tazmahal

  • Newbie
  • *
  • Posts: 27
    • View Profile
Make Global object
« on: March 31, 2018, 08:45:17 AM »
Hi everyone !

Is there any way to do global object like in view studio ? The plc is a Clx, so I would like to put control and info in a groupbox , start stop jog interlock condition etc..
All motor have the same data type, so can we read the tag from example a label in the group box ?

I'm not very good with VB.. just wanna know if it's possible and maybe if someone can give me a starting point on how i can get this working !

Many thanks !!

Phrog30

  • Guest
Re: Make Global object
« Reply #1 on: March 31, 2018, 10:59:38 AM »
There absolutely is, look into creating controls. Take the basic button for example, that is a global object. I'm not sure I included them, but I have posted several example apps before. Take a look at the multiple monitor example, look for popups for FVR, FVNR, etc. This will show how to do popups as global objects compared to FTView.

https://www.advancedhmi.com/forum/index.php?topic=1896.msg10810#msg10810

James

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Make Global object
« Reply #2 on: March 31, 2018, 11:03:34 AM »
I never used global objects in View Studio, so based on your description I made a rough version of how I interpret it to work.

- Download the attached file
- In Solution Explorer expand down the AdvancedHMIControls project
- Right click the PurchasedControls folder
- Browse to and select the GroupedObject.vb file downloaded here
- Double click the GroupedObject.vb file and it will open in design view
- From the Toolbox, add a control such as a BasicLabel
- Set PLCAddressValue to the sub-element of a UDT
- Build the solution
- In Solution Explorer, Double click MainForm.vb to open in design view
- From the Toolbox, add a GroupedObject to the form
- Set PLCAddressUDT to the UDT name that contains the sub-element specified above
- Run the application

This control still has a quirk that I did not get resolved where it will try to connect to a PLC in design view.

Tazmahal

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Make Global object
« Reply #3 on: March 31, 2018, 11:31:23 AM »
Wow !! Thank you for the quick response  :), I'll give a try this Pm !!

Tazmahal

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Make Global object
« Reply #4 on: March 31, 2018, 12:44:17 PM »
I'm very impressed !! Works like a charm , Archie you're the man !!

Phrog30

  • Guest
Re: Make Global object
« Reply #5 on: March 31, 2018, 01:13:24 PM »
Archie, global objects in FTView is just RA way of doing reusable objects, graphics, controls, etc. 

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Make Global object
« Reply #6 on: March 31, 2018, 02:31:39 PM »
Archie, global objects in FTView is just RA way of doing reusable objects, graphics, controls, etc.
That's what I was kind of thinking. How does it handle addressing if the object is re-used multiple times?

Tazmahal

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Make Global object
« Reply #7 on: March 31, 2018, 03:07:27 PM »
I've added 5 motor and no issues ! Works very nicely :)

Phrog I've used your build and i'm struggling a little bit , the header alarm keep telling me No plc communication and i've changed all the adress in the Main_plc to my clx address.. any clues ?!

Thanks again !!

Phrog30

  • Guest
Re: Make Global object
« Reply #8 on: March 31, 2018, 03:58:10 PM »
Archie, global objects in FTView is just RA way of doing reusable objects, graphics, controls, etc.
That's what I was kind of thinking. How does it handle addressing if the object is re-used multiple times?
You assign placeholders, then those are replaced with PLC addresses. RA uses #1, #2, as placeholders.

Phrog30

  • Guest
Re: Make Global object
« Reply #9 on: March 31, 2018, 04:01:44 PM »
I've added 5 motor and no issues ! Works very nicely :)

Phrog I've used your build and i'm struggling a little bit , the header alarm keep telling me No plc communication and i've changed all the adress in the Main_plc to my clx address.. any clues ?!

Thanks again !!
I honestly don't remember what I used in the PLC for looking at connections. I'm not in front of my PC right now. I used parents. If you look in the 1st parent, I have a bunch of regions. If you look in the I should have labeled things so you can easily find stuff. For right now you can simply comment out the code that deals with communication lost. If you still need help let me know, I can look later.

Tazmahal

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Make Global object
« Reply #10 on: April 01, 2018, 12:55:54 PM »
It's fine Phrog I'll take a look to that !

Archie there's a small bug will I change page and return to my main page I think it reconcate the string ex : my tag is ; In.DriveStatus_Active and PLCAdressUDT is M3110 , so M3110.In.DriveStatus_Active and reconcate to M3310.M3110.In.DriveStatus_Active

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Make Global object
« Reply #11 on: April 01, 2018, 03:05:35 PM »
In Phrog30's version, check MyHMI\Class\Globals.vb and update the IP there as well.

The other way could be to add to MyHMI\Data\App_Config.ini the following line:

[Settings]
IPAddress=192.168.0.22   <-- replace with your IP
 
and then add a line to the bottom of MyHMI\Displays\Replace\_0000_1st_Parent.vb --> App_Settings() sub:

Globals.PLC_1 = Main_PLC.IPAddress


You might need to make a few more changes if you want the alarms to work. Possibly create an array in your PLC, named HMI_Alarm_Array[20] and set the following line: Private Alarm_Quantity_PLC_Address As String = "HMI_Alarm_Array[1]" (in your PLC set the value of HMI_Alarm_Array[1] to 20). Then try changing the value of HMI_Alarm_Array[0] to see what alarm will turn ON. DINT array worked for me.

The attached picture shows it as working.
« Last Edit: April 01, 2018, 03:55:31 PM by Godra »

Tazmahal

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Make Global object
« Reply #12 on: April 01, 2018, 05:19:18 PM »
Thank you Godra, alarm works fine !!

No communication to plc is ok now ! :)

Hmi_Alarm_Array[0].0 to 31 works good ! can we use more than 32 alarm ? And what's the purpose of HMI_Alarm_Array[1] to 20 ?

Many thanks !!
« Last Edit: April 01, 2018, 06:22:21 PM by Tazmahal »

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Make Global object
« Reply #13 on: April 01, 2018, 08:01:16 PM »
I am not sure about everything in this app so try experimenting.

Look for this line in the 1st parent:

Private Alarm_Quantity_PLC_Address As String = "HMI_Alarm_Array[1]"

The value that you set at this address in the PLC should define the Alarm Quantity.
You don't have to use HMI_Alarm_Array[1] and shouldn't use it now that you want more than 32 alarms.
Instead, try using HMI_Alarm_Array[19] and set it to 64 or 128 (make sure to update the above mentioned line of code).
Then try changing HMI_Alarm_Array[0] and HMI_Alarm_Array[1] and HMI_Alarm_Array[2] and ... bits to see if they will trigger alarms.

I did try it and there is no limit of 32 alarms.

Also, look inside MyHMI\Data\Alarm_Desc.ini file, that's where description for each alarm should be (and you can add or remove entries).
You should make sure to have a description for each alarm you want to use.

There a several lines of code marked as "TO DO" so the app might not be complete (unless it was changed and updated since I downloaded it last).
« Last Edit: April 02, 2018, 07:45:13 AM by Godra »

Phrog30

  • Guest
Re: Make Global object
« Reply #14 on: April 02, 2018, 08:06:49 AM »
Thank you Godra, alarm works fine !!

No communication to plc is ok now ! :)

Hmi_Alarm_Array[0].0 to 31 works good ! can we use more than 32 alarm ? And what's the purpose of HMI_Alarm_Array[1] to 20 ?

Many thanks !!

Glad you figured things out.  I tried to bookmark areas with "TODO_x", those aren't necessarily items that still need completed, but items that  may need configured for your specific process - I probably could have picked a better term than TODO. 

I use arrays because I feel they are more efficient and easier to use.  You can use SINT, INT, DINT, etc., as long as you specify the word length (since the driver isn't capable of knowing data type).  This app has been tested with MicroLogix and AD Productivity (Modbus) as well.  You define length on line 654:

Code: [Select]
Private Binary_Length As Integer = 32 'TODO_2
If using CpLX/CLX I would always recommend using DINT, which is 32.  Since there isn't an alarm number 0, I skip that and start with 1.  So, word
  • bit 1 is alarm #1, word
  • bit 31 is alarm #31, word [1] bit 0 is alarm #32, etc.  There is no limit.  You could have 1000s of alarms.  This app is setup to use the descriptions from a user defined INI file within the app, as Godra pointed out, or you can use strings from the PLC, line 706:
Code: [Select]
AlarmDescArray.PLCAddress = "Alarm[" & i & "].Description_ID" 'TODO_6 '
Hope that clarifies things a little better.

James