optim.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. {% extends "index.html" %}
  2. {% block title %}智能最佳化{% endblock %}
  3. {% block head %}
  4. {{ super() }}
  5. {% endblock %}
  6. {% block body %}
  7. <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.js"></script> -->
  8. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  9. <script src="https://cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-datalabels/2.0.0-rc.1/chartjs-plugin-datalabels.min.js" integrity="sha512-+UYTD5L/bU1sgAfWA0ELK5RlQ811q8wZIocqI7+K0Lhh8yVdIoAMEs96wJAIbgFvzynPm36ZCXtkydxu1cs27w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
  10. <script src="../static/optim.js"></script>
  11. <script type="text/javascript" src="/static/tower.js"></script>
  12. <div id='select_boxes'>
  13. <select class="select-item" id="company-list" onChange="onChangeColumn1();">
  14. <option value=0>公司</option>
  15. </select>
  16. <select class="select-item" id="factory-list" onChange="onChangeColumn2();">
  17. <option value=0>工廠</option>
  18. </select>
  19. <select class="select-item" id="department-list" onChange="onChangeColumn3();">
  20. <option value=0>廠區</option>
  21. </select>
  22. <select class="select-item" id="towerGroup-list">
  23. <option value=0>機組</option>
  24. </select>
  25. <button class="me-0" id="tower_btn" onclick="click_button();"><i class="fas fa-search me-3"></i>搜尋</button>
  26. </div>
  27. <body>
  28. <div>
  29. <div style="padding: 15px;">
  30. <h1 class="mb-0" style="color:#002e86">機組1 總共有{{count}}座水塔</h1>
  31. </div>
  32. <div class="card">
  33. <p style="color:#002e86; padding: 15px;">濕球溫度預測:預測未來72小時濕球溫度不會低於下限</p>
  34. <canvas id="optim-predict"></canvas>
  35. </div>
  36. <div class="row px-0 mx-0 mb-5">
  37. <div class="col-lg-8">
  38. <div class="card2 h-100">
  39. <div class="fw-bold">
  40. <h1 class="mb-0" style="color:#002e86">水塔效能最佳化</h1>
  41. <h1 class="mt-0 pt-0">
  42. <hr class="my-1" style="background:#002e86; height: 1px; opacity: 1;">
  43. </h1>
  44. </div>
  45. <div class="row px-0 mx-0">
  46. <div class="col-lg-4 text-center">
  47. <div scr="hot_water" class="fw-bold">
  48. <!-- <h1><i style="color:#FF0000;" class="fas fa-thermometer-half me-2"></i>熱水溫度(°C)</h1> -->
  49. <p style="color:#002e86;">熱水溫度(°C)</p>
  50. <!-- <font size="1">{{ x }}</font><br> -->
  51. <div style="margin-top: -60px;" id="app" class="chart"></div>
  52. </div>
  53. </div>
  54. <div class="col-lg-4 text-center">
  55. <div id="cold_water" class="fw-bold">
  56. <!-- <h1><i style="color:#0174c7;" class="fas fa-thermometer-half me-2"></i>冷水溫度(°C)</h1> -->
  57. <p style="color:#002e86;">冷水溫度(°C)</p>
  58. <!-- <font size="1">{{ y }}</font><br> -->
  59. <div style="margin-top: -60px;" style="margin-top: -80px;" id="app2"></div>
  60. </div>
  61. </div>
  62. <div class="col-lg-4 text-center">
  63. <div id="wet_water" class="fw-bold">
  64. <!-- <h1><i style="color:#3dba1e;" class="fas fa-thermometer-half me-2"></i>濕球溫度(°C)</h1> -->
  65. <p style="color:#002e86;">濕球溫度(°C)</p>
  66. <!-- <font size="1">{{ z }}</font><br> -->
  67. <div style="margin-top: -60px;" id="app3"></div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="col-lg-4">
  74. <div class="card2 h-100">
  75. <h1 style="color:#002e86" class="mb-0">當前狀態</h1>
  76. <h1 class="my-0 py-0">
  77. <hr class="my-1" style="background:#002e86; height: 1px; opacity: 1;">
  78. </h1>
  79. <div style="font-weight:normal; padding: 15px;">
  80. <table class="table table-borderless">
  81. <tr>
  82. <td>水流量</td>
  83. <td>{{ waterflow }} M*3/H</td>
  84. </tr>
  85. <tr>
  86. <td>風扇數</td>
  87. <td>{{ fannum }} 台</td>
  88. </tr>
  89. </table>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <section class="tower_data my-3 mb-5">
  95. <div class="row px-0 mx-0">
  96. <div class="col-lg-6">
  97. <div class="card2 h-100">
  98. <h1 style="color:#002e86">效能最佳化</h1>
  99. <h1 class="my-0 py-0">
  100. <hr class="my-1" style="background:#002e86; height: 1px; opacity: 1;">
  101. </h1>
  102. <div style="padding: 15px;">
  103. <table class="table">
  104. <tr>
  105. <td>目前溫度</td>
  106. <td>{{ x }} 度C</td>
  107. </tr>
  108. <tr>
  109. <td>流量建議調整為</td>
  110. <td>{{ flowchange }} M*3/H</td>
  111. </tr>
  112. <tr>
  113. <td>可節省水費</td>
  114. <td>{{ savewater }} 元/天</td>
  115. </tr>
  116. <tr>
  117. <td>風扇建議調整為</td>
  118. <td>{{ fanchange }} 台</td>
  119. </tr>
  120. <tr>
  121. <td>可節省電費</td>
  122. <td>{{ saveelec }} 元/天</td>
  123. </tr>
  124. <tr>
  125. <td>總節省費用</td>
  126. <td>{{ total }} 元/天</td>
  127. </tr>
  128. </table>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="col-lg-6">
  133. <div class="card2 h-100">
  134. <div class="horizontal flat">
  135. <!-- <h1><i style="color:#0174c7;" class="far fa-chart-bar me-1"></i>測試驗證</h1> -->
  136. <h1 style="color:#002e86">測試驗證</h1>
  137. <h1 class="my-0 py-0">
  138. <hr class="my-1" style="background:#002e86; height: 1px; opacity: 1;">
  139. </h1>
  140. <div class="progress-content" style="padding: 15px;">
  141. <p class="mb-0">水流量:</p>
  142. <div class="progress-group mb-2">
  143. <!-- <div class="progress-label d-flex align-items-center justify-content-end">水流量</div> -->
  144. <!-- <span>100%</span> -->
  145. <div class="progress-bar horizontal my-1">
  146. <div class="progress-track">
  147. <div class="progress-fill d-flex align-items-center justify-content-center">
  148. <span>100%</span>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. <p class="mb-0">風扇數:</p>
  154. <div class="progress-group mb-2">
  155. <!-- <div class="progress-label d-flex align-items-center justify-content-end">風扇數</div> -->
  156. <div class="progress-bar horizontal my-1">
  157. <div class="progress-track">
  158. <div class="progress-fill2 d-flex align-items-center justify-content-center">
  159. <span>75%</span>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <p class="mb-0">濕求溫度:</p>
  165. <div class="progress-group mb-2">
  166. <!-- <div class="progress-label d-flex align-items-center justify-content-end">濕求溫度</div> -->
  167. <div class="progress-bar horizontal my-1">
  168. <div class="progress-track">
  169. <div class="progress-fill3 d-flex align-items-center justify-content-center">
  170. <span>60%</span>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. <p class="mb-0">熱水溫度:</p>
  176. <div class="progress-group">
  177. <!-- <div class="progress-label d-flex align-items-center justify-content-end">熱水溫度</div> -->
  178. <div class="progress-bar horizontal my-1">
  179. <div class="progress-track">
  180. <div class="progress-fill4 d-flex align-items-center justify-content-center">
  181. <span>20%</span>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </section>
  192. <script src="/static/echarts.min.js"></script>
  193. <script src="/static/echarts-liquidfill.js"></script>
  194. <script>
  195. function navlinkactive() {
  196. $('#nav-optim').addClass('active');
  197. };
  198. navlinkactive();
  199. </script>
  200. <script>
  201. var hot = '{{x}}'
  202. var cold = '{{y}}'
  203. var wet = '{{z}}'
  204. console.log(hot);
  205. console.log(cold);
  206. console.log(wet);
  207. var chart = echarts.init(document.getElementById("app"));
  208. chart.setOption({
  209. series: [
  210. {
  211. type: "liquidFill",
  212. name: 'Liquid Fill',
  213. data: [{
  214. name: 'First Data',
  215. value: 0.6,
  216. itemStyle: {
  217. color: '#FF0000'
  218. },
  219. }],
  220. radius: '70%',
  221. outline: {
  222. show: false
  223. },
  224. radius: '70%',
  225. outline: {
  226. show: false
  227. },
  228. outline: {
  229. show: false
  230. },
  231. label: {
  232. formatter: function (param) {
  233. return hot;
  234. },
  235. fontSize: 28
  236. }
  237. }
  238. ],
  239. });
  240. </script>
  241. <script>
  242. var hot = '{{x}}'
  243. var cold = '{{y}}'
  244. var wet = '{{z}}'
  245. console.log(hot);
  246. console.log(cold);
  247. console.log(wet);
  248. const chart2 = echarts.init(document.getElementById("app2"));
  249. chart2.setOption({
  250. series: [
  251. {
  252. type: "liquidFill",
  253. name: 'Liquid Fill',
  254. data: [{
  255. name: 'First Data',
  256. value: 0.6,
  257. itemStyle: {
  258. color: '#0174c7'
  259. },
  260. }],
  261. radius: '70%',
  262. outline: {
  263. show: false
  264. },
  265. radius: '70%',
  266. outline: {
  267. show: false
  268. },
  269. outline: {
  270. show: false
  271. },
  272. label: {
  273. formatter: function (param) {
  274. return cold;
  275. },
  276. fontSize: 28
  277. }
  278. }
  279. ],
  280. });
  281. </script>
  282. <script>
  283. var hot = '{{x}}'
  284. var cold = '{{y}}'
  285. var wet = '{{z}}'
  286. console.log(hot);
  287. console.log(cold);
  288. console.log(wet);
  289. const chart3 = echarts.init(document.getElementById("app3"));
  290. chart3.setOption({
  291. series: [
  292. {
  293. type: "liquidFill",
  294. name: 'Liquid Fill',
  295. data: [{
  296. name: 'First Data',
  297. value: 0.6,
  298. itemStyle: {
  299. color: '#3dba1e'
  300. },
  301. }],
  302. radius: '70%',
  303. outline: {
  304. show: false
  305. },
  306. outline: {
  307. show: false
  308. },
  309. label: {
  310. formatter: function (param) {
  311. return wet;
  312. },
  313. fontSize: 28
  314. }
  315. }
  316. ],
  317. });
  318. </script>
  319. <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.5.1/chart.min.js"
  320. integrity="sha512-Wt1bJGtlnMtGP0dqNFH1xlkLBNpEodaiQ8ZN5JLA5wpc1sUlk/O5uuOMNgvzddzkpvZ9GLyYNa8w2s7rqiTk5Q=="
  321. crossorigin="anonymous" referrerpolicy="no-referrer"></script> -->
  322. <!-- <script>
  323. const chart2 = echarts.init(document.getElementById("cold_water_data"));
  324. chart2.setOption({
  325. series: [
  326. {
  327. type: "liquidFill",
  328. data: [0.6, 0.5, 0.4, 0.3]
  329. }
  330. ]
  331. });
  332. </script>
  333. <script>
  334. const chart3 = echarts.init(document.getElementById("wet_water_data"));
  335. chart3.setOption({
  336. series: [
  337. {
  338. type: "liquidFill",
  339. data: [0.6, 0.5, 0.4, 0.3]
  340. }
  341. ]
  342. });
  343. </script> -->
  344. <!-- css -->
  345. <style>
  346. table {
  347. font-family: arial, sans-serif;
  348. border-collapse: collapse;
  349. width: 50%;
  350. padding: 15px !important;
  351. }
  352. td,
  353. th {
  354. border: none !important;
  355. text-align: left;
  356. padding: 8px;
  357. font-size: 2.4vmin;
  358. }
  359. tr:nth-child(even) {
  360. background-color: #e4f8ff;
  361. }
  362. </style>
  363. <!-- <script src="/static/echarts.min.js"></script>
  364. <script src="/static/echarts-liquidfill.js"></script>
  365. <script>
  366. // const chart = echarts.init(document.getElementById("app"));
  367. var hot_water = echarts.init(document.getElementById("app"));
  368. var cold_water = echarts.init(document.getElementById("app2"));
  369. var wet_water = echarts.init(document.getElementById("app3"));
  370. let date = transform_time_to_string(new Date());
  371. fetch(`/temperature/date=${date}`)
  372. .then(function (response) {
  373. return response.json();
  374. })
  375. .then(function (myJson) {
  376. hot_water.setOption({
  377. series: [
  378. {
  379. type: "liquidFill",
  380. data: [0.6, 0.5, 0.4, 0.3]
  381. }
  382. ]
  383. });
  384. cold_water.setOption({
  385. series: [
  386. {
  387. type: "liquidFill",
  388. data: [0.6, 0.5, 0.4, 0.3]
  389. }
  390. ]
  391. });
  392. wet_water.setOption({
  393. series: [
  394. {
  395. type: "liquidFill",
  396. data: [0.6, 0.5, 0.4, 0.3]
  397. }
  398. ]
  399. });
  400. });
  401. </script> -->
  402. <!-- <script type="text/javascript">
  403. var hot_water = echarts.init(document.getElementById("hot_water"));
  404. var cold_water = echarts.init(document.getElementById("cold_water"));
  405. var wet_water = echarts.init(document.getElementById("wet_water"));
  406. let date = transform_time_to_string(new Date());
  407. fetch(`/temperature/date=${date}`)
  408. .then(function (response) {
  409. return response.json();
  410. })
  411. .then(function (myJson) {
  412. // 配置圖表資訊
  413. console.log(myJson);
  414. option = {
  415. series: [{
  416. type: 'liquidFill',
  417. data: myJson['hot_water']
  418. }]
  419. };
  420. hot_water.setOption(option);
  421. option = {
  422. series: [{
  423. type: 'liquidFill',
  424. data: myJson['cold_water']
  425. }]
  426. };
  427. cold_water.setOption(option);
  428. option = {
  429. series: [{
  430. type: 'liquidFill',
  431. data: myJson['wet_water']
  432. }]
  433. };
  434. wet_water.setOption(option);
  435. });
  436. </script> -->
  437. <!-- css -->
  438. <!-- <style>
  439. .horizontal .progress-bar {
  440. float: left;
  441. height: 50px;
  442. width: 100%;
  443. padding: 3px 0;
  444. }
  445. .horizontal .progress-track {
  446. position: relative;
  447. width: 100%;
  448. height: 50px;
  449. background: #ebebeb;
  450. }
  451. .horizontal .progress-fill {
  452. position: relative;
  453. background: #2883fa;
  454. height: 50px;
  455. width: 50%;
  456. color: #080707;
  457. text-align: center;
  458. font-family: "Lato", "Verdana", sans-serif;
  459. font-size: 16px;
  460. line-height: 20px;
  461. }
  462. .horizontal .progress-fill2 {
  463. position: relative;
  464. background: #ba711e;
  465. height: 50px;
  466. width: 50%;
  467. color: #080707;
  468. text-align: center;
  469. font-family: "Lato", "Verdana", sans-serif;
  470. font-size: 16px;
  471. line-height: 20px;
  472. }
  473. .horizontal .progress-fill3 {
  474. position: relative;
  475. background: #3dba1e;
  476. height: 50px;
  477. width: 50%;
  478. color: #080707;
  479. text-align: center;
  480. font-family: "Lato", "Verdana", sans-serif;
  481. font-size: 16px;
  482. line-height: 20px;
  483. }
  484. .horizontal .progress-fill4 {
  485. position: relative;
  486. background: #f0ff1f;
  487. height: 50px;
  488. width: 50%;
  489. color: #080707;
  490. text-align: center;
  491. font-family: "Lato", "Verdana", sans-serif;
  492. font-size: 16px;
  493. line-height: 20px;
  494. }
  495. .progress-label {
  496. width: 170px;
  497. text-align: right;
  498. padding-right: 10px;
  499. font-size: 16px;
  500. }
  501. .progress-group {
  502. display: flex;
  503. }
  504. .progress-label::after {
  505. content: ":";
  506. }
  507. </style> -->
  508. <!-- <div class="card mt-5">
  509. <div class="horizontal flat">
  510. <h1><i style="color:#0174c7;" class="far fa-chart-bar me-1"></i>測試驗證</h1>
  511. <div class="progress-group">
  512. <div class="progress-label d-flex align-items-center justify-content-end">水流量</div>
  513. <div class="progress-bar horizontal my-2">
  514. <div class="progress-track">
  515. <div class="progress-fill d-flex align-items-center justify-content-center">
  516. <span>100%</span>
  517. </div>
  518. </div>
  519. </div>
  520. </div>
  521. <div class="progress-group">
  522. <div class="progress-label d-flex align-items-center justify-content-end">風扇數</div>
  523. <div class="progress-bar horizontal my-2">
  524. <div class="progress-track">
  525. <div class="progress-fill2 d-flex align-items-center justify-content-center">
  526. <span>75%</span>
  527. </div>
  528. </div>
  529. </div>
  530. </div>
  531. <div class="progress-group">
  532. <div class="progress-label d-flex align-items-center justify-content-end">濕求溫度</div>
  533. <div class="progress-bar horizontal my-2">
  534. <div class="progress-track">
  535. <div class="progress-fill3 d-flex align-items-center justify-content-center">
  536. <span>60%</span>
  537. </div>
  538. </div>
  539. </div>
  540. </div>
  541. <div class="progress-group">
  542. <div class="progress-label d-flex align-items-center justify-content-end">熱水溫度</div>
  543. <div class="progress-bar horizontal my-2">
  544. <div class="progress-track">
  545. <div class="progress-fill4 d-flex align-items-center justify-content-center">
  546. <span>20%</span>
  547. </div>
  548. </div>
  549. </div>
  550. </div>
  551. </div> -->
  552. <script>$(function () {
  553. $('.progress-fill span').each(function () {
  554. var percent = $(this).html();
  555. $(this).parent().css('width', percent);
  556. });
  557. $('.progress-fill2 span').each(function () {
  558. var percent = $(this).html();
  559. $(this).parent().css('width', percent);
  560. });
  561. $('.progress-fill3 span').each(function () {
  562. var percent = $(this).html();
  563. $(this).parent().css('width', percent);
  564. });
  565. $('.progress-fill4 span').each(function () {
  566. var percent = $(this).html();
  567. $(this).parent().css('width', percent);
  568. });
  569. });</script>
  570. <!-- <script></script> -->
  571. {% endblock %}