Author Topic: ChartBySampling (ScaleFactor Problem)  (Read 2085 times)

honeydrop

  • Newbie
  • *
  • Posts: 12
    • View Profile
ChartBySampling (ScaleFactor Problem)
« on: August 07, 2017, 01:13:34 AM »
Hi Archie,

i have problem with ScaleFactor property in ChartBySampling, it outputs wrong result with floating number scale factor, looks like it doesn't read the decimal point. That problem doesn't occure with integer number scale factor.
I'm using Omron PLC with SerialFINS driver.

example:
1) input=0-600
    scale factor=0,5
    output=5 (constant)
2) input=0-600
    scale factor=0,1
    output=1 (constant)
3)  input=0-600
    scale factor=1,5
    output=0-600 (the result equal with scale factor=1)
4)  input=0-600
    scale factor=2,5
    output=0-1200 (the result equal with scale factor=2)
5)  input=0-600
    scale factor=2,9
    output=0-1200 (the result equal with scale factor=2)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ChartBySampling (ScaleFactor Problem)
« Reply #1 on: August 07, 2017, 04:54:17 AM »
What version of AdvancedHMI are you using? I seem to remember this being fixed, but I can't find it in the release notes. I did a quick test using version 3.99x with the Modbus driver and it appears to be working correctly.

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: ChartBySampling (ScaleFactor Problem)
« Reply #2 on: August 07, 2017, 09:11:58 AM »
Did you try decimal point?
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ChartBySampling (ScaleFactor Problem)
« Reply #3 on: August 07, 2017, 09:30:28 AM »
Did you try decimal point?
Good catch... that is what I was trying to recall that was needed to fix the problem. Version 3.99x was changed to use Globalization list separators, which prior version was causing problems when the "," was used to separate different values.

honeydrop

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: ChartBySampling (ScaleFactor Problem)
« Reply #4 on: August 07, 2017, 11:23:17 PM »
What version of AdvancedHMI are you using? I seem to remember this being fixed, but I can't find it in the release notes. I did a quick test using version 3.99x with the Modbus driver and it appears to be working correctly.

I'm using version 3.99x.
I tried decimal point but it gave error (in attachment).
I tried scale factor=1,5 in BasicLabel and it worked (600x1,5=900).
Scale factor=1,5 in ChartBySampling gave wrong result (600x1,5=600).
         

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ChartBySampling (ScaleFactor Problem)
« Reply #5 on: August 08, 2017, 08:56:04 AM »
The problem seems to be in anything that uses the PLCAddressItem, such as the AnalogValueDisplay. Try adding an AnalogValueDisplay to the form and set one of the addresses to verify if I am correct in my thinking.

honeydrop

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: ChartBySampling (ScaleFactor Problem)
« Reply #6 on: August 08, 2017, 11:06:38 PM »
The problem seems to be in anything that uses the PLCAddressItem, such as the AnalogValueDisplay. Try adding an AnalogValueDisplay to the form and set one of the addresses to verify if I am correct in my thinking.

you were right, i tried with AnalogValueDisplay and set the parameters, it still gave wrong result. I guess there is a conflict between comma (,) used to separate each parameter and comma (,) used in decimal number.
For AnalogValueDisplay, the format of PLCAddressValue: D0,1,b,a,1,5,0  (in attachment)
D0  : PLCAddress
1    : NumberOfElements
b    : Name
a    : Description
1,5 : ScaleFactor
0    : ScaleOffset
As you can see the number 1,5 is read as 1 instead of 1,5 because it assumes the comma (,) is the parameter separator.
« Last Edit: August 08, 2017, 11:19:41 PM by honeydrop »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ChartBySampling (ScaleFactor Problem)
« Reply #7 on: August 09, 2017, 04:11:21 AM »
Try this diver Patch 1 for version 3.99x:

https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/Patches

- Open your solution in Visual Studio
- In Solution Explorer expand down the AdvancedHMIDrivers project
- Right the Support folder and select Add Existing
- Browse to and select the file you downloaded and extracted
Make sure it asks you to replace the file
- Rebuild the solution

honeydrop

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: ChartBySampling (ScaleFactor Problem)
« Reply #8 on: August 10, 2017, 01:18:12 AM »
After doing some trials and errors, finally i get it worked.
1) I still used the original AHMI version 3.99x (no patch applied)
2) I changed the Number Format in Control Panel->Region->Additional Settings...
    in Numbers Tab, i chose point (.) for Decimal symbol and comma (,) for List separator. AHMI's project will automatically uses that format.
3) Reopened the project, build, and nicely done :)

Thank you Archie for your help and support.