Commit 845c4a4c authored by Ivan Tyagov's avatar Ivan Tyagov

First POC of mini conveyor PLC.

parent 2ae4060e
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2021-05-14T14:33:11"/>
<contentHeader name="Counter (OSIE)" modificationDateTime="2024-05-22T13:47:43">
<contentHeader name="OILine" modificationDateTime="2024-06-18T16:11:18">
<coordinateInfo>
<fbd>
<scaling x="0" y="0"/>
......@@ -41,7 +41,7 @@
<localVars>
<variable name="CounterST0">
<type>
<derived name="CounterST"/>
<derived name="OILineST"/>
</type>
</variable>
</localVars>
......@@ -51,10 +51,10 @@
<comment localId="1" height="143" width="201">
<position x="566" y="75"/>
<content>
<xhtml:p><![CDATA[This PLC controls a real production line which can select objects by shape and blow them off the line.]]></xhtml:p>
<xhtml:p><![CDATA[This PLC controls a real production line which can select objects by shape and separate them on the line.]]></xhtml:p>
</content>
</comment>
<block localId="2" typeName="CounterST" instanceName="CounterST0" executionOrderId="0" height="109" width="99">
<block localId="2" typeName="OILineST" instanceName="CounterST0" executionOrderId="0" height="109" width="99">
<position x="288" y="192"/>
<inputVariables>
<variable formalParameter="Reset">
......@@ -119,15 +119,8 @@
</FBD>
</body>
</pou>
<pou name="CounterST" pouType="functionBlock">
<pou name="OILineST" pouType="functionBlock">
<interface>
<inputVars>
<variable name="Reset">
<type>
<BOOL/>
</type>
</variable>
</inputVars>
<outputVars>
<variable name="Out1">
<type>
......@@ -141,29 +134,41 @@
</variable>
</outputVars>
<localVars>
<variable name="Cnt0">
<variable name="tick_counter">
<type>
<INT/>
</type>
<initialValue>
<simpleValue value="0"/>
</initialValue>
<documentation>
<xhtml:p><![CDATA[Cycles counter]]></xhtml:p>
</documentation>
</variable>
</localVars>
<externalVars>
<variable name="ResetCounterValue">
<variable name="oi_counter">
<type>
<INT/>
</type>
<initialValue>
<simpleValue value="0"/>
</initialValue>
<documentation>
<xhtml:p><![CDATA[Cycles counter]]></xhtml:p>
</documentation>
</variable>
<variable name="OI_sensor_counter">
</localVars>
<externalVars>
<variable name="OI_sensor_shape">
<type>
<LREAL/>
</type>
</variable>
<variable name="VFD_relay0">
<variable name="Conveyor_relay0">
<type>
<DINT/>
</type>
</variable>
<variable name="Air_Valve_Relay0">
<variable name="Separator_relay1">
<type>
<DINT/>
</type>
......@@ -172,20 +177,21 @@
</interface>
<body>
<ST>
<xhtml:p><![CDATA[(* this will always switch on VFD_relay0 which controls conveyor line*)
VFD_relay0 := 1;
<xhtml:p><![CDATA[(* this will always switch on Conveyor_relay0 which controls conveyor line*)
Conveyor_relay0 := 1;
IF OI_sensor_counter=3.0 THEN
(* a circle was recognized thus switch ON air valve *)
Air_Valve_Relay0 := 1;
END_IF;
(* measure ticks of the PLC program *)
tick_counter := tick_counter + 1;
IF OI_sensor_counter=0.0 OR OI_sensor_counter=1.0 OR OI_sensor_counter=2.0 THEN
(* a rectange / triangle or nothing was recognized thus switch OFF air valve *)
Air_Valve_Relay0 := 0;
IF OI_sensor_shape=3.0 THEN
(* a circle was recognized thus switch ON selector *)
Separator_relay1 := 1;
END_IF;
]]></xhtml:p>
IF OI_sensor_shape=0.0 OR OI_sensor_shape=1.0 OR OI_sensor_shape=2.0 THEN
(* a rectange / triangle or nothing was recognized thus switch OFF selector *)
Separator_relay1 := 0;
END_IF;]]></xhtml:p>
</ST>
</body>
</pou>
......@@ -195,20 +201,12 @@ END_IF;
<configurations>
<configuration name="config">
<resource name="resource1">
<task name="task0" priority="0" interval="T#50ms">
<task name="task0" priority="0" interval="T#20ms">
<pouInstance name="instance0" typeName="plc_prg"/>
</task>
</resource>
<globalVars>
<variable name="ResetCounterValue">
<type>
<INT/>
</type>
<initialValue>
<simpleValue value="0"/>
</initialValue>
</variable>
<variable name="OI_sensor_counter" address="%IL1.2">
<variable name="OI_sensor_shape" address="%IL1.2">
<type>
<LREAL/>
</type>
......@@ -216,20 +214,20 @@ END_IF;
<xhtml:p><![CDATA[OPC UA optical shape sensor]]></xhtml:p>
</documentation>
</variable>
<variable name="VFD_relay0" address="%QD0.0">
<variable name="Conveyor_relay0" address="%QD0.0">
<type>
<DINT/>
</type>
<documentation>
<xhtml:p><![CDATA[VFD relay 0 (drive motor)]]></xhtml:p>
<xhtml:p><![CDATA[ relay 0 (conveyor drive motor)]]></xhtml:p>
</documentation>
</variable>
<variable name="Air_Valve_Relay0" address="%QD0.1">
<variable name="Separator_relay1" address="%QD0.1">
<type>
<DINT/>
</type>
<documentation>
<xhtml:p><![CDATA[relay 0 (air valve)]]></xhtml:p>
<xhtml:p><![CDATA[relay 1 (separator)]]></xhtml:p>
</documentation>
</variable>
</globalVars>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment