# `Sp_MachineSpeedanalysis_2` (procedure) > 机台速度分析_折线 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sLoginId` | `varchar(100)` | | 2 | IN | `tStartDate` | `datetime` | | 3 | IN | `tEndDate` | `datetime` | | 4 | IN | `p_sMachineId` | `varchar(100)` | | 5 | IN | `sBrId` | `varchar(100)` | | 6 | IN | `sSuId` | `varchar(100)` | | 7 | IN | `bFilter` | `varchar(5000)` | | 8 | OUT | `sCode` | `int` | | 9 | OUT | `sReturn` | `longtext` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_MachineSpeedanalysis_2`'`._ ## Narrative **Business context:** 生产管理 → 设备速度看板 — single-machine 折线 dashboard chart of 速度/小时 over a date window, sourced from `plc_oeeupdate`. Companion of `Sp_MachineSpeedanalysis_1` (pie). **What it does:** Reads the machine's average rate `dAvgRate` from `elemachine` (defaults 15000 if zero). Drops/creates temp `Sp_MachineSpeedanalysis_2`, then `INSERT … SELECT … AVG(dRate)` from `plc_oeeupdate` bucketed by 5-minute slots, filtered by `sMachineId = p_sMachineId`, `tCreateDate BETWEEN p_tStartDate AND p_tEndDate`, and `dRate <= dAvgRate × 1.5` plus `dRate > 10` (clips outliers). Returns `sReturn` as a chart-master `{"data":[{x:tCreateDate, y:dRate}, …]}` JSON. **Invocation:** Status: appears orphaned. The only DB reference is sibling `Sp_MachinePoweranalysis_2` which reuses the `Sp_MachineSpeedanalysis_2`-prefixed temp-table names — no CALL relationship. No `gdsconfigcharmaster.sProcedureName` binding, no caller in xly-src. The variant `Sp_MachineSpeedanalysis_2_new` switches the lookup key from `p_sMachineId` to `p_iPlcNo` (PLC number) and adds 状态-aware zero-out logic. Candidate for maintainer audit.