"x" is not an instance of "Controller_PID"

toby
2021-08-08
2021-08-09
  • toby - 2021-08-08

    Hi all,

    This is my first post on Forge. Thanks in advanced for any help offered, it's greatly appreciated.

    I seem to be going around in circles with this one, and unfortunately, it will likely be a simple problem.

    I've downloaded the Control Loop Library, added it to my projects Library Manager, but when trying to call either a 'Controller_PID' FB or 'PWM_Creator' FB from my code, I get the following error: 'x' is not an instance of 'Controller_PID'. (or 'PWM_Creator).

    I've had a look in the example folder from the Control Loop Library, even copied the initiation into my code, so it should be the same, but sadly its still not happy and throwing back an error.

    Please see attached screenshots below of the initiation, use, and the error messages.

    I also seem to be getting a warning for 2x libraries 'not being added', or 'no valid licenses'. Im not sure if this is connected to my main problem or not.

    Thank you again for any help offered.

    Toby

     
  • dFx

    dFx - 2021-08-09

    As said by the console, it seems that you are calling a "Controller_PID" functionBlock, using an instance of type "Ctrl.Controller_PID".
    Codesys obviously won't compile because the two types doesn't match.
    Try setting your type to Controller_PID, or change the type of the functionblock call to Ctrl.Controller_PID.

    Regards,
    dFx

     
  • toby - 2021-08-09

    Hi dFx,

    Thank you so much. Don't know how I missed that. Muppet I am!

    I changed the function block from 'Controller_PID' to 'Ctrl.Controller_PID' to match the data type, all errors and even the two library warnings disappeared.

    Thanks again, your help is very much appreciated!

    Regards,
    Toby

     

    Last edit: toby 2021-08-09

Log in to post a comment.