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'?> <?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"> <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"/> <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> <coordinateInfo>
<fbd> <fbd>
<scaling x="0" y="0"/> <scaling x="0" y="0"/>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<localVars> <localVars>
<variable name="CounterST0"> <variable name="CounterST0">
<type> <type>
<derived name="CounterST"/> <derived name="OILineST"/>
</type> </type>
</variable> </variable>
</localVars> </localVars>
...@@ -51,10 +51,10 @@ ...@@ -51,10 +51,10 @@
<comment localId="1" height="143" width="201"> <comment localId="1" height="143" width="201">
<position x="566" y="75"/> <position x="566" y="75"/>
<content> <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> </content>
</comment> </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"/> <position x="288" y="192"/>
<inputVariables> <inputVariables>
<variable formalParameter="Reset"> <variable formalParameter="Reset">
...@@ -119,15 +119,8 @@ ...@@ -119,15 +119,8 @@
</FBD> </FBD>
</body> </body>
</pou> </pou>
<pou name="CounterST" pouType="functionBlock"> <pou name="OILineST" pouType="functionBlock">
<interface> <interface>
<inputVars>
<variable name="Reset">
<type>
<BOOL/>
</type>
</variable>
</inputVars>
<outputVars> <outputVars>
<variable name="Out1"> <variable name="Out1">
<type> <type>
...@@ -141,29 +134,41 @@ ...@@ -141,29 +134,41 @@
</variable> </variable>
</outputVars> </outputVars>
<localVars> <localVars>
<variable name="Cnt0"> <variable name="tick_counter">
<type> <type>
<INT/> <INT/>
</type> </type>
<initialValue>
<simpleValue value="0"/>
</initialValue>
<documentation>
<xhtml:p><![CDATA[Cycles counter]]></xhtml:p>
</documentation>
</variable> </variable>
</localVars> <variable name="oi_counter">
<externalVars>
<variable name="ResetCounterValue">
<type> <type>
<INT/> <INT/>
</type> </type>
<initialValue>
<simpleValue value="0"/>
</initialValue>
<documentation>
<xhtml:p><![CDATA[Cycles counter]]></xhtml:p>
</documentation>
</variable> </variable>
<variable name="OI_sensor_counter"> </localVars>
<externalVars>
<variable name="OI_sensor_shape">
<type> <type>
<LREAL/> <LREAL/>
</type> </type>
</variable> </variable>
<variable name="VFD_relay0"> <variable name="Conveyor_relay0">
<type> <type>
<DINT/> <DINT/>
</type> </type>
</variable> </variable>
<variable name="Air_Valve_Relay0"> <variable name="Separator_relay1">
<type> <type>
<DINT/> <DINT/>
</type> </type>
...@@ -172,20 +177,21 @@ ...@@ -172,20 +177,21 @@
</interface> </interface>
<body> <body>
<ST> <ST>
<xhtml:p><![CDATA[(* this will always switch on VFD_relay0 which controls conveyor line*) <xhtml:p><![CDATA[(* this will always switch on Conveyor_relay0 which controls conveyor line*)
VFD_relay0 := 1; Conveyor_relay0 := 1;
IF OI_sensor_counter=3.0 THEN (* measure ticks of the PLC program *)
(* a circle was recognized thus switch ON air valve *) tick_counter := tick_counter + 1;
Air_Valve_Relay0 := 1;
END_IF;
IF OI_sensor_counter=0.0 OR OI_sensor_counter=1.0 OR OI_sensor_counter=2.0 THEN IF OI_sensor_shape=3.0 THEN
(* a rectange / triangle or nothing was recognized thus switch OFF air valve *) (* a circle was recognized thus switch ON selector *)
Air_Valve_Relay0 := 0; Separator_relay1 := 1;
END_IF; 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> </ST>
</body> </body>
</pou> </pou>
...@@ -195,20 +201,12 @@ END_IF; ...@@ -195,20 +201,12 @@ END_IF;
<configurations> <configurations>
<configuration name="config"> <configuration name="config">
<resource name="resource1"> <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"/> <pouInstance name="instance0" typeName="plc_prg"/>
</task> </task>
</resource> </resource>
<globalVars> <globalVars>
<variable name="ResetCounterValue"> <variable name="OI_sensor_shape" address="%IL1.2">
<type>
<INT/>
</type>
<initialValue>
<simpleValue value="0"/>
</initialValue>
</variable>
<variable name="OI_sensor_counter" address="%IL1.2">
<type> <type>
<LREAL/> <LREAL/>
</type> </type>
...@@ -216,20 +214,20 @@ END_IF; ...@@ -216,20 +214,20 @@ END_IF;
<xhtml:p><![CDATA[OPC UA optical shape sensor]]></xhtml:p> <xhtml:p><![CDATA[OPC UA optical shape sensor]]></xhtml:p>
</documentation> </documentation>
</variable> </variable>
<variable name="VFD_relay0" address="%QD0.0"> <variable name="Conveyor_relay0" address="%QD0.0">
<type> <type>
<DINT/> <DINT/>
</type> </type>
<documentation> <documentation>
<xhtml:p><![CDATA[VFD relay 0 (drive motor)]]></xhtml:p> <xhtml:p><![CDATA[ relay 0 (conveyor drive motor)]]></xhtml:p>
</documentation> </documentation>
</variable> </variable>
<variable name="Air_Valve_Relay0" address="%QD0.1"> <variable name="Separator_relay1" address="%QD0.1">
<type> <type>
<DINT/> <DINT/>
</type> </type>
<documentation> <documentation>
<xhtml:p><![CDATA[relay 0 (air valve)]]></xhtml:p> <xhtml:p><![CDATA[relay 1 (separator)]]></xhtml:p>
</documentation> </documentation>
</variable> </variable>
</globalVars> </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