11/2/2015 12:54 PM | |
Posts: 63 Rating:
|
Hello, I am trying to generate energy values from power values that I am working with. I am getting amp readings from around 130 Mudbus current sensors. I am getting the Line and Phase voltage from another Modbus diver. From this and the different machines power factor, I am generating about 100 one-phase and 30 three-phase Power values. I downloaded an integration block from her: https://support.industry.siemens.com/cs/ke/en/view/42469594 to be able to sum up the Power to get the Energy. I take the Power and divide it by 3600 and store it in a Real tag. Then I integrate that Tag. The problem is that after exactly one hour then I am not getting an exact result out. I put a constant 60 in which is 0,0166666 after dividing it into seconds. After exactly an hour the I get out about 53,6 which sould be 60 again. I figured it might by that it is losing sum data from the missing decimal point so I tried: 1> to integrating 60 without dividing it and then divide the result afterwards, but that gave me the same result. 2> to store the division in an Lreal and alter the integration block so it works on Lreal instead of Real. That did not do a lot, the result became around 53,8. Does anyone know a better and more accurate way to do this? P.S. I am only using simulation as is. Could that somehow be less accurate then if I would do it on the PCU? |
Last edited by: The Helping Hand at: 11/2/2015 4:43:52 PMReplaced the link by a static one |
|
11/2/2015 9:43 PM | |
Posts: 22 Rating:
|
Integrating with floating point values is a definite known problem! Check out Kahn Summation The sudo code given at the begin of the article can be translated for use in a PLC. Just let me know if you need help with that part. |
This contribution was helpful to
1 thankful Users |
11/5/2015 3:35 PM | |
Posts: 63 Rating:
|
After I removed unrelated stuff from my code then the result from the Integration-block changed. I tried the code from online and it to behaves weirdly. First time I ran the code then the outcome changed very slowly and after a while, it stopped. Can anyone tell my why this is behaving in this way? In this link ( http://we.tl/194lGETRJ3 ) is the original integration-code and my code. (Basically the same). |
Last edited by: The Helping Hand at: 11/6/2015 12:00:55 PMMade the link clickable |
|
11/10/2015 9:56 PM | |
Posts: 63 Rating:
|
Hi Jeff. Did you see my code? Do you think you see what could be wrong? |
Follow us on