Delta floating point to integer

Let's get this right, first the operator enters the values as integers, the PLC converts these to floats, does the maths, adds 0.5 then converts back to an integer, the operator does not need to do anything. it's simple maths if the result is 2.0 to 2.4 then by adding 0.5 & convert it to an integer it comes out at 2, if the result is 2.5 to 2.9 then adding 0.5 the float is 3.0.0 to 3.4 so converted it is 3
so there is no need for the operator to enter anything more than the values for the calculation it's that simple. in other words as per naormal math conversions it rounds down if the decimal places are less than 0.4 or rounds up if the decimal places are 0.5 to 0.9
I will try to make it simple:
Step 1 operator enters the values 8 & 3
Step 2 the PLC then converts them to floats using INT_TO_Float, 8.0 & 3.0
Step 3 the PLC divides them giving 2.66666
Step 4 the PLC adds 0.5 to the result (2.66666) so you end up with 3.16666
Step 5 the PLC converts that to an integer FLT_TO_INT the result is 3
 
Let's get this right, first the operator enters the values as integers, the PLC converts these to floats, does the maths, adds 0.5 then converts back to an integer, the operator does not need to do anything. it's simple maths if the result is 2.0 to 2.4 then by adding 0.5 & convert it to an integer it comes out at 2, if the result is 2.5 to 2.9 then adding 0.5 the float is 3.0.0 to 3.4 so converted it is 3
so there is no need for the operator to enter anything more than the values for the calculation it's that simple. in other words as per naormal math conversions it rounds down if the decimal places are less than 0.4 or rounds up if the decimal places are 0.5 to 0.9
I will try to make it simple:
Step 1 operator enters the values 8 & 3
Step 2 the PLC then converts them to floats using INT_TO_Float, 8.0 & 3.0
Step 3 the PLC divides them giving 2.66666
Step 4 the PLC adds 0.5 to the result (2.66666) so you end up with 3.16666
Step 5 the PLC converts that to an integer FLT_TO_INT the result is 3
Well said thank you i hve everything i need now thanks
 
Here is some code the top 5 rungs are using floats to get the result
the bottom 3 rungs are as Brian posted i.e. just using integers, not really tested Brians version but it should work
1721231325269.png
 

Similar Topics

Hello guys, i am taking a value from load cell module, i have to scale it so i want to divide it by 100 but the Wlsoft doesn't give me the...
6
Replies
7,071
Views
I want to connect a Schneider PLC (model TSX P57103) to a Delta HMI (model DOP-107DV). Which communication protocol should I choose? I believe...
0
Replies
124
Views
Hi everyone, I'm a control engineer working on a small RO (Reverse Osmosis) water treatment station control panel. I have solid experience with...
0
Replies
224
Views
hi guys how are u i have problem with communication with delta plc dvp-20pm software pmsoft and commgr v2.1 the detectig is failed because idont...
0
Replies
196
Views
Hi guys, I'm working on generating a voltage output of 0-10V using delta DVP04DA-S2 extension on DVP28SV311R PLC. I'm can't seem to get a voltage...
0
Replies
206
Views
Top