Getting started with Codesys

sherry
2019-11-27
2020-01-22
  • sherry - 2019-11-27

    Hello,
    I was newly introduced to Codesys and automation programming. Is there any beginners tutorial that I can look at especially on PID controllers?
    I am not sure how to create a project, which device should I choose.. I want to run a simulation with the PID controller. I read that the PID can be found in Util library. How do I drag it into the workspace? How to actually getting started with Codesys??

     
  • eschwellinger

    eschwellinger - 2019-11-27

    Hi,
    there is a new controller library available in the CODESYS store:
    https://store.codesys.com/control-loop-library.html

    The following function blocks are included in the library:
    Controls
    Controller_Base: Abstract basic function block for creating individual controls
    Controller_P: Function block for implementing a P control
    Controller_PD: Function block for implementing a PD control
    Controller_PI: Function block for implementing a PI control
    Controller_PID: Function block for implementing a PID control
    Integrator approximation
    Integrator_Base: Basic function block for creating individual integral approximations
    Integrator_ParabolicApproximation: Function block for approximating the integral by means of a
    parabola using the last values
    Integrator_RectangleApproximation: Function block for approximating the integral by means of a
    rectangle
    Integrator_TrapezoidApproximation: Function block for approximating the integral by means of a
    trapezoid
    Anti-windup strategies
    These functions blocks provide different strategies to avoid an overflow of the integrator in case of a prolonged
    control variance.
    AntiWindUp_Base: Abstract basis function block for creating individual anti-windup strategy
    AntiWindUp_Clamping: Function block for using an anti-windup strategy that fixes the integrator value to the
    set maximum
    AntiWindUp_BackCalculation: Function block for using an anti-windup strategy that decreases the
    integrator value over time
    Differentiator approximation
    Differentiator_Base: Abstract basis function block for creating individual differentiator approximations
    Differentiator_BackwardDifference: Function block for linear approximation of the differential using the
    last value
    Differentiator_LinearAverageApproximation: Function block for linear approximation of the differential
    using the last values
    Differentiator_LinearFourPointApproximation: Function block for linear approximation of the differential
    using the last values
    Differentiator_ParabolicApproximation: Function block for approximating the differential by means of a
    parabola using the last values
    Control Loop Library
    1/3
    BangBang controls
    BangBangController: Function block for implementing a BangBang control
    BangBangControllerWithTimeHysteresis: Function block for implementing a BangBang control with timebased
    hysteresis
    BangBangControllerWithValueHysteresis: Function block for implementing a BangBang control with valuebased
    hysteresis
    Three-point controls
    ThreePointController: Function block for implementing a three-point control
    ThreePointControllerWithValueHysteresis: Function block for implementing a three-point control with
    value-based modulation
    Filters
    Filter_Base: Abstract basis function block for creating individual filters
    Filter_FIR: Function block for implementing a finite impulse response filter
    Filter_IIR: Function block for implementing an infinite impulse response filter
    Filter_SOS: Function block for implementing a second-order section filter
    PWM Creator
    PWM_CreatorBase: Abstract basis function block for creating individual PWM signals
    PWM_Creator: Function block creating a PWM signal
    PWM_Creator_FixedCycle: Function block creating a PWM signal with a fixed cycle time differing from the
    task cycle time calling this Control Loop Library

    If you start, always a good option is to use a raspberry pi, even better then to simulate it.
    Just open CODESYS and goto the shopping card, search for the control loop examples ( install it that way to have an update notification later)

    After installing this package you'll find the example projects then here:

    "c:\Users\<yourwindowsusername>\CODESYS Examples\Control Loop Library\1.0.0.0\WaterLevelSampleExtended.project"
    "c:\Users\<yourwindowsusername>\CODESYS Examples\Control Loop Library\1.0.0.0\WaterLevelSample.project"
    "c:\Users\<yourwindowsusername>\CODESYS Examples\Control Loop Library\1.0.0.0\ FilterSample.project" </yourwindowsusername></yourwindowsusername></yourwindowsusername>

    BR
    Edwin

    IMG: ControlLoopLibrary.png

     
    πŸ‘
    1
  • sherry - 2019-11-28

    Hi,

    Thank you for the kindness reply.
    I have downloaded and installed the Control Loop package. I also have a look at the examples as you mentioned in the folder.

    The thing is, if I created a new project, how do I open/call out/use the control loop package? Do I use the Library Manager? I couldn't find the PID controller in the toolbox area. Do I need to write a code or something?

     
  • eschwellinger

    eschwellinger - 2019-11-28

    Hi,
    this is quite simple,
    - open/add an standard project - ( select Control Win64 or Raspberry PI if you want to login to local installed plc)then
    - go to the library manager and execute 'add Library'
    - use any know fb in the search field - in your case 'Controller_PID'
    - select the FB -> ok

    this search field is the most powerful and fastest way to add and search libraries ( even if you know only parts like PID in your case, unbeatable)
    See the documentation in the library for these fb's.

    IMG: AddLibraryButton.png

    IMG: AddLibrary_by_search_fb.png

    IMG: AddLibraryCtrlLib.png

     
  • sherry - 2019-11-28

    Is normal this message always pop-out whenever I double-click?

    "No source code available for this object because it is in the compiled library 'controllooplibrary, 1.0.0.0 (3s - smart software solutions gmbh)'. Do you want to browse for the original library in order to display the source code?"

    Where can I get the source code?

    Edit: Ok, now I get it how to call it into the program. Right click > Insert box > select controller.

     
  • sherry - 2019-12-02

    Hi,

    I have an Opto22 groov that will be use as controller in my project.
    I'd like to mimic a Yokogawa controller for simple PID function.

    What is the difference of the PID controller in Util library and ControlLoop library?

    Do I need to purchase anyhting? Like license or libraries etc? Previously, I try to learn BACnet using codesys, but I couldn't add the Bacnet object. It wouldn't appear for selection. I've already update my codesys to latest version but still the same. Then I saw a Bacnet SL product at codesys store and thought do i need to purchase this first before I can use bacnet on codesys?

    So there is a bit of confusion of how to configure using codesys, do i need to purchase or can I try run a simulation?

     
  • eschwellinger

    eschwellinger - 2019-12-02

    Hi,

    the difference between Util and Controler Loop library is, it is a new development,
    due the fact that many users ask for more features and better documentation.

    In general you need to check your used controller if there are licenses for products embedded or need to purchase then.
    All product with 'SL' - Single lincense in the CODESYS store need to be licensed per plc ( in the plc) therefore you need to check additional if your selected plc does support single licensing either by runtime key or soft container.

    If you have the plc, you could check the embedded license by the device reader command.

    Using Bacnet is from that point special that you need additional components in the runtime system.
    This I would recommend to as you manufaturer.( If these components are embedded)

    You could use CODESYS without buying anything if you use the simulation or even if you use the installed plc or use and other CODESYS store 'SL' runtime.
    All of the run for two hours without a icense.

    BR
    Edwin

    IMG: DeviceReader.png

     
  • sherry - 2020-01-21

    Zitat:
    "No source code available for this object because it is in the compiled library 'controllooplibrary, 1.0.0.0 (3s - smart software solutions gmbh)'. Do you want to browse for the original library in order to display the source code?"

    It always appear when I try to login. Where can I get the source code?

     
  • i-campbell

    i-campbell - 2020-01-22

    That comes up when an exception has occurred in the controller.
    There is no released source code for this library, and in fact for most libraries.
    So do you want to search for the library? You will have to answer "No".
    How can you track down the error? While online to the faulted controller, hit View > Call Stack. You should then be able to distinguish between what part of the stack is in the compiled library and which part is in your project.
    You will of course find an example project and .chm help file in the %USERPROFILE%\CODESYS Examples\Control Loop Library\ directory.

    more on the call stack function here:
    https://help.codesys.com/webapp/_cds_cm ... n=3.5.15.0

    you can also analyze this later by taking a core dump and loading it into the ide later.
    https://help.codesys.com/webapp/_cds_us ... n=3.5.15.0 m

     

Log in to post a comment.