---
tags: LRWA3
---
<style>
.markdown-body { max-width: 1500px; }
</style>
# LRWA3 封箱機流程與IP表
## 封箱機IP表
| 裝置 | IP | Port | 備註 |
| -------- | -------- | -------- | - |
| 輸送機 | 192.168.10.11 | 502 |
| 封箱模組 | 192.168.10.12 | 502 |
| 傳原噴印機 | 127.0.0.1 | 9111, 9112 | 192.168.1.128 |
| FX5U PLC | 192.168.10.3 | 5062 |
| SCARA 手臂 | 192.168.10.2 | 5555 |
| IPC | 192.168.10.6 | |現場 192.168.46.72|
| HP印表機 | 192.168.10.7/161||
| 貼標機 | 192.168.10.8||
## 主執行緒 (貨物中繼站)
```mermaid
graph TD
origin{起始點}
initCheck(執行初始檢查)
notifyInputStart(通知AGV可開始輸入)
baffleRise(阻擋升起)
baffleFall(阻擋下降)
startRollingUntilInput(開始輸入直到感測器有反應後停止)
startRollingUntilOutput(開始輸出直到感測器有反應後停止<br>設定本站為空)
readBarcode(讀取條碼)
queryInfo(取得任務內容<br>通知可開始輸出)
origin-->|未經過初始檢查|initCheck
origin-->|符合執行任務條件|readBarcode
origin-->|收到AGV到位通知<br>且目前此站為空|notifyInputStart
origin-->|下一站為空且目前不需清噴頭<br>本站任務已完成<br>取得下一站空間使用權|baffleFall
origin-->|錯誤回復但有條碼記錄|queryInfo
notifyInputStart-->baffleRise
baffleRise-->startRollingUntilInput
startRollingUntilInput-->origin
baffleFall-->startRollingUntilOutput
startRollingUntilOutput-->origin
initCheck-->origin
readBarcode-->queryInfo
queryInfo-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## 印彩色LOGO執行緒 (任務:放出貨單、彩色噴印)
```mermaid
graph TD
origin{起始點}
initCheck(執行初始檢查)
baffleRise(阻擋升起)
baffleFall(阻擋下降)
startRollingForInput(開始輸入直到感測器有反應<br>釋放本區空間使用權<br>通知可開始執行任務)
startRollingUntilOutput(開始輸出直到感測器有反應後停止<br>設定本站為空)
doPrint(進行噴印)
setBoxWidthAndPutterPushAndStopRolling(設定紙箱寬度推桿夾和滾筒停止)
putterRelease(推桿開<br>觸發後通知可開始輸出)
purgeStart(清噴頭前置動作)
purge(清噴頭)
purgeEnd(清噴頭完成動作<br>釋放本區空間使用權)
origin-->|未經過初始檢查|initCheck
origin-->|有輸入需求|baffleRise
origin-->|有輸出需求且下一站為空|baffleFall
origin-->|符合執行任務條件|setBoxWidthAndPutterPushAndStopRolling
origin-->|需執行清噴頭且本區為空<br>取得本區空間使用權|purgeStart
origin-->|噴印與單據放置完成<br>釋放推桿|putterRelease
baffleRise-->startRollingForInput
startRollingForInput-->origin
baffleFall-->startRollingUntilOutput
startRollingUntilOutput-->origin
setBoxWidthAndPutterPushAndStopRolling-->doPrint
doPrint-->origin
putterRelease-->origin
initCheck-->origin
purgeStart-->purge
purge-->purgeEnd
purgeEnd-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
噴印過不能重置清墨頭的循環,因為噴印不一定會所有噴孔都噴墨,清墨頭一定所有噴孔都噴墨
## 封箱模組流程
```mermaid
graph TD
origin{起始點}
initCheck(執行初始檢查)
baffleRise(阻擋升起)
clampAndOutputRollingUntilOutput(夾合與出料滾筒滾動<br>直到下一站感測器有反應後停止)
startRollingUntilInput(開始輸入直到感測器有反應後停止)
getReadyToSealBox(設定紙箱寬度與高度<br>升降與夾合同時到定位<br>準備封箱<br>停止滾輪<br>擋板下降)
elevatorAndClampOpen(升降與夾合同時回原點)
origin-->|未經過初始檢查|initCheck
origin-->|有輸入需求|baffleRise
origin-->|有輸出需求且下一站為空且已折蓋|clampAndOutputRollingUntilOutput
origin-->|輸入完成進行封箱準備|getReadyToSealBox
initCheck-->origin
baffleRise-->startRollingUntilInput
startRollingUntilInput-->origin
getReadyToSealBox-->origin
clampAndOutputRollingUntilOutput-->elevatorAndClampOpen
elevatorAndClampOpen-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## 生產汽泡袋執行緒
```mermaid
graph TD
origin{起始點}
produce(生產汽泡袋)
origin-->|有生產氣泡袋需求且架上無汽泡袋|produce
produce-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## SCARA手臂執行緒
```mermaid
graph TD
origin{起始點}
clipAirSaver(將氣泡袋吸起)
putAirSaver(將氣泡袋放入箱中)
fold(折後蓋)
backHome(手臂回原位)
origin-->|汽泡袋生產完畢|clipAirSaver
origin-->|箱子到位|putAirSaver
origin-->|汽泡袋全部放置完畢|fold
origin-->|封箱完畢|backHome
clipAirSaver-->origin
fold-->origin
backHome-->origin
putAirSaver-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## 印貼託運單執行緒
```mermaid
graph TD
origin{起始點}
initCheck(執行初始檢查)
baffleRise(阻擋升起)
baffleFall(阻擋下降)
startRollingUntilInput(開始輸入直到感測器有反應後停止<br>通知可開始執行任務)
startRollingUntilOutput(開始輸出直到感測器有反應後停止<br>設定本站為空)
doTask(執行任務<br>完成後通知可開始輸出)
origin-->|未經過初始檢查|initCheck
origin-->|有輸入需求|baffleRise
origin-->|有輸出需求且下一站為空|startRollingUntilOutput
origin-->|符合執行任務條件|doTask
baffleRise-->startRollingUntilInput
startRollingUntilInput-->origin
baffleFall-->origin
startRollingUntilOutput-->origin
doTask-->baffleFall
initCheck-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## 讀取出貨單資料執行緒
```mermaid
graph TD
origin{起始點}
downloadFromFTP(取得列印單據資料<br>完成後通知列印執行緒)
origin-->|有取得列印單據資料需求|downloadFromFTP
downloadFromFTP-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## 列印執行緒
```mermaid
graph TD
origin{起始點}
print(列印單據)
origin-->|有列印單據需求<br>且印表機架上淨空|print
print-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## 夾出貨單至箱內執行緒
```mermaid
graph TD
origin{起始點}
clipPaper(放置單據)
origin-->|印表機列印完成<br>且箱子到達可放置位置<br>需求檔案比對相同|clipPaper
clipPaper-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
### Collateral Damage Tree Node
概念上就是把發生問題的FlowManager與其週邊和前面結點先停止後,
讓後面的做完再整機停止,
減少出錯時需排除的工作量。
```mermaid
graph BT
station4(托運單站)
station3(封箱站)
station2(彩色噴印站)
station1(讀條碼站)
downloadFile(下載執行序)
hp(HP印表機)
airSaver(氣泡袋)
axis3(三軸手臂)
scara(SCARA手臂)
station4 --> station3
station3 --> station2
station2 --> station1
station1 --> airSaver --> station1
station1 --> downloadFile --> station1
downloadFile --> hp --> downloadFile
station2 --> axis3 --> station2
station3 --> scara --> station3
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
classDef mainNode fill:#B82F14 ,stroke:#871D07
class station1,station2,station3,station4 mainNode
```
# 壓力測試流程
## 放出貨單執行緒(1)
```mermaid
graph TD
origin{起始點}
startRolling1(開始轉動)
stopRolling1(停止轉動)
startRolling2(開始轉動)
stopRolling2(停止轉動)
wait5Sec1(等待5秒)
wait5Sec2(等待5秒)
wait5Sec3(等待5秒)
baffleRise(阻擋升起)
baffleFall(阻擋下降)
origin-->baffleRise
baffleRise-->startRolling1
startRolling1-->wait5Sec1
wait5Sec1-->stopRolling1
stopRolling1-->wait5Sec2
wait5Sec2-->baffleFall
baffleFall-->startRolling2
startRolling2-->wait5Sec3
wait5Sec3-->stopRolling2
stopRolling2-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## 彩色LOGO噴印執行緒(2)
```mermaid
graph TD
origin{起始點}
putterRise(推桿升起)
putterFall(推桿下降)
putterPush(推桿推)
putterRelease(推桿歸位)
baffleRise(阻擋升起)
baffleFall(阻擋下降)
startRolling1(開始轉動)
stopRolling1(停止轉動)
startRolling2(開始轉動)
stopRolling2(停止轉動)
wait5Sec1(等待5秒)
wait5Sec2(等待5秒)
origin-->baffleRise
baffleRise-->startRolling1
startRolling1-->wait5Sec1
wait5Sec1-->stopRolling1
stopRolling1-->putterRise
putterRise-->putterPush
putterPush-->putterFall
putterFall-->putterRelease
putterRelease-->baffleFall
baffleFall-->startRolling2
startRolling2-->wait5Sec2
wait5Sec2-->stopRolling2
stopRolling2-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```
## 印貼託運單執行緒(3)
```mermaid
graph TD
origin{起始點}
startRolling1(開始轉動)
stopRolling1(停止轉動)
startRolling2(開始轉動)
stopRolling2(停止轉動)
wait5Sec1(等待5秒)
wait5Sec2(等待5秒)
wait5Sec3(等待5秒)
baffleRise(阻擋升起)
baffleFall(阻擋下降)
origin-->baffleRise
baffleRise-->startRolling1
startRolling1-->wait5Sec1
wait5Sec1-->stopRolling1
stopRolling1-->wait5Sec2
wait5Sec2-->baffleFall
baffleFall-->startRolling2
startRolling2-->wait5Sec3
wait5Sec3-->stopRolling2
stopRolling2-->origin
linkStyle default fill:none, stroke:lightGray
classDef node color:#eee, stroke-width:2px,fill:#45526e,stroke:#59698d
```