Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Structuring of program

somlioy
2018-11-30
2018-11-30
  • somlioy - 2018-11-30

    Iam to make a simple plant with multiple process lines. Each process line consists of a pump driven by a VFD over modbus and a pressure transmitter. A PID is controlling the motor speed to keep a constant pressure.

    I'm thinking a function block for each process line, such that a process line can easily be intiated with the required content.
    As I mentioned the VFD has modbus TCP communication, and hence has several process words and a status word associated with it.

    The pressure transmitter is a simple 4-20mA sensor.

    Everything is to be controlled from a visu, no external control.

     
  • Anonymous - 2018-11-30

    Originally created by: rickj

    1. Many people define global tags using the % placeholder for the address and then use the codesys I/O assignment tools to bind the actual I/O points to the tags.

    2. If it were me I would build simulators for each of the lines so I could test everything without any I/O. In this case I/O points would be connected to the simulator and virtual I/O points would be connected between simulator and control function blocks. When simulator is disabled I/O is passed to/from the control FB. When it's enabled then feedbacks are supplied by the simulator rather than I/O and control outputs are sent to the simulator rather than written to outputs.

    3. There is an art to making FBs, or at least there is for good ones. Think hard and long how best to decompose the problem. Don't use more than 2 or 3 levels of inheritance, unless you really know what you're doing.

    4. Consider using program POUs for each line and then use a couple of your custom FBs in the program. This way local variable scope can be used for tuneup constants and intermediate variables. The program can then be copy/pasted for the next line and then edited for any differences.

     

Log in to post a comment.