Hi We have picked up an issue
OSCAT_BASIC.Scale_r function call not working in the old lad and FBD version 4.60.
Gives no output on the function call. When we convert this to LAD2 it works.
As can be see by the two screenshot in normal LD not working in LAD2 it works.
Please confirm if this is an issue with Oscat or with LAD in 3.5.21sp3, is there an workaround.
It seems like a bug in FBD. Work-around:
If you click on the small line between the box and the output variable and delete this, the variable is removed. When you then assign a variable again (Ctrl-A), then you will see that the line will be a bit longer. If you then select the previous variable, you will see that it works.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi We have picked up an issue
OSCAT_BASIC.Scale_r function call not working in the old lad and FBD version 4.60.
Gives no output on the function call. When we convert this to LAD2 it works.
As can be see by the two screenshot in normal LD not working in LAD2 it works.
Please confirm if this is an issue with Oscat or with LAD in 3.5.21sp3, is there an workaround.
Regards
Shaun
Is that rung definitely being executed? Is the POU called?
Yes it is called
It seems like a bug in FBD. Work-around:
If you click on the small line between the box and the output variable and delete this, the variable is removed. When you then assign a variable again (Ctrl-A), then you will see that the line will be a bit longer. If you then select the previous variable, you will see that it works.
here is formula for scale function you can impliment your own scale function
Output=OutMin+(Input−InMin)×(InMax−InMin)(OutMax−OutMin)
FUNCTION_BLOCK FB_Scale
VAR_INPUT
xIn : REAL; // Input value (e.g., raw sensor)
xInMin : REAL; // Input range minimum
xInMax : REAL; // Input range maximum
xOutMin : REAL; // Output range minimum
xOutMax : REAL; // Output range maximum
END_VAR
VAR_OUTPUT
xOut : REAL; // Scaled output
END_VAR
VAR
xGain : REAL;
xOffset : REAL;
END_VAR
// Implementation
xGain := (xOutMax - xOutMin) / (xInMax - xInMin);
xOffset := xOutMin - xGain * xInMin;
xOut := xGain * xIn + xOffset;