Manual PLC control - easymetal/Korrostop4.0-EN GitHub Wiki

PLC Connection

PLC means Programmable Logic Controller. Korrostop4.0 supports 2 digital Outputs that can be connected to a PLC or any kind of electronic. With the screen Config / PLC the behaviour of this two channels can be configured.

This Chapture describes, how you can connect and configure this feature.

Hardware

Internal Circuit

Korrostop4.0 have two potential free connections, that means four pins where you can connect your hardware. Every connection allows a maximum of 20 milli Ampere current and 70 Volts (details you will find here). There are also two pins connected to the internal Power Source. They supply 5.3V with a maximum of 100 mA current. There is no over load protection. Here you see the Schematic of the internal circuit:

 KS40_internal.JPG

The following photo show the physical Connector:

 KS40_Connect.jpg

Connect LED

A small demo to show, how to connect LED to Korrostop4.0.

 KS40_PLC_LED.jpg

BOM:

  • 2 x LED RED LOW POWER
  • 2 x Resistor 220 Ohm / 0.125W (Red, Red, Brown and Silver or Gold)
  • Some Wires

Connect Low Power Relays

If you do not need strong Relay you see here how to work with Low Power Relays.  KS40_PLC_LPR.jpg

BOM:

  • 2 x Diodes for removing reverse pulse
  • 2 x Relay 4.4 to 5V / <=20mA (Input)
  • External power source
  • Some Wires

Connect Stronger Relay

For more power, you will find this example useful.

 KS40_PLC_R.jpg

BOM:

  • 2 x Diodes for removing reverse pulse
  • 2 x Relay (user defined)
  • 2 x Resistor 560 Ohm / 0.125 W (Green, Blue, Brown and Silver or Gold)
  • 2 x Transistor NPN (user defined)
  • External power source
  • Some Wires

Connect Relay Modules

You also will find small modules called break out boards, that will do an excellent job for a small price.

The easymetal internal training board

This is the schematic for our internal test and training board. There are some diodes and relays for testing and training. It has the look of a tiny traffic light.

 KS40_PLC_test.jpg

 KS40_PLC_testhw.jpg

The total current for this schema is more than 100 mA (about 240 mA). This can NOT be used for production system. The reason is, that we do not use the WiFi and LAN combined with this training board. In this scenario, we use less current internally.

BOM:

  • 2 x K1,K2: DIP-16_W7.62mm_Socket_LongPads, G5V-2
  • 2 x D1,D5: D_SMA, SS14
  • 3 x D2,D6,D9: LED_0603, LED RED
  • 2 x D3,D7: LED_D5.0mm, LED RED
  • 2 x D4,D8: LED_D5.0mm, LED GREEN
  • 1 x J1: XW4L-06A1-H1, Conn_01x06|XW4L-06A1-H1
  • 2 x Q1,Q2: SOT-23, SS8050-G
  • 9 x R1,R2,R3,R4,R5,R6,R7,R8,R9: R_0603, 560R/100mW
  • 2 x J4,J5: Pin_Header_Straight_1x06_Pitch2.54mm, Conn_01x06

Configuration

There are two possibilities to configure then PLC Output:

  • Bind it to the Colour Schema. Binding to the Colour Schema means that you can configure your system to set your output for a channel to high, if there is a specified colour for Output, Input Korrostop, Temperature or Flow.
  • Bind it to Telemetry. Binding to Telemetry means that you can configure your system to set your output for a channel to high, if a specified value for Output, Input Korrostop, Temperature or Flow. is measured.

You can make this decision for every channel in depended.

Binding your external signal to the Colour Schema have the benefit, that you have straight forward rules for your colour symbolic. And it is easy to configure. The trash holds for the colour can be configured for the screen and your external signal at Configuration / Alarm.

If you bind your external signals to Telemetry you have more control to the behaviour. But it is a little bit more complex to configure it.

But both alternatives are configured with the same screen. Enter your expression for one or both channels. If the expression is too large for text box, you can split it in to parts. Internal they are connected to one string.

Expressions

Colour Binding

Basic example:

For PLC1: (get("telemetry","flow_color")!=GREEN)&(("telemetry","condin")>5.0)

For PLC2: get("telemetry","condout_color")=RED

With the function get you can access internal values. It needs two parameters: The Domain and the key as string. Our Domain is “telemetry” and the key "condout_color". The Operator = is a Boolean operator and compares the internal constant YELLOW with the returned value of the function get. If this is true, the output will be triggered.

Possible constants, parameters and operators:

Telemetry Colour Parameters:

  • condin_color Conductance for incoming Water
  • condout_color Conductance for outgoing Water
  • tempwater_color Temperature of water
  • korrostop_color Percent usage of IONISER
  • flow_color Water flow

Operators:

  • = Equal
  • != Not Equal

Colour Constants:

  • RED for Red Colour
  • YELLOW for Yellow Colour
  • GREEN for Green Colour
  • COLORNONE in very rare cases where no colour can be calculated

Telemetry Binding

Basic example:

For PLC1: get("telemetry","condout")<1

For PLC2: get("telemetry","condout")>5.2

It looks very similar to the colour binding example but “_color” is missing and it the comparison is with a number. Also the equal operator has change.

There is a very useful function for comparing values and avoid flickering: Trigger

Syntax: bool trigger(bool currentstate, number value, number minthreshold, number maxthreshold)

For further information see this chapter.

Possible parameters and operators:

Telemetry Parameters:

  • condin Conductance for incoming Water
  • condin_max_value Max Conductance for incoming Water
  • condin_min_value Min Conductance for incoming Water
  • condout Conductance for outgoing Water
  • condout_max_value Max Conductance for outgoing Water
  • condout_min_value Min Conductance for outgoing Water
  • flow_pertime Water flow per time
  • flow_volume Water flow total
  • korrostop Percent usage of IONISER
  • tempchip Temperature of internal chip
  • tempwater Temperature of water
  • counter Every Telemetry Package (single Measurement) has a number
  • ioniser Configured IONISER
  • source The Telemetry Source (measure = 0, simulator = 1, sdcard = 2)
  • now Current Date Time
  • condin_min_time Time when Min Conductance for incoming Water was reached
  • condin_max_time Time when Max Conductance for incoming Water was reached
  • condout_min_time Time when Min Conductance for outgoing Water was reached
  • condout_max_time Time when Max Conductance for outgoing Water was reached
  • system_start_time
  • blink True if the Display is blinking
  • plc1 Current Value of PLC Channel 1
  • plc2 Current Value of PLC Channel 2

Operators:

Math:

  • + Plus: 1 + 2 => 3
  • - Minus: 3 - 1 => 2
  • * Multiply: 2 * 3 => 6
  • / Divide: 7 / 2 => 3.5
  • % Modulo (Rest of Division): 7 % 3 => 1
  • ( Parenthesis ): (1 + 2) => 3

E.g.: 2 + 3 * 4 => 14; (2 + 3) * 4 => 20;

Boolean:

  • ! Not: ! true => false; ! false => true; ! ! true => true;
  • & And: true & true => true; true & false => false; false & true => false; false & false => false;
  • | Or: true | true => true; true | false => true; false | true => true; false> | false => false;

Comparison:

  • = Equal
  • != Not Equal
  • < Less than
  • > Greater than
  • <= Less than or Equal
  • >= Greater than or Equal

E.g.: ((1 < (5+3)) & (2>1)) | true => true

Other Bindings

Generally there can be used every function that evaluate to an Boolean Value. There are a lot of Functions, Constants and Language Constructs like if then else endif or user defined variables.

For further information see this chapter.