[New] Added ExamplePlcConveyorPlcService for 4 conveyor transferring
This commit is contained in:
parent
3da8df695e
commit
8d5b7dc4c2
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<StrolchModel xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd">
|
||||
|
||||
<Resource Id="PlcLogicalDevice" Name="PlcLogicalDevice Template" Type="Template">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Index="5" Type="String" Value=""/>
|
||||
<Parameter Id="group" Name="Group" Index="20" Type="String" Value="default"/>
|
||||
<Parameter Id="index" Name="Index" Index="30" Type="Integer" Value="0"/>
|
||||
</ParameterBag>
|
||||
<ParameterBag Id="relations" Name="Relations" Type="Relations">
|
||||
<Parameter Id="addresses" Name="Addresses" Index="10" Type="StringList" Interpretation="Resource-Ref" Uom="PlcAddress" Value=""/>
|
||||
<Parameter Id="telegrams" Name="Telegrams" Index="20" Type="StringList" Interpretation="Resource-Ref" Uom="PlcTelegram" Value=""/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="PlcAddress" Name="PlcAddress Template" Type="Template">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Index="5" Type="String" Value=""/>
|
||||
<Parameter Id="address" Name="HW Address" Index="10" Type="String" Interpretation="PlcConnection" Value=""/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Index="20" Type="String" Value=""/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Index="30" Type="String" Value=""/>
|
||||
<Parameter Id="index" Name="Index" Index="40" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="PlcTelegram" Name="PlcTelegram Template" Type="Template">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Index="5" Type="String" Value=""/>
|
||||
<Parameter Id="address" Name="HW Address" Index="10" Type="String" Interpretation="PlcConnection" Value=""/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Index="20" Type="String" Value=""/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Index="30" Type="String" Value=""/>
|
||||
<Parameter Id="index" Name="Index" Index="40" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
</StrolchModel>
|
|
@ -2,145 +2,28 @@
|
|||
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
|
||||
xsi:schemaLocation="https://strolch.li/xsd/StrolchModel-1.6.xsd StrolchModel-1.6.xsd">
|
||||
|
||||
<!--
|
||||
Simple logger output connection
|
||||
-->
|
||||
<Resource Id="loggerOutput" Name="Logger PLC Connection" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.connections.LoggerOutConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<IncludeFile file="Templates.xml"/>
|
||||
|
||||
<IncludeFile file="strolch-plc-example.xml"/>
|
||||
<IncludeFile file="strolch-plc-example-connections.xml"/>
|
||||
|
||||
<!--
|
||||
Virtual connections
|
||||
PLC to store connection state to server
|
||||
-->
|
||||
<Resource Id="virtualString" Name="Virtual String PLC Connection" Type="PlcConnection">
|
||||
<Resource Id="mfs-soh-plc01" Name="PLC" Type="Plc">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.connections.VirtualStringValueConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
<Parameter Id="connectionState" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="connectionStateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="virtualBoolean" Name="Virtual Boolean PLC Connection" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.connections.VirtualBooleanValueConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
Barcode reader connection, currently place holder with RandomString
|
||||
-->
|
||||
<Resource Id="barcodeReader" Name="Barcode Reader Connection" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.connections.RandomStringConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
Raspberry GPIO BCM Address connection
|
||||
-->
|
||||
<Resource Id="raspiBcmGpioOutput" Name="Raspi BCM GPIO Output" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.gpio.RaspiBcmGpioOutputConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="bcmOutputPins" Name="BCM Output Pins" Type="IntegerList" Value="27"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
I2C input connections
|
||||
-->
|
||||
<Resource Id="i2cInput.dev01" Name="PCF8574 Input 0x38" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.i2c.PCF8574InputConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
<Parameter Id="i2cBus" Name="I2C Bus" Type="Integer" Value="1"/>
|
||||
<Parameter Id="addresses" Name="Addresses" Type="IntegerList" Value="0x38"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="true"/>
|
||||
<Parameter Id="interruptPinPullResistance" Name="Raspi Interrupt PinPullResistance" Type="String" Value="PULL_UP"/>
|
||||
<Parameter Id="interruptChangeState" Name="Raspi Interrupt Change State" Type="String" Value="HIGH"/>
|
||||
<Parameter Id="interruptBcmPinAddress" Name="Raspi BCM Interrupt Pin" Type="Integer" Value="17"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
I2C output connections
|
||||
-->
|
||||
<Resource Id="i2cOutput.dev01" Name="PCF8574 Output 0x21" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.i2c.PCF8574OutputConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
<Parameter Id="i2cBus" Name="I2C Bus" Type="Integer" Value="1"/>
|
||||
<Parameter Id="addresses" Name="Addresses" Type="IntegerList" Value="0x21"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
Simple toggler device
|
||||
-->
|
||||
<Resource Id="toggler" Name="Toggler 01" Type="PlcLogicalDevice">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="group" Name="Group" Type="String" Value="Entry"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
<ParameterBag Id="relations" Name="Relations" Type="Relations">
|
||||
<Parameter Id="addresses" Name="Addresses" Type="StringList" Interpretation="Resource-Ref" Uom="PlcAddress" Value="addrTogglerOn"/>
|
||||
<Parameter Id="telegrams" Name="Telegrams" Type="StringList" Interpretation="Resource-Ref" Uom="PlcTelegram"
|
||||
Value="telToggleTogglerOn, telToggleTogglerOff"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrTogglerOn" Name="Toggler - On" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="loggerOutput"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="Toggler"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="On"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="telToggleTogglerOn" Name="Toggler - On" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="loggerOutput"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="Toggler"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="On"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="true"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="telToggleTogglerOff" Name="Toggler - Off" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="loggerOutput"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="Toggler"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="Off"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="20"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
PLC State
|
||||
-->
|
||||
<Resource Id="plc" Name="PLC" Type="PlcLogicalDevice">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="group" Name="Group" Type="String" Value="Startup"/>
|
||||
<Parameter Id="group" Name="Group" Type="String" Value="99 Startup"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="999999"/>
|
||||
</ParameterBag>
|
||||
<ParameterBag Id="relations" Name="Relations" Type="Relations">
|
||||
|
@ -150,20 +33,19 @@
|
|||
Value="telPlcStarted, telPlcStopped"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrPlcConnected" Name="PLC - Started" Type="PlcAddress">
|
||||
<Resource Id="addrPlcConnected" Name="PLC - Connected" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="virtualString"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="virtualString.plcServerConnected"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="PLC"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ServerConnected"/>
|
||||
<Parameter Id="valueType" Name="Value Type" Type="String" Interpretation="Interpretation" Uom="PlcValueType" Value="String"/>
|
||||
<Parameter Id="value" Name="Value" Type="String" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="5"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrPlcStarted" Name="PLC - Started" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="booleanConnection"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="raspiBcmGpioOutput.27"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="PLC"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="Started"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
|
@ -173,7 +55,7 @@
|
|||
</Resource>
|
||||
<Resource Id="telPlcStarted" Name="PLC - Started" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="booleanConnection"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="raspiBcmGpioOutput.27"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="PLC"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="Started"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="true"/>
|
||||
|
@ -182,7 +64,7 @@
|
|||
</Resource>
|
||||
<Resource Id="telPlcStopped" Name="PLC - Stopped" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="booleanConnection"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="raspiBcmGpioOutput.27"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="PLC"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="Stopped"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
|
@ -190,253 +72,4 @@
|
|||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
Simple conveyor
|
||||
-->
|
||||
<Resource Id="conveyor01" Name="Conveyor 01" Type="PlcLogicalDevice">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="group" Name="Group" Type="String" Value="Entry"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="20"/>
|
||||
</ParameterBag>
|
||||
<ParameterBag Id="relations" Name="Relations" Type="Relations">
|
||||
<Parameter Id="addresses" Name="Addresses" Type="StringList" Interpretation="Resource-Ref" Uom="PlcAddress"
|
||||
Value="addrConveyor01Occupied, addrConveyor01OnState"/>
|
||||
<Parameter Id="telegrams" Name="Telegrams" Type="StringList" Interpretation="Resource-Ref" Uom="PlcTelegram"
|
||||
Value="telConveyor01On, telConveyor01Off"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrConveyor01Occupied" Name="Conveyor01 - Occupied" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cInput.dev01.0.7"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="Conveyor01"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="Occupied"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrConveyor01OnState" Name="Conveyor01 - On" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.7"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="Conveyor01"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="On"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="20"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="telConveyor01On" Name="Conveyor01 - On" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.7"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="Conveyor01"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="On"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="true"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="telConveyor01Off" Name="Conveyor01 - Off" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.7"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="Conveyor01"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="Off"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="20"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
BoxFillPosition logical device
|
||||
-->
|
||||
<Resource Id="BoxFillPosition" Name="Box Fill Position" Type="PlcLogicalDevice">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="group" Name="Group" Type="String" Value="Filling"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
<ParameterBag Id="relations" Name="Relations" Type="Relations">
|
||||
<Parameter Id="addresses" Name="Addresses" Type="StringList" Interpretation="Resource-Ref" Uom="PlcAddress"
|
||||
Value="addrEntryOccupied, addrBoxFillPositionOccupied, addrExitOccupied, addrEntryStopperOpened, addrEntryStopperClosed, addrEntryStopperOpen, addrExitStopperOpened, addrExitStopperClosed, addrExitStopperOpen, addrConveyorRunning, addrBarcodeReader"/>
|
||||
<Parameter Id="telegrams" Name="Telegrams" Type="StringList" Interpretation="Resource-Ref" Uom="PlcTelegram"
|
||||
Value="telConveyorRun, telConveyorStop, telEntryStopperOpen, telEntryStopperClose, telExitStopperOpen, telExitStopperClose, telReadBarcode"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!-- FillPosition addresses -->
|
||||
<Resource Id="addrEntryOccupied" Name="BoxFillPosition - EntryOccupied" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cInput.dev01.0.0"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="EntryOccupied"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrBoxFillPositionOccupied" Name="BoxFillPosition - Occupied" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cInput.dev01.0.1"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="Occupied"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="20"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrExitOccupied" Name="BoxFillPosition - ExitOccupied" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cInput.dev01.0.2"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ExitOccupied"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="30"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="addrEntryStopperOpened" Name="BoxFillPosition - EntryStopperOpened" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cInput.dev01.0.3"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="EntryStopperOpened"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="40"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrEntryStopperClosed" Name="BoxFillPosition - EntryStopperClosed" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cInput.dev01.0.4"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="EntryStopperClosed"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="50"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrEntryStopperOpen" Name="BoxFillPosition - EntryStopperOpen" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.0"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="EntryStopperOpen"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="60"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="addrExitStopperOpened" Name="BoxFillPosition - ExitStopperOpened" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cInput.dev01.0.5"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ExitStopperOpened"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="70"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrExitStopperClosed" Name="BoxFillPosition - ExitStopperClosed" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cInput.dev01.0.6"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ExitStopperClosed"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="80"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="addrExitStopperOpen" Name="BoxFillPosition - ExitStopperOpen" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.1"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ExitStopperOpen"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="90"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="addrConveyorRunning" Name="BoxFillPosition - ConveyorRunning" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.2"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ConveyorRunning"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="100"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="addrBarcodeReader" Name="BoxFillPosition - Barcode" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="barcodeReader"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="Barcode"/>
|
||||
<Parameter Id="value" Name="Value" Type="String" Value=""/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="110"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!-- FillPosition telegrams -->
|
||||
<Resource Id="telConveyorRun" Name="BoxFillPosition - ConveyorRun" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.2"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ConveyorRun"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="true"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="10"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="telConveyorStop" Name="BoxFillPosition - ConveyorStop" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.2"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ConveyorStop"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="20"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="telEntryStopperOpen" Name="BoxFillPosition - EntryStopperOpen" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.0"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="EntryStopperOpen"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="true"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="30"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="telEntryStopperClose" Name="BoxFillPosition - EntryStopperClose" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.0"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="EntryStopperClose"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="40"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="telExitStopperOpen" Name="BoxFillPosition - ExitStopperOpen" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.1"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ExitStopperOpen"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="true"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="50"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="telExitStopperClose" Name="BoxFillPosition - ExitStopperClose" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="i2cOutput.dev01.0.1"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ExitStopperClose"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="60"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<Resource Id="telReadBarcode" Name="BoxFillPosition - ReadBarcode" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Value="barcodeReader"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Value="BoxFillPosition"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Value="ReadBarcode"/>
|
||||
<Parameter Id="value" Name="Value" Type="String" Value="DoRead"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Value="70"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
</StrolchModel>
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<StrolchModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://strolch.li/xsd/StrolchModel-1.6.xsd"
|
||||
xsi:schemaLocation="https://strolch.li/xsd/StrolchModel-1.6.xsd StrolchModel-1.6.xsd">
|
||||
|
||||
<!--
|
||||
Barcode reader connection, currently place holder with RandomString
|
||||
-->
|
||||
<Resource Id="barcodeReader01" Name="Barcode Reader 01" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.connections.RandomStringConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
Raspberry GPIO BCM Address connection
|
||||
-->
|
||||
<Resource Id="raspiBcmGpioOutput" Name="Raspi BCM GPIO Output" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.gpio.RaspiBcmGpioOutputConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
<Parameter Id="bcmOutputPins" Name="BCM Output Pins" Type="IntegerList" Value="27"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
I2C input connections
|
||||
-->
|
||||
<Resource Id="i2cInput.dev01" Name="PCF8574 Input 0x38" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.i2c.PCF8574InputConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
<Parameter Id="i2cBus" Name="I2C Bus" Type="Integer" Value="1"/>
|
||||
<Parameter Id="addresses" Name="Addresses" Type="IntegerList" Value="0x38"/>
|
||||
<Parameter Id="verbose" Name="Verbose" Type="Boolean" Value="true"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="true"/>
|
||||
<Parameter Id="interruptPinPullResistance" Name="Raspi Interrupt PinPullResistance" Type="String" Value="PULL_DOWN"/>
|
||||
<Parameter Id="interruptChangeState" Name="Raspi Interrupt Change State" Type="String" Value="HIGH"/>
|
||||
<Parameter Id="interruptBcmPinAddress" Name="Raspi BCM Interrupt Pin" Type="Integer" Value="17"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
<!--
|
||||
I2C output connections
|
||||
-->
|
||||
<Resource Id="i2cOutput.dev01" Name="PCF8574 Output 0x21" Type="PlcConnection">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="className" Name="Connection Class" Type="String" Value="li.strolch.plc.core.hw.i2c.PCF8574OutputConnection"/>
|
||||
<Parameter Id="state" Name="Connection State" Type="String" Interpretation="Enumeration" Uom="ConnectionState" Value="Disconnected"/>
|
||||
<Parameter Id="stateMsg" Name="Connection State Msg" Type="String" Interpretation="Enumeration" Uom="ConnectionState"
|
||||
Value=""/>
|
||||
<Parameter Id="i2cBus" Name="I2C Bus" Type="Integer" Value="1"/>
|
||||
<Parameter Id="addresses" Name="Addresses" Type="IntegerList" Value="0x21"/>
|
||||
<Parameter Id="inverted" Name="Inverted" Type="Boolean" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
|
||||
</StrolchModel>
|
|
@ -0,0 +1,11 @@
|
|||
Description,Type,Device,Pin,Resource,Action1,Action2,Connection,DeviceId
|
||||
Material Flow,Group,,,,,,,MaterialFlow
|
||||
Conveyor 1,Input,1,1,Conveyor01,Occupied,,i2cInput.dev01,
|
||||
Conveyor 2,Input,1,2,Conveyor02,Occupied,,i2cInput.dev01,
|
||||
Conveyor 3,Input,1,3,Conveyor03,Occupied,,i2cInput.dev01,
|
||||
Conveyor 4,Input,1,4,Conveyor04,Occupied,,i2cInput.dev01,
|
||||
Conveyor 1,Output,1,1,Conveyor01,MotorOn,MotorOff,i2cOutput.dev01,
|
||||
Conveyor 2,Output,1,2,Conveyor02,MotorOn,MotorOff,i2cOutput.dev01,
|
||||
Conveyor 3,Output,1,3,Conveyor03,MotorOn,MotorOff,i2cOutput.dev01,
|
||||
Conveyor 4,Output,1,4,Conveyor04,MotorOn,MotorOff,i2cOutput.dev01,
|
||||
BarcodeReader,BarcodeReader,,,Conveyor03,Barcode,ReadBarcode,barcodeReader01,
|
|
|
@ -0,0 +1,194 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<StrolchModel>
|
||||
<Resource Id="D_MaterialFlow" Name="MaterialFlow" Type="PlcLogicalDevice">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Material Flow"/>
|
||||
<Parameter Id="group" Name="Group" Type="String" Index="20" Value="01 Material Flow"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="30" Value="10"/>
|
||||
</ParameterBag>
|
||||
<ParameterBag Id="relations" Name="Relations" Type="Relations">
|
||||
<Parameter Id="addresses" Name="Addresses" Type="StringList" Interpretation="Resource-Ref" Uom="PlcAddress" Index="10" Value="A_Conveyor01-Occupied, A_Conveyor02-Occupied, A_Conveyor03-Occupied, A_Conveyor04-Occupied, A_Conveyor01-MotorOn, A_Conveyor02-MotorOn, A_Conveyor03-MotorOn, A_Conveyor04-MotorOn, A_Conveyor03-Barcode"/>
|
||||
<Parameter Id="telegrams" Name="Telegrams" Type="StringList" Interpretation="Resource-Ref" Uom="PlcTelegram" Index="20" Value="T_Conveyor01-MotorOn, T_Conveyor01MotorOff, T_Conveyor02-MotorOn, T_Conveyor02MotorOff, T_Conveyor03-MotorOn, T_Conveyor03MotorOff, T_Conveyor04-MotorOn, T_Conveyor04MotorOff, T_Conveyor03-Barcode"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor01-Occupied" Name="Conveyor01 - Occupied" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 1"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cInput.dev01.0.0"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor01"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="Occupied"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="10"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor02-Occupied" Name="Conveyor02 - Occupied" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 2"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cInput.dev01.0.1"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor02"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="Occupied"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="20"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor03-Occupied" Name="Conveyor03 - Occupied" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 3"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cInput.dev01.0.2"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor03"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="Occupied"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="30"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor04-Occupied" Name="Conveyor04 - Occupied" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 4"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cInput.dev01.0.3"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor04"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="Occupied"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="40"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor01-MotorOn" Name="Conveyor01 - MotorOn" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 1"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.0"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor01"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOn"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="10"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="true"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor01MotorOff" Name="Conveyor01 - MotorOn" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 1"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.0"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor01"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOff"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="20"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor01-MotorOn" Name="Conveyor01 - MotorOn" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 1"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.0"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor01"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOn"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="50"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor02-MotorOn" Name="Conveyor02 - MotorOn" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 2"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.1"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor02"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOn"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="30"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="true"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor02MotorOff" Name="Conveyor02 - MotorOn" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 2"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.1"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor02"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOff"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="40"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor02-MotorOn" Name="Conveyor02 - MotorOn" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 2"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.1"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor02"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOn"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="60"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor03-MotorOn" Name="Conveyor03 - MotorOn" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 3"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.2"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor03"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOn"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="50"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="true"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor03MotorOff" Name="Conveyor03 - MotorOn" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 3"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.2"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor03"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOff"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="60"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor03-MotorOn" Name="Conveyor03 - MotorOn" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 3"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.2"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor03"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOn"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="70"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor04-MotorOn" Name="Conveyor04 - MotorOn" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 4"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.3"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor04"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOn"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="70"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="true"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor04MotorOff" Name="Conveyor04 - MotorOn" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 4"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.3"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor04"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOff"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="80"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor04-MotorOn" Name="Conveyor04 - MotorOn" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="Conveyor 4"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="i2cOutput.dev01.0.3"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor04"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="MotorOn"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="80"/>
|
||||
<Parameter Id="value" Name="Value" Type="Boolean" Index="100" Value="false"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="A_Conveyor03-Barcode" Name="Conveyor03 - Barcode" Type="PlcAddress">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="BarcodeReader"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="barcodeReader01"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor03"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="Barcode"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="90"/>
|
||||
<Parameter Id="value" Name="Value" Type="String" Index="100" Value="ReadBarcode"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
<Resource Id="T_Conveyor03-Barcode" Name="Conveyor03 - Barcode" Type="PlcTelegram">
|
||||
<ParameterBag Id="parameters" Name="Parameters" Type="Parameters">
|
||||
<Parameter Id="description" Name="Description" Type="String" Index="5" Value="BarcodeReader"/>
|
||||
<Parameter Id="address" Name="HW Address" Type="String" Interpretation="PlcConnection" Index="10" Value="barcodeReader01"/>
|
||||
<Parameter Id="resource" Name="Resource ID for PlcAddress" Type="String" Index="20" Value="Conveyor03"/>
|
||||
<Parameter Id="action" Name="Action ID for PlcAddress" Type="String" Index="30" Value="Barcode"/>
|
||||
<Parameter Id="index" Name="Index" Type="Integer" Index="40" Value="90"/>
|
||||
<Parameter Id="value" Name="Value" Type="String" Index="100" Value="ReadBarcode"/>
|
||||
</ParameterBag>
|
||||
</Resource>
|
||||
</StrolchModel>
|
|
@ -0,0 +1,259 @@
|
|||
package li.strolch.plc.core.service.plc;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import li.strolch.agent.api.ComponentContainer;
|
||||
import li.strolch.persistence.api.StrolchTransaction;
|
||||
import li.strolch.plc.core.PlcHandler;
|
||||
import li.strolch.plc.core.PlcService;
|
||||
import li.strolch.plc.model.PlcAddress;
|
||||
|
||||
public class ExamplePlcConveyorPlcService extends PlcService {
|
||||
|
||||
public static final String R_CONVEYOR_01 = "Conveyor01";
|
||||
public static final String R_CONVEYOR_02 = "Conveyor02";
|
||||
public static final String R_CONVEYOR_03 = "Conveyor03";
|
||||
public static final String R_CONVEYOR_04 = "Conveyor04";
|
||||
|
||||
public static final String A_OCCUPIED = "Occupied";
|
||||
public static final String A_MOTOR_ON = "MotorOn";
|
||||
public static final String A_MOTOR_OFF = "MotorOff";
|
||||
public static final String A_BARCODE = "Barcode";
|
||||
public static final String A_READ_BARCODE = "ReadBarcode";
|
||||
|
||||
private AtomicBoolean conveyor1Occupied;
|
||||
private AtomicBoolean conveyor2Occupied;
|
||||
private AtomicBoolean conveyor3Occupied;
|
||||
private AtomicBoolean conveyor4Occupied;
|
||||
|
||||
private AtomicBoolean conveyor1On;
|
||||
private AtomicBoolean conveyor2On;
|
||||
private AtomicBoolean conveyor3On;
|
||||
private AtomicBoolean conveyor4On;
|
||||
|
||||
private AtomicBoolean conveyor1WaitingForTransfer;
|
||||
private AtomicBoolean conveyor2WaitingForTransfer;
|
||||
private AtomicBoolean conveyor3WaitingForTransfer;
|
||||
|
||||
public ExamplePlcConveyorPlcService(ComponentContainer container, PlcHandler plcHandler) {
|
||||
super(container, plcHandler);
|
||||
|
||||
this.conveyor1WaitingForTransfer = new AtomicBoolean(false);
|
||||
this.conveyor2WaitingForTransfer = new AtomicBoolean(false);
|
||||
this.conveyor3WaitingForTransfer = new AtomicBoolean(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleNotification(PlcAddress address, Object value) {
|
||||
|
||||
String resource = address.resource;
|
||||
String action = address.action;
|
||||
boolean state = (boolean) value;
|
||||
|
||||
switch (resource) {
|
||||
|
||||
case R_CONVEYOR_01:
|
||||
|
||||
if (action.equals(A_OCCUPIED)) {
|
||||
conveyor1Occupied.set(state);
|
||||
handleTransfer(null, R_CONVEYOR_01, R_CONVEYOR_02, //
|
||||
null, conveyor1Occupied, conveyor2Occupied, //
|
||||
null, conveyor1On, conveyor2On, //
|
||||
null, conveyor1WaitingForTransfer);
|
||||
} else {
|
||||
logger.error("Unhandled action " + resource + "-" + action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case R_CONVEYOR_02:
|
||||
|
||||
if (action.equals(A_OCCUPIED)) {
|
||||
conveyor2Occupied.set(state);
|
||||
handleTransfer(R_CONVEYOR_01, R_CONVEYOR_02, R_CONVEYOR_03, //
|
||||
conveyor1Occupied, conveyor2Occupied, conveyor3Occupied, //
|
||||
conveyor1On, conveyor2On, conveyor3On, //
|
||||
conveyor1WaitingForTransfer, conveyor2WaitingForTransfer);
|
||||
} else {
|
||||
logger.error("Unhandled action " + resource + "-" + action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case R_CONVEYOR_03:
|
||||
|
||||
if (action.equals(A_OCCUPIED)) {
|
||||
conveyor3Occupied.set(state);
|
||||
handleTransfer(R_CONVEYOR_02, R_CONVEYOR_03, R_CONVEYOR_04, //
|
||||
conveyor2Occupied, conveyor3Occupied, conveyor4Occupied, //
|
||||
conveyor2On, conveyor3On, conveyor4On, //
|
||||
conveyor2WaitingForTransfer, conveyor3WaitingForTransfer);
|
||||
} else {
|
||||
logger.error("Unhandled action " + resource + "-" + action);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case R_CONVEYOR_04:
|
||||
|
||||
if (action.equals(A_OCCUPIED)) {
|
||||
conveyor4Occupied.set(state);
|
||||
handleTransfer(R_CONVEYOR_03, R_CONVEYOR_04, null, //
|
||||
conveyor3Occupied, conveyor4Occupied, null, //
|
||||
conveyor3On, conveyor4On, null, //
|
||||
conveyor3WaitingForTransfer, null);
|
||||
} else {
|
||||
logger.error("Unhandled action " + resource + "-" + action);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void handleTransfer(String previous, String current, String next, //
|
||||
AtomicBoolean previousOccupied, AtomicBoolean currentOccupied, AtomicBoolean nextOccupied, //
|
||||
AtomicBoolean previousOn, AtomicBoolean currentOn, AtomicBoolean nextOn, //
|
||||
AtomicBoolean previousWaitingForTransfer, AtomicBoolean currentWaitingForTransfer) {
|
||||
|
||||
if (currentOccupied.get()) {
|
||||
|
||||
// handle current conveyor is now occupied
|
||||
if (next == null) {
|
||||
if (currentOn.get()) {
|
||||
logger.info(current + " is now occupied without a next conveyor, stopping conveyor");
|
||||
send(current, A_MOTOR_OFF);
|
||||
currentOn.set(false);
|
||||
} else {
|
||||
logger.info(current + " is now occupied, conveyor is off and no next conveyor: transfer complete.");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextOccupied.get()) {
|
||||
logger.info(current + " is now occupied, next conveyor " + next + " is still occupied, so waiting...");
|
||||
if (currentWaitingForTransfer.get())
|
||||
logger.error("What the hell, current " + current + " is already waiting for a transfer!");
|
||||
currentWaitingForTransfer.set(true);
|
||||
} else {
|
||||
logger.info(
|
||||
current + " is now occupied, next conveyor " + next + " is not occupied, so transferring...");
|
||||
|
||||
if (nextOn.get()) {
|
||||
logger.info("Next conveyor " + next + " is already running, waiting for transfer to complete...");
|
||||
} else {
|
||||
logger.info("Starting " + next + " and waiting for transfer to complete...");
|
||||
send(next, A_MOTOR_ON);
|
||||
nextOn.set(true);
|
||||
}
|
||||
|
||||
if (currentOn.get()) {
|
||||
logger.info(current + " is already running, waiting for transfer to complete...");
|
||||
} else {
|
||||
logger.info("Starting " + current + " and waiting for transfer to complete...");
|
||||
send(current, A_MOTOR_ON);
|
||||
currentOn.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// current conveyor is not occupied anymore
|
||||
|
||||
if (previous == null) {
|
||||
|
||||
// no previous conveyor, so just stop current, if still on
|
||||
|
||||
if (currentOn.get()) {
|
||||
logger.info(current + " is now unoccupied, stopping conveyor");
|
||||
send(current, A_MOTOR_OFF);
|
||||
currentOn.set(false);
|
||||
} else {
|
||||
logger.info(current + " is now unoccupied, conveyor is already off");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// handle transfer of previous to current
|
||||
|
||||
if (!previousOccupied.get()) {
|
||||
logger.info(previous + " is not occupied, so no transfer required.");
|
||||
|
||||
if (currentOn.get()) {
|
||||
logger.info(current + " is now unoccupied and previous " + previous
|
||||
+ " is not occupied, so no transfer required: Stopping conveyor");
|
||||
send(current, A_MOTOR_OFF);
|
||||
currentOn.set(false);
|
||||
} else {
|
||||
logger.info(current + " is now unoccupied and previous " + previous
|
||||
+ " is not occupied, and conveyor not running. Nothing else to do");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// previous is occupied, so transfer to current, but only if previous was waiting
|
||||
if (!previousWaitingForTransfer.get()) {
|
||||
logger.info(previous + " conveyor is not waiting for a transfer. Nothing else to do.");
|
||||
} else {
|
||||
|
||||
logger.info(previous + " conveyor is waiting for a transfer, so starting transfer");
|
||||
|
||||
if (currentOn.get()) {
|
||||
logger.info(current + " is already on, waiting for transfer...");
|
||||
} else {
|
||||
logger.info("Turning " + current + " on for transfer");
|
||||
send(current, A_MOTOR_ON);
|
||||
currentOn.set(true);
|
||||
}
|
||||
|
||||
if (previousOn.get()) {
|
||||
logger.info(previous + " is already on, waiting for transfer...");
|
||||
} else {
|
||||
logger.info("Turning " + previous + " on for transfer");
|
||||
send(previous, A_MOTOR_ON);
|
||||
previousOn.set(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
this.plcHandler.registerListener(R_CONVEYOR_01, A_OCCUPIED, this);
|
||||
this.plcHandler.registerListener(R_CONVEYOR_02, A_OCCUPIED, this);
|
||||
this.plcHandler.registerListener(R_CONVEYOR_03, A_OCCUPIED, this);
|
||||
this.plcHandler.registerListener(R_CONVEYOR_04, A_OCCUPIED, this);
|
||||
|
||||
this.plcHandler.registerListener(R_CONVEYOR_03, A_BARCODE, this);
|
||||
super.register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister() {
|
||||
this.plcHandler.unregisterListener(R_CONVEYOR_01, A_OCCUPIED, this);
|
||||
this.plcHandler.unregisterListener(R_CONVEYOR_02, A_OCCUPIED, this);
|
||||
this.plcHandler.unregisterListener(R_CONVEYOR_03, A_OCCUPIED, this);
|
||||
this.plcHandler.unregisterListener(R_CONVEYOR_04, A_OCCUPIED, this);
|
||||
|
||||
this.plcHandler.unregisterListener(R_CONVEYOR_03, A_BARCODE, this);
|
||||
super.unregister();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(StrolchTransaction tx) {
|
||||
|
||||
this.conveyor1Occupied = new AtomicBoolean(getAddressState(tx, R_CONVEYOR_01, A_OCCUPIED));
|
||||
this.conveyor2Occupied = new AtomicBoolean(getAddressState(tx, R_CONVEYOR_02, A_OCCUPIED));
|
||||
this.conveyor3Occupied = new AtomicBoolean(getAddressState(tx, R_CONVEYOR_03, A_OCCUPIED));
|
||||
this.conveyor4Occupied = new AtomicBoolean(getAddressState(tx, R_CONVEYOR_04, A_OCCUPIED));
|
||||
|
||||
this.conveyor1On = new AtomicBoolean(getAddressState(tx, R_CONVEYOR_01, A_MOTOR_ON));
|
||||
this.conveyor2On = new AtomicBoolean(getAddressState(tx, R_CONVEYOR_02, A_MOTOR_ON));
|
||||
this.conveyor3On = new AtomicBoolean(getAddressState(tx, R_CONVEYOR_03, A_MOTOR_ON));
|
||||
this.conveyor4On = new AtomicBoolean(getAddressState(tx, R_CONVEYOR_04, A_MOTOR_ON));
|
||||
|
||||
super.start(tx);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue