Preparation
Before you get started
Data security: In order to minimize the risk of data security breaches, we recommend the following organizational and technical measures:
Avoid access to the PLC and control networks from open networks and the Internet.
Use a VPN for remote access.
Install a firewall.
If you want to publish your visualization on the web, then set a password to prevent unauthorized access.
Use the newest versions of the gateway server and web server.
Installing CODESYS
Tip
The installation includes the development system and the CODESYS Gateway and CODESYS Control Win, whose services are accessible in the Windows taskbar. These three programs are necessary in order to simulate a controller on your computer.
Contents of your first project
In this tutorial, you will program a simple refrigerator controller. In addition to the sample project, which you will create here step by step, the finished project contains a complete visualization with operation and diagnosis. The finished RefrigeratorControl.projectarchive
project can be found in the CODESYS installation directory in the Projects
directory.
As with a conventional refrigerator, the temperature is specified by the user via a rotary control.
The refrigerator determines the actual temperature using a sensor. When it is too high, the refrigerator starts the compressor with an adjustable delay.
The compressor cools until the desired temperature is reached, minus a hysteresis of 1 degree. The hysteresis is intended to prevent the actual temperature from fluctuating too much around the set temperature, which would result in the compressor constantly switching itself off and on.
When the door is open, a lamp lights up inside the refrigerator. When the door is open too long, a beeping audible signal sounds.
If the compressor does not reach the set temperature despite activity of the motor over a long period of time, then the buzzer emits a steady audible signal.
Engineering:
The cooling activity is controlled in the main program of the application. The signal management is controlled in another POU. The required standard function blocks are available in the Standard
library. Because no physical temperature sensors and no physical actuators are connected in this sample project, you will also write a program to simulate the increase and decrease of the temperature. This will allow you to monitor the operation of the refrigerator controller afterwards in online mode.
Variables that are to be used by all POUs need to be defined in a global variable list.
Starting CODESYS Development System
You have installed the CODESYS Development System and launched it with the CODESYS <current version>" default profile. The frame window of the development system opens with the standard menu bar: No project is open yet.