gasPump.data.ts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. import { reactive, defineAsyncComponent } from 'vue';
  2. import { useGlobSetting } from '/@/hooks/setting';
  3. export const warningConfig = reactive({
  4. header: ['设备名称', '预警信息', '时间'],
  5. data: [
  6. ['火焰6', '严重报警', '03-05'],
  7. ['测点43', '一般预警', '03-05'],
  8. ['CO23', '一般预警', '03-05'],
  9. ['测点6', '超高预警', '03-05'],
  10. ['测点65', '超高预警', '03-05'],
  11. ['温度4', '一般预警', '03-05'],
  12. ['测点61', '一般预警', '03-05'],
  13. ['测点87', '一般信息', '03-05'],
  14. ],
  15. index: false,
  16. // columnWidth: [150, 80, 150, 150],
  17. headerBGC: '#3d9dd45d',
  18. oddRowBGC: '#009acd10',
  19. evenRowBGC: '#009acd05',
  20. align: ['center', 'center', 'center'],
  21. });
  22. // export const pumpMonitorData = [
  23. // {
  24. // title: '运行状态',
  25. // code: 'CentrifugalPump_PU_CBStatus',
  26. // type: 'sign',
  27. // },
  28. // {
  29. // title: '启动准备',
  30. // code: 'CentrifugalPump_PU_Ready',
  31. // type: 'sign',
  32. // },
  33. // {
  34. // title: '电压(V)',
  35. // code: 'CentrifugalPump_PU_SysVoltage',
  36. // type: '',
  37. // },
  38. // {
  39. // title: 'A相电流(A)',
  40. // code: 'CentrifugalPump_PU_Ia',
  41. // type: '',
  42. // },
  43. // {
  44. // title: 'B相电流(A)',
  45. // code: 'CentrifugalPump_PU_Ib',
  46. // type: '',
  47. // },
  48. // {
  49. // title: 'C相电流(A)',
  50. // code: 'CentrifugalPump_PU_Ic',
  51. // type: '',
  52. // },
  53. // ];
  54. export const pumpMonitorData = [
  55. {
  56. title: '断路器状态',
  57. code: 'Starter_CBStatus',
  58. type: 'sign',
  59. },
  60. {
  61. title: '合闸失败',
  62. code: 'Starter_CloseFail',
  63. type: 'warning',
  64. },
  65. {
  66. title: 'A相电流(A)',
  67. code: 'Starter_Ia',
  68. type: '',
  69. },
  70. {
  71. title: 'B相电流(A)',
  72. code: 'Starter_Ib',
  73. type: '',
  74. },
  75. {
  76. title: 'C相电流(A)',
  77. code: 'Starter_Ic',
  78. type: '',
  79. },
  80. {
  81. title: 'AB电压(V)',
  82. code: 'Starter_Uab',
  83. type: '',
  84. },
  85. {
  86. title: '健康信号',
  87. code: 'Starter_Ready',
  88. type: 'sign',
  89. },
  90. ];
  91. export const waterPumpData = [
  92. {
  93. title: '运行状态',
  94. code: 'WaterfloodPump_CBStatus',
  95. type: 'sign',
  96. },
  97. {
  98. title: '启动准备',
  99. code: 'WaterfloodPump_Ready',
  100. type: 'sign',
  101. },
  102. {
  103. title: '电压(V)',
  104. code: 'WaterfloodPump_SysVoltage',
  105. type: '',
  106. },
  107. ];
  108. export const dewateringPumpData = [
  109. {
  110. title: '运行状态',
  111. code: 'DewateringPump_CBStatus',
  112. type: 'sign',
  113. },
  114. {
  115. title: '启动准备',
  116. code: 'DewateringPump_Ready',
  117. type: 'sign',
  118. },
  119. {
  120. title: '电压(V)',
  121. code: 'DewateringPump_SysVoltage',
  122. type: '',
  123. },
  124. ];
  125. export const valveCtrlType = [
  126. {
  127. title: '进水阀',
  128. code: 'WaterInValve1',
  129. },
  130. {
  131. title: '排水阀',
  132. code: 'WaterOutValve2',
  133. },
  134. {
  135. title: '进气阀',
  136. code: 'AirInValve1',
  137. },
  138. {
  139. title: '排气阀',
  140. code: 'AirOutValve2',
  141. },
  142. ];
  143. export const valveCtrl = [
  144. {
  145. title: '开启',
  146. code: '_HMIOpen',
  147. },
  148. {
  149. title: '关闭',
  150. code: '_HMIClose',
  151. },
  152. {
  153. title: '停止',
  154. code: '_HMIStop',
  155. },
  156. {
  157. title: '复位',
  158. code: '_Reset',
  159. },
  160. ];
  161. export const stateWarningHeader = ['设备名称', '开限位', '关限位', '开输出', '关输出'];
  162. export const stateHeader = ['设备名称', '是否健康', '开失败', '关失败', '控制方式'];
  163. export const valveWarningState = [
  164. {
  165. title: '开限位',
  166. code: '_OpenLimit',
  167. defaultValue: '-',
  168. },
  169. {
  170. title: '关限位',
  171. code: '_CloseLimit',
  172. defaultValue: '-',
  173. },
  174. {
  175. title: '开输出',
  176. code: '_OnOutput',
  177. defaultValue: '-',
  178. },
  179. {
  180. title: '关输出',
  181. code: '_OffOutput',
  182. defaultValue: '-',
  183. },
  184. ];
  185. export const valveState = [
  186. {
  187. title: '是否健康',
  188. code: '_Healthy',
  189. defaultValue: '-',
  190. },
  191. {
  192. title: '开失败',
  193. code: '_OpenFail',
  194. defaultValue: '-',
  195. },
  196. {
  197. title: '关失败',
  198. code: '_CloseFail',
  199. defaultValue: '-',
  200. },
  201. {
  202. title: '控制方式',
  203. code: '_CtrlMode',
  204. defaultValue: '-',
  205. },
  206. ];
  207. export const pumpCtrlType = [
  208. {
  209. title: '瓦斯泵',
  210. code: 'CentrifugalPump',
  211. },
  212. {
  213. title: '排水泵',
  214. code: 'DewateringPump',
  215. },
  216. ];
  217. export const publicPumpCtrlType = [
  218. {
  219. title: '注水泵',
  220. code: 'WaterfloodPump',
  221. },
  222. ];
  223. export const PumpCtrlItems = [
  224. {
  225. title: '启动',
  226. code: '_SwitchOn',
  227. },
  228. {
  229. title: '停止',
  230. code: '_SwitchOff',
  231. },
  232. {
  233. title: '短路测试',
  234. code: '_HMIShortTest',
  235. },
  236. {
  237. title: '漏电测试',
  238. code: '_HMILeakageTest',
  239. },
  240. ];
  241. export const modelMonitor = [
  242. {
  243. title: '泵站输入管道内工混流量(m³/min)',
  244. code: 'mixedTraffic',
  245. },
  246. {
  247. title: '泵站内瓦斯(%CH₄)',
  248. code: 'gas2',
  249. },
  250. {
  251. title: '泵站输入管道内标况流量(m³/min)',
  252. code: 'standardTraffic',
  253. },
  254. {
  255. title: '泵站输入管道内瓦斯(%CH₄)',
  256. code: 'gas3',
  257. },
  258. {
  259. title: '泵站输入管道内工混累计(m³)',
  260. code: 'totalGasDrainage',
  261. },
  262. {
  263. title: '泵站管道输出瓦斯(%CH₄)',
  264. code: 'gas4',
  265. },
  266. {
  267. title: '泵站输入管道内一氧化碳(ppm)',
  268. code: 'coVal',
  269. },
  270. {
  271. title: '泵站管路出口30米处瓦斯(%CH₄)',
  272. code: 'gas1',
  273. },
  274. {
  275. title: '泵站内温度(℃)',
  276. code: 'temp',
  277. },
  278. {
  279. title: '泵站输入管道内温度(℃)',
  280. code: 'pipeTemp',
  281. },
  282. ];
  283. export const getModelMonitorTags = () => {
  284. const { sysOrgCode } = useGlobSetting();
  285. // const sysOrgCode = 'sdmtjtcctmk';
  286. switch (sysOrgCode) {
  287. case 'sdmtjtcctmk': // 寸草塔1
  288. return [
  289. {
  290. domId: 'jsf1',
  291. title: '进水阀1#',
  292. code: 'DRS13_GVL1_OpenLimit',
  293. type: 'sign',
  294. // value: '0',
  295. position: [-8.75, 0.3, 0.6],
  296. },
  297. {
  298. domId: 'jsf2',
  299. title: '进水阀2#',
  300. code: 'DRS13_GVL2_OpenLimit',
  301. type: 'sign',
  302. // value: '0',
  303. position: [-5.26, 0.28, 0.6],
  304. },
  305. {
  306. domId: 'csf1',
  307. title: '出水阀1#',
  308. code: 'DRS13_GVL1_OpenLimit',
  309. type: 'sign',
  310. // value: '0',
  311. position: [-9.42, 0.35, 0.3],
  312. },
  313. {
  314. domId: 'csf2',
  315. title: '出水阀2#',
  316. code: 'DRS13_GVL2_OpenLimit',
  317. type: 'sign',
  318. // value: '0',
  319. position: [-5.74, 0.35, 0.27],
  320. },
  321. {
  322. domId: 'jqf1',
  323. title: '进气阀1#',
  324. code: 'DRS13_GVL4_OpenLimit',
  325. type: 'sign',
  326. // value: '0',
  327. position: [-7.7, 1.31, -0.14],
  328. },
  329. {
  330. domId: 'jqf2',
  331. title: '进气阀2#',
  332. code: 'DRS13_GVL6_OpenLimit',
  333. type: 'sign',
  334. // value: '0',
  335. position: [-4.41, 1.28, 0.03],
  336. },
  337. {
  338. domId: 'cqf1',
  339. title: '出气阀1#',
  340. code: 'DRS13_GVL3_OpenLimit',
  341. type: 'sign',
  342. // value: '0',
  343. position: [-9.58, 1.55, -0.13],
  344. },
  345. {
  346. domId: 'cqf2',
  347. title: '出气阀2#',
  348. code: 'DRS13_GVL5_OpenLimit',
  349. type: 'sign',
  350. // value: '0',
  351. position: [-6.2, 1.55, 0.06],
  352. },
  353. ];
  354. case 'sdmtjtcctrk': // 布尔台
  355. return [
  356. {
  357. domId: 'jsf1',
  358. title: '进水阀1#',
  359. code: 'CentrifugalPump1_WaterInValve1_OpenLimit',
  360. type: 'sign',
  361. // value: '0',
  362. position: [-5.26, 0.28, 0.6],
  363. },
  364. {
  365. domId: 'jsf2',
  366. title: '进水阀2#',
  367. code: 'CentrifugalPump2_WaterInValve1_OpenLimit',
  368. type: 'sign',
  369. // value: '0',
  370. position: [-8.75, 0.3, 0.6],
  371. },
  372. {
  373. domId: 'csf1',
  374. title: '出水阀1#',
  375. code: 'CentrifugalPump1_WaterOutValve2_OpenLimit',
  376. type: 'sign',
  377. // value: '0',
  378. position: [-5.74, 0.35, 0.27],
  379. },
  380. {
  381. domId: 'csf2',
  382. title: '出水阀2#',
  383. code: 'CentrifugalPump2_WaterOutValve2_OpenLimit',
  384. type: 'sign',
  385. // value: '0',
  386. position: [-9.42, 0.35, 0.3],
  387. },
  388. {
  389. domId: 'jqf1',
  390. title: '进气阀1#开度',
  391. code: 'CentrifugalPump1_AirInValve1_OpenLimit',
  392. type: 'value',
  393. // value: '0',
  394. position: [-4.41, 1.28, 0.03],
  395. },
  396. {
  397. domId: 'jqf2',
  398. title: '进气阀2#开度',
  399. code: 'CentrifugalPump2_AirInValve1_OpenLimit',
  400. type: 'value',
  401. // value: '0',
  402. position: [-7.7, 1.31, -0.14],
  403. },
  404. {
  405. domId: 'cqf1',
  406. title: '出气阀1#开度',
  407. code: 'CentrifugalPump1_AirOutValve2_OpenLimit',
  408. type: 'value',
  409. // value: '0',
  410. position: [-6.2, 1.55, 0.06],
  411. },
  412. {
  413. domId: 'cqf2',
  414. title: '出气阀2#开度',
  415. code: 'CentrifugalPump2_AirOutValve2_OpenLimit',
  416. type: 'value',
  417. // value: '0',
  418. position: [-9.58, 1.55, -0.13],
  419. },
  420. ];
  421. default:
  422. return [
  423. {
  424. domId: 'jsf1',
  425. title: '进水阀1#',
  426. code: 'CentrifugalPump1_WaterInValve1_OpenLimit',
  427. type: 'sign',
  428. // value: '0',
  429. position: [-5.26, 0.28, 0.6],
  430. },
  431. {
  432. domId: 'jsf2',
  433. title: '进水阀2#',
  434. code: 'CentrifugalPump2_WaterInValve1_OpenLimit',
  435. type: 'sign',
  436. // value: '0',
  437. position: [-8.75, 0.3, 0.6],
  438. },
  439. {
  440. domId: 'csf1',
  441. title: '出水阀1#',
  442. code: 'CentrifugalPump1_WaterOutValve2_OpenLimit',
  443. type: 'sign',
  444. // value: '0',
  445. position: [-5.74, 0.35, 0.27],
  446. },
  447. {
  448. domId: 'csf2',
  449. title: '出水阀2#',
  450. code: 'CentrifugalPump2_WaterOutValve2_OpenLimit',
  451. type: 'sign',
  452. // value: '0',
  453. position: [-9.42, 0.35, 0.3],
  454. },
  455. {
  456. domId: 'jqf1',
  457. title: '进气阀1#',
  458. code: 'CentrifugalPump1_AirInValve1_OpenLimit',
  459. type: 'sign',
  460. // value: '0',
  461. position: [-4.41, 1.28, 0.03],
  462. },
  463. {
  464. domId: 'jqf2',
  465. title: '进气阀2#',
  466. code: 'CentrifugalPump2_AirInValve1_OpenLimit',
  467. type: 'sign',
  468. // value: '0',
  469. position: [-7.7, 1.31, -0.14],
  470. },
  471. {
  472. domId: 'cqf1',
  473. title: '出气阀1#',
  474. code: 'CentrifugalPump1_AirOutValve2_OpenLimit',
  475. type: 'sign',
  476. // value: '0',
  477. position: [-6.2, 1.55, 0.06],
  478. },
  479. {
  480. domId: 'cqf2',
  481. title: '出气阀2#',
  482. code: 'CentrifugalPump2_AirOutValve2_OpenLimit',
  483. type: 'sign',
  484. // value: '0',
  485. position: [-9.58, 1.55, -0.13],
  486. },
  487. ];
  488. }
  489. };
  490. export function getComponent() {
  491. const { sysOrgCode } = useGlobSetting();
  492. // const sysOrgCode = 'sdmtjtbetmk';
  493. let gasPumpHome;
  494. switch (sysOrgCode) {
  495. case 'sdmtjtbetmk': // 布尔台
  496. gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeBet.vue'));
  497. return gasPumpHome;
  498. case 'sdmtjtcctmk': // 寸草塔1
  499. gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeCC.vue'));
  500. return gasPumpHome;
  501. case 'sdmtjtcctrk': // 寸草塔2
  502. gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeCC.vue'));
  503. return gasPumpHome;
  504. case 'sdmtjtbdmk': // 保德
  505. gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeBD.vue'));
  506. return gasPumpHome;
  507. default:
  508. // gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHome.vue'));
  509. gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeCopy.vue'));
  510. // gasPumpHome = defineAsyncComponent(() => import('./components/gasPumpHomeBD.vue'));
  511. return gasPumpHome;
  512. }
  513. }
  514. /**
  515. * 按站型取「瓦斯泵运行信号」表(泵号 → 运行状态点位),用于驱动管道流动动画。
  516. *
  517. * 两个布尔台泵站的运行信号点位完全不同,绝不能互相借用:
  518. * - pump_22m2pq(新站):瓦斯泵由变频器驱动,用 CentrifugalPump<n>_VFD_Status
  519. * - pump_under (老站):用瓦斯泵磁力启动器 Starter5_/Starter6_ 的断路器状态
  520. *
  521. * 返回 null 表示该站型暂不支持泵状态驱动动画(调用方据此不点亮任何箭头)。
  522. */
  523. export async function getPumpRunSignals(deviceType: string) {
  524. const { sysOrgCode } = useGlobSetting();
  525. if (sysOrgCode !== 'sdmtjtbetmk') return null;
  526. if (deviceType == 'pump_22m2pq') {
  527. return (await import('./gasPump.data.bet2')).pumpRunSignals;
  528. }
  529. if (deviceType?.startsWith('pump_under')) {
  530. return (await import('./gasPump.data.bet')).pumpRunSignals;
  531. }
  532. return null;
  533. }
  534. export async function getMonitorData(deviceType) {
  535. const { sysOrgCode } = useGlobSetting();
  536. // const sysOrgCode = 'sdmtjtcctmk';
  537. switch (sysOrgCode) {
  538. // 布尔台
  539. case 'sdmtjtbetmk':
  540. if (deviceType == 'pump_22m2pq') {
  541. return await import('./gasPump.data.bet2');
  542. } else {
  543. return await import('./gasPump.data.bet');
  544. }
  545. case 'sdmtjtcctmk':
  546. return await import('./gasPump.dataCc');
  547. case 'sdmtjtcctrk':
  548. if (deviceType == 'pump_under') {
  549. return await import('./gasPump.dataCc2_1');
  550. } else if (deviceType == 'pump_under_31') {
  551. return await import('./gasPump.dataCc2_2');
  552. }
  553. default: //默认
  554. if (deviceType == 'pump_over') {
  555. return await import('./gasPump.dataCc2_1');
  556. } else if (deviceType == 'pump_under') {
  557. return await import('./gasPump.dataCc2_2');
  558. }
  559. }
  560. }
  561. interface deviceChildType {
  562. title: string;
  563. key: string[];
  564. childTitle: string[];
  565. }
  566. interface propertyListType {
  567. title: string;
  568. type: string;
  569. code: string;
  570. }
  571. export interface devicePropertyType {
  572. type: string;
  573. title: string;
  574. stateHeader: [];
  575. children: deviceChildType[];
  576. list: propertyListType[];
  577. }
  578. /** 二维 SVG 模型组件缓存(用于切换模型时不闪烁) */
  579. const componentsCaches = new Map<string, any>();
  580. /**
  581. * 获取瓦斯抽采泵模型组件
  582. *
  583. * @param is2DModel 是否为二维模型;三维模型由 index.vue 的 mountedThree 负责,此处仅返回二维组件
  584. * @param type 站型(页面 dataSource 里的 deviceType,如 pump_over / pump_under / pump_22m2pq)
  585. */
  586. export function getModelComponent(is2DModel: boolean = false, type: string = '') {
  587. if (!is2DModel) return null;
  588. const getComponent = (name) => {
  589. if (!componentsCaches.has(name)) {
  590. componentsCaches.set(name, import(`./components/${name}.vue`));
  591. }
  592. return componentsCaches.get(name);
  593. };
  594. // @ts-ignore
  595. return defineAsyncComponent(() => {
  596. switch (type) {
  597. // case 'pump_over':
  598. // case 'pump_under':
  599. // 目前地上/井下共用同一套二维场景,将来要分开时按站型指到不同组件即可
  600. default:
  601. return getComponent('gasPumpSVG');
  602. }
  603. });
  604. }
  605. /**
  606. * 判断某台泵是否运行(与三维 gasPump.threejs.under.ts 的 isPumpRunning 同一套口径)
  607. *
  608. * 已注入 runSignals 时(布尔台两站)按泵运行状态点位判定:Number(data[code]) === 1;
  609. * 未注入时(寸草塔1/2、保德等未接入该机制的站型)回落到进气/出气阀门开度,
  610. * 避免这些站的流动动画因缺少运行点位而全部不动。
  611. *
  612. * @param data 子组件轮询得到的监测数据(与传给三维 playAnimate 的同一份)
  613. * @param pumpNo 泵号(1 / 2)
  614. * @param runSignals 该站的"泵号 → 运行点位"表,null 表示未接入
  615. * @param tags 回落口径用的标签表(getModelMonitorTags() 的返回值)
  616. */
  617. export function isPumpRunning(
  618. data: any,
  619. pumpNo: number,
  620. runSignals: Record<number, { code: string }> | null,
  621. tags: { domId: string; code: string }[]
  622. ): boolean {
  623. if (!data) return false;
  624. const code = runSignals?.[pumpNo]?.code;
  625. if (code) {
  626. const raw = data[code];
  627. if (raw === undefined || raw === null || raw === '') return false;
  628. const value = Number(raw);
  629. return Number.isFinite(value) && value === 1;
  630. }
  631. // 回落到旧的阀门开度口径:该泵的任一进气/出气阀门开启即认为有流动
  632. const valvePrefixes = pumpNo === 1 ? ['jqf1', 'cqf1'] : ['jqf2', 'cqf2'];
  633. return valvePrefixes.some((domId) => {
  634. const tag = tags?.find((e: any) => e.domId === domId);
  635. if (!tag) return false;
  636. const value = Number(data[tag.code]);
  637. return Number.isFinite(value) && value > 0;
  638. });
  639. }