OSCAT Scale_r function not working in LD 4.60 works in LAD2 on 3.5.21sp3

shaunvdm
7 days ago
4 days ago
  • shaunvdm - 7 days ago

    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

     
  • ph0010421 - 7 days ago

    Is that rung definitely being executed? Is the POU called?

     
    • shaunvdm - 6 days ago

      Yes it is called

       
  • TimvH

    TimvH - 4 days ago

    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.

     
  • kishan - 4 days ago

    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;

     

Log in to post a comment.