Dear, All
Using WinccOA 3.12.
The A tag got Integer value via ModbusRTU . ex) value = 599.
But it is Hz, so It have to be divided by 10. ex) value = 599 / 10 = 59.9
and The B tag copy the value via DPfunc ( p1/10 )
by the way, B tag value is 59 , not 59.9
How to transform the Integer value to float value via DPfunc or other way ??
how to transform the Integer value to float value via DP func ??
- gyu
- Posts:11
- Joined: Wed Mar 19, 2014 2:08 am
how to transform the Integer value to float value via DP func ??
- RudiKreiner
- Posts:198
- Joined: Mon May 16, 2011 2:10 pm
Re: how to transform the Integer value to float value via DP func ??
The driver configs have powerful capabilities for doing such conversion.
To divide by 10 is just a simple case, you can do it like this, using the para:
1/ add a _msg_conv config to your datapoint
2/ add a conversion of the type "Polynomial of 1st to 4th degree" to it.
3/ in the properties, set the degree to 1, so that your conversion formula is y= bx +a
4/ Then set a to 0 and b to 0.1
That way you can see the result. If you have a lot of DPs to convert, you can then implement this in the same way that you set all of your other configs.
The same works for driver datapoints set out from WinCC using the cmd_conv config.
See also the "_cmd_conv, _msg_conv (Conversion)" section in the WinCC Help for more information.
And as Frenk alway says, share the fun
To divide by 10 is just a simple case, you can do it like this, using the para:
1/ add a _msg_conv config to your datapoint
2/ add a conversion of the type "Polynomial of 1st to 4th degree" to it.
3/ in the properties, set the degree to 1, so that your conversion formula is y= bx +a
4/ Then set a to 0 and b to 0.1
That way you can see the result. If you have a lot of DPs to convert, you can then implement this in the same way that you set all of your other configs.
The same works for driver datapoints set out from WinCC using the cmd_conv config.
See also the "_cmd_conv, _msg_conv (Conversion)" section in the WinCC Help for more information.
And as Frenk alway says, share the fun
- nmnogueira
- Posts:125
- Joined: Thu May 05, 2011 12:59 pm
Re: how to transform the Integer value to float value via DP func ??
Just a couple of notes to add to Kreiner's post:
- The DPE must be of type float
- The "Type of transformation" in the driver must be set to "int 16" or "uint 16", whichever is the case
- The message conversion can also be of type "Base curve", with the interpolation points x1=0, x2=10, y1=0, y2=1
- The DPE must be of type float
- The "Type of transformation" in the driver must be set to "int 16" or "uint 16", whichever is the case
- The message conversion can also be of type "Base curve", with the interpolation points x1=0, x2=10, y1=0, y2=1
- fmulder
- Posts:330
- Joined: Wed Feb 03, 2010 9:46 am
Re: how to transform the Integer value to float value via DP func ??
Guys. A datapoint fucntion is using the normal scirpting language. So a formula could be "p1 * p2"..... but you could also type "(float)p1 / 10.0".
So just add casting to your datapoint function like in any other script
Good luck and share the fun
Frenk Mulder
So just add casting to your datapoint function like in any other script
Good luck and share the fun
Frenk Mulder
- RudiKreiner
- Posts:198
- Joined: Mon May 16, 2011 2:10 pm
Re: how to transform the Integer value to float value via DP func ??
If you use a dp_function then you need a datapoint with the raw value from the communcation partner and another with the dp_function config that does the conversion.
If you use the message config of driver, then you only need one datapoint, as long as the driver has the required transformation routine that can read an integer from the communication partner and convert it to a real datapoint element to which the message config is then applied.
That is the way we did it when reading temperatures from an old S5 PLC where 0 ..3000 represents 0.0 ..300.0°C,
If you use the message config of driver, then you only need one datapoint, as long as the driver has the required transformation routine that can read an integer from the communication partner and convert it to a real datapoint element to which the message config is then applied.
That is the way we did it when reading temperatures from an old S5 PLC where 0 ..3000 represents 0.0 ..300.0°C,