That calculation will not work the way you expect it to. If PumpFillSpeed is limitied to 0-50 then the only whole number would be 50/50 = 1 everything else is 0.0-0.9999... and since you are using word and integer only 50 would work since there is no representation for mantissa in integer values. Declare a temporary real variable and do the calculation and then do a REAL_TO_WORD in the DRV2Speed assignment.
You need to change it in the "var" section at the top. Ex: "y1 AT %IX0.5 : bool = 0;" -> "y1 AT %QX0.5 : bool = 0;"
It looks like you are trying to write (assign) to inputs (%IX0.x) instead of outputs (%QX0.x).
Use VAR_OUTPUT for pins on the right side or VAR_INOUT for pins on the left side. i cant see any other way.
I miss understood the question. How do you imagine the FBs being reusable if you have hard coded global variables in them? Somehow you need to pass the variables to the FB. I suppose you could pass pointers as inputs to the blocks and modify the dereferenced pointer inside the function block but i cant see the gain in that.
This concept of "OOP" has been around for decades in PLC programming and is a standard way of working when you have more than one identical objects to control. When you create a POU chose typ FB and then you will be able to createinstances of this function block in your program.
How about a CASE statement? Or maybe put the data in an array and loop through it to find the match. This is probably the shortest code. But usually you only write the code once and maybe using brute force IF Else statements is easier to maintain.
Why not always go with the st_MES_Result_SN type, if the only difference is the serial member(?).