Advanced HMI Now Works with TwinCAT

Hi Archie

I can't offer any help on the programming front and my graphic designs can be an acquired taste. But having seen the comments on OPC I can do some research for you.

A version of the dll you need for VB is here and free:
http://gray-box.net/daawrapper.php

Sample code for accessing OPC data is here:
http://www.faweb.net/us/opc/sample_vb.html

Info from Kepware can be downloaded with examples:
http://www.kepware.com/KEP_KB/default.asp?ToDo=view&questId=84&catId=60
http://www.kepware.com/KEP_KB/default.asp?ToDo=view&questId=81&catId=60

There is stuff here that made my ears bleed:
http://www.opcfoundation.org/Downlo.../OPC DA Auto 2.02 Source Code 5.30.htm?RI=305

And another OPC client:
http://pgras.home.cern.ch/pgras/OPCClientTutorial/SimpleClient.html

Hope some of that helps if you get time to look at an OPC addition to your HMI.
If me spending time Googling and searching can help in any way, let me know.

Bryan
 
Hi Arche,

You might want to consider a sum up read for your polling routine. By calling an ADS read for every variable, could slow down severely the messaging after 500 variables. A sum up read will make one call which contains all of the handles to all of the wanted variables and return the information in one block. This is considerably more efficient. You might want to consider like the following:

Private Sub PollUpdate(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim intTimerIndex As Integer = tmrPollList.IndexOf(sender)

'* Stop the poll timer
tmrPollList(intTimerIndex).Enabled = False
Dim rdLength, wrLength As Int16
rdLength = PolledAddressList.Count * 4
wrLength = PolledAddressList.Count * 12
Dim wrStream As New AdsStream(wrLength)
Dim binwriter As New AdsBinaryWriter(wrStream)
Dim i As Integer
wrStream.Position = 0
While i < PolledAddressList.Count
binwriter.Write(PolledAddressList(i).Group)
binwriter.Write(PolledAddressList(i).Offset)
binwriter.Write(PolledAddressList(i).BytesPerElement)
rdLength = rdLength + PolledAddressList(i).BytesPerElement
i = i + 1
End While
i = 0
wrStream.Position = 0
Dim rdStream As New AdsStream(rdLength)
Dim binreader As New AdsBinaryReader(rdStream)
rdStream.Position = 0
TcClient.ReadWrite(&HF080, PolledAddressList.Count, rdStream, wrStream)

'for int16 information started at 8 for polling 2 variables
rdStream.Position = PolledAddressList.Count * 4
While i < PolledAddressList.Count
Dim values(0) As String
Try
If PolledAddressList(i).VariableType Is GetType(Boolean) Then values(0) = binreader.ReadBoolean
If PolledAddressList(i).VariableType Is GetType(SByte) Then values(0) = binreader.ReadSByte
If PolledAddressList(i).VariableType Is GetType(Int16) Then values(0) = binreader.ReadInt16
If PolledAddressList(i).VariableType Is GetType(Int32) Then values(0) = binreader.ReadInt32
If PolledAddressList(i).VariableType Is GetType(Single) Then values(0) = binreader.ReadSingle
If PolledAddressList(i).VariableType Is GetType(Double) Then values(0) = binreader.ReadDouble
If PolledAddressList(i).VariableType Is GetType(Byte) Then values(0) = binreader.ReadByte
If PolledAddressList(i).VariableType Is GetType(UInt32) Then values(0) = binreader.ReadUInt32
If PolledAddressList(i).VariableType Is GetType(UInt64) Then values(0) = binreader.ReadUInt64
If PolledAddressList(i).VariableType Is GetType(String) Then values(0) = binreader.ReadPlcString(81)

m_SynchronizingObject.BeginInvoke(PolledAddressList(i).dlgCallBack, CObj(values))
Catch ex As Exception
MsgBox(ex.Message)
Dim y = 0
End Try

i += 1
End While

'* Start the poll timer
tmrPollList(intTimerIndex).Enabled = True
End Sub


You will also have to add bytesPerElement in the subscriber. The synchronizing line could also be different as well as this is written for CE. Please excuse any coding concerns I just got this running. I am thinking that a better way exists to read from the binreader buffer.
 
Last edited:
You might want to consider a sum up read for your polling routine. By calling an ADS read for every variable, could slow down severely the messaging after 500 variables. A sum up read will make one call which contains all of the handles to all of the wanted variables and return the information in one block. This is considerably more efficient.

You will also have to add bytesPerElement in the subscriber. The synchronizing line could also be different as well as this is written for CE. Please excuse any coding concerns I just got this running. I am thinking that a better way exists to read from the binreader buffer.
I put that TwinCAT driver together very quickly, so it definitely could use some improvement. I will try out your code the next time I get to put some time into the Advanced HMI project.

Thanks
 
Hi Archie

I can't offer any help on the programming front and my graphic designs can be an acquired taste. But having seen the comments on OPC I can do some research for you.

A version of the dll you need for VB is here and free:
http://gray-box.net/daawrapper.php

Sample code for accessing OPC data is here:
http://www.faweb.net/us/opc/sample_vb.html

Info from Kepware can be downloaded with examples:
http://www.kepware.com/KEP_KB/default.asp?ToDo=view&questId=84&catId=60
http://www.kepware.com/KEP_KB/default.asp?ToDo=view&questId=81&catId=60

There is stuff here that made my ears bleed:
http://www.opcfoundation.org/Downlo.../OPC DA Auto 2.02 Source Code 5.30.htm?RI=305

And another OPC client:
http://pgras.home.cern.ch/pgras/OPCClientTutorial/SimpleClient.html

Hope some of that helps if you get time to look at an OPC addition to your HMI.
If me spending time Googling and searching can help in any way, let me know.

Bryan
Thanks for the links, they look like some good resources. OPC is definitely on my list of things to do for the Advanced HMI.
 
i ima new to hmi im trying to get the ads working with advanced hmi can anyone help

http://infosys.beckhoff.com/english.../tcadsnet/html/twincat.ads.intro.html&id=9669

so i can connect direct to the plc twincat and not pc va 232 or 485
AdvancedHMI works with TwinCAT via Ethernet or to a runtime on the same PC.

- On a new AdvancedHMI project, add a TwinCATComm from the toolbox to the form.
- Click once on TwinCATComm1 in the components bar
- Go to the properties window and set the AMS Net ID of the TwinCAT runtime you wish to communicate with
- Add a control such as a DigitalPanelMeter to the form
- Set the PLCAddress property to a variable in TwinCAT
When entering the address, be sure to add the POU (e.g. MAIN.myVariable)

If TwinCAT is being used over Ethernet, the AMS router needs to be registered on each machine. If you can go online with PLC Control from the PC you are running AdvancedHMI, then that means it is registered.

See this video for instructions:

http://www.youtube.com/watch?v=oHoPLYDVpa4
 
yes thats no problems

if i have an application running in a PLC and i want to sincronized with twincatcom driver how can set up the plc parameter to make a communication with plc


as now advancedhmi-----pc(twincat)

i want advancedhmi-------plc

have you got skype maybe
 
Archie,

Your software will be considered an OPC Client.

You will want to look at a product such as Client Ace for developing your client application:

http://www.eternity-sales.com/Kepware/clientace.htm

More information on KepserverEX (including downloads) can be found through the following links:

http://www.eternity-sales.com/Kepware/kepserverex.htm

More information regarding OPC can be located through the OPC Foundation.

Here is a link for a search result based on OPC Client:

http://www.opcfoundation.org/Search.aspx

You will be able to research further on their web site through their search web site feature.

If you have any additional questions, feel free to email, pm or respond to your thread.

Please note that I am a Kepware Distributor.

Shalom and God Bless,
 
this is what i want

http://www.youtube.com/user/arj3090

but keep getting error unable to get address info from the beckoff plcs

and thay run the twincat softwer thay say i need to use the ads dll but i see you have added it ot the softwer but how do iu set it to talk to plc


as on the plc my project would be Main.Analog_3.pv

if you could email me or add me to skype or something


as from twincat i can log into the plc and read all the data

ads the ams netid to plc is 16.16.16.253.1.1
and my pc is 192.168.84.1.1.1


and me to skype if you can please

meerholz.brendan is my skype name
thanks
 
Last edited:
if i have an application running in a PLC and i want to sincronized with twincatcom driver how can set up the plc parameter to make a communication with plc


as now advancedhmi-----pc(twincat)

i want advancedhmi-------plc
I'm not completely sure I understand what you are asking.

If you want AdvancedHMI to run on one PC and TwinCAT to run on another PC (or CX controller), then it works the same. You just need to get the AMS Net ID from the PC or controller with the TwinCAT runtime.

In that scenario, the AMS router will need to be registered on each machine. This is done using the System Manager by going through the process of broadcast searching. I believe I cover that in detail in the video "Getting Connected"

http://www.youtube.com/watch?v=8T171NIyH74
 
Your software will be considered an OPC Client.
Stephen

I tossed around the idea of writing a wrapper that would make AdvancedHMI OPC capable in order to give more communication options, but I abandoned the idea for multiple reasons.

The first is that if it used an OPC driver, then it would no longer be a standalone application and become dependent on a 3rd party piece of software with run time license costs. The expense of an OPC driver would also take it out of the hands of hobbyists and those needing an economical solution to machine control.

Also relative to .NET, OPC DA is an older technology. Currently, with the exception of the Beckhoff driver, AdvancedHMI is purley .NET code.

The drivers currently available for AdvancedHMI include DF1 serial, Ethernet/IP for SLC and Micro, partial Modbus, and Beckhoff.

Currently in testing are drivers for ControlLogix via Ethernet/IP and Siemens PPI/MPI. Once those drivers are available, AdvancedHMI should cover the majority of PLC applications.
 
Stephen

I tossed around the idea of writing a wrapper that would make AdvancedHMI OPC capable in order to give more communication options, but I abandoned the idea for multiple reasons.

The first is that if it used an OPC driver, then it would no longer be a standalone application and become dependent on a 3rd party piece of software with run time license costs. The expense of an OPC driver would also take it out of the hands of hobbyists and those needing an economical solution to machine control.

Also relative to .NET, OPC DA is an older technology. Currently, with the exception of the Beckhoff driver, AdvancedHMI is purley .NET code.

The drivers currently available for AdvancedHMI include DF1 serial, Ethernet/IP for SLC and Micro, partial Modbus, and Beckhoff.

Currently in testing are drivers for ControlLogix via Ethernet/IP and Siemens PPI/MPI. Once those drivers are available, AdvancedHMI should cover the majority of PLC applications.

Archie, when you are at a point where you feel comfortable with people testing the ControlLogix driver, I'd love to help. I toy with VB fairly regularly (although I still consider myself pretty amateur).
 
i still cant get it running i set all up like to youtube movies and still nothing

thats why im here i diid all on youtube and still get errors


now i need help

i need advanced hmi to read data direct from plcs to one pc

i have 9 plc

please help me
 
ad i can even see all the io running on the plc from the system manger

i have a bechoff bc9050 plcs

please add me to skype or email me

meerholz.brendan

brendan @ volthan .co .za
 

Similar Topics

I’m new to plc programming and very new to HMIs. So this is what I have done so far: I bought a micrologix 1100, I used bootP to set the up...
Replies
17
Views
1,740
So I installed advanced hmi and grabbed an ethernet cable. I have the click C0-12DRE-1-D PLC. I installed the advanced hmi and added the...
Replies
13
Views
2,132
Do I use the ethernet port on the click plc to connect it to my computer. Will advancedhmi work properly? Am I able to start data logging into a...
Replies
1
Views
957
Having a hard time getting the data received when using BeginReadMultiple. Not the most familiar with the ClxDriver and EthernetIPforCLXCom()...
Replies
8
Views
2,362
I am in search of a non-PC based, non-SCADA based HMI and software that allows the ability to dynamically draw graphical objects on the screen to...
Replies
15
Views
5,097
Back
Top Bottom