Author Topic: MessageListByValue and ModbusTCP  (Read 2440 times)

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
MessageListByValue and ModbusTCP
« on: January 28, 2015, 01:57:08 AM »
Dear all,

I am using version 3.97d.
Got an issue with MessageListByValue + ModbusTCP comm.
I have setup some messages in the collection, and set the BackColor as RED.
However, when the particular message appears during runtime, the backcolor is transparent.

Then trying to use Highlight key character color as well.
So, in my message I put ! character, and by default the setting of highlight color is RED.
But still when the message occurs, the backcolor is transparent.

Please advise how to apply some background color to MessageListByValue.
I expect this component to be Alarm System, so it might require color.
Thank you.


Best regards,
Andrew




Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5274
    • View Profile
    • AdvancedHMI
Re: MessageListByValue and ModbusTCP
« Reply #1 on: January 28, 2015, 08:35:24 AM »
This feature hasn't been implemented yet for the MessageList, but it will be as of version 3.97e

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5274
    • View Profile
    • AdvancedHMI
Re: MessageListByValue and ModbusTCP
« Reply #2 on: January 28, 2015, 02:27:59 PM »
Version 3.97e is now available with this new feature. Also see the post on 3.97e breaking changes if upgrading a project

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: MessageListByValue and ModbusTCP
« Reply #3 on: January 28, 2015, 09:03:14 PM »
Version 3.97e is now available with this new feature. Also see the post on 3.97e breaking changes if upgrading a project

Thanks Archie, it works now.

Just a little expectation here:
It would be nice if the PLCAddressValue can be specified for each message.
Since I am using ModbusTCP, so currently my MessageListByValue can only contain 16 alarms.

Or do you have trick regarding this? perhaps mapping the address or something.
Thank you.


Best regards,
Andrew

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5274
    • View Profile
    • AdvancedHMI
Re: MessageListByValue and ModbusTCP
« Reply #4 on: January 28, 2015, 09:37:17 PM »
Just a little expectation here:
It would be nice if the PLCAddressValue can be specified for each message.
Since I am using ModbusTCP, so currently my MessageListByValue can only contain 16 alarms.

Or do you have trick regarding this? perhaps mapping the address or something.
The MessageListByValue should be able to support 32767 messages using a 16 bit integer and millions with a 32 bit.

Am I misunderstanding something?

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: MessageListByValue and ModbusTCP
« Reply #5 on: January 28, 2015, 09:48:48 PM »
The MessageListByValue should be able to support 32767 messages using a 16 bit integer and millions with a 32 bit.

Am I misunderstanding something?

You're right.

But in my situation, the alarm mapping is described as below:
40001.0 = alarm 1
40001.1 = alarm 2
40001.2 = alarm 3
....
40001.15 = alarm 16

So, when I register the alarms in 'message' parameter of MessageListByValue, it would be like in the attachment.
Then I guess I need to map my alarms in one special address in PLC.


Best regards,
Andrew


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5274
    • View Profile
    • AdvancedHMI
Re: MessageListByValue and ModbusTCP
« Reply #6 on: January 28, 2015, 10:02:36 PM »
Ok, so you're really doing a message by bit. There may be one trick that can get you more alarms. If you use the address L40001, it will give you a 32 bit read that spans over 40001 and 40002

So let's say you use 40002.0, then the alarm number would be 256

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: MessageListByValue and ModbusTCP
« Reply #7 on: January 29, 2015, 05:07:11 AM »
Ok, so you're really doing a message by bit. There may be one trick that can get you more alarms. If you use the address L40001, it will give you a 32 bit read that spans over 40001 and 40002

So let's say you use 40002.0, then the alarm number would be 256

Sorry Archie, I am unable to understand what you mean.
I tried to change the address to L40001, then when i change 40002 into 1 (meaning 40002.0 becomes TRUE).
It generates unknown alarm. In fact according to my alarm list, value 256 should generate Alarm 8.
Please correct me if i'm wrong.

So I was trying to do different method.
Mapping all my list of alarms into 1 modbus address using DataSubscriber.
Putting all the bits condition into array-of-boolean, if certain bit is TRUE or even FALSE, it will generate ALARM or ALARM NORMAL message.

Code: [Select]
Private Sub DataSubscriber1_DataChanged(ByVal sender As System.Object, ByVal e As MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        Dim arrBool(15) As Boolean
        Dim temp As Integer
        Dim iCtr As Integer

        If e.PlcAddress = "413388" Then
            temp = e.Values(0)

            For iCtr = 15 To 0 Step -1
                arrBool(iCtr) = 0
                If temp > (2 ^ iCtr) - 1 Then
                    arrBool(iCtr) = 1
                    temp = temp - (2 ^ iCtr)
                End If

                If arrBool(iCtr) = 1 Then
                    ModbusTCPCom1.Write(465535, iCtr * 2 + 1)
                ElseIf arrBool(iCtr) = 0 Then
                    ModbusTCPCom1.Write(465535, iCtr * 2 + 2)
                End If

            Next iCtr
        End If
End Sub

Sadly, this is not working.
Basically I successfully map all bits of my alarm into array.
But because the MessageListByValue only gets the last number from the specified address (465535), finally it only generates 1 message.

I was thinking about allocating the message numbers into queue in for loop, then using timer to generate in sequence.
But before i go too far, i would try to get advise from you.
Maybe more efficient solution than my brute force.
Thank you.


Best regards,
Andrew

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5274
    • View Profile
    • AdvancedHMI
Re: MessageListByValue and ModbusTCP
« Reply #8 on: January 29, 2015, 08:03:31 AM »
Sorry, I was typing faster than I was thinking. When reading L40001, then bit 40002.0 will represent 65536 because it is shifted by 16 bits. So your alarms numbers would be like this:

40002.0 = 65536
40002.1 = 131072
40002.2 = 262144
etc.

The problem with this method is that if 2 alarms are active at the same time, then you will get an unknown message.

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: MessageListByValue and ModbusTCP
« Reply #9 on: February 02, 2015, 08:20:40 PM »
Sorry, I was typing faster than I was thinking. When reading L40001, then bit 40002.0 will represent 65536 because it is shifted by 16 bits. So your alarms numbers would be like this:

40002.0 = 65536
40002.1 = 131072
40002.2 = 262144
etc.

It does the trick.

Quote
The problem with this method is that if 2 alarms are active at the same time, then you will get an unknown message.

However, this doesn't work for my case because it is possible for alarms to come at the same time.
Even if using 1 address (e.g 40001), it should be able to display more than 1 alarm/message.
MessageListByValue only can display 1 message according to the message value.

So in this case, the alarm mapping should be done in PLC,
and then use queue/timer to display the list of active alarms by modifying the address (specified in MessageListByValue).

Hope there will be more features for MessageListByValue in the next version.
Thank you.


Best regards,
Andrew