Skip to main content



      Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Why "INF" value in composite fb?(addition of 2 small real and dividing the sum by 2 delivers INF)
Why "INF" value in composite fb? [message #1750656] Fri, 23 December 2016 20:36 Go to next message
Eclipse UserFriend
I want to calculate the mean value of two real values. It works, if I use a simple fb with the following:

QO := QI1 AND QI2;
IF QO THEN
OUT := IN1/2.0+IN2/2.0;
END_IF


However, it does not work if I make it with a composite fb. See atached pictures.

  • Attachment: mean1.png
    (Size: 24.04KB, Downloaded 162 times)
  • Attachment: mean2.png
    (Size: 65.55KB, Downloaded 154 times)
Re: Why "INF" value in composite fb? [message #1750666 is a reply to message #1750656] Sat, 24 December 2016 05:46 Go to previous message
Eclipse UserFriend
I think the problem is that you are specifying only 2.0 at the second input of the F_DIV block. As the inputs are of type ANY_NUM the code does not know what to do with the 2.0 wand will ignore it. Therefore the second input stays at 0.0 and you will get a division by zero.
In order to do this correctly you would need to specify the type with your parameter (e.g., REAL#2.0). With that the runtime knows your intention.

I know this is not nice and already the tool should handle this. Generally I would say that the basic FB solution is for your problem the better and more clean solution. It uses less memory and will also be much faster.

In my personal opinion I would use the generic math blocks only when there is some simple adaption between some existing FBs needed. E.g., you need to combine two values to form a new one. For applicaiton components I would not recommend them. Most of the time the resulting FB networks are very complicated, hard to understand and maintain.

P.S.: While thinking about why you have this issue I came up with a workaround for the REAL2REAL FB: If you give also a parameter value with REAL#0 for the first input of F_DIV then the input should be correctly typed and a direct connection between F_ADD and F_DIV should be possible. As I'm currently in the train I haven't tested it. But you could give it a try. This should work in applications and CFBs alike.
Previous Topic:MQTT
Next Topic:Version Information on Splash Screen
Goto Forum:
  


Current Time: Wed Jul 23 21:12:44 EDT 2025

Powered by FUDForum. Page generated in 0.04680 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top