AdvancedHMI Software

General Category => Support Questions => Topic started by: iDeeW on December 29, 2016, 01:23:51 PM

Title: Meter2 Control Scale problem
Post by: iDeeW on December 29, 2016, 01:23:51 PM
Hi everybody,

Check the below picture. I have a guage control, a meter control & a meter2 control on the latest version of AdvancedHMI.
The meter & guage control works with no issues. But the meter2 controls is off!!
The value displayed in the PLCAddressText does not match with the PLCAddressValue.
My ValueScaleFactor is 1 for all meters.
Any ideas??
Title: Re: Meter2 Control Scale problem
Post by: bachphi on December 29, 2016, 02:36:17 PM
You did not say what exactly are in PLCAddresstext and PLCAddressvalue. Perharps check MaxValue setting
Title: Re: Meter2 Control Scale problem
Post by: iDeeW on December 29, 2016, 02:51:34 PM
Max value = 150
Min value = -150

the current value is 125

Thanks,
Title: Re: Meter2 Control Scale problem
Post by: Archie on December 29, 2016, 05:18:11 PM
This is definitely an issue and it only occurs when setting for zero centered. This will be fixed in the next release.
Title: Re: Meter2 Control Scale problem
Post by: iDeeW on December 30, 2016, 12:40:03 PM
Thanks Arch
Title: Re: Meter2 Control Scale problem
Post by: iDeeW on January 13, 2017, 05:01:50 PM
Archie,

Thanks for updating the meter2 control on version t.

But now Meter2.vb crashes on communication fail.

Error msg:
Code: [Select]
{"Conversion from string "Com Error -999.No Values Returne" to type 'Double' is not valid."}
So as a quick fix I'm checking if the value is numeric before doing the scaling. Looks like the problem is no more.

But I'm sure you will addressed this in a more elegant manner.

Thanks,
Title: Re: Meter2 Control Scale problem
Post by: Archie on January 13, 2017, 06:33:18 PM
Archie,

Thanks for updating the meter2 control on version t.

But now Meter2.vb crashes on communication fail.

Error msg:
Code: [Select]
{"Conversion from string "Com Error -999.No Values Returne" to type 'Double' is not valid."}
So as a quick fix I'm checking if the value is numeric before doing the scaling. Looks like the problem is no more.
I tried to replicate this by using a Modbus simulator. I added a Meter2 and set PLCAddressValue to 40001. Started the simulator and it showed the value, I then shut down the simulator. The result is an error message on the face of the meter, but no program exception.
Title: Re: Meter2 Control Scale problem
Post by: iDeeW on January 14, 2017, 11:42:18 PM
Yes I tried it too. Same app did not crashed with my simulator.
But when I just pull the Ethernet cable from an actual modbus server it crashed with the above error.
 
Title: Re: Meter2 Control Scale problem
Post by: Archie on January 17, 2017, 08:34:52 PM
How are you checking the Value before it gets to the Meter2?
Title: Re: Meter2 Control Scale problem
Post by: iDeeW on January 17, 2017, 11:18:46 PM
In Meter2.vb -> Public Overrides Property Text()
This is how you have it right now...
Code: [Select]
..
...

If ValueScaleFactor = 1 Then
     MyBase.Text = value
Else
     MyBase.Text = value * ValueScaleFactor
End If
...
..

Below is my modification
Code: [Select]
If ValueScaleFactor = 1 Then
     MyBase.Text = value
Else
     If value Is NumericFormat Then MyBase.Text = value * ValueScaleFactor
End If

Thanks,
Title: Re: Meter2 Control Scale problem
Post by: Archie on January 18, 2017, 01:58:31 AM
Ok.. So you are using PLCAdressText as well as PLCAddressValue ?
Title: Re: Meter2 Control Scale problem
Post by: iDeeW on January 19, 2017, 10:41:12 AM
No. I only use the PLCAddressValue.
Title: Re: Meter2 Control Scale problem
Post by: Archie on January 19, 2017, 07:01:38 PM
I see now.... the error is normally sent to the Text property, but when you have a ScaleFactor other than 1, it tries to scale a string. This will be fixed in the next release.