5.8 KiB
1. Goal
Implement the control logic for a two-format bottle loop consisting of the Accumulation Table, Curve 1, Divider, Combiner, Curve 2 and the format-change axes. Only the loop, table and format-change logic are in scope.
2. Physical Layout
AccumTable → Curve 1 (M344) → Divider → Combiner (M311 + M312) → Curve 2 (M315) → AccumTable
3. Runtime Data held by every entity
Field | Type | Meaning |
---|---|---|
formatId |
INT | Active bottle format |
cycleMode |
ENUM {AUTO, MAN} | Automatic / Manual |
alarmBits |
DWORD | Active alarms bitmap |
topAlarm |
WORD | Highest-priority alarm code |
4. Main Operating States
-
Load – fill outermost channels first.
-
Bypass – straight-through flow.
-
Unload – empty innermost channels first.
5. Functional Behaviour (concise)
Sub-system | Key rules of operation |
---|---|
Accumulation Table | • Works in three states (Load, Bypass, Unload).• Channels are filled from the outside in and emptied from the inside out; channels that lie between the selector and the active channel must run while bottles cross them. |
• Each channel keeps two virtual counters firstBottle_mm & lastBottle_mm , initialised to the full channel length when a bottle is detected and decremented by the conveyor encoder; when firstBottle_mm == 0 the leading bottle has reached the channel’s end. |
|
• Once a channel starts Unload it must run until lastBottle_mm == 0 to avoid trapping product. |
|
Curve 1 / Curve 2 | • Curve 1 runs in speed-follower mode slaved to the Divider and may move only while the Divider is running.• Curve 2 is slaved to the Combiner and must run whenever the Combiner runs; the two curves are the only places where line accumulation may build up. |
Combiner | • Speed follows the Divider.• Stops if the downstream photo-sensor pth_out detects more than one bottle; if Combiner stops it also stops the Divider. |
Doser Pair | • Two motors run in mirror at identical speed; if either trips, both stop.• After the last bottle pulse the pair runs an additional distance (stopDist_mm ) using a virtual encoder before stopping. |
6. Key Parameters
bottleLen_mm
, minAccumTime_ms
, loadSpeed_mmps
, unloadSpeed_mmps
, bypassSpeed_mmps
, virtualEncRatio_HzPerMm
, safetyGapIn_mm
, safetyGapOut_mm
7. Software Architecture (Function Blocks)
FB Name | Purpose | Typical DB |
---|---|---|
FB_FormatAxis | Position a single minimotor to the target format dimension | DB_FormatAxis_<axis> |
FB_ChannelSelector | Position the infeed/outfeed selector to a channel | DB_SelIn , DB_SelOut |
FB_AreaTracker | Track firstBottle / lastBottle and drive an area motor |
DB_Area_<n> |
FB_DoserPair | Run a left/right doser pair with stop-after-pulse logic | DB_DoserIO |
FB_BufferLogic | High-level coordinator for Load / Bypass / Unload | DB_Buffer |
FB_CombinerCtrl | Synchronise Combiner with Divider, stop on blockage | DB_Combiner |
FB_LoopCurve | Slave Curve 1 to Divider and Curve 2 to Combiner | DB_Curve1 , DB_Curve2 |
8. Interfaces (concise examples)
FB_FormatAxis
Inputs : enable, dimSet_mm, cycleMode, cmdHoming, jogFwd, jogRev, reset
Outputs: inPosition, positioning, errorWord
FB_ChannelSelector
Inputs : enable, channelSet(0-9), cycleMode, cmdHoming, jogFwd, jogRev, reset
Outputs: inPosition, positioning, autoActive, errorWord
FB_AreaTracker
Inputs : enable, speedRef_mmps, bottleLen_mm, spacing_mm, areaDim_mm
Outputs: areaEmpty, noBottleAtIn, noBottleAtOut
FB_DoserPair
Inputs : enable, speedRef_mmps, bottlePulse, stopDist_mm
Outputs: running, errorWord
FB_BufferLogic
Inputs : reqLoad, reqFormatChange, unloadEnable, bypassSpeedRef
Outputs: tableNeedsProduct, formatChangeOK, outfeedSpeedRef, bypassActive
FB_CombinerCtrl
Inputs : dividerSpeedRef_mmps, pthOutBlocked, dividerRunning
Outputs: combinerSpeedRef_mmps, stopDivider
9. Naming Guidelines
Category | Convention | Example |
---|---|---|
FBs | FB_<Meaning> |
FB_BufferLogic |
BOOL var | verbNounFlag | enableMove |
WORD | camelCase | errorWord |
REAL | suffix _mm , _mmps |
speedRef_mmps |
Structs | ST_<Role> |
ST_AreaStatus |
10. Signal Map (I/O)
Signal | Suggested Name | Dir | Comment |
---|---|---|---|
i1 | ringOutReq |
IN | Product request from downstream |
i2 | loadCmd |
IN | Start load for format change |
i3 | ringEmptyOk |
IN | Loop & Divider ready for change |
i4 | bypassSpeedRef |
IN | Desired bypass speed |
i5 | formatChangeCmd |
IN | HMI executes change |
i6 | unloadEnable |
IN | Allow automatic unload |
o1 | tableProdReq |
OUT | Table ready, asks for bottles |
o2 | formatChangeOK |
OUT | Loading done & loop empty |
o3 | outfeedSpeedRef |
OUT | Speed reference to ring outfeed |
o4 | bypassActive |
OUT | Table in bypass state |
11. State Sequence Summary
-
External
loadCmd
→ BufferLogic enters Load, enforcing outer-to-inner rule. -
On HMI
formatChangeCmd
, BufferLogic finishes load, waits forringEmptyOk
, then raisesformatChangeOK
. -
After format change, BufferLogic triggers Unload (inner-to-outer).
-
When all channels empty, state switches to Bypass and
bypassActive
is set.
This version retains the tight structure and English terminology from the previous draft while adding the essential operating descriptions for the Accumulation Table, Curves, Combiner and Doser logic drawn from the original Spanish document.