├── .gitignore ├── LICENSE ├── MAINTAINERS ├── NOTICE ├── README.md ├── docker-compose.dev.yml ├── docker-compose.sim.yml ├── docker-compose.yml ├── docs ├── equipment.png ├── libre-line-performance.png ├── libre-logo.png ├── libre-order-state-model.drawio ├── libre-order-state-model.png ├── product-operation.png ├── product.png ├── raw-material.png ├── reason-codes.png ├── scheduler-order-mgt-table-panel.gif ├── simulator.png └── try-it-out.md ├── grafana ├── Dockerfile └── provisioning │ ├── dashboards │ ├── SmartFactory.yaml │ └── smart-factory │ │ ├── analytics.json │ │ ├── line-performance.json │ │ ├── line-schedule.json │ │ ├── master-data.json │ │ └── scheduling.json │ └── datasources │ ├── Influx.yaml │ └── PostgreSQL.yaml ├── integration-templates ├── README.md ├── integration-template.md └── rpi-part-counter │ ├── Libre Template.json │ └── README.md └── postgres ├── Dockerfile └── db ├── 02_structure.sql └── 03_data_bootstrap.sql /.gitignore: -------------------------------------------------------------------------------- 1 | /grafana/plugins 2 | /grafana/plugins/ 3 | tmp 4 | tmp/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2020 Spruik Technologies 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | Geoff Nunan 2 | Tom Hollingworth -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | 2 | This document contains attribution notices and/or licenses for 3rd party software used. 3 | 4 | ------ 5 | 6 | This product uses the software 'PostgreSQL' with the following license: 7 | 8 | PostgreSQL is released under the (PostgreSQL License)[http://www.opensource.org/licenses/postgresql], a liberal Open Source license, similar to the BSD or MIT licenses. 9 | 10 | PostgreSQL Database Management System 11 | (formerly known as Postgres, then as Postgres95) 12 | 13 | Portions Copyright © 1996-2020, The PostgreSQL Global Development Group 14 | 15 | Portions Copyright © 1994, The Regents of the University of California 16 | 17 | Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. 18 | 19 | IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 20 | 21 | THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 22 | 23 | ------ 24 | 25 | This product uses the software 'Grafana' with the following license: 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ![Libre](docs/libre-logo.png) 2 | 3 | > Open source Manufacturing Execution and Performance Monitoring built on [Grafana](https://grafana.com), [Influx](https://www.influxdata.com/), and [Postgres](https://www.postgresql.org/). 4 | 5 | Define your master data, push your machine metrics, start collecting and analyzing your manufacturing data with Libre. Libre is an open source manufacturing execution and performance monitoring tool. 6 | 7 | - _Define:_ Your manufacturing master data including your enterprise model, downtime reasons, products, ingredients and product steps. 8 | - _Capture:_ Connect up your machines using a variety of methods into key buckets with an InfluxDB Historian 9 | - _Use:_ Schedulers create and schedule orders, operators execute orders and capture downtime reasons. 10 | - _Improve:_ Get key insights into your manufacturing, understand your biggest losses, visualize OEE. 11 | - _Extensible:_ Built on Grafana, Influx and postgres push your key process parameters to view alongside your production dashboards. Extend with your Grafana dashboards. Free to innovate. 12 | 13 | ![Libre](docs/libre-line-performance.png) 14 | 15 | ## Try it out 16 | 17 | Use the [Libre Simulator](https://github.com/Spruik/Libre-Simulator) to test out Libre. The quickest way to run Libre and the Libre Simulator it is with the docker-compose command `docker-compose -f docker-compose.yml -f docker-compose.sim.yml up -d`. This will start up Libre and the simulator together. After running the command, browse to `http://localhost:3000` to access Grafana and `http://localhost:1880/ui` to control the simulation. 18 | 19 | See [Try it out](/docs/try-it-out.md) for more information. 20 | 21 | ## Getting Started 22 | 23 | ### Installation 24 | 25 | Libre requires the following on an x86 architecture server 26 | 27 | - docker (>= 18 required) 28 | - docker-compose (>= 1.25 required) 29 | - git (>= 2 optional) 30 | 31 | The `docker-compose.yml` file is required to start. Easiest way to get this is to clone this repository. 32 | 33 | ```shell 34 | $ git clone https://github.com/Spruik/Libre 35 | 36 | Cloning into 'Libre'... 37 | remote: Enumerating objects: 165, done. 38 | remote: Counting objects: 100% (165/165), done. 39 | remote: Compressing objects: 100% (115/115), done. 40 | 41 | Receiving objects: 100% (165/165), 176.45 KiB | 3.60 MiB/s, done. 42 | Resolving deltas: 100% (49/49), done. 43 | 44 | $ docker-compose up -d 45 | Creating network "libre_default" with the default driver 46 | Creating volume "libre_grafana_plugins" with default driver 47 | Creating volume "libre_grafana_provisioning" with default driver 48 | Creating volume "libre_postgres_data" with default driver 49 | Creating volume "libre_influx_data" with default driver 50 | Creating libre_influx_1 ... done 51 | Creating libre_postgres_1 ... done 52 | Creating libre_grafana_1 ... done 53 | Creating libre_postREST_1 ... done 54 | 55 | ``` 56 | 57 | #### Set Grafana Admin Password 58 | 59 | Once Libre is installed and running, navigate to `http://:3000/` and use the default Grafana login username `admin` and password `admin` to login. You will then be prompted to change the default password. 60 | 61 | ### Define your factory Model 62 | 63 | Define your factory model using the provided `SmartFactory/Master Data` dashboard. Start by long-clicking the Enterprise in the equipment panel and add a Site. Long-click the newly created site and add an Area. Continue this process to add in a Line and equipment on the line. Add in any additional Sites, area, lines and equipment to mimic your enterprise. 64 | 65 | ![Equipment](/docs/equipment.png) 66 | 67 | Next, define your reason codes. Long click ReasonCodes in the Reason Codes panel and add a category. Once a category has been created, long click the category to add in a reason. 68 | 69 | > Two recommend categories are `Planned` and `Unplanned` 70 | 71 | ![Reason Codes](/docs/reason-codes.png) 72 | 73 | Raw Materials are added during product operations. Products are made up of a number of product operations. Finally, products can be categorized by groups. Start by entering in Raw Material information by clicking the (+) on the Raw Material panel. These are the ingredients that go into your final product. Once raw materials have been added, add in the required Product Operations in the Product Operation panel. Product Operations are the steps to manufacture the final product and is where a raw ingredient is added. For example `Fill Tank` or `Add Label`. 74 | 75 | ![Raw Materials](docs/raw-material.png) 76 | 77 | ![Product Operations](docs/product-operation.png) 78 | 79 | Once Raw Materials and Product Operations are added create a Product group using the Products Panel. Click the (+) and select Product Group, enter a name and save. Follow the same process and select Product. You can now add any number of product operations, and optionally an ingredient, to the product definition. At a minimum provide a product name, product group and save. Repeat for all your products. 80 | 81 | ![Products](docs/product.png) 82 | 83 | Now that you have defined your factory model, downtime reasons, ingredients, product operations and products your are ready to start scheduling orders. 84 | 85 | ### Scheduling Orders 86 | 87 | Schedule orders on your lines using the `SmartFactory/Scheduling` dashboard. To setup use the `Production Line Start Time Setter` to define the start time for each line. This is the time whereby an order will be first scheduled for the day. For 24hr operation, set to 12:00AM. 88 | 89 | Use the `Scheduler Order Management Table` panel to create orders. Click the (+) define the order details and submit. Orders can be edited until they are released. Once an order has been released it can no longer be edited. Orders are edited by clicking in them in the panel. 90 | 91 | ![Scheduler Table](docs/scheduler-order-mgt-table-panel.gif) 92 | 93 | Orders have the following state model: 94 | 95 | ![Libre Order State Model](docs/libre-order-state-model.png) 96 | 97 | The `SmartFactory/Line Schedule` dashboard shows the schedule for the selected manufacturing line. Orders can be set to next/running so that they are visible on the `SmartFactory/Line Performance` dashboard. 98 | 99 | ### Executing Orders 100 | 101 | Orders be executed by clicking from the list in either `SmartFactory/Line Performance` or `SmartFactory/Line Schedule` and selecting Running. Only a single order can be Running at once per line. The Paused state can be used to pause orders until they are ready to be execute on again or completed. Once an order is running machine state and counts are logged against that order. 102 | 103 | ### Integrating Machines 104 | 105 | Machines will need to push data to the following buckets and schemas. Some [integration templates](/integration-templates/README.md) are also provided within this repository. 106 | 107 | #### Availability 108 | 109 | The machine will need to publish to the `Availability` Influx bucket with the following information. It is important that the tags match the [model definition](#Define-your-factory-Model). Log data on state change. `category`, `reason`, `parentReason` and `comment` are for classification of downtime category/reason. The Machine can self report (if known), otherwise leave blank. An operator can always split a reason and override 110 | 111 | | Name | Type | Variable Type | Details | 112 | |--------------|-------|---------------|-----------------------------------------------------------------------------------------------| 113 | | Site | tag | string | | 114 | | Area | tag | string | | 115 | | Line | tag | string | | 116 | | idle | field | number | ∈ [1, 0] for active / not active | 117 | | stopped | field | number | ∈ [1, 0] for active / not active | 118 | | held | field | number | ∈ [1, 0] for active / not active | 119 | | execute | field | number | ∈ [1, 0] for active / not active | 120 | | complete | field | number | ∈ [1, 0] for active / not active | 121 | | status | field | string | String - ∈ ['idle', 'stopped', 'held', 'execute', 'complete']. String representation of state | 122 | | category | field | string | Label of the category | 123 | | reason | field | string | Label of the reason | 124 | | parentReason | field | string | Child reason of the category (same reason as above) | 125 | | comment | field | string | Comment on the reason | 126 | 127 | #### Performance 128 | 129 | The machine will need to publish to the `Performance` Influx bucket with the following information. It is important that the tags match the [model definition](#Define-your-factory-Model). Log data on state, planned rate or a significant actual_rate change. Ensure to use identical units for `planned_rate` and `actual_rate`. 130 | 131 | | Name | Type | Variable Type | Details | 132 | |--------------|-------|---------------|-----------------------------------------------------------------------------------------------| 133 | | Site | tag | string | | 134 | | Area | tag | string | | 135 | | Line | tag | string | | 136 | | idle | field | number | ∈ [1, 0] for active / not active | 137 | | stopped | field | number | ∈ [1, 0] for active / not active | 138 | | held | field | number | ∈ [1, 0] for active / not active | 139 | | execute | field | number | ∈ [1, 0] for active / not active | 140 | | complete | field | number | ∈ [1, 0] for active / not active | 141 | | status | field | string | String - ∈ ['idle', 'stopped', 'held', 'execute', 'complete']. String representation of state | 142 | | planned_rate | field | float | The planned rate or line theoretically best possible rate | 143 | | actual_rate | field | float | The actual machine rate | 144 | 145 | #### Quality 146 | 147 | The machine will need to publish to the `Quality` Influx bucket with the following information. It is important that the tags match the [model definition](#Define-your-factory-Model). Log data on state, planned rate or a significant actual_rate change. 148 | 149 | | Name | Type | Variable Type | Details | 150 | |--------------|-------|---------------|-------------------------------------| 151 | | Site | tag | string | | 152 | | Area | tag | string | | 153 | | Line | tag | string | | 154 | | Temp | field | number | Quantity of good product this order | 155 | 156 | #### Order Performance 157 | 158 | The machine will need to publish to the `OrderPerformance` Influx bucket with the following information. Log data on issued_qty change. Note that order_id and product_id must match to update the current order panel. 159 | 160 | | Name | Type | Variable Type | Details | 161 | |--------------|-------|---------------|-----------------------------------| 162 | | order_id | tag | string | Current order id | 163 | | product_id | tag | string | Current product id | 164 | | issued_qty | field | number | Count of good products this order | 165 | 166 | ### Analyzing the Manufacturing Data 167 | 168 | Analyse your manufacturing data using the `SmartFactory/Line Performance` and `SmartFactory/Analysis` dashboards. Line Performance offers analysis of performance and availability whilst the Analysis dashboard drills into time loss through Downtime Pareto graphs and sunbursts of both Downtime duration and frequency. 169 | 170 | ## Developing 171 | 172 | Prerequisites 173 | 174 | - docker (>= 18 required) 175 | - git (>= 1.20 required) 176 | 177 | 1. Run the docker compose with the docker-compose.dev.yl file. Include the --build argument to build containers from source. `docker-compose -f docker-compose.dev.yml up --build` 178 | 2. To clear data whilst developing ensure to remove volumes `docker-compose -f docker-compose.dev.yml rm -v` 179 | 180 | ## Building 181 | 182 | Prerequisites 183 | 184 | - docker (>= 18 required) 185 | - git (>= 1.20 required) 186 | 187 | 1. Clone this repository with `git clone https://github.com/Spruik/Libre` and enter directory `cd Libre` 188 | 2. Change directory into grafana and build the container `cd grafana`, `docker build . -t spruiktec/libre-grafana` 189 | 3. Change directory up one level, into postgres and build the container `cd .. && cd postgres`, `docker build . -t spruiktec/libre-postgres` 190 | 191 | ## Contributing 192 | 193 | For any issue, there are fundamentally three ways an individual can contribute: 194 | 195 | - By opening the issue for discussion: For instance, if you believe that you have uncovered a bug in, creating a new issue in the [GitHub issue tracker](https://github.com/Spruik/Libre/issues) is the way to report it. 196 | - By helping to triage the issue: This can be done either by providing supporting details (a test case that demonstrates a bug) or providing suggestions on how to address the issue. 197 | - By helping to resolve the issue: Typically, this is done either in the form of demonstrating that the issue reported is not a problem after all, or more often, by opening a Pull Request that changes some bit of something in the panel in a concrete and reviewable manner. 198 | 199 | ## License 200 | 201 | Libre is distributed under the [Apache 2.0 License](https://github.com/spruik/libre/blob/master/LICENSE). 202 | 203 | ## Change Log 204 | 205 | - 1.0.3 206 | - Documentation Update 207 | - Added integration Templates 208 | - Added rpi-part-counter. Credits to R.W. for their submission! 209 | 210 | - 1.0.2 211 | - Bump [Libre-Production-Line-Time-Setter-Panel](https://github.com/Spruik/Libre-Production-Line-Time-Setter-Panel/releases/download/v1.0.4/libre-production-line-time-setter-panel.tar.gz) from 1.0.3 to 1.0.4 212 | 213 | - 1.0.1 214 | - Fix Line Performance Downtime table event duration 215 | - Fix Line Performance Graph Query Bug 216 | - Fix Spelling 217 | - Bump Revision 218 | 219 | - 1.0.0 Initial Public Release 220 | -------------------------------------------------------------------------------- /docker-compose.dev.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | 3 | x-common-postgres-variables: &common-postgres-variables 4 | POSTGRES_USER: postgres 5 | POSTGRES_PASSWORD: mysecretpassword 6 | 7 | x-common-influx-variables: &common-influx-variables 8 | INFLUXDB_DB: smart_factory 9 | INFLUXDB_USER: admin 10 | INFLUXDB_USER_PASSWORD: admin 11 | 12 | services: 13 | grafana: 14 | build: ./grafana 15 | ports: 16 | - 3000:3000 17 | volumes: 18 | - grafana_plugins:/var/lib/grafana/plugins 19 | - grafana_provisioning:/etc/grafana/provisioning 20 | environment: 21 | <<: *common-postgres-variables 22 | <<: *common-influx-variables 23 | depends_on: 24 | - postgres 25 | - influx 26 | postgres: 27 | build: ./postgres 28 | environment: *common-postgres-variables 29 | ports: 30 | - 5432:5432 31 | volumes: 32 | - postgres_data:/var/lib/postgresql/data 33 | influx: 34 | image: influxdb 35 | ports: 36 | - 8086:8086 37 | environment: *common-influx-variables 38 | volumes: 39 | - influx_data:/var/lib/influxdb 40 | postREST: 41 | image: postgrest/postgrest 42 | ports: 43 | - 5436:3000 44 | environment: 45 | - PGRST_DB_URI=postgres://postgres:mysecretpassword@postgres/smartfactory 46 | - PGRST_DB_ANON_ROLE=postgres 47 | depends_on: 48 | - postgres 49 | 50 | volumes: 51 | grafana_plugins: 52 | grafana_provisioning: 53 | postgres_data: 54 | influx_data: 55 | -------------------------------------------------------------------------------- /docker-compose.sim.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | 3 | services: 4 | simulator: 5 | image: spruiktec/libre-simulator 6 | ports: 7 | - 1880:1880 8 | depends_on: 9 | - influx 10 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | 3 | x-common-postgres-variables: &common-postgres-variables 4 | POSTGRES_USER: postgres 5 | POSTGRES_PASSWORD: mysecretpassword 6 | 7 | x-common-influx-variables: &common-influx-variables 8 | INFLUXDB_DB: smart_factory 9 | INFLUXDB_USER: admin 10 | INFLUXDB_USER_PASSWORD: admin 11 | 12 | services: 13 | grafana: 14 | image: spruiktec/libre-grafana 15 | restart: always 16 | ports: 17 | - 3000:3000 18 | volumes: 19 | - grafana_plugins:/var/lib/grafana/plugins 20 | - grafana_provisioning:/etc/grafana/provisioning 21 | environment: 22 | <<: *common-postgres-variables 23 | <<: *common-influx-variables 24 | depends_on: 25 | - postgres 26 | - influx 27 | postgres: 28 | image: spruiktec/libre-postgres 29 | restart: always 30 | environment: *common-postgres-variables 31 | ports: 32 | - 5432:5432 33 | volumes: 34 | - postgres_data:/var/lib/postgresql/data 35 | influx: 36 | image: influxdb 37 | restart: always 38 | ports: 39 | - 8086:8086 40 | environment: *common-influx-variables 41 | volumes: 42 | - influx_data:/var/lib/influxdb 43 | postREST: 44 | image: postgrest/postgrest 45 | restart: always 46 | ports: 47 | - 5436:3000 48 | environment: 49 | - PGRST_DB_URI=postgres://postgres:mysecretpassword@postgres/smartfactory 50 | - PGRST_DB_SCHEMA=public 51 | - PGRST_DB_ANON_ROLE=postgres 52 | depends_on: 53 | - postgres 54 | 55 | volumes: 56 | grafana_plugins: 57 | grafana_provisioning: 58 | postgres_data: 59 | influx_data: 60 | -------------------------------------------------------------------------------- /docs/equipment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/equipment.png -------------------------------------------------------------------------------- /docs/libre-line-performance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/libre-line-performance.png -------------------------------------------------------------------------------- /docs/libre-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/libre-logo.png -------------------------------------------------------------------------------- /docs/libre-order-state-model.drawio: -------------------------------------------------------------------------------- 1 | 7VtbU6MwFP41fdQBwq2Pa2t13Ms46+6qTzuxpMCakk5Ibeuv3wAJl2JLrLVFBx8czknOScg535dDMu2BwXR5QeEs+E48hHuG5i17YNgzDMfs8/+JYpUpTNPMFD4NvUylF4qb8BkJpSa089BDcaUjIwSzcFZVjkkUoTGr6CClZFHtNiG4OuoM+qimuBlDXNfehh4LhFbXtKLhEoV+IIZ2LdHwAMePPiXzSIzXM8Ak/cuap1D6Ev3jAHpkUVKB8x4YUEJY9jRdDhBOllYuW2Y32tCaz5uiiKkY2BpyNEe3nT7QAUD9EyAC9QTxHMl3SGfKVnJ1kMcXS4iEsoD4JIL4vNCepSuAkjE0LgVsivmjzh8xfED4LF+kAcGE8qaIRIlZzCBlIhssLqPI+5JEk4tjDOM4HP8KwihrGIVYOuVSyegfYmwlZDhnhKuKSX4jZCasYkbJYx7eRDMhERvBaYiTrP2DqAcjKNTCn5uOxujqTrxaKtwnwqklxeGy3DhcSWkZsjs5Y/5csuJSYZQI0qYeThHhmMzpWITj6/PvxQTdDgdXzj10/16iq+HziUQNpD5iW/qJ6CYhLQ0gkuUCkSni78A7CGSfaKe2bTuZ0aoKWoowZOFTFUJQINHPXeXer0nI36roQiaTmM+1lK78oTSJQpUm8csJvW0xSjk9oAgynqDrqb0IQoZuZjBd2wXntmr6VvM6B69KZu+WbBCHfpSkP08ARGW7mG/qhsNAjsXJZpT+5ZnzhChDy43csD3WktNEmK3+qWtnmkXBia7oFJTY0NQ2x74S2tfG0ajF8SeC3uqjR/HtodKd1sUK1GL1Ay1ZFyqj37pQdVv+jlu+sdueb6hs+ms78m5VgKFYBYAWbfpFHwkxt4oYt0CM9JIthLDb4iqvuze7ytaq5mpfpYhV38LmURRGfseMpt46ZrQ7Zmzbx5AKLzbynaXIn63mRWsNL87uvGhqx+ZFp4a0AZnOMGKoI0YLtI4Y3Y4YPyIxNhKepUigTquJsZnNVInRMo9NjP06MWISf/yjq7fTot2+AyqZ5B0vfjJedBR5sd9mXrTtvfGic/SCUa8f6l/DeUeMvfqHtA5awIz1s/uOGTcw46ljVchRkRqlnWBH/VDcqFoz6m26Wvzk5Fi/fenQtgltRgVtujLajDLatEOhTX/VGVdr0bZ2pKFru8Ot5ss8PN66KzR1vO24uR0FbcZnABtoPsRQxRpovot7b6jVb9A6qL0MNb0CtFJV2YS1yje2c7CPbKAINqMD26HA1l2A7rivqZaRRzrPUq4iW33Qb5r7qyINt9nXe6OtfgnaoW2vaKtWkQc7IVGtIlt9erwOEPsNX2xao6sNUOMpCVelbrOkQ/zCi8lJrx2FGgWqN06u32TCH7J5KKKfi8UvOrLuxa9mwPl/ -------------------------------------------------------------------------------- /docs/libre-order-state-model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/libre-order-state-model.png -------------------------------------------------------------------------------- /docs/product-operation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/product-operation.png -------------------------------------------------------------------------------- /docs/product.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/product.png -------------------------------------------------------------------------------- /docs/raw-material.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/raw-material.png -------------------------------------------------------------------------------- /docs/reason-codes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/reason-codes.png -------------------------------------------------------------------------------- /docs/scheduler-order-mgt-table-panel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/scheduler-order-mgt-table-panel.gif -------------------------------------------------------------------------------- /docs/simulator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Spruik/Libre/219ccdfef14c1d9614942c3072af60dd3f639fdf/docs/simulator.png -------------------------------------------------------------------------------- /docs/try-it-out.md: -------------------------------------------------------------------------------- 1 | # Try it Out 2 | 3 | Try out Libre before spending time on setup. Alternatively checkout the [Spruik Technologies](https://www.youtube.com/channel/UCLSo9vtYPXkuOJkXNnooCjQ) YouTube channel for videos. 4 | 5 | ## Prerequisites 6 | 7 | - docker (>= 18 required) 8 | - docker-compose (>= 1.25 required) 9 | - git (>= 1.25 optional) 10 | 11 | ## Running 12 | 13 | 1. Clone this repository `git clone https://github.com/Spruik/Libre` 14 | 15 | ```shell 16 | $ git clone https://github.com/Spruik/Libre 17 | Cloning into 'Libre'... 18 | remote: Enumerating objects: 165, done. 19 | remote: Counting objects: 100% (165/165), done. 20 | remote: Compressing objects: 100% (115/115), done. 21 | 22 | Receiving objects: 100% (165/165), 176.45 KiB | 3.60 MiB/s, done. 23 | Resolving deltas: 100% (49/49), done. 24 | 25 | ``` 26 | 27 | ```shell 28 | cd Libre 29 | ``` 30 | 31 | 2. Start Libre with Libre Simulator `docker-compose -f docker-compose.yml -f docker-compose.sim.yml up -d` 32 | 33 | ```shell 34 | $ docker-compose -f docker-compose.yml -f docker-compose.sim.yml up -d 35 | Creating network "libre_default" with the default driver 36 | Creating volume "libre_grafana_plugins" with default driver 37 | Creating volume "libre_grafana_provisioning" with default driver 38 | Creating volume "libre_postgres_data" with default driver 39 | Creating volume "libre_influx_data" with default driver 40 | Creating libre_influx_1 ... done 41 | Creating libre_postgres_1 ... done 42 | Creating libre_simulator_1 ... done 43 | Creating libre_postREST_1 ... done 44 | Creating libre_grafana_1 ... done 45 | 46 | ``` 47 | 48 | 3. Navigate to `https://localhost:3000` log into Grafana with username admin and password admin. Explore the SmartFactory dashboard folder. 49 | 50 | 4. Navigate to `https://localhost:1880/ui` to start/stop and complete a line. 51 | 52 | ![Simulation](simulator.png) 53 | -------------------------------------------------------------------------------- /grafana/Dockerfile: -------------------------------------------------------------------------------- 1 | # Dockerfile 2 | FROM grafana/grafana:6.7.4 3 | 4 | LABEL maintainer="Tom Hollingworth " 5 | 6 | # 7 | # Copy in Provisioned datasources & dashboards 8 | # 9 | 10 | COPY ./provisioning/datasources/*.yaml /etc/grafana/provisioning/datasources/ 11 | COPY ./provisioning/dashboards/*.yaml /etc/grafana/provisioning/dashboards/ 12 | COPY ./provisioning/dashboards/smart-factory/*.json /etc/grafana/provisioning/dashboards/smart-factory/ 13 | 14 | # 15 | # Grafana Configuration 16 | # 17 | 18 | ENV GF_DEFAULT_THEME=light 19 | 20 | # 21 | # Add in latest versions of all plugins 22 | # - One liners so we down leave container layers and bloat our container 23 | # 24 | RUN cd /var/lib/grafana/plugins \ 25 | && wget https://github.com/Spruik/Libre-Operation-CRUD-Table-Panel/releases/latest/download/libre-operation-crud-table-panel.tar.gz \ 26 | && mkdir ./libre-operation-crud-table-panel \ 27 | && tar -xf libre-operation-crud-table-panel.tar.gz -C ./libre-operation-crud-table-panel \ 28 | && rm libre-operation-crud-table-panel.tar.gz 29 | 30 | RUN cd /var/lib/grafana/plugins \ 31 | && wget https://github.com/Spruik/Libre-Downtime-Sunburst-Chart-Panel/releases/latest/download/libre-downtime-sunburst-chart-panel.tar.gz \ 32 | && mkdir ./libre-downtime-sunburst-chart-panel \ 33 | && tar -xf libre-downtime-sunburst-chart-panel.tar.gz -C ./libre-downtime-sunburst-chart-panel \ 34 | && rm libre-downtime-sunburst-chart-panel.tar.gz 35 | 36 | RUN cd /var/lib/grafana/plugins \ 37 | && wget https://github.com/Spruik/Libre-Equipment-CRUD-Tree-Chart-Panel/releases/latest/download/libre-equipment-crud-tree-chart-panel.tar.gz \ 38 | && mkdir ./libre-equipment-crud-tree-chart-panel \ 39 | && tar -xf libre-equipment-crud-tree-chart-panel.tar.gz -C ./libre-equipment-crud-tree-chart-panel \ 40 | && rm libre-equipment-crud-tree-chart-panel.tar.gz 41 | 42 | RUN cd /var/lib/grafana/plugins \ 43 | && wget https://github.com/Spruik/Libre-Reason-Codes-CRUD-Tree-Chart-Panel/releases/latest/download/libre-reason-codes-crud-tree-chart-panel.tar.gz \ 44 | && mkdir ./libre-reason-codes-crud-tree-chart-panel \ 45 | && tar -xf libre-reason-codes-crud-tree-chart-panel.tar.gz -C ./libre-reason-codes-crud-tree-chart-panel \ 46 | && rm libre-reason-codes-crud-tree-chart-panel.tar.gz 47 | 48 | RUN cd /var/lib/grafana/plugins \ 49 | && wget https://github.com/Spruik/Libre-Production-Line-Time-Setter-Panel/releases/download/v1.0.4/libre-production-line-time-setter-panel.tar.gz \ 50 | && mkdir ./libre-production-line-time-setter-panel \ 51 | && tar -xf libre-production-line-time-setter-panel.tar.gz -C ./libre-production-line-time-setter-panel \ 52 | && rm libre-production-line-time-setter-panel.tar.gz 53 | 54 | RUN cd /var/lib/grafana/plugins \ 55 | && wget https://github.com/Spruik/Libre-Material-CRUD-Table-Panel/releases/latest/download/libre-material-crud-table-panel.tar.gz \ 56 | && mkdir ./libre-material-crud-table-panel \ 57 | && tar -xf libre-material-crud-table-panel.tar.gz -C ./libre-material-crud-table-panel \ 58 | && rm libre-material-crud-table-panel.tar.gz 59 | 60 | RUN cd /var/lib/grafana/plugins \ 61 | && wget https://github.com/Spruik/Libre-Product-CRUD-Table-Panel/releases/latest/download/libre-product-crud-table-panel.tar.gz \ 62 | && mkdir ./libre-product-crud-table-panel \ 63 | && tar -xf libre-product-crud-table-panel.tar.gz -C ./libre-product-crud-table-panel \ 64 | && rm libre-product-crud-table-panel.tar.gz 65 | 66 | RUN cd /var/lib/grafana/plugins \ 67 | && wget https://github.com/Spruik/Libre-Scheduler-Order-Mgt-Table-Panel/releases/latest/download/libre-scheduler-order-mgt-table-panel.tar.gz \ 68 | && mkdir ./libre-scheduler-order-mgt-table-panel \ 69 | && tar -xf libre-scheduler-order-mgt-table-panel.tar.gz -C ./libre-scheduler-order-mgt-table-panel \ 70 | && rm libre-scheduler-order-mgt-table-panel.tar.gz 71 | 72 | RUN cd /var/lib/grafana/plugins \ 73 | && wget https://github.com/Spruik/Libre-Operator-Order-Mgt-Table-Panel/releases/latest/download/libre-operator-order-mgt-table-panel.tar.gz \ 74 | && mkdir ./libre-operator-order-mgt-table-panel \ 75 | && tar -xf libre-operator-order-mgt-table-panel.tar.gz -C ./libre-operator-order-mgt-table-panel \ 76 | && rm libre-operator-order-mgt-table-panel.tar.gz 77 | 78 | RUN cd /var/lib/grafana/plugins \ 79 | && wget https://github.com/Spruik/Libre-Downtime-Pie-Chart-Panel/releases/latest/download/libre-downtime-pie-chart-panel.tar.gz \ 80 | && mkdir ./libre-downtime-pie-chart-panel \ 81 | && tar -xf libre-downtime-pie-chart-panel.tar.gz -C ./libre-downtime-pie-chart-panel \ 82 | && rm libre-downtime-pie-chart-panel.tar.gz 83 | 84 | RUN cd /var/lib/grafana/plugins \ 85 | && wget https://github.com/Spruik/Libre-Production-Schedule-Gantt-Chart-Panel/releases/latest/download/libre-production-schedule-gantt-chart-panel.tar.gz \ 86 | && mkdir ./libre-production-schedule-gantt-chart-panel \ 87 | && tar -xf libre-production-schedule-gantt-chart-panel.tar.gz -C ./libre-production-schedule-gantt-chart-panel \ 88 | && rm libre-production-schedule-gantt-chart-panel.tar.gz 89 | 90 | RUN cd /var/lib/grafana/plugins \ 91 | && wget https://github.com/Spruik/Libre-Event-Editor-Table-Panel/releases/latest/download/libre-event-editor-table-panel.tar.gz \ 92 | && mkdir ./libre-event-editor-table-panel \ 93 | && tar -xf libre-event-editor-table-panel.tar.gz -C ./libre-event-editor-table-panel \ 94 | && rm libre-event-editor-table-panel.tar.gz 95 | 96 | RUN cd /var/lib/grafana/plugins \ 97 | && wget https://github.com/Spruik/Libre-Downtime-Pareto-Chart-Panel/releases/latest/download/libre-downtime-pareto-chart-panel.tar.gz \ 98 | && mkdir ./libre-downtime-pareto-chart-panel \ 99 | && tar -xf libre-downtime-pareto-chart-panel.tar.gz -C ./libre-downtime-pareto-chart-panel \ 100 | && rm libre-downtime-pareto-chart-panel.tar.gz 101 | -------------------------------------------------------------------------------- /grafana/provisioning/dashboards/SmartFactory.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | # an unique provider name. Required 5 | - name: 'SmartFactory' 6 | # Org id. Default to 1 7 | orgId: 1 8 | # name of the dashboard folder. 9 | folder: SmartFactory 10 | # folder UID. will be automatically generated if not specified 11 | folderUid: '' 12 | # provider type. Default to 'file' 13 | type: file 14 | # disable dashboard deletion 15 | disableDeletion: false 16 | # enable dashboard editing 17 | editable: true 18 | # how often Grafana will scan for changed dashboards 19 | updateIntervalSeconds: 10 20 | # allow updating provisioned dashboards from the UI 21 | allowUiUpdates: false 22 | options: 23 | # path to dashboard files on disk. Required when using the 'file' type 24 | path: /etc/grafana/provisioning/dashboards/smart-factory/ 25 | -------------------------------------------------------------------------------- /grafana/provisioning/dashboards/smart-factory/analytics.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": "-- Grafana --", 7 | "enable": true, 8 | "hide": true, 9 | "iconColor": "rgba(0, 211, 255, 1)", 10 | "name": "Annotations & Alerts", 11 | "type": "dashboard" 12 | } 13 | ] 14 | }, 15 | "editable": true, 16 | "gnetId": null, 17 | "graphTooltip": 0, 18 | "id": 2, 19 | "links": [], 20 | "panels": [ 21 | { 22 | "content": "
\n Reason Codes Analysis\n
\n\n\n\n", 23 | "datasource": null, 24 | "gridPos": { 25 | "h": 2, 26 | "w": 24, 27 | "x": 0, 28 | "y": 0 29 | }, 30 | "id": 22, 31 | "links": [], 32 | "mode": "html", 33 | "timeFrom": null, 34 | "timeShift": null, 35 | "title": "", 36 | "transparent": true, 37 | "type": "text" 38 | }, 39 | { 40 | "columns": [], 41 | "datasource": null, 42 | "fontSize": "100%", 43 | "gridPos": { 44 | "h": 12, 45 | "w": 24, 46 | "x": 0, 47 | "y": 2 48 | }, 49 | "id": 12, 50 | "links": [], 51 | "pageSize": null, 52 | "showHeader": true, 53 | "styles": [], 54 | "targets": [ 55 | { 56 | "groupBy": [ 57 | { 58 | "params": [ 59 | "$__interval" 60 | ], 61 | "type": "time" 62 | }, 63 | { 64 | "params": [ 65 | "null" 66 | ], 67 | "type": "fill" 68 | } 69 | ], 70 | "orderByTime": "ASC", 71 | "policy": "default", 72 | "query": "SELECT \"Site\", \"Area\", \"Line\", \"execute\", \"held\", \"idle\", \"stopped\", \"complete\", \"category\", \"reason\", \"comment\", \"parentReason\" FROM \"Availability\" WHERE $timeFilter", 73 | "rawQuery": true, 74 | "refId": "A", 75 | "resultFormat": "table", 76 | "select": [ 77 | [ 78 | { 79 | "params": [ 80 | "value" 81 | ], 82 | "type": "field" 83 | }, 84 | { 85 | "params": [], 86 | "type": "mean" 87 | } 88 | ] 89 | ], 90 | "tags": [] 91 | } 92 | ], 93 | "title": "Pareto Chart - Reason Codes", 94 | "type": "libre-downtime-pareto-chart-panel" 95 | }, 96 | { 97 | "columns": [], 98 | "datasource": "InfluxDB", 99 | "fontSize": "100%", 100 | "gridPos": { 101 | "h": 11, 102 | "w": 14, 103 | "x": 0, 104 | "y": 14 105 | }, 106 | "id": 10, 107 | "links": [], 108 | "pageSize": null, 109 | "showHeader": true, 110 | "styles": [], 111 | "targets": [ 112 | { 113 | "groupBy": [ 114 | { 115 | "params": [ 116 | "$__interval" 117 | ], 118 | "type": "time" 119 | }, 120 | { 121 | "params": [ 122 | "null" 123 | ], 124 | "type": "fill" 125 | } 126 | ], 127 | "orderByTime": "ASC", 128 | "policy": "default", 129 | "query": "SELECT \"Site\", \"Area\", \"Line\", \"execute\", \"held\", \"idle\", \"stopped\", \"complete\", \"category\", \"reason\", \"comment\", \"parentReason\" FROM \"Availability\" WHERE $timeFilter", 130 | "rawQuery": true, 131 | "refId": "A", 132 | "resultFormat": "table", 133 | "select": [ 134 | [ 135 | { 136 | "params": [ 137 | "value" 138 | ], 139 | "type": "field" 140 | }, 141 | { 142 | "params": [], 143 | "type": "mean" 144 | } 145 | ] 146 | ], 147 | "tags": [] 148 | } 149 | ], 150 | "title": "Reason Codes Frequency & Duration", 151 | "type": "libre-downtime-pie-chart-panel" 152 | }, 153 | { 154 | "columns": [], 155 | "datasource": null, 156 | "fontSize": "100%", 157 | "gridPos": { 158 | "h": 11, 159 | "w": 10, 160 | "x": 14, 161 | "y": 14 162 | }, 163 | "id": 14, 164 | "links": [], 165 | "pageSize": null, 166 | "showHeader": true, 167 | "styles": [], 168 | "targets": [ 169 | { 170 | "groupBy": [ 171 | { 172 | "params": [ 173 | "$__interval" 174 | ], 175 | "type": "time" 176 | }, 177 | { 178 | "params": [ 179 | "null" 180 | ], 181 | "type": "fill" 182 | } 183 | ], 184 | "orderByTime": "ASC", 185 | "policy": "default", 186 | "query": "SELECT \"Site\", \"Area\", \"Line\", \"duration\", \"durationInt\", \"execute\", \"held\", \"idle\", \"stopped\", \"complete\", \"category\", \"reason\", \"comment\", \"parentReason\" FROM \"Availability\" WHERE $timeFilter", 187 | "rawQuery": true, 188 | "refId": "A", 189 | "resultFormat": "table", 190 | "select": [ 191 | [ 192 | { 193 | "params": [ 194 | "value" 195 | ], 196 | "type": "field" 197 | }, 198 | { 199 | "params": [], 200 | "type": "mean" 201 | } 202 | ] 203 | ], 204 | "tags": [] 205 | } 206 | ], 207 | "title": "Reason Codes Sunburst", 208 | "type": "libre-downtime-sunburst-chart-panel" 209 | } 210 | ], 211 | "schemaVersion": 22, 212 | "style": "dark", 213 | "tags": [ 214 | "SmartFactory" 215 | ], 216 | "templating": { 217 | "list": [] 218 | }, 219 | "time": { 220 | "from": "now-1y", 221 | "to": "now" 222 | }, 223 | "timepicker": { 224 | "refresh_intervals": [ 225 | "5s", 226 | "10s", 227 | "30s", 228 | "1m", 229 | "5m", 230 | "15m", 231 | "30m", 232 | "1h", 233 | "2h", 234 | "1d" 235 | ], 236 | "time_options": [ 237 | "5m", 238 | "15m", 239 | "1h", 240 | "6h", 241 | "12h", 242 | "24h", 243 | "2d", 244 | "7d", 245 | "30d" 246 | ] 247 | }, 248 | "timezone": "", 249 | "title": "Analytics", 250 | "uid": "libreAnalytics", 251 | "variables": { 252 | "list": [] 253 | }, 254 | "version": 1 255 | } -------------------------------------------------------------------------------- /grafana/provisioning/dashboards/smart-factory/line-performance.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": "-- Grafana --", 7 | "enable": false, 8 | "hide": false, 9 | "iconColor": "#cffaff", 10 | "limit": 100, 11 | "name": "Annotations & Alerts", 12 | "query": "select text from events where $timeFilter", 13 | "showIn": 0, 14 | "type": "dashboard" 15 | } 16 | ] 17 | }, 18 | "editable": true, 19 | "gnetId": null, 20 | "graphTooltip": 0, 21 | "id": 3, 22 | "iteration": 1599145406842, 23 | "links": [ 24 | { 25 | "asDropdown": true, 26 | "icon": "external link", 27 | "includeVars": true, 28 | "keepTime": true, 29 | "tags": [ 30 | "SmartFactory" 31 | ], 32 | "title": "Links", 33 | "type": "dashboards" 34 | } 35 | ], 36 | "panels": [ 37 | { 38 | "columns": [], 39 | "datasource": "InfluxDB", 40 | "fontSize": "100%", 41 | "gridPos": { 42 | "h": 4, 43 | "w": 24, 44 | "x": 0, 45 | "y": 0 46 | }, 47 | "hideTimeOverride": true, 48 | "id": 29, 49 | "links": [], 50 | "pageSize": null, 51 | "scroll": true, 52 | "showHeader": true, 53 | "sort": { 54 | "col": 0, 55 | "desc": true 56 | }, 57 | "styles": [ 58 | { 59 | "alias": "Time", 60 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 61 | "headerColor": "rgba(51, 181, 229, 1)", 62 | "pattern": "Time", 63 | "type": "date" 64 | }, 65 | { 66 | "alias": "Production Line", 67 | "colorMode": null, 68 | "colors": [ 69 | "rgba(245, 54, 54, 0.9)", 70 | "rgba(237, 129, 40, 0.89)", 71 | "rgba(50, 172, 45, 0.97)" 72 | ], 73 | "decimals": 2, 74 | "headerColor": "rgba(51, 181, 229, 1)", 75 | "pattern": "production_line", 76 | "thresholds": [], 77 | "type": "string", 78 | "unit": "short" 79 | }, 80 | { 81 | "alias": "Order ID", 82 | "colorMode": null, 83 | "colors": [ 84 | "rgba(245, 54, 54, 0.9)", 85 | "rgba(237, 129, 40, 0.89)", 86 | "rgba(50, 172, 45, 0.97)" 87 | ], 88 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 89 | "decimals": 2, 90 | "mappingType": 1, 91 | "pattern": "order_id", 92 | "thresholds": [], 93 | "type": "string", 94 | "unit": "short" 95 | }, 96 | { 97 | "alias": "Product Description", 98 | "colorMode": null, 99 | "colors": [ 100 | "rgba(245, 54, 54, 0.9)", 101 | "rgba(237, 129, 40, 0.89)", 102 | "rgba(50, 172, 45, 0.97)" 103 | ], 104 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 105 | "decimals": 2, 106 | "mappingType": 1, 107 | "pattern": "product_desc", 108 | "thresholds": [], 109 | "type": "string", 110 | "unit": "short" 111 | }, 112 | { 113 | "alias": "Product ID", 114 | "colorMode": null, 115 | "colors": [ 116 | "rgba(245, 54, 54, 0.9)", 117 | "rgba(237, 129, 40, 0.89)", 118 | "rgba(50, 172, 45, 0.97)" 119 | ], 120 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 121 | "decimals": 2, 122 | "mappingType": 1, 123 | "pattern": "product_id", 124 | "thresholds": [], 125 | "type": "string", 126 | "unit": "short" 127 | }, 128 | { 129 | "alias": "", 130 | "colorMode": null, 131 | "colors": [ 132 | "rgba(245, 54, 54, 0.9)", 133 | "rgba(237, 129, 40, 0.89)", 134 | "rgba(50, 172, 45, 0.97)" 135 | ], 136 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 137 | "decimals": 2, 138 | "mappingType": 1, 139 | "pattern": "order_date", 140 | "thresholds": [], 141 | "type": "hidden", 142 | "unit": "short" 143 | }, 144 | { 145 | "alias": "Order State", 146 | "colorMode": null, 147 | "colors": [ 148 | "rgba(245, 54, 54, 0.9)", 149 | "rgba(237, 129, 40, 0.89)", 150 | "rgba(50, 172, 45, 0.97)" 151 | ], 152 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 153 | "decimals": 2, 154 | "mappingType": 1, 155 | "pattern": "order_state", 156 | "thresholds": [], 157 | "type": "string", 158 | "unit": "short" 159 | }, 160 | { 161 | "alias": "Order Qty", 162 | "colorMode": null, 163 | "colors": [ 164 | "rgba(245, 54, 54, 0.9)", 165 | "rgba(237, 129, 40, 0.89)", 166 | "rgba(50, 172, 45, 0.97)" 167 | ], 168 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 169 | "decimals": 2, 170 | "mappingType": 1, 171 | "pattern": "order_qty", 172 | "thresholds": [], 173 | "type": "string", 174 | "unit": "short" 175 | }, 176 | { 177 | "alias": "Setpoint Rate", 178 | "colorMode": null, 179 | "colors": [ 180 | "rgba(245, 54, 54, 0.9)", 181 | "rgba(237, 129, 40, 0.89)", 182 | "rgba(50, 172, 45, 0.97)" 183 | ], 184 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 185 | "decimals": 2, 186 | "mappingType": 1, 187 | "pattern": "setpoint_rate", 188 | "thresholds": [], 189 | "type": "number", 190 | "unit": "short" 191 | }, 192 | { 193 | "alias": "Scheduled Start Time", 194 | "colorMode": null, 195 | "colors": [ 196 | "rgba(245, 54, 54, 0.9)", 197 | "rgba(237, 129, 40, 0.89)", 198 | "rgba(50, 172, 45, 0.97)" 199 | ], 200 | "dateFormat": "YYYY-MM-DD HH:mm:ss.SSS", 201 | "decimals": 2, 202 | "mappingType": 1, 203 | "pattern": "scheduled_start_datetime", 204 | "thresholds": [], 205 | "type": "date", 206 | "unit": "short" 207 | }, 208 | { 209 | "alias": "Actual Start Time", 210 | "colorMode": null, 211 | "colors": [ 212 | "rgba(245, 54, 54, 0.9)", 213 | "rgba(237, 129, 40, 0.89)", 214 | "rgba(50, 172, 45, 0.97)" 215 | ], 216 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 217 | "decimals": 2, 218 | "mappingType": 1, 219 | "pattern": "actual_start_datetime", 220 | "thresholds": [], 221 | "type": "date", 222 | "unit": "short" 223 | }, 224 | { 225 | "alias": "Issued Qty", 226 | "colorMode": null, 227 | "colors": [ 228 | "rgba(245, 54, 54, 0.9)", 229 | "rgba(237, 129, 40, 0.89)", 230 | "rgba(50, 172, 45, 0.97)" 231 | ], 232 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 233 | "decimals": 2, 234 | "mappingType": 1, 235 | "pattern": "issued_qty", 236 | "thresholds": [], 237 | "type": "string", 238 | "unit": "short" 239 | }, 240 | { 241 | "alias": "Remaining Qty", 242 | "colorMode": null, 243 | "colors": [ 244 | "rgba(245, 54, 54, 0.9)", 245 | "rgba(237, 129, 40, 0.89)", 246 | "rgba(50, 172, 45, 0.97)" 247 | ], 248 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 249 | "decimals": 2, 250 | "mappingType": 1, 251 | "pattern": "remaining_qty", 252 | "thresholds": [], 253 | "type": "string", 254 | "unit": "short" 255 | }, 256 | { 257 | "alias": "Remaining Time", 258 | "colorMode": null, 259 | "colors": [ 260 | "rgba(245, 54, 54, 0.9)", 261 | "rgba(237, 129, 40, 0.89)", 262 | "rgba(50, 172, 45, 0.97)" 263 | ], 264 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 265 | "decimals": 2, 266 | "mappingType": 1, 267 | "pattern": "remaining_time", 268 | "thresholds": [], 269 | "type": "number", 270 | "unit": "short" 271 | } 272 | ], 273 | "targets": [ 274 | { 275 | "groupBy": [ 276 | { 277 | "params": [ 278 | "$__interval" 279 | ], 280 | "type": "time" 281 | }, 282 | { 283 | "params": [ 284 | "null" 285 | ], 286 | "type": "fill" 287 | } 288 | ], 289 | "orderByTime": "ASC", 290 | "policy": "default", 291 | "query": "Select last_production_line as production_line,last_product_desc as product_desc, last_order_state as order_state,last_scheduled_start_datetime as scheduled_start_datetime,last_actual_start_datetime as actual_start_datetime,last_setpoint_rate as setpoint_rate,last_order_qty as order_qty,last_issued_qty as issued_qty, last_order_qty - last_issued_qty as remaining_qty ,(last_order_qty - last_issued_qty)/last_setpoint_rate as remaining_time FROM (SELECT last(*) FROM \"OrderPerformance\" GROUP BY \"order_id\",\"product_id\" ) WHERE \"last_order_state\" =~ /running|next/ and \"last_production_line\" = '$Site | $Area | $Line' GROUP BY \"order_id\",\"product_id\" ", 292 | "rawQuery": true, 293 | "refId": "A", 294 | "resultFormat": "table", 295 | "select": [ 296 | [ 297 | { 298 | "params": [ 299 | "value" 300 | ], 301 | "type": "field" 302 | }, 303 | { 304 | "params": [], 305 | "type": "mean" 306 | } 307 | ] 308 | ], 309 | "tags": [] 310 | } 311 | ], 312 | "timeFrom": "1y", 313 | "timeShift": null, 314 | "title": "Current Running Order", 315 | "transform": "table", 316 | "type": "libre-operator-order-mgt-table-panel" 317 | }, 318 | { 319 | "cacheTimeout": null, 320 | "colorBackground": false, 321 | "colorValue": false, 322 | "colors": [ 323 | "#299c46", 324 | "rgba(237, 129, 40, 0.89)", 325 | "#d44a3a" 326 | ], 327 | "datasource": "InfluxDB", 328 | "decimals": 0, 329 | "format": "none", 330 | "gauge": { 331 | "maxValue": 100, 332 | "minValue": 0, 333 | "show": false, 334 | "thresholdLabels": false, 335 | "thresholdMarkers": true 336 | }, 337 | "gridPos": { 338 | "h": 2, 339 | "w": 4, 340 | "x": 0, 341 | "y": 4 342 | }, 343 | "id": 13, 344 | "interval": null, 345 | "links": [], 346 | "mappingType": 1, 347 | "mappingTypes": [ 348 | { 349 | "name": "value to text", 350 | "value": 1 351 | }, 352 | { 353 | "name": "range to text", 354 | "value": 2 355 | } 356 | ], 357 | "maxDataPoints": 100, 358 | "nullPointMode": "connected", 359 | "nullText": null, 360 | "postfix": "", 361 | "postfixFontSize": "50%", 362 | "prefix": "", 363 | "prefixFontSize": "50%", 364 | "rangeMaps": [ 365 | { 366 | "from": "null", 367 | "text": "N/A", 368 | "to": "null" 369 | } 370 | ], 371 | "sparkline": { 372 | "fillColor": "rgba(31, 118, 189, 0.18)", 373 | "full": false, 374 | "lineColor": "rgb(31, 120, 193)", 375 | "show": false 376 | }, 377 | "tableColumn": "", 378 | "targets": [ 379 | { 380 | "alias": "", 381 | "format": "time_series", 382 | "groupBy": [ 383 | { 384 | "params": [ 385 | "$__interval" 386 | ], 387 | "type": "time" 388 | }, 389 | { 390 | "params": [ 391 | "null" 392 | ], 393 | "type": "fill" 394 | } 395 | ], 396 | "orderByTime": "ASC", 397 | "policy": "default", 398 | "query": "SELECT integral(\"planned_rate\",1s)/3600 FROM \"Performance\" WHERE $timeFilter and (\"Site\" = '$Site') and (\"Area\" = '$Area') and (\"Line\" = '$Line') ", 399 | "rawQuery": true, 400 | "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", 401 | "refId": "A", 402 | "resultFormat": "time_series", 403 | "select": [ 404 | [ 405 | { 406 | "params": [ 407 | "value" 408 | ], 409 | "type": "field" 410 | }, 411 | { 412 | "params": [], 413 | "type": "mean" 414 | } 415 | ] 416 | ], 417 | "tags": [] 418 | } 419 | ], 420 | "thresholds": "", 421 | "title": "Planned Production", 422 | "type": "singlestat", 423 | "valueFontSize": "80%", 424 | "valueMaps": [ 425 | { 426 | "op": "=", 427 | "text": "N/A", 428 | "value": "null" 429 | } 430 | ], 431 | "valueName": "avg" 432 | }, 433 | { 434 | "cacheTimeout": null, 435 | "colorBackground": false, 436 | "colorValue": false, 437 | "colors": [ 438 | "#299c46", 439 | "rgba(237, 129, 40, 0.89)", 440 | "#d44a3a" 441 | ], 442 | "datasource": "InfluxDB", 443 | "decimals": null, 444 | "format": "none", 445 | "gauge": { 446 | "maxValue": 100, 447 | "minValue": 0, 448 | "show": false, 449 | "thresholdLabels": false, 450 | "thresholdMarkers": true 451 | }, 452 | "gridPos": { 453 | "h": 2, 454 | "w": 4, 455 | "x": 4, 456 | "y": 4 457 | }, 458 | "id": 12, 459 | "interval": null, 460 | "links": [], 461 | "mappingType": 1, 462 | "mappingTypes": [ 463 | { 464 | "name": "value to text", 465 | "value": 1 466 | }, 467 | { 468 | "name": "range to text", 469 | "value": 2 470 | } 471 | ], 472 | "maxDataPoints": 100, 473 | "nullPointMode": "connected", 474 | "nullText": null, 475 | "postfix": "", 476 | "postfixFontSize": "50%", 477 | "prefix": "", 478 | "prefixFontSize": "50%", 479 | "rangeMaps": [ 480 | { 481 | "from": "null", 482 | "text": "N/A", 483 | "to": "null" 484 | } 485 | ], 486 | "sparkline": { 487 | "fillColor": "rgba(31, 118, 189, 0.18)", 488 | "full": false, 489 | "lineColor": "rgb(31, 120, 193)", 490 | "show": false 491 | }, 492 | "tableColumn": "", 493 | "targets": [ 494 | { 495 | "alias": "", 496 | "format": "time_series", 497 | "groupBy": [ 498 | { 499 | "params": [ 500 | "$__interval" 501 | ], 502 | "type": "time" 503 | }, 504 | { 505 | "params": [ 506 | "null" 507 | ], 508 | "type": "fill" 509 | } 510 | ], 511 | "orderByTime": "ASC", 512 | "policy": "default", 513 | "query": "SELECT sum(\"actual_rate\") FROM \"Performance\" WHERE $timeFilter and (\"Site\" = '$Site') and (\"Area\" = '$Area') and (\"Line\" = '$Line') ", 514 | "rawQuery": true, 515 | "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", 516 | "refId": "A", 517 | "resultFormat": "time_series", 518 | "select": [ 519 | [ 520 | { 521 | "params": [ 522 | "value" 523 | ], 524 | "type": "field" 525 | }, 526 | { 527 | "params": [], 528 | "type": "mean" 529 | } 530 | ] 531 | ], 532 | "tags": [] 533 | } 534 | ], 535 | "thresholds": "", 536 | "title": "Actual Production", 537 | "type": "singlestat", 538 | "valueFontSize": "80%", 539 | "valueMaps": [ 540 | { 541 | "op": "=", 542 | "text": "N/A", 543 | "value": "null" 544 | } 545 | ], 546 | "valueName": "avg" 547 | }, 548 | { 549 | "cacheTimeout": null, 550 | "colorBackground": false, 551 | "colorValue": false, 552 | "colors": [ 553 | "#299c46", 554 | "rgba(237, 129, 40, 0.89)", 555 | "#d44a3a" 556 | ], 557 | "datasource": "InfluxDB", 558 | "decimals": 2, 559 | "format": "s", 560 | "gauge": { 561 | "maxValue": 100, 562 | "minValue": 0, 563 | "show": false, 564 | "thresholdLabels": false, 565 | "thresholdMarkers": true 566 | }, 567 | "gridPos": { 568 | "h": 2, 569 | "w": 4, 570 | "x": 8, 571 | "y": 4 572 | }, 573 | "id": 6, 574 | "interval": null, 575 | "links": [], 576 | "mappingType": 1, 577 | "mappingTypes": [ 578 | { 579 | "name": "value to text", 580 | "value": 1 581 | }, 582 | { 583 | "name": "range to text", 584 | "value": 2 585 | } 586 | ], 587 | "maxDataPoints": 100, 588 | "nullPointMode": "connected", 589 | "nullText": null, 590 | "postfix": "", 591 | "postfixFontSize": "50%", 592 | "prefix": "", 593 | "prefixFontSize": "50%", 594 | "rangeMaps": [ 595 | { 596 | "from": "null", 597 | "text": "N/A", 598 | "to": "null" 599 | } 600 | ], 601 | "sparkline": { 602 | "fillColor": "rgba(31, 118, 189, 0.18)", 603 | "full": true, 604 | "lineColor": "rgb(31, 120, 193)", 605 | "show": true 606 | }, 607 | "tableColumn": "", 608 | "targets": [ 609 | { 610 | "alias": "", 611 | "format": "time_series", 612 | "groupBy": [ 613 | { 614 | "params": [ 615 | "$__interval" 616 | ], 617 | "type": "time" 618 | }, 619 | { 620 | "params": [ 621 | "null" 622 | ], 623 | "type": "fill" 624 | } 625 | ], 626 | "orderByTime": "ASC", 627 | "policy": "default", 628 | "query": "SELECT SUM(\"last\") FROM (SELECT last(\"held\") FROM \"Performance\" WHERE (\"Site\" = '$Site') and (\"Area\" = '$Area') and (\"Line\" = '$Line') AND $timeFilter GROUP BY time(1s) fill(previous))", 629 | "rawQuery": true, 630 | "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", 631 | "refId": "A", 632 | "resultFormat": "time_series", 633 | "select": [ 634 | [ 635 | { 636 | "params": [ 637 | "value" 638 | ], 639 | "type": "field" 640 | }, 641 | { 642 | "params": [], 643 | "type": "mean" 644 | } 645 | ] 646 | ], 647 | "tags": [] 648 | } 649 | ], 650 | "thresholds": "", 651 | "title": "Held Time", 652 | "type": "singlestat", 653 | "valueFontSize": "80%", 654 | "valueMaps": [ 655 | { 656 | "op": "=", 657 | "text": "0", 658 | "value": "null" 659 | } 660 | ], 661 | "valueName": "avg" 662 | }, 663 | { 664 | "cacheTimeout": null, 665 | "colorBackground": false, 666 | "colorValue": false, 667 | "colors": [ 668 | "#299c46", 669 | "rgba(237, 129, 40, 0.89)", 670 | "#d44a3a" 671 | ], 672 | "datasource": "InfluxDB", 673 | "decimals": 2, 674 | "format": "s", 675 | "gauge": { 676 | "maxValue": 100, 677 | "minValue": 0, 678 | "show": false, 679 | "thresholdLabels": false, 680 | "thresholdMarkers": true 681 | }, 682 | "gridPos": { 683 | "h": 2, 684 | "w": 4, 685 | "x": 12, 686 | "y": 4 687 | }, 688 | "id": 4, 689 | "interval": null, 690 | "links": [], 691 | "mappingType": 1, 692 | "mappingTypes": [ 693 | { 694 | "name": "value to text", 695 | "value": 1 696 | }, 697 | { 698 | "name": "range to text", 699 | "value": 2 700 | } 701 | ], 702 | "maxDataPoints": 100, 703 | "nullPointMode": "connected", 704 | "nullText": null, 705 | "postfix": "", 706 | "postfixFontSize": "50%", 707 | "prefix": "", 708 | "prefixFontSize": "50%", 709 | "rangeMaps": [ 710 | { 711 | "from": "null", 712 | "text": "N/A", 713 | "to": "null" 714 | } 715 | ], 716 | "sparkline": { 717 | "fillColor": "rgba(31, 118, 189, 0.18)", 718 | "full": false, 719 | "lineColor": "rgb(31, 120, 193)", 720 | "show": false 721 | }, 722 | "tableColumn": "", 723 | "targets": [ 724 | { 725 | "alias": "", 726 | "format": "time_series", 727 | "groupBy": [], 728 | "measurement": "Performance", 729 | "orderByTime": "ASC", 730 | "policy": "default", 731 | "query": "SELECT SUM(\"last\") FROM (SELECT last(\"execute\") FROM \"Performance\" WHERE (\"Site\" = '$Site') and (\"Area\" = '$Area') and (\"Line\" = '$Line') AND $timeFilter GROUP BY time(1s) fill(previous))", 732 | "rawQuery": true, 733 | "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", 734 | "refId": "A", 735 | "resultFormat": "time_series", 736 | "select": [ 737 | [ 738 | { 739 | "params": [ 740 | "execute" 741 | ], 742 | "type": "field" 743 | } 744 | ] 745 | ], 746 | "tags": [] 747 | } 748 | ], 749 | "thresholds": "", 750 | "title": "Running Time", 751 | "type": "singlestat", 752 | "valueFontSize": "80%", 753 | "valueMaps": [ 754 | { 755 | "op": "=", 756 | "text": "N/A", 757 | "value": "null" 758 | } 759 | ], 760 | "valueName": "current" 761 | }, 762 | { 763 | "cacheTimeout": null, 764 | "colorBackground": false, 765 | "colorValue": false, 766 | "colors": [ 767 | "#299c46", 768 | "rgba(237, 129, 40, 0.89)", 769 | "#d44a3a" 770 | ], 771 | "datasource": "InfluxDB", 772 | "format": "percentunit", 773 | "gauge": { 774 | "maxValue": 100, 775 | "minValue": 0, 776 | "show": false, 777 | "thresholdLabels": false, 778 | "thresholdMarkers": true 779 | }, 780 | "gridPos": { 781 | "h": 2, 782 | "w": 4, 783 | "x": 16, 784 | "y": 4 785 | }, 786 | "id": 10, 787 | "interval": null, 788 | "links": [], 789 | "mappingType": 1, 790 | "mappingTypes": [ 791 | { 792 | "name": "value to text", 793 | "value": 1 794 | }, 795 | { 796 | "name": "range to text", 797 | "value": 2 798 | } 799 | ], 800 | "maxDataPoints": 100, 801 | "nullPointMode": "connected", 802 | "nullText": null, 803 | "postfix": "", 804 | "postfixFontSize": "50%", 805 | "prefix": "", 806 | "prefixFontSize": "50%", 807 | "rangeMaps": [ 808 | { 809 | "from": "null", 810 | "text": "N/A", 811 | "to": "null" 812 | } 813 | ], 814 | "sparkline": { 815 | "fillColor": "rgba(31, 118, 189, 0.18)", 816 | "full": false, 817 | "lineColor": "rgb(31, 120, 193)", 818 | "show": false 819 | }, 820 | "tableColumn": "", 821 | "targets": [ 822 | { 823 | "alias": "", 824 | "format": "time_series", 825 | "groupBy": [ 826 | { 827 | "params": [ 828 | "$__interval" 829 | ], 830 | "type": "time" 831 | }, 832 | { 833 | "params": [ 834 | "null" 835 | ], 836 | "type": "fill" 837 | } 838 | ], 839 | "orderByTime": "ASC", 840 | "policy": "default", 841 | "query": "SELECT SUM(\"execute\") / (SUM(\"held\")+SUM(\"execute\")) FROM (SELECT last(\"held\") AS held, last(\"execute\") AS execute FROM \"Performance\" WHERE (\"Site\" = '$Site') and (\"Area\" = '$Area') and (\"Line\" = '$Line') AND $timeFilter GROUP BY time(1s) fill(previous))", 842 | "rawQuery": true, 843 | "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", 844 | "refId": "A", 845 | "resultFormat": "table", 846 | "select": [ 847 | [ 848 | { 849 | "params": [ 850 | "value" 851 | ], 852 | "type": "field" 853 | }, 854 | { 855 | "params": [], 856 | "type": "mean" 857 | } 858 | ] 859 | ], 860 | "tags": [] 861 | } 862 | ], 863 | "thresholds": "", 864 | "title": "Availability", 865 | "type": "singlestat", 866 | "valueFontSize": "80%", 867 | "valueMaps": [ 868 | { 869 | "op": "=", 870 | "text": "N/A", 871 | "value": "null" 872 | } 873 | ], 874 | "valueName": "avg" 875 | }, 876 | { 877 | "cacheTimeout": null, 878 | "colorBackground": false, 879 | "colorValue": false, 880 | "colors": [ 881 | "#299c46", 882 | "rgba(237, 129, 40, 0.89)", 883 | "#d44a3a" 884 | ], 885 | "datasource": "InfluxDB", 886 | "format": "percentunit", 887 | "gauge": { 888 | "maxValue": 100, 889 | "minValue": 0, 890 | "show": false, 891 | "thresholdLabels": false, 892 | "thresholdMarkers": true 893 | }, 894 | "gridPos": { 895 | "h": 2, 896 | "w": 4, 897 | "x": 20, 898 | "y": 4 899 | }, 900 | "id": 14, 901 | "interval": null, 902 | "links": [], 903 | "mappingType": 1, 904 | "mappingTypes": [ 905 | { 906 | "name": "value to text", 907 | "value": 1 908 | }, 909 | { 910 | "name": "range to text", 911 | "value": 2 912 | } 913 | ], 914 | "maxDataPoints": 100, 915 | "nullPointMode": "connected", 916 | "nullText": null, 917 | "postfix": "", 918 | "postfixFontSize": "50%", 919 | "prefix": "", 920 | "prefixFontSize": "50%", 921 | "rangeMaps": [ 922 | { 923 | "from": "null", 924 | "text": "N/A", 925 | "to": "null" 926 | } 927 | ], 928 | "sparkline": { 929 | "fillColor": "rgba(31, 118, 189, 0.18)", 930 | "full": false, 931 | "lineColor": "rgb(31, 120, 193)", 932 | "show": false 933 | }, 934 | "tableColumn": "", 935 | "targets": [ 936 | { 937 | "alias": "", 938 | "format": "time_series", 939 | "groupBy": [ 940 | { 941 | "params": [ 942 | "$__interval" 943 | ], 944 | "type": "time" 945 | }, 946 | { 947 | "params": [ 948 | "null" 949 | ], 950 | "type": "fill" 951 | } 952 | ], 953 | "orderByTime": "ASC", 954 | "policy": "default", 955 | "query": "SELECT integral(\"actual_rate\",1s) / (integral(\"planned_rate\",1s) + integral(\"held\",1s)) FROM \"Performance\" WHERE $timeFilter and (\"Site\" = '$Site') and (\"Area\" = '$Area') and (\"Line\" = '$Line') ", 956 | "rawQuery": true, 957 | "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", 958 | "refId": "A", 959 | "resultFormat": "time_series", 960 | "select": [ 961 | [ 962 | { 963 | "params": [ 964 | "value" 965 | ], 966 | "type": "field" 967 | }, 968 | { 969 | "params": [], 970 | "type": "mean" 971 | } 972 | ] 973 | ], 974 | "tags": [] 975 | } 976 | ], 977 | "thresholds": "", 978 | "title": "Performance", 979 | "type": "singlestat", 980 | "valueFontSize": "80%", 981 | "valueMaps": [ 982 | { 983 | "op": "=", 984 | "text": "N/A", 985 | "value": "null" 986 | } 987 | ], 988 | "valueName": "avg" 989 | }, 990 | { 991 | "cacheTimeout": null, 992 | "datasource": "InfluxDB", 993 | "gridPos": { 994 | "h": 7, 995 | "w": 5, 996 | "x": 0, 997 | "y": 6 998 | }, 999 | "id": 8, 1000 | "links": [], 1001 | "options": { 1002 | "fieldOptions": { 1003 | "calcs": [ 1004 | "mean" 1005 | ], 1006 | "defaults": { 1007 | "color": { 1008 | "mode": "thresholds" 1009 | }, 1010 | "decimals": null, 1011 | "mappings": [ 1012 | { 1013 | "from": "", 1014 | "id": 1, 1015 | "operator": "", 1016 | "text": "STOPPED", 1017 | "to": "", 1018 | "type": 1, 1019 | "value": "0" 1020 | } 1021 | ], 1022 | "max": "70", 1023 | "min": 0, 1024 | "thresholds": { 1025 | "mode": "absolute", 1026 | "steps": [ 1027 | { 1028 | "color": "#AD0317", 1029 | "index": 0, 1030 | "value": null 1031 | }, 1032 | { 1033 | "color": "#F2CC0C", 1034 | "index": 1, 1035 | "value": 30 1036 | }, 1037 | { 1038 | "color": "#56A64B", 1039 | "index": 2, 1040 | "value": 45 1041 | } 1042 | ] 1043 | }, 1044 | "unit": "none" 1045 | }, 1046 | "overrides": [], 1047 | "values": false 1048 | }, 1049 | "orientation": "auto", 1050 | "showThresholdLabels": false, 1051 | "showThresholdMarkers": false 1052 | }, 1053 | "pluginVersion": "6.7.4", 1054 | "targets": [ 1055 | { 1056 | "alias": "", 1057 | "format": "time_series", 1058 | "groupBy": [], 1059 | "measurement": "Performance", 1060 | "orderByTime": "ASC", 1061 | "policy": "default", 1062 | "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", 1063 | "refId": "A", 1064 | "resultFormat": "time_series", 1065 | "select": [ 1066 | [ 1067 | { 1068 | "params": [ 1069 | "actual_rate" 1070 | ], 1071 | "type": "field" 1072 | }, 1073 | { 1074 | "params": [], 1075 | "type": "last" 1076 | } 1077 | ] 1078 | ], 1079 | "tags": [ 1080 | { 1081 | "key": "Site", 1082 | "operator": "=~", 1083 | "value": "/^$Site$/" 1084 | }, 1085 | { 1086 | "condition": "AND", 1087 | "key": "Area", 1088 | "operator": "=~", 1089 | "value": "/^$Area$/" 1090 | }, 1091 | { 1092 | "condition": "AND", 1093 | "key": "Line", 1094 | "operator": "=~", 1095 | "value": "/^$Line$/" 1096 | } 1097 | ] 1098 | } 1099 | ], 1100 | "title": "Current Rate", 1101 | "type": "gauge" 1102 | }, 1103 | { 1104 | "aliasColors": {}, 1105 | "bars": false, 1106 | "dashLength": 10, 1107 | "dashes": false, 1108 | "datasource": "InfluxDB", 1109 | "fill": 5, 1110 | "fillGradient": 0, 1111 | "gridPos": { 1112 | "h": 7, 1113 | "w": 19, 1114 | "x": 5, 1115 | "y": 6 1116 | }, 1117 | "hiddenSeries": false, 1118 | "id": 2, 1119 | "interval": "", 1120 | "legend": { 1121 | "avg": false, 1122 | "current": false, 1123 | "max": false, 1124 | "min": false, 1125 | "rightSide": false, 1126 | "show": true, 1127 | "total": false, 1128 | "values": false 1129 | }, 1130 | "lines": true, 1131 | "linewidth": 1, 1132 | "links": [], 1133 | "nullPointMode": "null", 1134 | "options": { 1135 | "dataLinks": [] 1136 | }, 1137 | "paceLength": 10, 1138 | "percentage": false, 1139 | "pointradius": 5, 1140 | "points": false, 1141 | "renderer": "flot", 1142 | "seriesOverrides": [ 1143 | { 1144 | "alias": "Execute", 1145 | "color": "#96D98D", 1146 | "fill": 1, 1147 | "steppedLine": true, 1148 | "yaxis": 2 1149 | }, 1150 | { 1151 | "alias": "Held", 1152 | "color": "#AD0317", 1153 | "fill": 10, 1154 | "steppedLine": true, 1155 | "yaxis": 2 1156 | }, 1157 | { 1158 | "alias": "Idle", 1159 | "fill": 2, 1160 | "steppedLine": true, 1161 | "yaxis": 2 1162 | }, 1163 | { 1164 | "alias": "Stopped", 1165 | "color": "#70dbed", 1166 | "steppedLine": true, 1167 | "yaxis": 2 1168 | }, 1169 | { 1170 | "alias": "Actual Rate", 1171 | "color": "#73BF69", 1172 | "steppedLine": true 1173 | }, 1174 | { 1175 | "alias": "Complete", 1176 | "color": "#3274D9", 1177 | "steppedLine": true, 1178 | "yaxis": 2 1179 | } 1180 | ], 1181 | "spaceLength": 10, 1182 | "stack": false, 1183 | "steppedLine": true, 1184 | "targets": [ 1185 | { 1186 | "alias": "Held", 1187 | "format": "time_series", 1188 | "groupBy": [ 1189 | { 1190 | "params": [ 1191 | "$interval" 1192 | ], 1193 | "type": "time" 1194 | }, 1195 | { 1196 | "params": [ 1197 | "previous" 1198 | ], 1199 | "type": "fill" 1200 | } 1201 | ], 1202 | "hide": false, 1203 | "measurement": "Performance", 1204 | "orderByTime": "ASC", 1205 | "policy": "default", 1206 | "rawSql": "SELECT\n $__time(time_column),\n value1\nFROM\n metric_table\nWHERE\n $__timeFilter(time_column)\n", 1207 | "refId": "A", 1208 | "resultFormat": "time_series", 1209 | "select": [ 1210 | [ 1211 | { 1212 | "params": [ 1213 | "held" 1214 | ], 1215 | "type": "field" 1216 | }, 1217 | { 1218 | "params": [], 1219 | "type": "first" 1220 | } 1221 | ] 1222 | ], 1223 | "tags": [ 1224 | { 1225 | "key": "Site", 1226 | "operator": "=~", 1227 | "value": "/^$Site$/" 1228 | }, 1229 | { 1230 | "condition": "AND", 1231 | "key": "Area", 1232 | "operator": "=~", 1233 | "value": "/^$Area$/" 1234 | }, 1235 | { 1236 | "condition": "AND", 1237 | "key": "Line", 1238 | "operator": "=~", 1239 | "value": "/^$Line$/" 1240 | } 1241 | ] 1242 | }, 1243 | { 1244 | "alias": "Actual Rate", 1245 | "groupBy": [], 1246 | "hide": false, 1247 | "measurement": "Performance", 1248 | "orderByTime": "ASC", 1249 | "policy": "default", 1250 | "refId": "B", 1251 | "resultFormat": "time_series", 1252 | "select": [ 1253 | [ 1254 | { 1255 | "params": [ 1256 | "actual_rate" 1257 | ], 1258 | "type": "field" 1259 | }, 1260 | { 1261 | "params": [ 1262 | "actual_rate" 1263 | ], 1264 | "type": "alias" 1265 | } 1266 | ] 1267 | ], 1268 | "tags": [ 1269 | { 1270 | "key": "Site", 1271 | "operator": "=~", 1272 | "value": "/^$Site$/" 1273 | }, 1274 | { 1275 | "condition": "AND", 1276 | "key": "Area", 1277 | "operator": "=~", 1278 | "value": "/^$Area$/" 1279 | }, 1280 | { 1281 | "condition": "AND", 1282 | "key": "Line", 1283 | "operator": "=~", 1284 | "value": "/^$Line$/" 1285 | } 1286 | ] 1287 | }, 1288 | { 1289 | "alias": "Idle", 1290 | "groupBy": [ 1291 | { 1292 | "params": [ 1293 | "$interval" 1294 | ], 1295 | "type": "time" 1296 | }, 1297 | { 1298 | "params": [ 1299 | "previous" 1300 | ], 1301 | "type": "fill" 1302 | } 1303 | ], 1304 | "measurement": "Performance", 1305 | "orderByTime": "ASC", 1306 | "policy": "default", 1307 | "refId": "F", 1308 | "resultFormat": "time_series", 1309 | "select": [ 1310 | [ 1311 | { 1312 | "params": [ 1313 | "idle" 1314 | ], 1315 | "type": "field" 1316 | }, 1317 | { 1318 | "params": [], 1319 | "type": "first" 1320 | } 1321 | ] 1322 | ], 1323 | "tags": [ 1324 | { 1325 | "key": "Site", 1326 | "operator": "=~", 1327 | "value": "/^$Site$/" 1328 | }, 1329 | { 1330 | "condition": "AND", 1331 | "key": "Area", 1332 | "operator": "=~", 1333 | "value": "/^$Area$/" 1334 | }, 1335 | { 1336 | "condition": "AND", 1337 | "key": "Line", 1338 | "operator": "=~", 1339 | "value": "/^$Line$/" 1340 | } 1341 | ] 1342 | }, 1343 | { 1344 | "alias": "Execute", 1345 | "groupBy": [ 1346 | { 1347 | "params": [ 1348 | "$interval" 1349 | ], 1350 | "type": "time" 1351 | }, 1352 | { 1353 | "params": [ 1354 | "previous" 1355 | ], 1356 | "type": "fill" 1357 | } 1358 | ], 1359 | "measurement": "Performance", 1360 | "orderByTime": "ASC", 1361 | "policy": "default", 1362 | "refId": "C", 1363 | "resultFormat": "time_series", 1364 | "select": [ 1365 | [ 1366 | { 1367 | "params": [ 1368 | "execute" 1369 | ], 1370 | "type": "field" 1371 | }, 1372 | { 1373 | "params": [], 1374 | "type": "first" 1375 | } 1376 | ] 1377 | ], 1378 | "tags": [ 1379 | { 1380 | "key": "Site", 1381 | "operator": "=~", 1382 | "value": "/^$Site$/" 1383 | }, 1384 | { 1385 | "condition": "AND", 1386 | "key": "Area", 1387 | "operator": "=~", 1388 | "value": "/^$Area$/" 1389 | }, 1390 | { 1391 | "condition": "AND", 1392 | "key": "Line", 1393 | "operator": "=~", 1394 | "value": "/^$Line$/" 1395 | } 1396 | ] 1397 | }, 1398 | { 1399 | "alias": "Stopped", 1400 | "groupBy": [ 1401 | { 1402 | "params": [ 1403 | "$interval" 1404 | ], 1405 | "type": "time" 1406 | }, 1407 | { 1408 | "params": [ 1409 | "previous" 1410 | ], 1411 | "type": "fill" 1412 | } 1413 | ], 1414 | "hide": false, 1415 | "measurement": "Performance", 1416 | "orderByTime": "ASC", 1417 | "policy": "default", 1418 | "refId": "D", 1419 | "resultFormat": "time_series", 1420 | "select": [ 1421 | [ 1422 | { 1423 | "params": [ 1424 | "stopped" 1425 | ], 1426 | "type": "field" 1427 | }, 1428 | { 1429 | "params": [], 1430 | "type": "first" 1431 | } 1432 | ] 1433 | ], 1434 | "tags": [ 1435 | { 1436 | "key": "Site", 1437 | "operator": "=~", 1438 | "value": "/^$Site$/" 1439 | }, 1440 | { 1441 | "condition": "AND", 1442 | "key": "Area", 1443 | "operator": "=~", 1444 | "value": "/^$Area$/" 1445 | }, 1446 | { 1447 | "condition": "AND", 1448 | "key": "Line", 1449 | "operator": "=~", 1450 | "value": "/^$Line$/" 1451 | } 1452 | ] 1453 | }, 1454 | { 1455 | "alias": "Complete", 1456 | "groupBy": [ 1457 | { 1458 | "params": [ 1459 | "$__interval" 1460 | ], 1461 | "type": "time" 1462 | }, 1463 | { 1464 | "params": [ 1465 | "previous" 1466 | ], 1467 | "type": "fill" 1468 | } 1469 | ], 1470 | "measurement": "Performance", 1471 | "orderByTime": "ASC", 1472 | "policy": "default", 1473 | "refId": "E", 1474 | "resultFormat": "time_series", 1475 | "select": [ 1476 | [ 1477 | { 1478 | "params": [ 1479 | "complete" 1480 | ], 1481 | "type": "field" 1482 | }, 1483 | { 1484 | "params": [], 1485 | "type": "first" 1486 | } 1487 | ] 1488 | ], 1489 | "tags": [ 1490 | { 1491 | "key": "Site", 1492 | "operator": "=~", 1493 | "value": "/^$Site$/" 1494 | }, 1495 | { 1496 | "condition": "AND", 1497 | "key": "Area", 1498 | "operator": "=~", 1499 | "value": "/^$Area$/" 1500 | }, 1501 | { 1502 | "condition": "AND", 1503 | "key": "Line", 1504 | "operator": "=~", 1505 | "value": "/^$Line$/" 1506 | } 1507 | ] 1508 | } 1509 | ], 1510 | "thresholds": [], 1511 | "timeFrom": null, 1512 | "timeRegions": [], 1513 | "timeShift": null, 1514 | "title": "Line Performance", 1515 | "tooltip": { 1516 | "shared": true, 1517 | "sort": 0, 1518 | "value_type": "individual" 1519 | }, 1520 | "transparent": true, 1521 | "type": "graph", 1522 | "xaxis": { 1523 | "buckets": null, 1524 | "mode": "time", 1525 | "name": null, 1526 | "show": true, 1527 | "values": [] 1528 | }, 1529 | "yaxes": [ 1530 | { 1531 | "format": "short", 1532 | "label": null, 1533 | "logBase": 1, 1534 | "max": null, 1535 | "min": null, 1536 | "show": true 1537 | }, 1538 | { 1539 | "format": "short", 1540 | "label": "", 1541 | "logBase": 1, 1542 | "max": null, 1543 | "min": null, 1544 | "show": true 1545 | } 1546 | ], 1547 | "yaxis": { 1548 | "align": false, 1549 | "alignLevel": null 1550 | } 1551 | }, 1552 | { 1553 | "camundaUrl": {}, 1554 | "columns": [], 1555 | "datasource": "InfluxDB", 1556 | "durationFilter": 3, 1557 | "endPoint": "Availability", 1558 | "equipmentEndPoint": "equipment", 1559 | "fontSize": "100%", 1560 | "gridPos": { 1561 | "h": 8, 1562 | "w": 24, 1563 | "x": 0, 1564 | "y": 13 1565 | }, 1566 | "hideExecute": true, 1567 | "id": 26, 1568 | "links": [], 1569 | "measurementOK": true, 1570 | "pageSize": null, 1571 | "reasonCodeEndPoint": "reason_code", 1572 | "scroll": true, 1573 | "showHeader": true, 1574 | "sort": { 1575 | "col": 0, 1576 | "desc": true 1577 | }, 1578 | "styles": [ 1579 | { 1580 | "alias": "Time", 1581 | "dateFormat": "YYYY-MM-DD HH:mm:ss.SSS", 1582 | "headerColor": "rgba(51, 181, 229, 1)", 1583 | "pattern": "Time", 1584 | "type": "date" 1585 | }, 1586 | { 1587 | "alias": "", 1588 | "colorMode": null, 1589 | "colors": [ 1590 | "rgba(245, 54, 54, 0.9)", 1591 | "rgba(237, 129, 40, 0.89)", 1592 | "rgba(50, 172, 45, 0.97)" 1593 | ], 1594 | "decimals": 2, 1595 | "headerColor": "rgba(51, 181, 229, 1)", 1596 | "pattern": "execute", 1597 | "thresholds": [], 1598 | "type": "hidden", 1599 | "unit": "short" 1600 | }, 1601 | { 1602 | "alias": "", 1603 | "colorMode": null, 1604 | "colors": [ 1605 | "rgba(245, 54, 54, 0.9)", 1606 | "rgba(237, 129, 40, 0.89)", 1607 | "rgba(50, 172, 45, 0.97)" 1608 | ], 1609 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1610 | "decimals": 2, 1611 | "mappingType": 1, 1612 | "pattern": "held", 1613 | "thresholds": [], 1614 | "type": "hidden", 1615 | "unit": "short" 1616 | }, 1617 | { 1618 | "alias": "", 1619 | "colorMode": null, 1620 | "colors": [ 1621 | "rgba(245, 54, 54, 0.9)", 1622 | "rgba(237, 129, 40, 0.89)", 1623 | "rgba(50, 172, 45, 0.97)" 1624 | ], 1625 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1626 | "decimals": 2, 1627 | "mappingType": 1, 1628 | "pattern": "idle", 1629 | "thresholds": [], 1630 | "type": "hidden", 1631 | "unit": "short" 1632 | }, 1633 | { 1634 | "alias": "", 1635 | "colorMode": null, 1636 | "colors": [ 1637 | "rgba(245, 54, 54, 0.9)", 1638 | "rgba(237, 129, 40, 0.89)", 1639 | "rgba(50, 172, 45, 0.97)" 1640 | ], 1641 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1642 | "decimals": 2, 1643 | "mappingType": 1, 1644 | "pattern": "stopped", 1645 | "thresholds": [], 1646 | "type": "hidden", 1647 | "unit": "short" 1648 | }, 1649 | { 1650 | "alias": "", 1651 | "colorMode": null, 1652 | "colors": [ 1653 | "rgba(245, 54, 54, 0.9)", 1654 | "rgba(237, 129, 40, 0.89)", 1655 | "rgba(50, 172, 45, 0.97)" 1656 | ], 1657 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1658 | "decimals": 2, 1659 | "mappingType": 1, 1660 | "pattern": "complete", 1661 | "thresholds": [], 1662 | "type": "hidden", 1663 | "unit": "short" 1664 | }, 1665 | { 1666 | "alias": "", 1667 | "colorMode": null, 1668 | "colors": [ 1669 | "rgba(245, 54, 54, 0.9)", 1670 | "rgba(237, 129, 40, 0.89)", 1671 | "rgba(50, 172, 45, 0.97)" 1672 | ], 1673 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1674 | "decimals": 2, 1675 | "mappingType": 1, 1676 | "pattern": "comment", 1677 | "thresholds": [], 1678 | "type": "hidden", 1679 | "unit": "short" 1680 | }, 1681 | { 1682 | "alias": "", 1683 | "colorMode": null, 1684 | "colors": [ 1685 | "rgba(245, 54, 54, 0.9)", 1686 | "rgba(237, 129, 40, 0.89)", 1687 | "rgba(50, 172, 45, 0.97)" 1688 | ], 1689 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1690 | "decimals": 2, 1691 | "mappingType": 1, 1692 | "pattern": "Site", 1693 | "thresholds": [], 1694 | "type": "hidden", 1695 | "unit": "short" 1696 | }, 1697 | { 1698 | "alias": "", 1699 | "colorMode": null, 1700 | "colors": [ 1701 | "rgba(245, 54, 54, 0.9)", 1702 | "rgba(237, 129, 40, 0.89)", 1703 | "rgba(50, 172, 45, 0.97)" 1704 | ], 1705 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1706 | "decimals": 2, 1707 | "mappingType": 1, 1708 | "pattern": "Area", 1709 | "thresholds": [], 1710 | "type": "hidden", 1711 | "unit": "short" 1712 | }, 1713 | { 1714 | "alias": "", 1715 | "colorMode": null, 1716 | "colors": [ 1717 | "rgba(245, 54, 54, 0.9)", 1718 | "rgba(237, 129, 40, 0.89)", 1719 | "rgba(50, 172, 45, 0.97)" 1720 | ], 1721 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1722 | "decimals": 2, 1723 | "mappingType": 1, 1724 | "pattern": "Line", 1725 | "thresholds": [], 1726 | "type": "hidden", 1727 | "unit": "short" 1728 | }, 1729 | { 1730 | "alias": "", 1731 | "colorMode": null, 1732 | "colors": [ 1733 | "rgba(245, 54, 54, 0.9)", 1734 | "rgba(237, 129, 40, 0.89)", 1735 | "rgba(50, 172, 45, 0.97)" 1736 | ], 1737 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1738 | "decimals": 2, 1739 | "mappingType": 1, 1740 | "pattern": "DurationValue", 1741 | "thresholds": [], 1742 | "type": "hidden", 1743 | "unit": "short" 1744 | }, 1745 | { 1746 | "alias": "", 1747 | "colorMode": null, 1748 | "colors": [ 1749 | "rgba(245, 54, 54, 0.9)", 1750 | "rgba(237, 129, 40, 0.89)", 1751 | "rgba(50, 172, 45, 0.97)" 1752 | ], 1753 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 1754 | "decimals": 2, 1755 | "mappingType": 1, 1756 | "pattern": "durationint", 1757 | "thresholds": [], 1758 | "type": "hidden", 1759 | "unit": "short" 1760 | } 1761 | ], 1762 | "targets": [ 1763 | { 1764 | "groupBy": [ 1765 | { 1766 | "params": [ 1767 | "$__interval" 1768 | ], 1769 | "type": "time" 1770 | }, 1771 | { 1772 | "params": [ 1773 | "null" 1774 | ], 1775 | "type": "fill" 1776 | } 1777 | ], 1778 | "orderByTime": "ASC", 1779 | "policy": "default", 1780 | "query": "SELECT \"Site\", \"Area\", \"Line\", \"status\", \"execute\", \"held\", \"idle\", \"stopped\", \"complete\", \"category\", \"reason\", \"equipment\", \"comment\" FROM \"Availability\" WHERE $timeFilter AND (\"Site\" = '$Site') AND (\"Area\" = '$Area') AND (\"Line\" = '$Line')", 1781 | "rawQuery": true, 1782 | "refId": "A", 1783 | "resultFormat": "table", 1784 | "select": [ 1785 | [ 1786 | { 1787 | "params": [ 1788 | "value" 1789 | ], 1790 | "type": "field" 1791 | }, 1792 | { 1793 | "params": [], 1794 | "type": "mean" 1795 | } 1796 | ] 1797 | ], 1798 | "tags": [] 1799 | } 1800 | ], 1801 | "title": "DownTime Editor Table", 1802 | "transform": "table", 1803 | "type": "libre-event-editor-table-panel" 1804 | } 1805 | ], 1806 | "refresh": "10s", 1807 | "schemaVersion": 22, 1808 | "style": "dark", 1809 | "tags": [ 1810 | "SmartFactory" 1811 | ], 1812 | "templating": { 1813 | "list": [ 1814 | { 1815 | "allValue": null, 1816 | "current": { 1817 | "text": "Site", 1818 | "value": "Site" 1819 | }, 1820 | "datasource": "PostgreSQL", 1821 | "definition": "Select site from equipment", 1822 | "hide": 0, 1823 | "includeAll": false, 1824 | "index": -1, 1825 | "label": "Site", 1826 | "multi": false, 1827 | "name": "Site", 1828 | "options": [], 1829 | "query": "Select site from equipment", 1830 | "refresh": 1, 1831 | "regex": "", 1832 | "skipUrlSync": false, 1833 | "sort": 1, 1834 | "tagValuesQuery": "", 1835 | "tags": [], 1836 | "tagsQuery": "", 1837 | "type": "query", 1838 | "useTags": false 1839 | }, 1840 | { 1841 | "allValue": null, 1842 | "current": { 1843 | "text": "Area", 1844 | "value": "Area" 1845 | }, 1846 | "datasource": "PostgreSQL", 1847 | "definition": "select area from equipment where area is not null and site = '$Site'", 1848 | "hide": 0, 1849 | "includeAll": false, 1850 | "index": -1, 1851 | "label": "Area", 1852 | "multi": false, 1853 | "name": "Area", 1854 | "options": [], 1855 | "query": "select area from equipment where area is not null and site = '$Site'", 1856 | "refresh": 1, 1857 | "regex": "", 1858 | "skipUrlSync": false, 1859 | "sort": 0, 1860 | "tagValuesQuery": "", 1861 | "tags": [], 1862 | "tagsQuery": "", 1863 | "type": "query", 1864 | "useTags": false 1865 | }, 1866 | { 1867 | "allValue": null, 1868 | "current": { 1869 | "text": "Line1", 1870 | "value": "Line1" 1871 | }, 1872 | "datasource": "PostgreSQL", 1873 | "definition": "select production_line from equipment where production_line is not null and area = '$Area' and site = '$Site'", 1874 | "hide": 0, 1875 | "includeAll": false, 1876 | "index": -1, 1877 | "label": "Line", 1878 | "multi": false, 1879 | "name": "Line", 1880 | "options": [], 1881 | "query": "select production_line from equipment where production_line is not null and area = '$Area' and site = '$Site'", 1882 | "refresh": 1, 1883 | "regex": "", 1884 | "skipUrlSync": false, 1885 | "sort": 1, 1886 | "tagValuesQuery": "", 1887 | "tags": [], 1888 | "tagsQuery": "", 1889 | "type": "query", 1890 | "useTags": false 1891 | } 1892 | ] 1893 | }, 1894 | "time": { 1895 | "from": "now-24h", 1896 | "to": "now" 1897 | }, 1898 | "timepicker": { 1899 | "refresh_intervals": [ 1900 | "5s", 1901 | "10s", 1902 | "30s", 1903 | "1m", 1904 | "5m", 1905 | "15m", 1906 | "30m", 1907 | "1h", 1908 | "2h", 1909 | "1d" 1910 | ], 1911 | "time_options": [ 1912 | "5m", 1913 | "15m", 1914 | "1h", 1915 | "6h", 1916 | "12h", 1917 | "24h", 1918 | "2d", 1919 | "7d", 1920 | "30d" 1921 | ] 1922 | }, 1923 | "timezone": "", 1924 | "title": "Line Performance", 1925 | "uid": "librePerformance", 1926 | "variables": { 1927 | "list": [] 1928 | }, 1929 | "version": 1 1930 | } -------------------------------------------------------------------------------- /grafana/provisioning/dashboards/smart-factory/line-schedule.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": "-- Grafana --", 7 | "enable": true, 8 | "hide": true, 9 | "iconColor": "rgba(0, 211, 255, 1)", 10 | "name": "Annotations & Alerts", 11 | "type": "dashboard" 12 | } 13 | ] 14 | }, 15 | "editable": true, 16 | "gnetId": null, 17 | "graphTooltip": 0, 18 | "id": 1, 19 | "iteration": 1592350242006, 20 | "links": [ 21 | { 22 | "asDropdown": true, 23 | "icon": "external link", 24 | "includeVars": true, 25 | "keepTime": true, 26 | "tags": [ 27 | "SmartFactory" 28 | ], 29 | "type": "dashboards" 30 | } 31 | ], 32 | "panels": [ 33 | { 34 | "columns": [], 35 | "datasource": null, 36 | "fontSize": "100%", 37 | "gridPos": { 38 | "h": 19, 39 | "w": 24, 40 | "x": 0, 41 | "y": 0 42 | }, 43 | "hideTimeOverride": false, 44 | "id": 16, 45 | "links": [], 46 | "pageSize": null, 47 | "scroll": true, 48 | "showHeader": true, 49 | "sort": { 50 | "col": 10, 51 | "desc": true 52 | }, 53 | "styles": [ 54 | { 55 | "alias": "Time", 56 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 57 | "headerColor": "rgba(51, 181, 229, 1)", 58 | "pattern": "Time", 59 | "type": "hidden" 60 | }, 61 | { 62 | "alias": "Production Line", 63 | "colorMode": null, 64 | "colors": [ 65 | "rgba(245, 54, 54, 0.9)", 66 | "rgba(237, 129, 40, 0.89)", 67 | "rgba(50, 172, 45, 0.97)" 68 | ], 69 | "decimals": 2, 70 | "headerColor": "rgba(51, 181, 229, 1)", 71 | "pattern": "production_line", 72 | "thresholds": [], 73 | "type": "string", 74 | "unit": "short" 75 | }, 76 | { 77 | "alias": "Order ID", 78 | "colorMode": null, 79 | "colors": [ 80 | "rgba(245, 54, 54, 0.9)", 81 | "rgba(237, 129, 40, 0.89)", 82 | "rgba(50, 172, 45, 0.97)" 83 | ], 84 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 85 | "decimals": 2, 86 | "mappingType": 1, 87 | "pattern": "order_id", 88 | "thresholds": [], 89 | "type": "string", 90 | "unit": "short" 91 | }, 92 | { 93 | "alias": "Product Description", 94 | "colorMode": null, 95 | "colors": [ 96 | "rgba(245, 54, 54, 0.9)", 97 | "rgba(237, 129, 40, 0.89)", 98 | "rgba(50, 172, 45, 0.97)" 99 | ], 100 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 101 | "decimals": 2, 102 | "mappingType": 1, 103 | "pattern": "product_desc", 104 | "thresholds": [], 105 | "type": "string", 106 | "unit": "short" 107 | }, 108 | { 109 | "alias": "Product ID", 110 | "colorMode": null, 111 | "colors": [ 112 | "rgba(245, 54, 54, 0.9)", 113 | "rgba(237, 129, 40, 0.89)", 114 | "rgba(50, 172, 45, 0.97)" 115 | ], 116 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 117 | "decimals": 2, 118 | "mappingType": 1, 119 | "pattern": "product_id", 120 | "thresholds": [], 121 | "type": "string", 122 | "unit": "short" 123 | }, 124 | { 125 | "alias": "Order Date", 126 | "colorMode": null, 127 | "colors": [ 128 | "rgba(245, 54, 54, 0.9)", 129 | "rgba(237, 129, 40, 0.89)", 130 | "rgba(50, 172, 45, 0.97)" 131 | ], 132 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 133 | "decimals": 2, 134 | "mappingType": 1, 135 | "pattern": "order_date", 136 | "thresholds": [], 137 | "type": "hidden", 138 | "unit": "short" 139 | }, 140 | { 141 | "alias": "Order State", 142 | "colorMode": null, 143 | "colors": [ 144 | "rgba(245, 54, 54, 0.9)", 145 | "rgba(237, 129, 40, 0.89)", 146 | "rgba(50, 172, 45, 0.97)" 147 | ], 148 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 149 | "decimals": 2, 150 | "mappingType": 1, 151 | "pattern": "order_state", 152 | "thresholds": [], 153 | "type": "string", 154 | "unit": "short" 155 | }, 156 | { 157 | "alias": "Quantity", 158 | "colorMode": null, 159 | "colors": [ 160 | "rgba(245, 54, 54, 0.9)", 161 | "rgba(237, 129, 40, 0.89)", 162 | "rgba(50, 172, 45, 0.97)" 163 | ], 164 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 165 | "decimals": 2, 166 | "mappingType": 1, 167 | "pattern": "order_qty", 168 | "thresholds": [], 169 | "type": "string", 170 | "unit": "short" 171 | }, 172 | { 173 | "alias": "Completed Quantity", 174 | "colorMode": null, 175 | "colors": [ 176 | "rgba(245, 54, 54, 0.9)", 177 | "rgba(237, 129, 40, 0.89)", 178 | "rgba(50, 172, 45, 0.97)" 179 | ], 180 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 181 | "decimals": 2, 182 | "mappingType": 1, 183 | "pattern": "completed_qty", 184 | "thresholds": [], 185 | "type": "string", 186 | "unit": "short" 187 | }, 188 | { 189 | "alias": "Setpoint Rate", 190 | "colorMode": null, 191 | "colors": [ 192 | "rgba(245, 54, 54, 0.9)", 193 | "rgba(237, 129, 40, 0.89)", 194 | "rgba(50, 172, 45, 0.97)" 195 | ], 196 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 197 | "decimals": 2, 198 | "mappingType": 1, 199 | "pattern": "setpoint_rate", 200 | "thresholds": [], 201 | "type": "number", 202 | "unit": "short" 203 | }, 204 | { 205 | "alias": "Scheduled Start Time", 206 | "colorMode": null, 207 | "colors": [ 208 | "rgba(245, 54, 54, 0.9)", 209 | "rgba(237, 129, 40, 0.89)", 210 | "rgba(50, 172, 45, 0.97)" 211 | ], 212 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 213 | "decimals": 2, 214 | "mappingType": 1, 215 | "pattern": "scheduled_start_datetime", 216 | "thresholds": [], 217 | "type": "date", 218 | "unit": "short" 219 | } 220 | ], 221 | "targets": [ 222 | { 223 | "groupBy": [ 224 | { 225 | "params": [ 226 | "$__interval" 227 | ], 228 | "type": "time" 229 | }, 230 | { 231 | "params": [ 232 | "null" 233 | ], 234 | "type": "fill" 235 | } 236 | ], 237 | "orderByTime": "ASC", 238 | "policy": "default", 239 | "query": "SELECT last(\"order_date\") AS \"order_date\", last(\"order_state\") AS \"order_state\", last(\"order_qty\") AS \"order_qty\", sum(\"completion_qty\") AS \"completed_qty\", last(\"setpoint_rate\") AS \"setpoint_rate\", last(\"production_line\") AS \"production_line\", last(\"scheduled_start_datetime\") AS \"scheduled_start_datetime\", last(\"product_desc\") AS \"product_desc\" FROM \"OrderPerformance\" WHERE (\"production_line\" = '$Site | $Area | $Line') AND \"scheduled_start_datetime\" >= $__from AND \"scheduled_start_datetime\" <= $__to GROUP BY \"product_id\", \"order_id\"", 240 | "rawQuery": true, 241 | "refId": "A", 242 | "resultFormat": "table", 243 | "select": [ 244 | [ 245 | { 246 | "params": [ 247 | "value" 248 | ], 249 | "type": "field" 250 | }, 251 | { 252 | "params": [], 253 | "type": "mean" 254 | } 255 | ] 256 | ], 257 | "tags": [] 258 | } 259 | ], 260 | "timeFrom": null, 261 | "title": "Operator Order Management Table", 262 | "transform": "table", 263 | "type": "libre-operator-order-mgt-table-panel" 264 | } 265 | ], 266 | "refresh": "5s", 267 | "schemaVersion": 22, 268 | "style": "dark", 269 | "tags": [ 270 | "SmartFactory" 271 | ], 272 | "templating": { 273 | "list": [ 274 | { 275 | "allValue": null, 276 | "current": { 277 | "text": "Site", 278 | "value": "Site" 279 | }, 280 | "datasource": "PostgreSQL", 281 | "definition": "Select site from equipment", 282 | "hide": 0, 283 | "includeAll": false, 284 | "index": -1, 285 | "label": "Site", 286 | "multi": false, 287 | "name": "Site", 288 | "options": [], 289 | "query": "Select site from equipment", 290 | "refresh": 1, 291 | "regex": "", 292 | "skipUrlSync": false, 293 | "sort": 0, 294 | "tagValuesQuery": "", 295 | "tags": [], 296 | "tagsQuery": "", 297 | "type": "query", 298 | "useTags": false 299 | }, 300 | { 301 | "allValue": null, 302 | "current": { 303 | "text": "Area", 304 | "value": "Area" 305 | }, 306 | "datasource": "PostgreSQL", 307 | "definition": "select area from equipment where area is not null and site = '$Site'", 308 | "hide": 0, 309 | "includeAll": false, 310 | "index": -1, 311 | "label": "Area", 312 | "multi": false, 313 | "name": "Area", 314 | "options": [], 315 | "query": "select area from equipment where area is not null and site = '$Site'", 316 | "refresh": 1, 317 | "regex": "", 318 | "skipUrlSync": false, 319 | "sort": 0, 320 | "tagValuesQuery": "", 321 | "tags": [], 322 | "tagsQuery": "", 323 | "type": "query", 324 | "useTags": false 325 | }, 326 | { 327 | "allValue": null, 328 | "current": { 329 | "tags": [], 330 | "text": "Line1", 331 | "value": "Line1" 332 | }, 333 | "datasource": "PostgreSQL", 334 | "definition": "select production_line from equipment where production_line is not null and area = '$Area' and site = '$Site'", 335 | "hide": 0, 336 | "includeAll": false, 337 | "index": -1, 338 | "label": "Line", 339 | "multi": false, 340 | "name": "Line", 341 | "options": [], 342 | "query": "select production_line from equipment where production_line is not null and area = '$Area' and site = '$Site'", 343 | "refresh": 1, 344 | "regex": "", 345 | "skipUrlSync": false, 346 | "sort": 0, 347 | "tagValuesQuery": "", 348 | "tags": [], 349 | "tagsQuery": "", 350 | "type": "query", 351 | "useTags": false 352 | } 353 | ] 354 | }, 355 | "time": { 356 | "from": "now/M", 357 | "to": "now/M" 358 | }, 359 | "timepicker": { 360 | "refresh_intervals": [ 361 | "5s", 362 | "10s", 363 | "30s", 364 | "1m", 365 | "5m", 366 | "15m", 367 | "30m", 368 | "1h", 369 | "2h", 370 | "1d" 371 | ], 372 | "time_options": [ 373 | "5m", 374 | "15m", 375 | "1h", 376 | "6h", 377 | "12h", 378 | "24h", 379 | "2d", 380 | "7d", 381 | "30d" 382 | ] 383 | }, 384 | "timezone": "", 385 | "title": "Line Schedule", 386 | "uid": "libreSchedule", 387 | "variables": { 388 | "list": [] 389 | }, 390 | "version": 1 391 | } -------------------------------------------------------------------------------- /grafana/provisioning/dashboards/smart-factory/master-data.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "$$hashKey": "object:104", 6 | "builtIn": 1, 7 | "datasource": "-- Grafana --", 8 | "enable": true, 9 | "hide": true, 10 | "iconColor": "rgba(0, 211, 255, 1)", 11 | "name": "Annotations & Alerts", 12 | "type": "dashboard" 13 | } 14 | ] 15 | }, 16 | "editable": true, 17 | "gnetId": null, 18 | "graphTooltip": 0, 19 | "links": [ 20 | { 21 | "icon": "external link", 22 | "tags": [ 23 | "SmartFactory" 24 | ], 25 | "type": "dashboards" 26 | } 27 | ], 28 | "panels": [ 29 | { 30 | "columns": [], 31 | "datasource": "PostgreSQL", 32 | "fontSize": "100%", 33 | "gridPos": { 34 | "h": 10, 35 | "w": 8, 36 | "x": 0, 37 | "y": 0 38 | }, 39 | "id": 14, 40 | "links": [], 41 | "pageSize": null, 42 | "scroll": true, 43 | "showHeader": true, 44 | "sort": { 45 | "col": 0, 46 | "desc": true 47 | }, 48 | "styles": [ 49 | { 50 | "alias": "ID", 51 | "colorMode": null, 52 | "colors": [ 53 | "rgba(245, 54, 54, 0.9)", 54 | "rgba(237, 129, 40, 0.89)", 55 | "rgba(50, 172, 45, 0.97)" 56 | ], 57 | "decimals": 2, 58 | "headerColor": "rgba(51, 181, 229, 1)", 59 | "pattern": "id", 60 | "thresholds": [], 61 | "type": "hidden", 62 | "unit": "short" 63 | }, 64 | { 65 | "alias": "Description", 66 | "colorMode": null, 67 | "colors": [ 68 | "rgba(245, 54, 54, 0.9)", 69 | "rgba(237, 129, 40, 0.89)", 70 | "rgba(50, 172, 45, 0.97)" 71 | ], 72 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 73 | "decimals": 2, 74 | "mappingType": 1, 75 | "pattern": "description", 76 | "thresholds": [], 77 | "type": "string", 78 | "unit": "short" 79 | }, 80 | { 81 | "alias": "Description2", 82 | "colorMode": null, 83 | "colors": [ 84 | "rgba(245, 54, 54, 0.9)", 85 | "rgba(237, 129, 40, 0.89)", 86 | "rgba(50, 172, 45, 0.97)" 87 | ], 88 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 89 | "decimals": 2, 90 | "mappingType": 1, 91 | "pattern": "description_optional", 92 | "thresholds": [], 93 | "type": "string", 94 | "unit": "short" 95 | }, 96 | { 97 | "alias": "Unit", 98 | "colorMode": null, 99 | "colors": [ 100 | "rgba(245, 54, 54, 0.9)", 101 | "rgba(237, 129, 40, 0.89)", 102 | "rgba(50, 172, 45, 0.97)" 103 | ], 104 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 105 | "decimals": 2, 106 | "mappingType": 1, 107 | "pattern": "unit_of_measure", 108 | "thresholds": [], 109 | "type": "string", 110 | "unit": "short" 111 | }, 112 | { 113 | "alias": "ID", 114 | "colorMode": null, 115 | "colors": [ 116 | "rgba(245, 54, 54, 0.9)", 117 | "rgba(237, 129, 40, 0.89)", 118 | "rgba(50, 172, 45, 0.97)" 119 | ], 120 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 121 | "decimals": 2, 122 | "mappingType": 1, 123 | "pattern": "name", 124 | "thresholds": [], 125 | "type": "string", 126 | "unit": "short" 127 | } 128 | ], 129 | "targets": [ 130 | { 131 | "format": "table", 132 | "group": [], 133 | "metricColumn": "none", 134 | "rawQuery": true, 135 | "rawSql": "SELECT * from material", 136 | "refId": "A", 137 | "select": [ 138 | [ 139 | { 140 | "params": [ 141 | "value_double" 142 | ], 143 | "type": "column" 144 | } 145 | ] 146 | ], 147 | "table": "test_data", 148 | "timeColumn": "time_date_time", 149 | "timeColumnType": "timestamp", 150 | "where": [ 151 | { 152 | "name": "$__timeFilter", 153 | "params": [], 154 | "type": "macro" 155 | } 156 | ] 157 | } 158 | ], 159 | "timeFrom": null, 160 | "timeShift": null, 161 | "title": "Raw Material", 162 | "transform": "table", 163 | "type": "libre-material-crud-table-panel" 164 | }, 165 | { 166 | "columns": [], 167 | "datasource": "PostgreSQL", 168 | "description": "", 169 | "fontSize": "100%", 170 | "gridPos": { 171 | "h": 10, 172 | "w": 6, 173 | "x": 8, 174 | "y": 0 175 | }, 176 | "id": 16, 177 | "pageSize": null, 178 | "scroll": true, 179 | "showHeader": true, 180 | "sort": { 181 | "col": 0, 182 | "desc": true 183 | }, 184 | "styles": [ 185 | { 186 | "$$hashKey": "object:265", 187 | "alias": "Time", 188 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 189 | "headerColor": "rgba(51, 181, 229, 1)", 190 | "pattern": "id", 191 | "type": "hidden" 192 | }, 193 | { 194 | "$$hashKey": "object:266", 195 | "alias": "ID", 196 | "colorMode": null, 197 | "colors": [ 198 | "rgba(245, 54, 54, 0.9)", 199 | "rgba(237, 129, 40, 0.89)", 200 | "rgba(50, 172, 45, 0.97)" 201 | ], 202 | "decimals": 2, 203 | "headerColor": "rgba(51, 181, 229, 1)", 204 | "pattern": "name", 205 | "thresholds": [], 206 | "type": "string", 207 | "unit": "short" 208 | }, 209 | { 210 | "$$hashKey": "object:305", 211 | "alias": "SEQUENCE", 212 | "colorMode": null, 213 | "colors": [ 214 | "rgba(245, 54, 54, 0.9)", 215 | "rgba(237, 129, 40, 0.89)", 216 | "rgba(50, 172, 45, 0.97)" 217 | ], 218 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 219 | "decimals": 0, 220 | "mappingType": 1, 221 | "pattern": "sequence", 222 | "thresholds": [], 223 | "type": "number", 224 | "unit": "short" 225 | } 226 | ], 227 | "targets": [ 228 | { 229 | "format": "table", 230 | "group": [], 231 | "metricColumn": "none", 232 | "rawQuery": true, 233 | "rawSql": "SELECT * FROM operation ", 234 | "refId": "A", 235 | "select": [ 236 | [ 237 | { 238 | "params": [ 239 | "value" 240 | ], 241 | "type": "column" 242 | } 243 | ] 244 | ], 245 | "timeColumn": "time", 246 | "where": [ 247 | { 248 | "name": "$__timeFilter", 249 | "params": [], 250 | "type": "macro" 251 | } 252 | ] 253 | } 254 | ], 255 | "timeFrom": null, 256 | "timeShift": null, 257 | "title": "Product Operation", 258 | "transform": "table", 259 | "type": "libre-operation-crud-table-panel" 260 | }, 261 | { 262 | "columns": [], 263 | "datasource": "PostgreSQL", 264 | "fontSize": "100%", 265 | "gridPos": { 266 | "h": 10, 267 | "w": 10, 268 | "x": 14, 269 | "y": 0 270 | }, 271 | "id": 10, 272 | "links": [], 273 | "pageSize": null, 274 | "scroll": true, 275 | "showHeader": true, 276 | "sort": { 277 | "col": 0, 278 | "desc": true 279 | }, 280 | "styles": [ 281 | { 282 | "alias": "Time", 283 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 284 | "headerColor": "rgba(51, 181, 229, 1)", 285 | "pattern": "Time", 286 | "type": "date" 287 | }, 288 | { 289 | "alias": "Product ID", 290 | "colorMode": null, 291 | "colors": [ 292 | "rgba(245, 54, 54, 0.9)", 293 | "rgba(237, 129, 40, 0.89)", 294 | "rgba(50, 172, 45, 0.97)" 295 | ], 296 | "decimals": 2, 297 | "headerColor": "rgba(51, 181, 229, 1)", 298 | "pattern": "id", 299 | "thresholds": [], 300 | "type": "string", 301 | "unit": "short" 302 | }, 303 | { 304 | "alias": "Product Description", 305 | "colorMode": null, 306 | "colors": [ 307 | "rgba(245, 54, 54, 0.9)", 308 | "rgba(237, 129, 40, 0.89)", 309 | "rgba(50, 172, 45, 0.97)" 310 | ], 311 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 312 | "decimals": 2, 313 | "mappingType": 1, 314 | "pattern": "product_desc", 315 | "thresholds": [], 316 | "type": "string", 317 | "unit": "short" 318 | }, 319 | { 320 | "alias": "", 321 | "colorMode": null, 322 | "colors": [ 323 | "rgba(245, 54, 54, 0.9)", 324 | "rgba(237, 129, 40, 0.89)", 325 | "rgba(50, 172, 45, 0.97)" 326 | ], 327 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 328 | "decimals": 2, 329 | "mappingType": 1, 330 | "pattern": "ingredient", 331 | "thresholds": [], 332 | "type": "hidden", 333 | "unit": "short" 334 | }, 335 | { 336 | "alias": "", 337 | "colorMode": null, 338 | "colors": [ 339 | "rgba(245, 54, 54, 0.9)", 340 | "rgba(237, 129, 40, 0.89)", 341 | "rgba(50, 172, 45, 0.97)" 342 | ], 343 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 344 | "decimals": 2, 345 | "mappingType": 1, 346 | "pattern": "comment", 347 | "thresholds": [], 348 | "type": "hidden", 349 | "unit": "short" 350 | }, 351 | { 352 | "alias": "Brand Product Line", 353 | "colorMode": null, 354 | "colors": [ 355 | "rgba(245, 54, 54, 0.9)", 356 | "rgba(237, 129, 40, 0.89)", 357 | "rgba(50, 172, 45, 0.97)" 358 | ], 359 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 360 | "decimals": 2, 361 | "mappingType": 1, 362 | "pattern": "product_group", 363 | "thresholds": [], 364 | "type": "string", 365 | "unit": "short" 366 | } 367 | ], 368 | "targets": [ 369 | { 370 | "format": "table", 371 | "group": [], 372 | "groupBy": [ 373 | { 374 | "params": [ 375 | "$__interval" 376 | ], 377 | "type": "time" 378 | }, 379 | { 380 | "params": [ 381 | "null" 382 | ], 383 | "type": "fill" 384 | } 385 | ], 386 | "metricColumn": "none", 387 | "orderByTime": "ASC", 388 | "policy": "default", 389 | "rawQuery": true, 390 | "rawSql": "SELECT * FROM product", 391 | "refId": "A", 392 | "resultFormat": "time_series", 393 | "select": [ 394 | [ 395 | { 396 | "params": [ 397 | "value_double" 398 | ], 399 | "type": "column" 400 | } 401 | ] 402 | ], 403 | "table": "test_data", 404 | "tags": [], 405 | "timeColumn": "time_date_time", 406 | "timeColumnType": "timestamp", 407 | "where": [ 408 | { 409 | "name": "$__timeFilter", 410 | "params": [], 411 | "type": "macro" 412 | } 413 | ] 414 | }, 415 | { 416 | "format": "table", 417 | "group": [], 418 | "metricColumn": "none", 419 | "rawQuery": true, 420 | "rawSql": "SELECT * FROM product_group", 421 | "refId": "B", 422 | "select": [ 423 | [ 424 | { 425 | "params": [ 426 | "value_double" 427 | ], 428 | "type": "column" 429 | } 430 | ] 431 | ], 432 | "table": "test_data", 433 | "timeColumn": "time_date_time", 434 | "timeColumnType": "timestamp", 435 | "where": [ 436 | { 437 | "name": "$__timeFilter", 438 | "params": [], 439 | "type": "macro" 440 | } 441 | ] 442 | }, 443 | { 444 | "format": "table", 445 | "group": [], 446 | "metricColumn": "none", 447 | "rawQuery": true, 448 | "rawSql": "SELECT * FROM material", 449 | "refId": "C", 450 | "select": [ 451 | [ 452 | { 453 | "params": [ 454 | "value_double" 455 | ], 456 | "type": "column" 457 | } 458 | ] 459 | ], 460 | "table": "test_data", 461 | "timeColumn": "time_date_time", 462 | "timeColumnType": "timestamp", 463 | "where": [ 464 | { 465 | "name": "$__timeFilter", 466 | "params": [], 467 | "type": "macro" 468 | } 469 | ] 470 | }, 471 | { 472 | "format": "table", 473 | "group": [], 474 | "metricColumn": "none", 475 | "rawQuery": true, 476 | "rawSql": "SELECT * from operation\n", 477 | "refId": "D", 478 | "select": [ 479 | [ 480 | { 481 | "params": [ 482 | "value" 483 | ], 484 | "type": "column" 485 | } 486 | ] 487 | ], 488 | "timeColumn": "time", 489 | "where": [ 490 | { 491 | "name": "$__timeFilter", 492 | "params": [], 493 | "type": "macro" 494 | } 495 | ] 496 | } 497 | ], 498 | "title": "Product", 499 | "transform": "table", 500 | "type": "libre-product-crud-table-panel" 501 | }, 502 | { 503 | "columns": [], 504 | "datasource": "PostgreSQL", 505 | "description": "Long click to add/edit/remove node.", 506 | "fontSize": "100%", 507 | "gridPos": { 508 | "h": 8, 509 | "w": 24, 510 | "x": 0, 511 | "y": 10 512 | }, 513 | "id": 12, 514 | "links": [], 515 | "pageSize": null, 516 | "showHeader": true, 517 | "styles": [], 518 | "targets": [ 519 | { 520 | "format": "table", 521 | "group": [], 522 | "groupBy": [ 523 | { 524 | "params": [ 525 | "$__interval" 526 | ], 527 | "type": "time" 528 | }, 529 | { 530 | "params": [ 531 | "null" 532 | ], 533 | "type": "fill" 534 | } 535 | ], 536 | "metricColumn": "none", 537 | "orderByTime": "ASC", 538 | "policy": "default", 539 | "rawQuery": true, 540 | "rawSql": "select * from equipment", 541 | "refId": "A", 542 | "resultFormat": "time_series", 543 | "select": [ 544 | [ 545 | { 546 | "params": [ 547 | "value_double" 548 | ], 549 | "type": "column" 550 | } 551 | ] 552 | ], 553 | "table": "test_data", 554 | "tags": [], 555 | "timeColumn": "time_date_time", 556 | "timeColumnType": "timestamp", 557 | "where": [ 558 | { 559 | "name": "$__timeFilter", 560 | "params": [], 561 | "type": "macro" 562 | } 563 | ] 564 | } 565 | ], 566 | "title": "Equipment", 567 | "type": "libre-equipment-crud-tree-chart-panel" 568 | }, 569 | { 570 | "columns": [], 571 | "datasource": "PostgreSQL", 572 | "description": "Long click to add/edit/remove node.", 573 | "fontSize": "100%", 574 | "gridPos": { 575 | "h": 9, 576 | "w": 24, 577 | "x": 0, 578 | "y": 18 579 | }, 580 | "id": 8, 581 | "links": [], 582 | "pageSize": null, 583 | "showHeader": true, 584 | "styles": [], 585 | "targets": [ 586 | { 587 | "format": "table", 588 | "group": [], 589 | "groupBy": [ 590 | { 591 | "params": [ 592 | "$__interval" 593 | ], 594 | "type": "time" 595 | }, 596 | { 597 | "params": [ 598 | "null" 599 | ], 600 | "type": "fill" 601 | } 602 | ], 603 | "metricColumn": "none", 604 | "orderByTime": "ASC", 605 | "policy": "default", 606 | "rawQuery": true, 607 | "rawSql": "SELECT * FROM reason_code", 608 | "refId": "A", 609 | "resultFormat": "time_series", 610 | "select": [ 611 | [ 612 | { 613 | "params": [ 614 | "value_double" 615 | ], 616 | "type": "column" 617 | } 618 | ] 619 | ], 620 | "table": "test_data", 621 | "tags": [], 622 | "timeColumn": "time_date_time", 623 | "timeColumnType": "timestamp", 624 | "where": [ 625 | { 626 | "name": "$__timeFilter", 627 | "params": [], 628 | "type": "macro" 629 | } 630 | ] 631 | } 632 | ], 633 | "title": "Reason Codes", 634 | "type": "libre-reason-codes-crud-tree-chart-panel" 635 | } 636 | ], 637 | "schemaVersion": 22, 638 | "style": "dark", 639 | "tags": [ 640 | "SmartFactory" 641 | ], 642 | "templating": { 643 | "list": [] 644 | }, 645 | "time": { 646 | "from": "now-6h", 647 | "to": "now" 648 | }, 649 | "timepicker": { 650 | "refresh_intervals": [ 651 | "5s", 652 | "10s", 653 | "30s", 654 | "1m", 655 | "5m", 656 | "15m", 657 | "30m", 658 | "1h", 659 | "2h", 660 | "1d" 661 | ], 662 | "time_options": [ 663 | "5m", 664 | "15m", 665 | "1h", 666 | "6h", 667 | "12h", 668 | "24h", 669 | "2d", 670 | "7d", 671 | "30d" 672 | ] 673 | }, 674 | "timezone": "", 675 | "title": "Master Data", 676 | "uid": "libreMasterData", 677 | "variables": { 678 | "list": [] 679 | }, 680 | "version": 1 681 | } -------------------------------------------------------------------------------- /grafana/provisioning/dashboards/smart-factory/scheduling.json: -------------------------------------------------------------------------------- 1 | { 2 | "annotations": { 3 | "list": [ 4 | { 5 | "builtIn": 1, 6 | "datasource": "-- Grafana --", 7 | "enable": true, 8 | "hide": true, 9 | "iconColor": "rgba(0, 211, 255, 1)", 10 | "name": "Annotations & Alerts", 11 | "type": "dashboard" 12 | } 13 | ] 14 | }, 15 | "editable": true, 16 | "gnetId": null, 17 | "graphTooltip": 0, 18 | "links": [ 19 | { 20 | "asDropdown": true, 21 | "icon": "external link", 22 | "tags": [ 23 | "SmartFactory" 24 | ], 25 | "title": "", 26 | "type": "dashboards" 27 | } 28 | ], 29 | "panels": [ 30 | { 31 | "columns": [], 32 | "datasource": "InfluxDB", 33 | "fontSize": "100%", 34 | "gridPos": { 35 | "h": 12, 36 | "w": 24, 37 | "x": 0, 38 | "y": 0 39 | }, 40 | "hideTimeOverride": true, 41 | "id": 4, 42 | "links": [], 43 | "pageSize": null, 44 | "showHeader": true, 45 | "styles": [], 46 | "targets": [ 47 | { 48 | "groupBy": [ 49 | { 50 | "params": [ 51 | "$__interval" 52 | ], 53 | "type": "time" 54 | }, 55 | { 56 | "params": [ 57 | "null" 58 | ], 59 | "type": "fill" 60 | } 61 | ], 62 | "orderByTime": "ASC", 63 | "policy": "default", 64 | "query": "SELECT \"order_date\", last(\"order_state\") as Status, \"order_qty\", \"planned_rate\", \"production_line\", \"scheduled_start_datetime\", \"scheduled_end_datetime\", \"planned_changeover_time\", \"compl_qty\", \"actual_start_datetime\", \"actual_end_datetime\", \"setpoint_rate\", \"product_desc\" FROM \"OrderPerformance\" WHERE $timeFilter GROUP BY \"order_id\", \"product_id\"", 65 | "rawQuery": true, 66 | "refId": "A", 67 | "resultFormat": "table", 68 | "select": [ 69 | [ 70 | { 71 | "params": [ 72 | "value" 73 | ], 74 | "type": "field" 75 | }, 76 | { 77 | "params": [], 78 | "type": "mean" 79 | } 80 | ] 81 | ], 82 | "tags": [] 83 | } 84 | ], 85 | "timeFrom": "3y", 86 | "title": "Production Schedule Gantt Chart", 87 | "type": "libre-production-schedule-gantt-chart-panel" 88 | }, 89 | { 90 | "columns": [], 91 | "datasource": "InfluxDB", 92 | "fontSize": "100%", 93 | "gridPos": { 94 | "h": 10, 95 | "w": 18, 96 | "x": 0, 97 | "y": 12 98 | }, 99 | "hideTimeOverride": false, 100 | "id": 2, 101 | "links": [], 102 | "pageSize": null, 103 | "scroll": true, 104 | "showHeader": true, 105 | "sort": { 106 | "col": 5, 107 | "desc": true 108 | }, 109 | "styles": [ 110 | { 111 | "alias": "Time", 112 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 113 | "headerColor": "rgba(51, 181, 229, 1)", 114 | "pattern": "Time", 115 | "type": "hidden" 116 | }, 117 | { 118 | "alias": "Production Line", 119 | "colorMode": null, 120 | "colors": [ 121 | "rgba(245, 54, 54, 0.9)", 122 | "rgba(237, 129, 40, 0.89)", 123 | "rgba(50, 172, 45, 0.97)" 124 | ], 125 | "decimals": 2, 126 | "headerColor": "rgba(51, 181, 229, 1)", 127 | "pattern": "production_line", 128 | "thresholds": [], 129 | "type": "string", 130 | "unit": "short" 131 | }, 132 | { 133 | "alias": "Order ID", 134 | "colorMode": null, 135 | "colors": [ 136 | "rgba(245, 54, 54, 0.9)", 137 | "rgba(237, 129, 40, 0.89)", 138 | "rgba(50, 172, 45, 0.97)" 139 | ], 140 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 141 | "decimals": 2, 142 | "mappingType": 1, 143 | "pattern": "order_id", 144 | "thresholds": [], 145 | "type": "string", 146 | "unit": "short" 147 | }, 148 | { 149 | "alias": "Production Description", 150 | "colorMode": null, 151 | "colors": [ 152 | "rgba(245, 54, 54, 0.9)", 153 | "rgba(237, 129, 40, 0.89)", 154 | "rgba(50, 172, 45, 0.97)" 155 | ], 156 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 157 | "decimals": 2, 158 | "mappingType": 1, 159 | "pattern": "product_desc", 160 | "thresholds": [], 161 | "type": "string", 162 | "unit": "short" 163 | }, 164 | { 165 | "alias": "Product ID", 166 | "colorMode": null, 167 | "colors": [ 168 | "rgba(245, 54, 54, 0.9)", 169 | "rgba(237, 129, 40, 0.89)", 170 | "rgba(50, 172, 45, 0.97)" 171 | ], 172 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 173 | "decimals": 2, 174 | "mappingType": 1, 175 | "pattern": "product_id", 176 | "thresholds": [], 177 | "type": "string", 178 | "unit": "short" 179 | }, 180 | { 181 | "alias": "Order Date", 182 | "colorMode": null, 183 | "colors": [ 184 | "rgba(245, 54, 54, 0.9)", 185 | "rgba(237, 129, 40, 0.89)", 186 | "rgba(50, 172, 45, 0.97)" 187 | ], 188 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 189 | "decimals": 2, 190 | "mappingType": 1, 191 | "pattern": "order_date", 192 | "thresholds": [], 193 | "type": "string", 194 | "unit": "short" 195 | }, 196 | { 197 | "alias": "Status", 198 | "colorMode": null, 199 | "colors": [ 200 | "rgba(245, 54, 54, 0.9)", 201 | "rgba(237, 129, 40, 0.89)", 202 | "rgba(50, 172, 45, 0.97)" 203 | ], 204 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 205 | "decimals": 2, 206 | "mappingType": 1, 207 | "pattern": "status", 208 | "thresholds": [], 209 | "type": "string", 210 | "unit": "short" 211 | }, 212 | { 213 | "alias": "Order Quantity", 214 | "colorMode": null, 215 | "colors": [ 216 | "rgba(245, 54, 54, 0.9)", 217 | "rgba(237, 129, 40, 0.89)", 218 | "rgba(50, 172, 45, 0.97)" 219 | ], 220 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 221 | "decimals": 2, 222 | "mappingType": 1, 223 | "pattern": "order_qty", 224 | "thresholds": [], 225 | "type": "string", 226 | "unit": "short" 227 | }, 228 | { 229 | "alias": "Planned Rate", 230 | "colorMode": null, 231 | "colors": [ 232 | "rgba(245, 54, 54, 0.9)", 233 | "rgba(237, 129, 40, 0.89)", 234 | "rgba(50, 172, 45, 0.97)" 235 | ], 236 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 237 | "decimals": 2, 238 | "mappingType": 1, 239 | "pattern": "planned_rate", 240 | "thresholds": [], 241 | "type": "string", 242 | "unit": "short" 243 | }, 244 | { 245 | "alias": "", 246 | "colorMode": null, 247 | "colors": [ 248 | "rgba(245, 54, 54, 0.9)", 249 | "rgba(237, 129, 40, 0.89)", 250 | "rgba(50, 172, 45, 0.97)" 251 | ], 252 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 253 | "decimals": 2, 254 | "mappingType": 1, 255 | "pattern": "planned_changeover_time", 256 | "thresholds": [], 257 | "type": "hidden", 258 | "unit": "short" 259 | }, 260 | { 261 | "alias": "", 262 | "colorMode": null, 263 | "colors": [ 264 | "rgba(245, 54, 54, 0.9)", 265 | "rgba(237, 129, 40, 0.89)", 266 | "rgba(50, 172, 45, 0.97)" 267 | ], 268 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 269 | "decimals": 2, 270 | "mappingType": 1, 271 | "pattern": "scheduled_start_datetime", 272 | "thresholds": [], 273 | "type": "hidden", 274 | "unit": "short" 275 | }, 276 | { 277 | "alias": "", 278 | "colorMode": null, 279 | "colors": [ 280 | "rgba(245, 54, 54, 0.9)", 281 | "rgba(237, 129, 40, 0.89)", 282 | "rgba(50, 172, 45, 0.97)" 283 | ], 284 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 285 | "decimals": 2, 286 | "mappingType": 1, 287 | "pattern": "scheduled_end_datetime", 288 | "thresholds": [], 289 | "type": "hidden", 290 | "unit": "short" 291 | } 292 | ], 293 | "targets": [ 294 | { 295 | "groupBy": [ 296 | { 297 | "params": [ 298 | "$__interval" 299 | ], 300 | "type": "time" 301 | }, 302 | { 303 | "params": [ 304 | "null" 305 | ], 306 | "type": "fill" 307 | } 308 | ], 309 | "orderByTime": "ASC", 310 | "policy": "default", 311 | "query": "SELECT \"order_date\", last(\"order_state\") as status, \"order_qty\", \"planned_rate\", \"planned_changeover_time\", \"production_line\", \"scheduled_start_datetime\", \"scheduled_end_datetime\", \"product_desc\" FROM \"OrderPerformance\" WHERE \"scheduled_start_datetime\" >= $__from AND \"scheduled_start_datetime\" <= $__to GROUP BY \"order_id\", \"product_id\"", 312 | "rawQuery": true, 313 | "refId": "A", 314 | "resultFormat": "table", 315 | "select": [ 316 | [ 317 | { 318 | "params": [ 319 | "value" 320 | ], 321 | "type": "field" 322 | }, 323 | { 324 | "params": [], 325 | "type": "mean" 326 | } 327 | ] 328 | ], 329 | "tags": [] 330 | } 331 | ], 332 | "timeFrom": null, 333 | "title": "Scheduler Order Management Table", 334 | "transform": "table", 335 | "type": "libre-scheduler-order-mgt-table-panel" 336 | }, 337 | { 338 | "columns": [], 339 | "datasource": "PostgreSQL", 340 | "fontSize": "100%", 341 | "gridPos": { 342 | "h": 10, 343 | "w": 6, 344 | "x": 18, 345 | "y": 12 346 | }, 347 | "id": 6, 348 | "links": [], 349 | "pageSize": null, 350 | "scroll": true, 351 | "showHeader": true, 352 | "sort": { 353 | "col": 0, 354 | "desc": true 355 | }, 356 | "styles": [ 357 | { 358 | "alias": "Time", 359 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 360 | "headerColor": "rgba(51, 181, 229, 1)", 361 | "pattern": "Time", 362 | "type": "date" 363 | }, 364 | { 365 | "alias": "Site", 366 | "colorMode": null, 367 | "colors": [ 368 | "rgba(245, 54, 54, 0.9)", 369 | "rgba(237, 129, 40, 0.89)", 370 | "rgba(50, 172, 45, 0.97)" 371 | ], 372 | "decimals": 2, 373 | "headerColor": "rgba(51, 181, 229, 1)", 374 | "pattern": "site", 375 | "thresholds": [], 376 | "type": "string", 377 | "unit": "short" 378 | }, 379 | { 380 | "alias": "Area", 381 | "colorMode": null, 382 | "colors": [ 383 | "rgba(245, 54, 54, 0.9)", 384 | "rgba(237, 129, 40, 0.89)", 385 | "rgba(50, 172, 45, 0.97)" 386 | ], 387 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 388 | "decimals": 2, 389 | "mappingType": 1, 390 | "pattern": "area", 391 | "thresholds": [], 392 | "type": "string", 393 | "unit": "short" 394 | }, 395 | { 396 | "alias": "Line", 397 | "colorMode": null, 398 | "colors": [ 399 | "rgba(245, 54, 54, 0.9)", 400 | "rgba(237, 129, 40, 0.89)", 401 | "rgba(50, 172, 45, 0.97)" 402 | ], 403 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 404 | "decimals": 2, 405 | "mappingType": 1, 406 | "pattern": "production_line", 407 | "thresholds": [], 408 | "type": "string", 409 | "unit": "short" 410 | }, 411 | { 412 | "alias": "Start Time", 413 | "colorMode": null, 414 | "colors": [ 415 | "rgba(245, 54, 54, 0.9)", 416 | "rgba(237, 129, 40, 0.89)", 417 | "rgba(50, 172, 45, 0.97)" 418 | ], 419 | "dateFormat": "YYYY-MM-DD HH:mm:ss", 420 | "decimals": 2, 421 | "mappingType": 1, 422 | "pattern": "start_time", 423 | "thresholds": [], 424 | "type": "string", 425 | "unit": "short" 426 | } 427 | ], 428 | "targets": [ 429 | { 430 | "format": "table", 431 | "group": [], 432 | "groupBy": [ 433 | { 434 | "params": [ 435 | "$__interval" 436 | ], 437 | "type": "time" 438 | }, 439 | { 440 | "params": [ 441 | "null" 442 | ], 443 | "type": "fill" 444 | } 445 | ], 446 | "metricColumn": "none", 447 | "orderByTime": "ASC", 448 | "policy": "default", 449 | "query": "SELECT mean(\"value\") FROM \"measurement\" WHERE $timeFilter GROUP BY time($__interval) fill(null) s", 450 | "rawQuery": true, 451 | "rawSql": "SELECT distinct site, area, production_line, start_time FROM equipment where area is not null and production_line is not null order by site asc, area asc, production_line desc", 452 | "refId": "A", 453 | "resultFormat": "time_series", 454 | "select": [ 455 | [ 456 | { 457 | "params": [ 458 | "value_double" 459 | ], 460 | "type": "column" 461 | } 462 | ] 463 | ], 464 | "table": "test_data", 465 | "tags": [], 466 | "timeColumn": "time_date_time", 467 | "timeColumnType": "timestamp", 468 | "where": [ 469 | { 470 | "name": "$__timeFilter", 471 | "params": [], 472 | "type": "macro" 473 | } 474 | ] 475 | } 476 | ], 477 | "title": "Production Line Start Time Setter", 478 | "transform": "table", 479 | "type": "libre-production-line-time-setter-panel" 480 | } 481 | ], 482 | "refresh": "5s", 483 | "schemaVersion": 18, 484 | "style": "dark", 485 | "tags": [ 486 | "SmartFactory" 487 | ], 488 | "templating": { 489 | "list": [] 490 | }, 491 | "time": { 492 | "from": "now/M", 493 | "to": "now/M" 494 | }, 495 | "timepicker": { 496 | "refresh_intervals": [ 497 | "5s", 498 | "10s", 499 | "30s", 500 | "1m", 501 | "5m", 502 | "15m", 503 | "30m", 504 | "1h", 505 | "2h", 506 | "1d" 507 | ], 508 | "time_options": [ 509 | "5m", 510 | "15m", 511 | "1h", 512 | "6h", 513 | "12h", 514 | "24h", 515 | "2d", 516 | "7d", 517 | "30d" 518 | ] 519 | }, 520 | "timezone": "", 521 | "uid": "libreScheduling", 522 | "title": "Scheduling", 523 | "version": 1 524 | } -------------------------------------------------------------------------------- /grafana/provisioning/datasources/Influx.yaml: -------------------------------------------------------------------------------- 1 | # config file version 2 | apiVersion: 1 3 | 4 | # list of datasources that should be deleted from the database 5 | deleteDatasources: 6 | - name: InfluxDB 7 | orgId: 1 8 | 9 | # list of datasources to insert/update depending 10 | # what's available in the database 11 | datasources: 12 | # name of the datasource. Required 13 | - name: InfluxDB 14 | # datasource type. Required 15 | type: influxdb 16 | # access mode. proxy or direct (Server or Browser in the UI). Required 17 | access: proxy 18 | # org id. will default to orgId 1 if not specified 19 | orgId: 1 20 | # url 21 | url: http://influx:8086 22 | # database user, if used 23 | user: admin 24 | # database name, if used 25 | database: $INFLUXDB_DB 26 | # enable/disable basic auth 27 | basicAuth: true 28 | # basic auth username 29 | basicAuthUser: $INFLUXDB_USER 30 | # Deprecated, use secureJsonData.basicAuthPassword 31 | basicAuthPassword: $INFLUXDB_USER_PASSWORD 32 | # enable/disable with credentials headers 33 | withCredentials: false 34 | # mark as default datasource. Max one per org 35 | isDefault: true 36 | # fields that will be converted to json and stored in jsonData 37 | jsonData: 38 | keepCookies: 39 | # json object of data that will be encrypted. 40 | secureJsonData: 41 | version: 1 42 | # allow users to edit datasources from the UI. 43 | editable: false 44 | -------------------------------------------------------------------------------- /grafana/provisioning/datasources/PostgreSQL.yaml: -------------------------------------------------------------------------------- 1 | # config file version 2 | apiVersion: 1 3 | 4 | # list of datasources that should be deleted from the database 5 | deleteDatasources: 6 | - name: PostgreSQL 7 | orgId: 1 8 | 9 | # list of datasources to insert/update depending 10 | # what's available in the database 11 | datasources: 12 | # name of the datasource. Required 13 | - name: PostgreSQL 14 | # datasource type. Required 15 | type: postgres 16 | # access mode. proxy or direct (Server or Browser in the UI). Required 17 | access: proxy 18 | # org id. will default to orgId 1 if not specified 19 | orgId: 1 20 | # url 21 | url: postgres 22 | # database user, if used 23 | user: $POSTGRES_USER 24 | # database name, if used 25 | database: smartfactory 26 | # enable/disable basic auth 27 | basicAuth: false 28 | # basic auth username 29 | basicAuthUser: 30 | # Deprecated, use secureJsonData.basicAuthPassword 31 | basicAuthPassword: 32 | # enable/disable with credentials headers 33 | withCredentials: false 34 | # mark as default datasource. Max one per org 35 | isDefault: false 36 | # fields that will be converted to json and stored in jsonData 37 | jsonData: 38 | postgresVersion: 903 39 | sslmode: disable 40 | # json object of data that will be encrypted. 41 | secureJsonData: 42 | password: $POSTGRES_PASSWORD 43 | version: 1 44 | # allow users to edit datasources from the UI. 45 | editable: false 46 | -------------------------------------------------------------------------------- /integration-templates/README.md: -------------------------------------------------------------------------------- 1 | # Integration Templates 2 | 3 | This directory contains folders with the following user contributed integration templates: 4 | 5 | - [rpi-part-counter](./rpi-part-counter) - Raspberry Pi part counter integration. Thanks to R.W. for their submission. 6 | 7 | ## Contributing 8 | 9 | Use the github pull request feature to submit any contributions, alternatively email contributions to info@spruiktec.com. Include a readme to describe what and how to use your integration. See [template](./integration-template.md) to get started. Ensure to remove any sensitive information before submitting. 10 | -------------------------------------------------------------------------------- /integration-templates/integration-template.md: -------------------------------------------------------------------------------- 1 | # SHORT NAME 2 | 3 | ## Functional Description 4 | 5 | ## Installing 6 | 7 | ## Author 8 | 9 | ## Changelog 10 | -------------------------------------------------------------------------------- /integration-templates/rpi-part-counter/Libre Template.json: -------------------------------------------------------------------------------- 1 | [{"id":"1f1892e2.58095d","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"47799b14.9af1a4","type":"change","z":"1f1892e2.58095d","name":"","rules":[{"t":"set","p":"output","pt":"flow","to":"$flowContext(\"output\")+1","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":300,"wires":[["22460333.36795c"]],"info":"This is used to count the amount of times the sensor is triggered"},{"id":"d7f5071f.505088","type":"debug","z":"1f1892e2.58095d","name":"Production output","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"output","targetType":"msg","statusVal":"","statusType":"auto","x":370,"y":420,"wires":[]},{"id":"807d3c22.63537","type":"change","z":"1f1892e2.58095d","name":"","rules":[{"t":"set","p":"output","pt":"msg","to":"output","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":260,"wires":[["47799b14.9af1a4"]]},{"id":"ea490b7b.97ee38","type":"debug","z":"1f1892e2.58095d","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"rate","targetType":"msg","statusVal":"","statusType":"auto","x":1080,"y":120,"wires":[]},{"id":"41564e57.8342","type":"change","z":"1f1892e2.58095d","name":"Clear Count","rules":[{"t":"set","p":"output","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"orderRunning","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":760,"wires":[[]]},{"id":"82e62254.6f7fa","type":"change","z":"1f1892e2.58095d","name":"","rules":[{"t":"set","p":"output","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":220,"wires":[["807d3c22.63537"]]},{"id":"cfd50818.fa36b8","type":"http request","z":"1f1892e2.58095d","name":"","method":"POST","ret":"txt","paytoqs":"query","url":"yourinfluxdbaddress/write?db=smart_factory","tls":"","persist":false,"proxy":"","authType":"basic","x":950,"y":240,"wires":[["1764e2b5.9877bd"]]},{"id":"1764e2b5.9877bd","type":"debug","z":"1f1892e2.58095d","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1290,"y":240,"wires":[]},{"id":"7ce5cd49.2bb1a4","type":"http request","z":"1f1892e2.58095d","name":"","method":"POST","ret":"txt","paytoqs":"query","url":"yourinfluxdbaddress/write?db=smart_factory","tls":"","persist":false,"proxy":"","authType":"basic","x":1092,"y":160,"wires":[["1764e2b5.9877bd"]]},{"id":"2eaece8b.30fa82","type":"function","z":"1f1892e2.58095d","name":"Availability Function","func":"var stopped = 0;\nvar status = \"null\";\nvar held = 0;\nvar idle = flow.get('orderRunning')\nvar time = global.get('Time')\nvar lineProtocol = {\n payload: \"\"\n};\nvar timestamp = (new Date().getTime() * 1000000);\nvar outStr = \"Availability,Site=,Area=,Line= \";\nif (time == 1 && idle == 0 && msg.rate ==0) {\n stopped = 0;\n status = \"held\";\n held = 1;\n idle = 0;\n} else if (time == 1 && idle == 1 && msg.rate ==0) {\n stopped = 0;\n status = \"idle\";\n held = 0;\n idle = 1;\n} else if (time == 0 && msg.rate ==0) {\n stopped = 1;\n status = \"stopped\";\n held = 0;\n idle = 0;\n}\nconsole.log(timestamp);\nif (msg.rate > 0) {\n outStr += \"stopped=0,\";\n outStr += \"idle=0,\";\n outStr += \"execute=1,\";\n outStr += \"held=0,\";\n outStr += \"complete=0,\";\n outStr += 'status=\"execute\"';\n} else {\n outStr += \"stopped=\" + stopped + \",\";\n outStr += \"idle=\"+idle+\",\";\n outStr += \"execute=0,\";\n outStr += \"held=\" + held + \",\";\n outStr += \"complete=0,\";\n outStr += \"category=\\\"\\\",\";\n outStr += \"reason=\\\"\\\",\";\n outStr += \"parentReason=\\\"\\\",\";\n outStr += \"comment=\\\"\\\",\";\n outStr += 'status=\\\"' + status + '\\\",';\n}\noutStr +=\" \"+timestamp;\nlineProtocol.payload = outStr;\nreturn [lineProtocol, msg];","outputs":1,"noerr":0,"initialize":"","finalize":"","x":760,"y":240,"wires":[["cfd50818.fa36b8","e68becb1.d15d7"]]},{"id":"dda8971f.e9d348","type":"function","z":"1f1892e2.58095d","name":"Performance Function","func":"var stopped = 0;\n\nvar status = \"held\";\n\nvar held = 0;\n\nvar idle = flow.get('orderRunning');\n\nvar time = global.get('Time');\n\nvar lineProtocol = {\n payload: \"\"\n};\n\nvar outStr = \"Performance,Site=,Area=,Line= \";\n\nif (time == 1 && idle === 0) {\n stopped = 0;\n status = \"held\";\n held = 1;\n idle = 0;\n} else if (time == 1 && idle == 1) {\n stopped = 0;\n status = \"idle\";\n held = 0;\n idle = 1;\n} else {\n stopped = 1;\n status = \"stopped\";\n held = 0;\n idle = 0;\n}\n\nif (msg.rate > 0) {\n\n outStr += \"planned_rate=\" + flow.get('plannedrate') + \",\";\n outStr += \"actual_rate=\" + msg.rate + \",\";\n outStr += \"stopped=0,\";\n outStr += \"idle=0,\";\n outStr += \"execute=1,\";\n outStr += \"held=0,\";\n outStr += \"complete=0,\";\n outStr += 'status=\"execute\" ';\n\n} else {\n\n outStr += \"planned_rate=\" + flow.get('plannedrate') + \",\";\n outStr += \"actual_rate=0,\";\n outStr += \"stopped=\" + stopped + \",\";\n outStr += \"idle=\" + idle + \",\";\n outStr += \"execute=0,\";\n outStr += \"held=\" + held + \",\";\n outStr += \"complete=0,\";\n outStr += 'status=' + '\"' + status + '\"';\n\n}\n\nlineProtocol.payload = outStr;\n\nreturn [lineProtocol, msg];\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1062,"y":200,"wires":[["7ce5cd49.2bb1a4"]]},{"id":"326d3e1.3ec0ac2","type":"switch","z":"1f1892e2.58095d","name":"","property":"rate","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":691,"y":155,"wires":[["4a7abe6a.617c3"],["2eaf11e1.13c59e"]]},{"id":"2eaf11e1.13c59e","type":"change","z":"1f1892e2.58095d","name":"Zero Rate","rules":[{"t":"set","p":"rate","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":200,"wires":[["8edbda32.b3a098"]]},{"id":"70b70cbb.0cf9d4","type":"inject","z":"1f1892e2.58095d","name":"","props":[{"p":"payload"}],"repeat":"10","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"output","payloadType":"flow","x":712,"y":72,"wires":[["aa435d55.8170b"]]},{"id":"e74da372.c3d4d","type":"switch","z":"1f1892e2.58095d","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":180,"wires":[[],["82e62254.6f7fa"]]},{"id":"8edbda32.b3a098","type":"rbe","z":"1f1892e2.58095d","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"rate","x":870,"y":200,"wires":[["ea490b7b.97ee38","dda8971f.e9d348","2eaece8b.30fa82"]]},{"id":"92ebb3f7.6911","type":"http request","z":"1f1892e2.58095d","name":"Get Order Data","method":"GET","ret":"obj","paytoqs":"ignore","url":"yourinfluxdbaddress/query?db=smart_factory&q=Select last_production_line as production_line,last_product_desc as product_desc, last_order_state as order_state,last_scheduled_start_datetime as scheduled_start_datetime,last_actual_start_datetime as actual_start_datetime,last_setpoint_rate as setpoint_rate,last_order_qty as order_qty,last_issued_qty as issued_qty, last_order_qty - last_issued_qty as remaining_qty ,(last_order_qty - last_issued_qty)/last_setpoint_rate as remaining_time FROM (SELECT last(*) FROM \"OrderPerformance\" GROUP BY \"order_id\",\"product_id\" ) WHERE \"last_order_state\" =~ /running/ and \"last_production_line\" = 'Site | Area | Line1' GROUP BY \"order_id\",\"product_id\"","tls":"","persist":false,"proxy":"","authType":"basic","x":340,"y":651,"wires":[["e90e2fea.9381f","c02ea3e3.e01d4","67649ec.9e83b6"]]},{"id":"e90e2fea.9381f","type":"debug","z":"1f1892e2.58095d","name":"Current order results","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":360,"y":571,"wires":[]},{"id":"cbaea760.ca5eb8","type":"function","z":"1f1892e2.58095d","name":"Pull PlannedRate","func":"p=msg.payload;\nnode.log(typeof p);\nmsg.payload=p.results[0].series[0].values[0][6];\nflow.set(\"plannedrate\", msg.payload)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":548,"y":848,"wires":[[]]},{"id":"fa5039b1.e6f078","type":"inject","z":"1f1892e2.58095d","name":"Query current order","props":[{"p":"payload"}],"repeat":"900","crontab":"","once":true,"onceDelay":"0.01","topic":"","payload":"payload","payloadType":"msg","x":360,"y":611,"wires":[["92ebb3f7.6911"]]},{"id":"c02ea3e3.e01d4","type":"function","z":"1f1892e2.58095d","name":"Check Order","func":"try {\n p = msg.payload;\n node.log(typeof p);\n msg.payload = p.results[0].series[0].tags.order_id;\n} catch (error) {\n msg.payload = 0;\n}\n\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330,"y":692,"wires":[["6b150c41.b0ae84"]]},{"id":"deb7c1c9.b3d56","type":"rbe","z":"1f1892e2.58095d","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":308,"y":768,"wires":[["366eb719.6aff18","41564e57.8342"]]},{"id":"366eb719.6aff18","type":"http request","z":"1f1892e2.58095d","name":"Get Order Data","method":"GET","ret":"obj","paytoqs":"ignore","url":"yourinfluxdbaddress/query?db=smart_factory&q=Select last_production_line as production_line,last_product_desc as product_desc, last_order_state as order_state,last_scheduled_start_datetime as scheduled_start_datetime,last_actual_start_datetime as actual_start_datetime,last_setpoint_rate as setpoint_rate,last_order_qty as order_qty,last_issued_qty as issued_qty, last_order_qty - last_issued_qty as remaining_qty ,(last_order_qty - last_issued_qty)/last_setpoint_rate as remaining_time FROM (SELECT last(*) FROM \"OrderPerformance\" GROUP BY \"order_id\",\"product_id\" ) WHERE \"last_order_state\" =~ /running/ and \"last_production_line\" = 'Site | Area | Line1' GROUP BY \"order_id\",\"product_id\"","tls":"","persist":false,"proxy":"","authType":"basic","x":338,"y":808,"wires":[["cbaea760.ca5eb8","d7b7f225.30838","16859c2.616fe64","2b12e739.012c78","fce4d38f.496b"]]},{"id":"d7b7f225.30838","type":"function","z":"1f1892e2.58095d","name":"Pull OrderQty","func":"p=msg.payload;\nnode.log(typeof p);\nmsg.payload=p.results[0].series[0].values[0][7];\nflow.set(\"orderQty\", msg.payload)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":538,"y":888,"wires":[[]]},{"id":"16859c2.616fe64","type":"function","z":"1f1892e2.58095d","name":"Pull IssuedQty","func":"p=msg.payload;\nnode.log(typeof p);\nmsg.payload=p.results[0].series[0].values[0][8];\nif (msg.payload === null){\n flow.set(\"issuedQty\", 0)\n}else{\n flow.set(\"issuedQty\", msg.payload)\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":538,"y":928,"wires":[[]]},{"id":"ba0258da.012e48","type":"comment","z":"1f1892e2.58095d","name":"Production Rate","info":"Sets the prodution rate and post downtime codes","x":700,"y":20,"wires":[]},{"id":"22460333.36795c","type":"switch","z":"1f1892e2.58095d","name":"","property":"output","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":340,"wires":[[],["d7f5071f.505088","b8197de0.2e80c","54312e33.6bcf5"]]},{"id":"2b12e739.012c78","type":"function","z":"1f1892e2.58095d","name":"Pull Orderid","func":"p=msg.payload;\nnode.log(typeof p);\nmsg.payload=p.results[0].series[0].tags.order_id;\nflow.set(\"orderid\", msg.payload)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":528,"y":968,"wires":[[]]},{"id":"e68becb1.d15d7","type":"debug","z":"1f1892e2.58095d","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":712,"y":292,"wires":[]},{"id":"aa3224cf.ac6138","type":"switch","z":"1f1892e2.58095d","name":"","property":"payload","propertyType":"msg","rules":[{"t":"else"},{"t":"gte","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":692,"y":112,"wires":[["961c95b5.b4dad8"],["326d3e1.3ec0ac2"]]},{"id":"961c95b5.b4dad8","type":"change","z":"1f1892e2.58095d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":113,"wires":[["326d3e1.3ec0ac2"]],"info":"this is used to block negitive numbers"},{"id":"dd845dc3.7860b","type":"change","z":"1f1892e2.58095d","name":"Clear Flow Data","rules":[{"t":"set","p":"issuedQty","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"orderQty","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"orderRunning","pt":"flow","to":"1","tot":"num"},{"t":"set","p":"orderid","pt":"flow","to":"null","tot":"str"},{"t":"set","p":"output","pt":"flow","to":"0","tot":"num"},{"t":"set","p":"plannedrate","pt":"flow","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":720,"wires":[[]]},{"id":"6b150c41.b0ae84","type":"switch","z":"1f1892e2.58095d","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":312,"y":732,"wires":[["dd845dc3.7860b"],["deb7c1c9.b3d56"]]},{"id":"b8830c1c.6b8a8","type":"comment","z":"1f1892e2.58095d","name":"Production Count","info":"","x":380,"y":20,"wires":[]},{"id":"4b274132.1729d","type":"comment","z":"1f1892e2.58095d","name":"Check order/data","info":"","x":360,"y":520,"wires":[]},{"id":"67649ec.9e83b6","type":"debug","z":"1f1892e2.58095d","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":660,"wires":[]},{"id":"54312e33.6bcf5","type":"function","z":"1f1892e2.58095d","name":"OrderPerformance Function","func":"var lineProtocol = {\n payload: \"\"\n};\nvar output = flow.get('output')\nvar order = flow.get('orderid')\nvar productId = flow.get('productId')\n\nvar outStr = \"OrderPerformance,product_id=\"+productId+\",order_id=\"+order+\" \"\nif (msg.output >= 0) {\n\n outStr += 'issued_qty=' + output+\"\"\n}\n\nlineProtocol.payload = outStr;\n\nreturn [lineProtocol, msg];","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":340,"wires":[["9ceaed9d.be5bf","d4ec2738.a3b158"]]},{"id":"9ceaed9d.be5bf","type":"http request","z":"1f1892e2.58095d","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"yourinfluxdbaddress/write?db=smart_factory","tls":"","persist":false,"proxy":"","authType":"basic","x":810,"y":340,"wires":[["d43aa039.edd51"]]},{"id":"d43aa039.edd51","type":"debug","z":"1f1892e2.58095d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":810,"y":380,"wires":[]},{"id":"d4ec2738.a3b158","type":"debug","z":"1f1892e2.58095d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":420,"wires":[]},{"id":"aa435d55.8170b","type":"rate","z":"1f1892e2.58095d","name":"Production Rate","inputField":"output","inputFieldType":"flow","outputField":"rate","outputFieldType":"msg","timestampField":"","timestampFieldType":"now","ratePeriod":"60000","x":882,"y":72,"wires":[["aa3224cf.ac6138"]]},{"id":"4a7abe6a.617c3","type":"smooth","z":"1f1892e2.58095d","name":"Smooth Rate","property":"rate","action":"mean","count":"6","round":"0","mult":"single","reduce":false,"x":850,"y":153,"wires":[["8edbda32.b3a098"]]},{"id":"7cb7a939.9fbc68","type":"udp in","z":"1f1892e2.58095d","name":"Apps counter","iface":"","port":"9245","ipv":"udp4","multicast":"false","group":"","datatype":"utf8","x":350,"y":60,"wires":[[]]},{"id":"2b5db23b.f61e6e","type":"function","z":"1f1892e2.58095d","name":"String to number","func":"if (msg.payload == \"1\"){\n msg.payload = 1;\n} else if (msg.payload == \"0\") {\n msg.payload = 0;\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":100,"wires":[["e74da372.c3d4d"]]},{"id":"b8197de0.2e80c","type":"function","z":"1f1892e2.58095d","name":"Set issued_qty","func":"if (msg.output > 0) {\n flow.set('issuedQty', msg.output + 1)\n}\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":380,"wires":[[]]},{"id":"a6f17700.e7f8b8","type":"function","z":"1f1892e2.58095d","name":"Set Time","func":"if (msg.payload == 1){\n global.set('Time', 1 );\n}else{\n global.set('Time', 0 );\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1260,"y":480,"wires":[["bb0ecb0.2dbe538"]]},{"id":"bb0ecb0.2dbe538","type":"debug","z":"1f1892e2.58095d","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1290,"y":520,"wires":[]},{"id":"aa0d150.b797ae8","type":"bigtimer","z":"1f1892e2.58095d","outtopic":"","outpayload1":"1","outpayload2":"0","name":"Big Timer","comment":"Set on time to your match the start of your workday and the off time to the end of your workday","lat":"39.3210","lon":"-111.0937","starttime":"0","endtime":"0","starttime2":0,"endtime2":0,"startoff":"0","endoff":"0","startoff2":0,"endoff2":0,"offs":0,"outtext1":"","outtext2":"","timeout":"10","sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"day6":0,"month6":0,"day7":0,"month7":0,"day8":0,"month8":0,"day9":0,"month9":0,"day10":0,"month10":0,"day11":0,"month11":0,"day12":0,"month12":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"d6":0,"w6":0,"xday1":0,"xmonth1":0,"xday2":0,"xmonth2":0,"xday3":0,"xmonth3":0,"xday4":0,"xmonth4":0,"xday5":0,"xmonth5":0,"xday6":0,"xmonth6":0,"xday7":"","xmonth7":"","xday8":"","xmonth8":"","xday9":"","xmonth9":"","xday10":"","xmonth10":"","xday11":"","xmonth11":"","xday12":"","xmonth12":"","xd1":0,"xw1":0,"xd2":0,"xw2":0,"xd3":0,"xw3":0,"xd4":0,"xw4":0,"xd5":0,"xw5":0,"xd6":0,"xw6":0,"suspend":false,"random":false,"randon1":false,"randoff1":false,"randon2":false,"randoff2":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":1120,"y":500,"wires":[["a6f17700.e7f8b8"],[],[]]},{"id":"1829d633.5bacda","type":"comment","z":"1f1892e2.58095d","name":"Set global.Time","info":"","x":1190,"y":440,"wires":[]},{"id":"fce4d38f.496b","type":"function","z":"1f1892e2.58095d","name":"Pull ProductID","func":"p=msg.payload;\nnode.log(typeof p);\nmsg.payload=p.results[0].series[0].tags.product_id;\nflow.set(\"productId\", msg.payload)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":540,"y":800,"wires":[[]]}] -------------------------------------------------------------------------------- /integration-templates/rpi-part-counter/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry PI Part Counter 2 | 3 | ## Functional Description 4 | 5 | This integration is for a hub and spoke architecture of node-red instances. At each machine (spoke), Node-red is running on a Raspberry Pi with a single digital input of part present / not present sensor. This sensor value is published to a centralized node-red which then transforms into the data structures for Libre. The centralized node-red instance is running on a server with connectivity to Libre and each machine. 6 | 7 | ## Installing 8 | 9 | ### Hub 10 | 11 | 1. Install [node-red](https://nodered.org/docs/getting-started/) 12 | 2. Install additional nodes via the [palette manager](https://nodered.org/docs/user-guide/editor/palette/manager#installing-nodes) 13 | 1. node-red-node-smooth 14 | 2. bigtimer 15 | 3. Import [Template](./Libre%20Template.json) 16 | 1. Configure http request nodes with your influxdb address 17 | 4. Deploy template 18 | 19 | ### Spoke 20 | 21 | 1. Install [node-red](https://nodered.org/docs/getting-started/) 22 | 2. Add counter to i/o input node 23 | 3. Publish changes to :9245 24 | 25 | ## Author 26 | 27 | 2021 - R.W. 28 | 29 | ## Changelog 30 | 31 | Jan 11, 2021 - First Issue 32 | -------------------------------------------------------------------------------- /postgres/Dockerfile: -------------------------------------------------------------------------------- 1 | # Dockerfile 2 | FROM postgres:9.6 3 | 4 | LABEL maintainer="Tom Hollingworth " 5 | 6 | COPY db/*.sql /docker-entrypoint-initdb.d/ 7 | -------------------------------------------------------------------------------- /postgres/db/02_structure.sql: -------------------------------------------------------------------------------- 1 | CREATE DATABASE smartfactory; 2 | \c smartfactory 3 | 4 | /* Material */ 5 | CREATE TABLE material ( 6 | id SERIAL, 7 | name character varying(20) NOT NULL, 8 | description character varying(50) NOT NULL, 9 | description_optional character varying(50) NULL, 10 | unit_of_measure character varying(10) NOT NULL 11 | ); 12 | 13 | ALTER TABLE material ADD CONSTRAINT material_pkey PRIMARY KEY (id); 14 | 15 | /* Equipment */ 16 | CREATE TABLE equipment ( 17 | site character varying(50) NULL, 18 | area character varying(50) NULL, 19 | production_line character varying(50) NULL, 20 | equipment character varying(50) NULL, 21 | start_time character varying(10) NULL 22 | ); 23 | 24 | /* Material Requirement */ 25 | CREATE TABLE material_requirement ( 26 | product_id character varying(20) NOT NULL, 27 | material_id integer NOT NULL, 28 | operation_id integer NOT NULL, 29 | route_id integer NULL, 30 | quantity double precision NOT NULL, 31 | grams_on_scale double precision NOT NULL, 32 | grams_total double precision NOT NULL, 33 | quantity_uom character varying(20) NULL, 34 | sub_sequence_id integer NOT NULL 35 | ); 36 | 37 | /* Operation */ 38 | CREATE TABLE operation ( 39 | id SERIAL, 40 | name character varying(20) NOT NULL, 41 | sequence integer NOT NULL, 42 | UNIQUE(sequence) 43 | ); 44 | 45 | ALTER TABLE operation ADD CONSTRAINT operation_pkey PRIMARY KEY (id); 46 | 47 | /* Order State */ 48 | CREATE TABLE order_state ( 49 | state character varying NOT NULL, 50 | state_options character varying[] NOT NULL, 51 | is_unique boolean NOT NULL, 52 | is_init_state boolean NOT NULL, 53 | backup_state character varying NULL 54 | ); 55 | 56 | /* Process Control Form */ 57 | CREATE TABLE process_control_form ( 58 | id character varying NOT NULL, 59 | order_id character varying NOT NULL, 60 | product_id character varying NOT NULL, 61 | product_description character varying NOT NULL, 62 | production_line character varying NOT NULL, 63 | qa_form jsonb NOT NULL, 64 | reviewed_at timestamp with time zone NOT NULL, 65 | reviewed_by character varying NOT NULL, 66 | comment character varying NOT NULL, 67 | line_lead_form jsonb NOT NULL, 68 | order_created_at timestamp with time zone NOT NULL, 69 | checked_by character varying NOT NULL, 70 | num_out_of_range integer NOT NULL, 71 | num_of_check integer NOT NULL 72 | ); 73 | 74 | ALTER TABLE process_control_form ADD CONSTRAINT process_control_form_pkey PRIMARY KEY (id); 75 | 76 | /* Product */ 77 | CREATE TABLE product ( 78 | id character varying(20) NOT NULL, 79 | ingredient jsonb NOT NULL, 80 | comment character varying(255) NULL, 81 | product_group character varying(50) NOT NULL, 82 | product_desc character varying(50) NOT NULL 83 | ); 84 | 85 | /* Product Group */ 86 | CREATE TABLE product_group ( 87 | group_name character varying(50) NOT NULL 88 | ); 89 | 90 | /* QA Check Review */ 91 | CREATE TABLE qa_check_review ( 92 | process_id character varying(50) NOT NULL, 93 | reviewed_by character varying NOT NULL, 94 | num_of_checks integer NOT NULL, 95 | form_type character varying(20) NOT NULL, 96 | comment character varying(255) NULL, 97 | time_reviewed timestamp with time zone NOT NULL 98 | ); 99 | 100 | /* QA Product Check */ 101 | CREATE TABLE qa_product_check ( 102 | checked_by character varying NOT NULL, 103 | production_line character varying(50) NOT NULL, 104 | belt_condition character varying(10) NOT NULL, 105 | product_id character varying(20) NOT NULL, 106 | product_description character varying(50) NOT NULL, 107 | "check" jsonb NOT NULL, 108 | is_manual boolean NOT NULL, 109 | check_count integer NOT NULL, 110 | id character varying(60) NOT NULL, 111 | process_id character varying(50) NOT NULL, 112 | num_of_mat_out_of_range integer NOT NULL, 113 | time_checked timestamp with time zone NOT NULL, 114 | order_id character varying NULL 115 | ); 116 | 117 | ALTER TABLE qa_product_check ADD CONSTRAINT qa_product_check_pkey PRIMARY KEY (id); 118 | 119 | /* Reason Code */ 120 | CREATE TABLE reason_code ( 121 | category_id character varying NULL, 122 | reason_id character varying NULL, 123 | parent_reason_id character varying NULL 124 | ); 125 | 126 | /* Route */ 127 | CREATE TABLE route ( 128 | id SERIAL, 129 | name character varying NOT NULL, 130 | setup_time_minutes bigint NULL, 131 | rate_per_mintue double precision NULL, 132 | efficiency_rate double precision NULL 133 | ); 134 | 135 | ALTER TABLE route ADD CONSTRAINT route_pkey PRIMARY KEY (id); -------------------------------------------------------------------------------- /postgres/db/03_data_bootstrap.sql: -------------------------------------------------------------------------------- 1 | /* Order States */ 2 | 3 | \c smartfactory 4 | 5 | INSERT INTO "order_state" (state, state_options, is_unique, is_init_state, backup_state) VALUES ('planned', ARRAY['ready'], false, true, null); 6 | INSERT INTO "order_state" (state, state_options, is_unique, is_init_state, backup_state) VALUES ('ready', ARRAY['next'], false, false, null); 7 | INSERT INTO "order_state" (state, state_options, is_unique, is_init_state, backup_state) VALUES ('paused', ARRAY['next', 'complete'], false, false, null); 8 | INSERT INTO "order_state" (state, state_options, is_unique, is_init_state, backup_state) VALUES ('complete', ARRAY['closed'], false, false, null); 9 | INSERT INTO "order_state" (state, state_options, is_unique, is_init_state, backup_state) VALUES ('closed', ARRAY[''], false, false, null); 10 | INSERT INTO "order_state" (state, state_options, is_unique, is_init_state, backup_state) VALUES ('next', ARRAY['running'], true, false, 'ready'); 11 | INSERT INTO "order_state" (state, state_options, is_unique, is_init_state, backup_state) VALUES ('running', ARRAY['paused', 'complete'], true, false, 'complete'); 12 | --------------------------------------------------------------------------------