diff --git a/.circleci/config.yml b/.circleci/config.yml
index e980686..b7210ab 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -39,10 +39,6 @@ jobs:
## ------------------ Run Unit Tests ------------------
run-unit-tests:
- # Use VM over docker container
- machine:
- # # https://circleci.com/docs/2.0/configuration-reference/#available-machine-images
- # image: ubuntu-2204:2022.07.1
docker:
- image: cimg/python:3.11.0
steps:
@@ -51,8 +47,6 @@ jobs:
- disable_docker_hub
- attach_workspace:
at: /tmp/workspace
-
- # - configure_environment
- checkout
- python/install-packages:
pkg-manager: pip
@@ -60,9 +54,15 @@ jobs:
name: Run Unit Tests
command: |
set -x
+ export ENV_VAR_TENANT=${ENV_VAR_TENANT}
+ export ENV_VAR_USERNAME=${ENV_VAR_USERNAME}
+ export ENV_VAR_PASSWORD=${ENV_VAR_PASSWORD}
+ export ENV_VAR_API_KEY=${ENV_VAR_API_KEY}
+ export ENV_VAR_API_SECRET=${ENV_VAR_API_SECRET}
pip install -r requirements-codecoverage.txt
+ pip install -e .
mkdir test-results
- coverage run -m pytest --junitxml=test-results/junit.xml tests
+ coverage run -m pytest --nbmake --nbmake-timeout=300 -n=auto --junitxml=test-results/junit.xml tests examples
- run:
name: Compile Coverage Report
command: |
diff --git a/examples/Cookbooks Examples.ipynb b/examples/Cookbooks Examples.ipynb
index 913792f..679c5f7 100644
--- a/examples/Cookbooks Examples.ipynb
+++ b/examples/Cookbooks Examples.ipynb
@@ -14,85 +14,57 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from smsdk import client\n",
"from datetime import datetime, timedelta\n",
- "import pandas as pd"
+ "import pandas as pd\n",
+ "import os"
]
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "['Downtime',\n",
- " 'Paper_Mill_Finishing_and_Shipping',\n",
- " 'Paper_Mill_PM1_Broke',\n",
- " 'Paper_Mill_PM1_Calender_Stacks',\n",
- " 'Paper_Mill_PM1_Dryer_Section',\n",
- " 'Paper_Mill_PM1_Forming_Section',\n",
- " 'Paper_Mill_PM1_Headbox',\n",
- " 'Paper_Mill_PM1_Lab_Tests',\n",
- " 'Paper_Mill_PM1_Press_Section',\n",
- " 'Paper_Mill_PM1_Production_Status',\n",
- " 'Paper_Mill_PM1_Reel',\n",
- " 'Paper_Mill_PM1_Scale',\n",
- " 'Paper_Mill_PM1_Steam_System',\n",
- " 'Paper_Mill_PM1_Stock_Approach',\n",
- " 'Paper_Mill_PM1_White_Water',\n",
- " 'Paper_Mill_PM2_Broke',\n",
- " 'Paper_Mill_PM2_Calendar',\n",
- " 'Paper_Mill_PM2_Dryer_Section',\n",
- " 'Paper_Mill_PM2_Forming_Section',\n",
- " 'Paper_Mill_PM2_Headbox',\n",
- " 'Paper_Mill_PM2_Lab_Tests',\n",
- " 'Paper_Mill_PM2_Press_Section',\n",
- " 'Paper_Mill_PM2_Production_Status',\n",
- " 'Paper_Mill_PM2_Reel',\n",
- " 'Paper_Mill_PM2_Scale',\n",
- " 'Paper_Mill_PM2_Steam_System',\n",
- " 'Paper_Mill_PM2_Stock_Approach',\n",
- " 'Paper_Mill_PM2_White_Water',\n",
- " 'Pulp_Mill_Num1_OCC_Coarse_Screen',\n",
- " 'Pulp_Mill_Num1_OCC_Disc_Thickener',\n",
- " 'Pulp_Mill_Num1_OCC_Fine_Screen',\n",
- " 'Pulp_Mill_Num1_OCC_HD_Cleaning',\n",
- " 'Pulp_Mill_Num2_OCC_Coarse_Screen',\n",
- " 'Pulp_Mill_Num2_OCC_Fractionator',\n",
- " 'Pulp_Mill_Num2_OCC_HD_Cleaning',\n",
- " 'Pulp_Mill_Num2_OCC_Krofta',\n",
- " 'Pulp_Mill_Num2_OCC_Long_Fiber',\n",
- " 'Pulp_Mill_Num2_OCC_Short_Fiber',\n",
- " 'Pulp_Mill_Pulpers',\n",
- " 'Utilities_Compressed_Air',\n",
- " 'Utilities_Gas_Turbine',\n",
- " 'Utilities_Heat_Recovery_Steam_Generator',\n",
- " 'Utilities_Package_Boiler',\n",
- " 'Utilities_Power_Boiler_2',\n",
- " 'Utilities_Sludge_System',\n",
- " 'Utilities_Steam_Distribution_System',\n",
- " 'Utilities_Steam_Turbine',\n",
- " 'Utilities_Water_Systems',\n",
- " 'Utilities_Wood_Handling',\n",
- " 'Waste_Water_Treatment']"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "tenant = 'demo-continuous'\n",
- "api_key = ''\n",
- "api_secret = ''\n",
+ "env_var_tenant = 'ENV_VAR_TENANT'\n",
+ "env_var_api_key = 'ENV_VAR_API_KEY'\n",
+ "env_var_api_secret = 'ENV_VAR_API_SECRET'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_tenant in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " tenant = os.environ[env_var_tenant]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " tenant = 'demo-continuous'\n",
"\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_api_key in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " api_key = os.environ[env_var_api_key]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " api_key = ''\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_api_secret in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " api_secret = os.environ[env_var_api_secret]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " api_secret = ''"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
"cli = client.Client(tenant)\n",
"cli.login('apikey', \n",
" key_id = api_key, \n",
@@ -128,90 +100,9 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Total number of cookbooks: 4\n"
- ]
- },
- {
- "data": {
- "text/html": [
- "
\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " name | \n",
- " assetNames | \n",
- " id | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " F1_Paper_Mill_PM2_Reel: grade_id | \n",
- " [F1_Paper_Mill_PM2_Steam_System, F1_Paper_Mill... | \n",
- " 63a72d837f033fe0b503f0ac | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " F3_Paper_Mill_PM2_Reel: grade_id | \n",
- " [F3_Paper_Mill_PM2_Calendar, F3_Paper_Mill_PM2... | \n",
- " 63bb0a751820fae5cf675bf4 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " F2_Paper_Mill: Steam Usage Optimization | \n",
- " [F2_Paper_Mill_PM1_Steam_System, F2_Paper_Mill... | \n",
- " 63bf0500dc0336c041487801 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " F1_PM2: Steam Use Case | \n",
- " [F1_Paper_Mill_PM2_Forming_Section, F1_Paper_M... | \n",
- " 63c7f7272f24210013b90c80 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " name \n",
- "0 F1_Paper_Mill_PM2_Reel: grade_id \\\n",
- "1 F3_Paper_Mill_PM2_Reel: grade_id \n",
- "2 F2_Paper_Mill: Steam Usage Optimization \n",
- "3 F1_PM2: Steam Use Case \n",
- "\n",
- " assetNames id \n",
- "0 [F1_Paper_Mill_PM2_Steam_System, F1_Paper_Mill... 63a72d837f033fe0b503f0ac \n",
- "1 [F3_Paper_Mill_PM2_Calendar, F3_Paper_Mill_PM2... 63bb0a751820fae5cf675bf4 \n",
- "2 [F2_Paper_Mill_PM1_Steam_System, F2_Paper_Mill... 63bf0500dc0336c041487801 \n",
- "3 [F1_Paper_Mill_PM2_Forming_Section, F1_Paper_M... 63c7f7272f24210013b90c80 "
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"cookbooks = cli.get_cookbooks()\n",
"\n",
@@ -225,801 +116,9 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "{'hash': '1b22a5e7894aab4dca82971d9eaa5ebb109db64465b420728da0d886534d84bb',\n",
- " 'tag': 'demo-continuous',\n",
- " 'auto_generated_parent': {},\n",
- " 'name': 'F2_Paper_Mill: Steam Usage Optimization',\n",
- " 'assetNames': ['F2_Paper_Mill_PM1_Steam_System',\n",
- " 'F2_Paper_Mill_PM1_Press_Section',\n",
- " 'F2_Paper_Mill_PM2_Steam_System',\n",
- " 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'F2_Paper_Mill_PM2_Press_Section',\n",
- " 'F2_Utilities_Steam_Turbine',\n",
- " 'F2_Utilities_Steam_Distribution_System',\n",
- " 'F2_Paper_Mill_PM2_Dryer_Section',\n",
- " 'F2_Paper_Mill_PM1_Production_Status'],\n",
- " 'key_constraint': {'field': {'fieldName': 'stats__PM1_Reel_Grade__val',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'categorical',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'PM1_Reel_Grade',\n",
- " 'fieldUnit': ''},\n",
- " 'valueMap': {'KPKT30': 0, 'KPBS30': 1, 'KPBS33': 2}},\n",
- " 'recipe_groups': [{'id': 'S1dWHt3co',\n",
- " 'values': ['KPKT30'],\n",
- " 'runBoundaries': [{'fieldName': 'shift',\n",
- " 'machineId': '25554f6b1a30bfa7a1da5f28',\n",
- " 'machineName': 'F2_Paper_Mill_PM2_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM2_Steam_System',\n",
- " 'fieldType': 'categorical',\n",
- " 'machineType': 'mt_paper_mill_pm2_steam_system',\n",
- " 'fieldDisplayName': 'Shift',\n",
- " 'fieldUnit': ''}],\n",
- " 'maxDuration': {'isEnabled': False, 'minimum': 0, 'unit': 'second'},\n",
- " 'topRun': 10,\n",
- " 'constraints': [{'field': {'fieldName': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val',\n",
- " 'machineId': 'c0e482b0f7ca873203971cc0',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Machine Speed',\n",
- " 'fieldUnit': 'fpm'},\n",
- " 'ranges': [[{'op': 'gt', 'value': 120}]],\n",
- " 'valueMap': {}}],\n",
- " 'levers': [{'fieldName': 'stats__22PC0103:22PC0103_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': '75# Header to Sect. 1,2,5 Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0902:22PC0902_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Main Condensate Collection Tank Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PI0124:22PA0124_PNT__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Vacuum Reciever Tank Pressure (IN HG) PV',\n",
- " 'fieldUnit': 'inHg'},\n",
- " {'fieldName': 'stats__22PC0108:22PC0108_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #3 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0110:22PC0110_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #5 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0111:22PC0111_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #7 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0109:22PC0109_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '2nd Section Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0115:22PC0115_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '3rd Section Dryer Pressure Diff PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0118A:22PC0118A_MEAS__val',\n",
- " 'machineId': '1e870e89558d6efc329375e6',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '5th Section Steam Pressure Control PV',\n",
- " 'fieldUnit': 'psi'}],\n",
- " 'outcomes': [{'field': {'fieldName': 'stats__40FI0083:40FB0083_RO01__val',\n",
- " 'machineId': '6114a9bbc977f2cd6b4c41a6',\n",
- " 'machineName': 'F2_Utilities_Steam_Turbine',\n",
- " 'machineDisplayName': 'F2_Utilities_Steam_Turbine',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_F1_utilities_steam_turbine',\n",
- " 'fieldDisplayName': '350 Ext Flow',\n",
- " 'fieldUnit': 'klb/hr'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'stats__PM1SteamKpphTon__val',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Steam per Ton',\n",
- " 'fieldUnit': ''},\n",
- " 'weight': '1',\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'availability',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'kpi',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Availability'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'maximize'}],\n",
- " 'filters': {'duration': {'isEnabled': False,\n",
- " 'minimum': 0,\n",
- " 'unit': 'second'},\n",
- " 'recordFilters': []},\n",
- " 'dateRange': {'value': {'relativeAmount': 7, 'relativeUnit': 'day'},\n",
- " 'config': {'mode': 'relative',\n",
- " 'selectableRelativeUnits': ['minute',\n",
- " 'hour',\n",
- " 'day',\n",
- " 'week',\n",
- " 'month',\n",
- " 'year'],\n",
- " 'enableTimeTypeSelection': True,\n",
- " 'showQuarterShortcuts': True}},\n",
- " 'computeDeployedDateRange': None,\n",
- " 'statsCalculationSetting': 'default',\n",
- " 'deployed': {'id': 'S1dWHt3co',\n",
- " 'values': ['KPKT30'],\n",
- " 'runBoundaries': [{'fieldName': 'shift',\n",
- " 'machineId': '25554f6b1a30bfa7a1da5f28',\n",
- " 'machineName': 'F2_Paper_Mill_PM2_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM2_Steam_System',\n",
- " 'fieldType': 'categorical',\n",
- " 'machineType': 'mt_paper_mill_pm2_steam_system',\n",
- " 'fieldDisplayName': 'Shift',\n",
- " 'fieldUnit': ''}],\n",
- " 'maxDuration': {'isEnabled': False, 'minimum': 0, 'unit': 'second'},\n",
- " 'topRun': 10,\n",
- " 'constraints': [{'field': {'fieldName': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val',\n",
- " 'machineId': 'c0e482b0f7ca873203971cc0',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Machine Speed',\n",
- " 'fieldUnit': 'fpm'},\n",
- " 'ranges': [[{'op': 'gt', 'value': 120}]]}],\n",
- " 'levers': [{'fieldName': 'stats__22PC0103:22PC0103_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': '75# Header to Sect. 1,2,5 Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0902:22PC0902_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Main Condensate Collection Tank Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PI0124:22PA0124_PNT__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Vacuum Reciever Tank Pressure (IN HG) PV',\n",
- " 'fieldUnit': 'inHg'},\n",
- " {'fieldName': 'stats__22PC0108:22PC0108_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #3 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0110:22PC0110_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #5 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0111:22PC0111_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #7 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0109:22PC0109_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '2nd Section Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0115:22PC0115_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '3rd Section Dryer Pressure Diff PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0118A:22PC0118A_MEAS__val',\n",
- " 'machineId': '1e870e89558d6efc329375e6',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '5th Section Steam Pressure Control PV',\n",
- " 'fieldUnit': 'psi'}],\n",
- " 'outcomes': [{'field': {'fieldName': 'stats__40FI0083:40FB0083_RO01__val',\n",
- " 'machineId': '6114a9bbc977f2cd6b4c41a6',\n",
- " 'machineName': 'F2_Utilities_Steam_Turbine',\n",
- " 'machineDisplayName': 'F2_Utilities_Steam_Turbine',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_F1_utilities_steam_turbine',\n",
- " 'fieldDisplayName': '350 Ext Flow',\n",
- " 'fieldUnit': 'klb/hr'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'stats__PM1SteamKpphTon__val',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Steam per Ton',\n",
- " 'fieldUnit': ''},\n",
- " 'weight': '1',\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'availability',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'kpi',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Availability'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'maximize'}],\n",
- " 'filters': {'duration': {'isEnabled': False,\n",
- " 'minimum': 0,\n",
- " 'unit': 'second'},\n",
- " 'recordFilters': []},\n",
- " 'dateRange': {'value': {'relativeAmount': 7, 'relativeUnit': 'day'},\n",
- " 'config': {'mode': 'relative',\n",
- " 'selectableRelativeUnits': ['minute',\n",
- " 'hour',\n",
- " 'day',\n",
- " 'week',\n",
- " 'month',\n",
- " 'year'],\n",
- " 'enableTimeTypeSelection': True,\n",
- " 'showQuarterShortcuts': True}},\n",
- " 'computeDeployedDateRange': None,\n",
- " 'statsCalculationSetting': 'default',\n",
- " 'deployed_date': '2023-04-12T17:59:47.312Z',\n",
- " 'deployed_status': {'success': True,\n",
- " 'run_count_saved': 161,\n",
- " 'seconds_to_exec': 88,\n",
- " 'timestamp': '2023-04-19 00:31:48.317000'}}},\n",
- " {'constraints': [],\n",
- " 'levers': [{'fieldName': 'stats__22PC0103:22PC0103_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': '75# Header to Sect. 1,2,5 Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0902:22PC0902_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Main Condensate Collection Tank Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PI0124:22PA0124_PNT__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Vacuum Reciever Tank Pressure (IN HG) PV',\n",
- " 'fieldUnit': 'inHg'},\n",
- " {'fieldName': 'stats__22PC0108:22PC0108_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #3 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0110:22PC0110_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #5 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0111:22PC0111_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #7 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0109:22PC0109_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '2nd Section Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0115:22PC0115_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '3rd Section Dryer Pressure Diff PV',\n",
- " 'fieldUnit': 'psi'}],\n",
- " 'outcomes': [{'field': {'fieldName': 'stats__40FI0083:40FB0083_RO01__val',\n",
- " 'machineId': '6114a9bbc977f2cd6b4c41a6',\n",
- " 'machineName': 'F2_Utilities_Steam_Turbine',\n",
- " 'machineDisplayName': 'F2_Utilities_Steam_Turbine',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_F1_utilities_steam_turbine',\n",
- " 'fieldDisplayName': '350 Ext Flow',\n",
- " 'fieldUnit': 'klb/hr'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'stats__PM1SteamKpphTon__val',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Steam per Ton',\n",
- " 'fieldUnit': ''},\n",
- " 'weight': '0',\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'availability',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'kpi',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Availability'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'maximize'}],\n",
- " 'dateRange': {'value': {'relativeAmount': 7, 'relativeUnit': 'day'},\n",
- " 'config': {'mode': 'relative',\n",
- " 'selectableRelativeUnits': ['minute',\n",
- " 'hour',\n",
- " 'day',\n",
- " 'week',\n",
- " 'month',\n",
- " 'year'],\n",
- " 'enableTimeTypeSelection': True,\n",
- " 'showQuarterShortcuts': True}},\n",
- " 'filters': {'duration': {'isEnabled': False,\n",
- " 'minimum': 0,\n",
- " 'unit': 'second'},\n",
- " 'recordFilters': []},\n",
- " 'runBoundaries': [],\n",
- " 'maxDuration': {'isEnabled': False, 'minimum': 0, 'unit': 'second'},\n",
- " 'topRun': 10,\n",
- " 'computeDeployedDateRange': None,\n",
- " 'deployed': {'constraints': [],\n",
- " 'levers': [{'fieldName': 'stats__22PC0103:22PC0103_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': '75# Header to Sect. 1,2,5 Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0902:22PC0902_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Main Condensate Collection Tank Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PI0124:22PA0124_PNT__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Vacuum Reciever Tank Pressure (IN HG) PV',\n",
- " 'fieldUnit': 'inHg'},\n",
- " {'fieldName': 'stats__22PC0108:22PC0108_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #3 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0110:22PC0110_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #5 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0111:22PC0111_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #7 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0109:22PC0109_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '2nd Section Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0115:22PC0115_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '3rd Section Dryer Pressure Diff PV',\n",
- " 'fieldUnit': 'psi'}],\n",
- " 'outcomes': [{'field': {'fieldName': 'stats__40FI0083:40FB0083_RO01__val',\n",
- " 'machineId': '6114a9bbc977f2cd6b4c41a6',\n",
- " 'machineName': 'F2_Utilities_Steam_Turbine',\n",
- " 'machineDisplayName': 'F2_Utilities_Steam_Turbine',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_F1_utilities_steam_turbine',\n",
- " 'fieldDisplayName': '350 Ext Flow',\n",
- " 'fieldUnit': 'klb/hr'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'stats__PM1SteamKpphTon__val',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Steam per Ton',\n",
- " 'fieldUnit': ''},\n",
- " 'weight': '0',\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'availability',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'kpi',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Availability'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'maximize'}],\n",
- " 'dateRange': {'value': {'relativeAmount': 7, 'relativeUnit': 'day'},\n",
- " 'config': {'mode': 'relative',\n",
- " 'selectableRelativeUnits': ['minute',\n",
- " 'hour',\n",
- " 'day',\n",
- " 'week',\n",
- " 'month',\n",
- " 'year'],\n",
- " 'enableTimeTypeSelection': True,\n",
- " 'showQuarterShortcuts': True}},\n",
- " 'filters': {'duration': {'isEnabled': False,\n",
- " 'minimum': 0,\n",
- " 'unit': 'second'},\n",
- " 'recordFilters': []},\n",
- " 'runBoundaries': [],\n",
- " 'maxDuration': {'isEnabled': False, 'minimum': 0, 'unit': 'second'},\n",
- " 'topRun': 10,\n",
- " 'computeDeployedDateRange': None,\n",
- " 'statsCalculationSetting': 'default',\n",
- " 'id': 'HJxuWrF25i',\n",
- " 'values': ['KPBS30'],\n",
- " 'deployed_date': '2023-01-11T18:58:51.153Z',\n",
- " 'deployed_status': {'success': True,\n",
- " 'run_count_saved': 80,\n",
- " 'seconds_to_exec': 38,\n",
- " 'timestamp': '2023-04-19 00:32:26.633000'}},\n",
- " 'statsCalculationSetting': 'default',\n",
- " 'id': 'HJxuWrF25i',\n",
- " 'values': ['KPBS30']},\n",
- " {'constraints': [],\n",
- " 'levers': [{'fieldName': 'stats__22PC0103:22PC0103_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': '75# Header to Sect. 1,2,5 Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0902:22PC0902_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Main Condensate Collection Tank Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PI0124:22PA0124_PNT__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Vacuum Reciever Tank Pressure (IN HG) PV',\n",
- " 'fieldUnit': 'inHg'},\n",
- " {'fieldName': 'stats__22PC0108:22PC0108_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #3 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0110:22PC0110_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #5 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0111:22PC0111_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #7 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0109:22PC0109_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '2nd Section Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0115:22PC0115_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '3rd Section Dryer Pressure Diff PV',\n",
- " 'fieldUnit': 'psi'}],\n",
- " 'outcomes': [{'field': {'fieldName': 'stats__40FI0083:40FB0083_RO01__val',\n",
- " 'machineId': '6114a9bbc977f2cd6b4c41a6',\n",
- " 'machineName': 'F2_Utilities_Steam_Turbine',\n",
- " 'machineDisplayName': 'F2_Utilities_Steam_Turbine',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_F1_utilities_steam_turbine',\n",
- " 'fieldDisplayName': '350 Ext Flow',\n",
- " 'fieldUnit': 'klb/hr'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'stats__PM1SteamKpphTon__val',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Steam per Ton',\n",
- " 'fieldUnit': ''},\n",
- " 'weight': '0',\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'availability',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'kpi',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Availability'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'maximize'}],\n",
- " 'dateRange': {'value': {'relativeAmount': 7, 'relativeUnit': 'day'},\n",
- " 'config': {'mode': 'relative',\n",
- " 'selectableRelativeUnits': ['minute',\n",
- " 'hour',\n",
- " 'day',\n",
- " 'week',\n",
- " 'month',\n",
- " 'year'],\n",
- " 'enableTimeTypeSelection': True,\n",
- " 'showQuarterShortcuts': True}},\n",
- " 'filters': {'duration': {'isEnabled': False,\n",
- " 'minimum': 0,\n",
- " 'unit': 'second'},\n",
- " 'recordFilters': []},\n",
- " 'runBoundaries': [],\n",
- " 'maxDuration': {'isEnabled': False, 'minimum': 0, 'unit': 'second'},\n",
- " 'topRun': 10,\n",
- " 'computeDeployedDateRange': None,\n",
- " 'deployed': {'constraints': [],\n",
- " 'levers': [{'fieldName': 'stats__22PC0103:22PC0103_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': '75# Header to Sect. 1,2,5 Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0902:22PC0902_MEAS__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Main Condensate Collection Tank Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PI0124:22PA0124_PNT__val',\n",
- " 'machineId': '252024f2fc71fd69814419ca',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_steam_system',\n",
- " 'fieldDisplayName': 'Vacuum Reciever Tank Pressure (IN HG) PV',\n",
- " 'fieldUnit': 'inHg'},\n",
- " {'fieldName': 'stats__22PC0108:22PC0108_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #3 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0110:22PC0110_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #5 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0111:22PC0111_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '1st Section #7 Dryer Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0109:22PC0109_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '2nd Section Steam Pressure PV',\n",
- " 'fieldUnit': 'psi'},\n",
- " {'fieldName': 'stats__22PC0115:22PC0115_MEAS__val',\n",
- " 'machineId': '53308642e37fef85803f862a',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_dryer_section',\n",
- " 'fieldDisplayName': '3rd Section Dryer Pressure Diff PV',\n",
- " 'fieldUnit': 'psi'}],\n",
- " 'outcomes': [{'field': {'fieldName': 'stats__40FI0083:40FB0083_RO01__val',\n",
- " 'machineId': '6114a9bbc977f2cd6b4c41a6',\n",
- " 'machineName': 'F2_Utilities_Steam_Turbine',\n",
- " 'machineDisplayName': 'F2_Utilities_Steam_Turbine',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_F1_utilities_steam_turbine',\n",
- " 'fieldDisplayName': '350 Ext Flow',\n",
- " 'fieldUnit': 'klb/hr'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'stats__PM1SteamKpphTon__val',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'continuous',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Steam per Ton',\n",
- " 'fieldUnit': ''},\n",
- " 'weight': '0',\n",
- " 'optimization_func': 'minimize'},\n",
- " {'field': {'fieldName': 'availability',\n",
- " 'machineId': 'b0b3ff8d1ab70eadd2a2ad87',\n",
- " 'machineName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'machineDisplayName': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'fieldType': 'kpi',\n",
- " 'machineType': 'mt_paper_mill_pm1_production_status',\n",
- " 'fieldDisplayName': 'Availability'},\n",
- " 'weight': 1,\n",
- " 'optimization_func': 'maximize'}],\n",
- " 'dateRange': {'value': {'relativeAmount': 7, 'relativeUnit': 'day'},\n",
- " 'config': {'mode': 'relative',\n",
- " 'selectableRelativeUnits': ['minute',\n",
- " 'hour',\n",
- " 'day',\n",
- " 'week',\n",
- " 'month',\n",
- " 'year'],\n",
- " 'enableTimeTypeSelection': True,\n",
- " 'showQuarterShortcuts': True}},\n",
- " 'filters': {'duration': {'isEnabled': False,\n",
- " 'minimum': 0,\n",
- " 'unit': 'second'},\n",
- " 'recordFilters': []},\n",
- " 'runBoundaries': [],\n",
- " 'maxDuration': {'isEnabled': False, 'minimum': 0, 'unit': 'second'},\n",
- " 'topRun': 10,\n",
- " 'computeDeployedDateRange': None,\n",
- " 'statsCalculationSetting': 'default',\n",
- " 'id': 'HJZ_ZBF39s',\n",
- " 'values': ['KPBS33'],\n",
- " 'deployed_date': '2023-01-11T18:58:51.153Z',\n",
- " 'deployed_status': {'success': True,\n",
- " 'run_count_saved': 80,\n",
- " 'seconds_to_exec': 51,\n",
- " 'timestamp': '2023-04-19 00:33:18.663000'}},\n",
- " 'statsCalculationSetting': 'default',\n",
- " 'id': 'HJZ_ZBF39s',\n",
- " 'values': ['KPBS33']}],\n",
- " 'metadata': {'created_by': {'id': '626c19b6d241e3a2346b64b6',\n",
- " 'email': 'ckalluri@sightmachine.com',\n",
- " 'metadata': {'first_name': 'Charu',\n",
- " 'last_name': 'Kalluri',\n",
- " 'tenant': 'demo-continuous'}}},\n",
- " 'updatetime': '2023-04-19 00:33:18.667000',\n",
- " 'assets': [],\n",
- " 'id': '63bf0500dc0336c041487801'}"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# example: check out data from one of the cookbooks\n",
"cookbook = cookbooks[2]\n",
@@ -1028,34 +127,9 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Outcomes:\n",
- "stats__40FI0083:40FB0083_RO01__val - weight: 1\n",
- "stats__PM1SteamKpphTon__val - weight: 1\n",
- "availability - weight: 1\n",
- "\n",
- "Levers:\n",
- "stats__22PC0103:22PC0103_MEAS__val\n",
- "stats__22PC0902:22PC0902_MEAS__val\n",
- "stats__22PI0124:22PA0124_PNT__val\n",
- "stats__22PC0108:22PC0108_MEAS__val\n",
- "stats__22PC0110:22PC0110_MEAS__val\n",
- "stats__22PC0111:22PC0111_MEAS__val\n",
- "stats__22PC0109:22PC0109_MEAS__val\n",
- "stats__22PC0115:22PC0115_MEAS__val\n",
- "stats__22PC0118A:22PC0118A_MEAS__val\n",
- "\n",
- "Constraints (Conditions):\n",
- "stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"cookbook = cookbooks[2]\n",
"# set a specific recipe group (product) for the examples below\n",
@@ -1081,29 +155,9 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Products:\n"
- ]
- },
- {
- "data": {
- "text/plain": [
- "[('S1dWHt3co', ['KPKT30']),\n",
- " ('HJxuWrF25i', ['KPBS30']),\n",
- " ('HJZ_ZBF39s', ['KPBS33'])]"
- ]
- },
- "execution_count": 6,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"cookbook = cookbooks[2]\n",
"\n",
@@ -1127,18 +181,9 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Cookbook name: F2_Paper_Mill: Steam Usage Optimization\n",
- "Product: ['KPKT30']\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"cookbook = cookbooks[2]\n",
"recipe_group_ids = [i[\"id\"] for i in cookbook[\"recipe_groups\"]]\n",
@@ -1156,142 +201,9 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "{'_count': 203,\n",
- " '_count_muted': 0,\n",
- " '_duration_seconds': 6060.0,\n",
- " '_earliest': '2022-11-14T16:30:00+00:00',\n",
- " '_latest': '2022-11-14T18:11:00+00:00',\n",
- " '_score': 0.8668942386041227,\n",
- " 'constraint_group_id': '01',\n",
- " 'constraints': [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'values': {'from': 120,\n",
- " 'from_is_inclusive': False,\n",
- " 'to': None,\n",
- " 'to_is_inclusive': False},\n",
- " 'pos': 0}],\n",
- " 'cookbook': '63bf0500dc0336c041487801',\n",
- " 'i_vals': [{'name': 'group', 'asset': 'SHARED', 'value': '01'},\n",
- " {'name': 'sequence', 'asset': 'SHARED', 'value': 77},\n",
- " {'name': 'shift',\n",
- " 'asset': 'F2_Paper_Mill_PM2_Steam_System',\n",
- " 'value': 'Shift 1'}],\n",
- " 'filters': [],\n",
- " 'levers': [{'name': 'stats__22PC0103:22PC0103_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'd_pos': 5,\n",
- " 'value': {'min': 93.552734375,\n",
- " 'max': 95.08853912353516,\n",
- " 'avg': 94.2665102728482,\n",
- " 'var_pop': 0.057734212819979674,\n",
- " 'count': 203.0}},\n",
- " {'name': 'stats__22PC0902:22PC0902_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'd_pos': 6,\n",
- " 'value': {'min': 6.311039447784424,\n",
- " 'max': 7.688246250152588,\n",
- " 'avg': 6.820557631882541,\n",
- " 'var_pop': 0.15248664995407288,\n",
- " 'count': 203.0}},\n",
- " {'name': 'stats__22PI0124:22PA0124_PNT__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'd_pos': 7,\n",
- " 'value': {'min': -9.146780967712402,\n",
- " 'max': -7.093267440795898,\n",
- " 'avg': -8.193342051482553,\n",
- " 'var_pop': 0.3322408728598573,\n",
- " 'count': 203.0}},\n",
- " {'name': 'stats__22PC0108:22PC0108_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 8,\n",
- " 'value': {'min': -1.5603828430175781,\n",
- " 'max': -1.560240626335144,\n",
- " 'avg': -1.560259914750536,\n",
- " 'var_pop': 1.4733707845085186e-09,\n",
- " 'count': 203.0}},\n",
- " {'name': 'stats__22PC0110:22PC0110_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 9,\n",
- " 'value': {'min': 307.0,\n",
- " 'max': 307.0,\n",
- " 'avg': 307.0,\n",
- " 'var_pop': 0.0,\n",
- " 'count': 203.0}},\n",
- " {'name': 'stats__22PC0111:22PC0111_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 10,\n",
- " 'value': {'min': -1.2472726106643677,\n",
- " 'max': -1.2472422122955322,\n",
- " 'avg': -1.247271453218507,\n",
- " 'var_pop': 2.2884786066017333e-11,\n",
- " 'count': 203.0}},\n",
- " {'name': 'stats__22PC0109:22PC0109_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 11,\n",
- " 'value': {'min': 14.437151908874512,\n",
- " 'max': 18.154111862182617,\n",
- " 'avg': 15.48980943557664,\n",
- " 'var_pop': 1.2260853917412884,\n",
- " 'count': 203.0}},\n",
- " {'name': 'stats__22PC0115:22PC0115_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 12,\n",
- " 'value': {'min': 4.909910202026367,\n",
- " 'max': 5.080625534057617,\n",
- " 'avg': 4.999873656944688,\n",
- " 'var_pop': 0.0007930457084042974,\n",
- " 'count': 203.0}},\n",
- " {'name': 'stats__22PC0118A:22PC0118A_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 13,\n",
- " 'value': {'min': 28.34580421447754,\n",
- " 'max': 32.03201675415039,\n",
- " 'avg': 29.48879719250308,\n",
- " 'var_pop': 1.2446803379333555,\n",
- " 'count': 203.0}}],\n",
- " 'outcomes': [{'name': 'stats__40FI0083:40FB0083_RO01__val',\n",
- " 'asset': 'F2_Utilities_Steam_Turbine',\n",
- " 'd_pos': 0,\n",
- " 'value': {'min': 8.769634,\n",
- " 'max': 10.80831,\n",
- " 'avg': 8.973997496619013,\n",
- " 'var_pop': 0.037743812441506555,\n",
- " 'count': 203.0,\n",
- " 'normal': 0.2666211046277865}},\n",
- " {'name': 'stats__PM1SteamKpphTon__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'd_pos': 1,\n",
- " 'value': {'min': 3.6244893,\n",
- " 'max': 4.1946373,\n",
- " 'avg': 3.879726607224037,\n",
- " 'var_pop': 0.00799474484291085,\n",
- " 'count': 203.0,\n",
- " 'normal': 0.93474432699695}},\n",
- " {'name': 'availability',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'd_pos': 2,\n",
- " 'value': {'min': 95.0,\n",
- " 'max': 95.0,\n",
- " 'avg': 95.0,\n",
- " 'var_pop': 95.0,\n",
- " 'count': 95.0,\n",
- " 'normal': 1.0},\n",
- " 'kpi': {'dependencies': {'availability': 19285.0, 'denominator': 20300.0},\n",
- " 'formula': '(availability / denominator) * 100 if denominator > 0 else None',\n",
- " 'aggregates': {'availability': 'sum', 'denominator': 'sum'}}}]}"
- ]
- },
- "execution_count": 8,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# check out a sample run\n",
"runs[0]"
@@ -1299,134 +211,9 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "{'_score': 0.8348390098202568,\n",
- " '_count': 22043,\n",
- " '_count_muted': 0,\n",
- " '_run_count': 10,\n",
- " '_duration_seconds': 660990.0,\n",
- " '_earliest': '2022-07-27T11:31:00+00:00',\n",
- " '_latest': '2023-04-14T19:19:30+00:00',\n",
- " 'constraint_group_id': '01',\n",
- " 'constraints': [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'values': {'from': 120,\n",
- " 'from_is_inclusive': False,\n",
- " 'to': None,\n",
- " 'to_is_inclusive': False},\n",
- " 'pos': 0}],\n",
- " 'filters': [],\n",
- " 'levers': [{'name': 'stats__22PC0103:22PC0103_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'd_pos': 5,\n",
- " 'value': {'avg': 95.25972194885357,\n",
- " 'normal': None,\n",
- " 'std': 1.525770839754254,\n",
- " 'max': 99.529296875,\n",
- " 'min': 63.62662887573242}},\n",
- " {'name': 'stats__22PC0902:22PC0902_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'd_pos': 6,\n",
- " 'value': {'avg': 5.993394899556486,\n",
- " 'normal': None,\n",
- " 'std': 1.0880215716215262,\n",
- " 'max': 8.618355751037598,\n",
- " 'min': 3.7090229988098145}},\n",
- " {'name': 'stats__22PI0124:22PA0124_PNT__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Steam_System',\n",
- " 'd_pos': 7,\n",
- " 'value': {'avg': -8.251673771174165,\n",
- " 'normal': None,\n",
- " 'std': 7.666692116233222,\n",
- " 'max': 307.0,\n",
- " 'min': -11.046372413635254}},\n",
- " {'name': 'stats__22PC0108:22PC0108_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 8,\n",
- " 'value': {'avg': -1.5613264711702584,\n",
- " 'normal': None,\n",
- " 'std': 0.0016506482659102348,\n",
- " 'max': -1.523790955543518,\n",
- " 'min': -1.56393563747406}},\n",
- " {'name': 'stats__22PC0110:22PC0110_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 9,\n",
- " 'value': {'avg': 307.0,\n",
- " 'normal': None,\n",
- " 'std': 0.0,\n",
- " 'max': 307.0,\n",
- " 'min': 307.0}},\n",
- " {'name': 'stats__22PC0111:22PC0111_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 10,\n",
- " 'value': {'avg': -1.2406303695102345,\n",
- " 'normal': None,\n",
- " 'std': 0.0406832234924538,\n",
- " 'max': -0.9207859039306641,\n",
- " 'min': -1.2473849058151245}},\n",
- " {'name': 'stats__22PC0109:22PC0109_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 11,\n",
- " 'value': {'avg': 16.06298153838465,\n",
- " 'normal': None,\n",
- " 'std': 4.385950704140755,\n",
- " 'max': 21.908061981201172,\n",
- " 'min': -1.523828387260437}},\n",
- " {'name': 'stats__22PC0115:22PC0115_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 12,\n",
- " 'value': {'avg': 4.997446826505732,\n",
- " 'normal': None,\n",
- " 'std': 0.4559954065868936,\n",
- " 'max': 14.970330238342285,\n",
- " 'min': -0.079327791929245}},\n",
- " {'name': 'stats__22PC0118A:22PC0118A_MEAS__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Dryer_Section',\n",
- " 'd_pos': 13,\n",
- " 'value': {'avg': 24.734875756588952,\n",
- " 'normal': None,\n",
- " 'std': 5.874316774497378,\n",
- " 'max': 33.583251953125,\n",
- " 'min': 6.804054260253906}}],\n",
- " 'outcomes': [{'name': 'stats__40FI0083:40FB0083_RO01__val',\n",
- " 'asset': 'F2_Utilities_Steam_Turbine',\n",
- " 'd_pos': 0,\n",
- " 'value': {'avg': 6.78430634784212,\n",
- " 'normal': 0.3597299832861044,\n",
- " 'std': 2.2774032979106322,\n",
- " 'max': 24.245049,\n",
- " 'min': 0.0005871781}},\n",
- " {'name': 'stats__PM1SteamKpphTon__val',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'd_pos': 1,\n",
- " 'value': {'avg': 3.7519514308184845,\n",
- " 'normal': 0.9358952296748202,\n",
- " 'std': 2.2739450577924845,\n",
- " 'max': 118.49054,\n",
- " 'min': 0.0}},\n",
- " {'name': 'availability',\n",
- " 'asset': 'F2_Paper_Mill_PM1_Production_Status',\n",
- " 'd_pos': 2,\n",
- " 'value': {'avg': 92.82774576963209,\n",
- " 'normal': 0.7134088459606167,\n",
- " 'std': None,\n",
- " 'max': 95.0,\n",
- " 'min': 92.30499236974057,\n",
- " 'kpi_dependencies': {'availability': 2046202.0,\n",
- " 'denominator': 2204300.0}}}],\n",
- " 'cookbook': '63bf0500dc0336c041487801'}"
- ]
- },
- "execution_count": 9,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# check out a sample recipe\n",
"recipes[0]"
@@ -1434,18 +221,9 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Total number of runs for this recipe group (product): 10\n",
- "Total number of runs with unmuted records: 10\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# example: print some stats\n",
"print(\"Total number of runs for this recipe group (product):\", len(runs))\n",
@@ -1455,301 +233,9 @@
},
{
"cell_type": "code",
- "execution_count": 11,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " _count | \n",
- " _count_muted | \n",
- " _duration_seconds | \n",
- " _earliest | \n",
- " _latest | \n",
- " _score | \n",
- " constraint_group_id | \n",
- " constraints | \n",
- " cookbook | \n",
- " i_vals | \n",
- " filters | \n",
- " levers | \n",
- " outcomes | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 203 | \n",
- " 0 | \n",
- " 6060.0 | \n",
- " 2022-11-14T16:30:00+00:00 | \n",
- " 2022-11-14T18:11:00+00:00 | \n",
- " 0.866894 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " 1620 | \n",
- " 0 | \n",
- " 48570.0 | \n",
- " 2022-11-14T01:54:00+00:00 | \n",
- " 2022-11-14T15:23:30+00:00 | \n",
- " 0.865011 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " 1621 | \n",
- " 0 | \n",
- " 48600.0 | \n",
- " 2022-10-30T09:14:00+00:00 | \n",
- " 2022-10-30T22:44:00+00:00 | \n",
- " 0.841374 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 203 | \n",
- " 0 | \n",
- " 6060.0 | \n",
- " 2022-11-22T00:50:00+00:00 | \n",
- " 2022-11-22T02:31:00+00:00 | \n",
- " 0.833544 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 204 | \n",
- " 0 | \n",
- " 6090.0 | \n",
- " 2022-07-27T11:31:00+00:00 | \n",
- " 2022-07-27T13:12:30+00:00 | \n",
- " 0.833508 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 5 | \n",
- " 204 | \n",
- " 0 | \n",
- " 6090.0 | \n",
- " 2022-10-30T23:50:00+00:00 | \n",
- " 2022-10-31T01:31:30+00:00 | \n",
- " 0.833462 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 6 | \n",
- " 4587 | \n",
- " 0 | \n",
- " 137580.0 | \n",
- " 2022-11-17T06:28:30+00:00 | \n",
- " 2022-11-18T20:41:30+00:00 | \n",
- " 0.826714 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 7 | \n",
- " 4587 | \n",
- " 0 | \n",
- " 137580.0 | \n",
- " 2023-04-13T05:06:30+00:00 | \n",
- " 2023-04-14T19:19:30+00:00 | \n",
- " 0.821241 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 8 | \n",
- " 4407 | \n",
- " 0 | \n",
- " 132180.0 | \n",
- " 2022-10-13T18:06:00+00:00 | \n",
- " 2022-10-15T06:49:00+00:00 | \n",
- " 0.817072 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- " 9 | \n",
- " 4407 | \n",
- " 0 | \n",
- " 132180.0 | \n",
- " 2022-08-30T16:06:30+00:00 | \n",
- " 2022-09-01T04:49:30+00:00 | \n",
- " 0.809568 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " 63bf0500dc0336c041487801 | \n",
- " [{'name': 'group', 'asset': 'SHARED', 'value':... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " _count _count_muted _duration_seconds _earliest \n",
- "0 203 0 6060.0 2022-11-14T16:30:00+00:00 \\\n",
- "1 1620 0 48570.0 2022-11-14T01:54:00+00:00 \n",
- "2 1621 0 48600.0 2022-10-30T09:14:00+00:00 \n",
- "3 203 0 6060.0 2022-11-22T00:50:00+00:00 \n",
- "4 204 0 6090.0 2022-07-27T11:31:00+00:00 \n",
- "5 204 0 6090.0 2022-10-30T23:50:00+00:00 \n",
- "6 4587 0 137580.0 2022-11-17T06:28:30+00:00 \n",
- "7 4587 0 137580.0 2023-04-13T05:06:30+00:00 \n",
- "8 4407 0 132180.0 2022-10-13T18:06:00+00:00 \n",
- "9 4407 0 132180.0 2022-08-30T16:06:30+00:00 \n",
- "\n",
- " _latest _score constraint_group_id \n",
- "0 2022-11-14T18:11:00+00:00 0.866894 01 \\\n",
- "1 2022-11-14T15:23:30+00:00 0.865011 01 \n",
- "2 2022-10-30T22:44:00+00:00 0.841374 01 \n",
- "3 2022-11-22T02:31:00+00:00 0.833544 01 \n",
- "4 2022-07-27T13:12:30+00:00 0.833508 01 \n",
- "5 2022-10-31T01:31:30+00:00 0.833462 01 \n",
- "6 2022-11-18T20:41:30+00:00 0.826714 01 \n",
- "7 2023-04-14T19:19:30+00:00 0.821241 01 \n",
- "8 2022-10-15T06:49:00+00:00 0.817072 01 \n",
- "9 2022-09-01T04:49:30+00:00 0.809568 01 \n",
- "\n",
- " constraints \n",
- "0 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \\\n",
- "1 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "2 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "3 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "4 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "5 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "6 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "7 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "8 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "9 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... \n",
- "\n",
- " cookbook \n",
- "0 63bf0500dc0336c041487801 \\\n",
- "1 63bf0500dc0336c041487801 \n",
- "2 63bf0500dc0336c041487801 \n",
- "3 63bf0500dc0336c041487801 \n",
- "4 63bf0500dc0336c041487801 \n",
- "5 63bf0500dc0336c041487801 \n",
- "6 63bf0500dc0336c041487801 \n",
- "7 63bf0500dc0336c041487801 \n",
- "8 63bf0500dc0336c041487801 \n",
- "9 63bf0500dc0336c041487801 \n",
- "\n",
- " i_vals filters \n",
- "0 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \\\n",
- "1 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "2 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "3 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "4 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "5 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "6 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "7 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "8 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "9 [{'name': 'group', 'asset': 'SHARED', 'value':... [] \n",
- "\n",
- " levers \n",
- "0 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \\\n",
- "1 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "2 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "3 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "4 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "5 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "6 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "7 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "8 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "9 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \n",
- "\n",
- " outcomes \n",
- "0 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "1 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "2 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "3 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "4 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "5 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "6 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "7 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "8 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... \n",
- "9 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... "
- ]
- },
- "execution_count": 11,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# example: make a runs table\n",
"df_runs = pd.DataFrame(runs)\n",
@@ -1760,88 +246,9 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " _score | \n",
- " _count | \n",
- " _count_muted | \n",
- " _run_count | \n",
- " _duration_seconds | \n",
- " _earliest | \n",
- " _latest | \n",
- " constraint_group_id | \n",
- " constraints | \n",
- " filters | \n",
- " levers | \n",
- " outcomes | \n",
- " cookbook | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 0.834839 | \n",
- " 22043 | \n",
- " 0 | \n",
- " 10 | \n",
- " 660990.0 | \n",
- " 2022-07-27T11:31:00+00:00 | \n",
- " 2023-04-14T19:19:30+00:00 | \n",
- " 01 | \n",
- " [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... | \n",
- " [] | \n",
- " [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... | \n",
- " [{'name': 'stats__40FI0083:40FB0083_RO01__val'... | \n",
- " 63bf0500dc0336c041487801 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " _score _count _count_muted _run_count _duration_seconds \n",
- "0 0.834839 22043 0 10 660990.0 \\\n",
- "\n",
- " _earliest _latest constraint_group_id \n",
- "0 2022-07-27T11:31:00+00:00 2023-04-14T19:19:30+00:00 01 \\\n",
- "\n",
- " constraints filters \n",
- "0 [{'name': 'stats__22AUTOMAX_RD:REELDRUM_SFB_PN... [] \\\n",
- "\n",
- " levers \n",
- "0 [{'name': 'stats__22PC0103:22PC0103_MEAS__val'... \\\n",
- "\n",
- " outcomes cookbook \n",
- "0 [{'name': 'stats__40FI0083:40FB0083_RO01__val'... 63bf0500dc0336c041487801 "
- ]
- },
- "execution_count": 12,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# example: make a recipes table (matching cookbooks Recipes UI)\n",
"df_recipes = pd.DataFrame(recipes)\n",
@@ -1850,17 +257,9 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Total number of constraint groups (recipes) shown in final cookbook: 1\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# example: count number of constraint groups (recipes)\n",
"print(\"Total number of constraint groups (recipes) shown in final cookbook:\", len(df_recipes.index))"
@@ -1876,17 +275,9 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "True\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"print(df_runs.constraint_group_id.nunique() == len(df_recipes.index))"
]
@@ -1912,67 +303,9 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " asset | \n",
- " name | \n",
- " values | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " F2_Paper_Mill_PM1_Production_Status | \n",
- " stats__PM1SteamKpphTon__val | \n",
- " {'latest': 0.0} | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " F2_Paper_Mill_PM1_Production_Status | \n",
- " stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val | \n",
- " {'latest': 2695.5151} | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " asset \n",
- "0 F2_Paper_Mill_PM1_Production_Status \\\n",
- "1 F2_Paper_Mill_PM1_Production_Status \n",
- "\n",
- " name values \n",
- "0 stats__PM1SteamKpphTon__val {'latest': 0.0} \n",
- "1 stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val {'latest': 2695.5151} "
- ]
- },
- "execution_count": 15,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# get the current value for a constraint and non-KPI outcome\n",
"vars = [{'asset': 'F2_Paper_Mill_PM1_Production_Status', 'name': \"stats__PM1SteamKpphTon__val\"},\n",
@@ -1983,67 +316,9 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " asset | \n",
- " name | \n",
- " values | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " F2_Paper_Mill_PM1_Production_Status | \n",
- " stats__PM1SteamKpphTon__val | \n",
- " {'latest': None} | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " F2_Paper_Mill_PM1_Production_Status | \n",
- " stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val | \n",
- " {'latest': None} | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " asset \n",
- "0 F2_Paper_Mill_PM1_Production_Status \\\n",
- "1 F2_Paper_Mill_PM1_Production_Status \n",
- "\n",
- " name values \n",
- "0 stats__PM1SteamKpphTon__val {'latest': None} \n",
- "1 stats__22AUTOMAX_RD:REELDRUM_SFB_PNT__val {'latest': None} "
- ]
- },
- "execution_count": 16,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# example: a setting for minutes that doesn't go far enough back to find last value\n",
"vals_dict = cli.get_cookbook_current_value(vars, minutes=0.5)\n",
@@ -2052,59 +327,9 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " asset | \n",
- " name | \n",
- " values | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " F2_Paper_Mill_PM1_Production_Status | \n",
- " stats__max_speed__val | \n",
- " {'latest': 2962.1047} | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " asset name \n",
- "0 F2_Paper_Mill_PM1_Production_Status stats__max_speed__val \\\n",
- "\n",
- " values \n",
- "0 {'latest': 2962.1047} "
- ]
- },
- "execution_count": 17,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# get the current value for a tag that's not necessarily in cookbook\n",
"vars = [{'asset': 'F2_Paper_Mill_PM1_Production_Status', 'name': \"stats__max_speed__val\"}]\n",
@@ -2130,39 +355,20 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "{'from': 120, 'from_is_inclusive': False, 'to': None, 'to_is_inclusive': False}"
- ]
- },
- "execution_count": 18,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "range_example = runs[0][\"constraints\"][0][\"values\"]\n",
- "range_example"
+ "if len(runs) and len(runs[0][\"constraints\"]):\n",
+ " range_example = runs[0][\"constraints\"][0][\"values\"]\n",
+ " range_example"
]
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[{'from': 120, 'from_is_inclusive': False, 'to': None, 'to_is_inclusive': False}]\n",
- "['(None,120)']\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"# turn constraint dicts to strings for the first run\n",
"run_idx = 0\n",
@@ -2191,7 +397,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.3"
+ "version": "3.8.18"
},
"orig_nbformat": 4
},
diff --git a/examples/Interactive Notebook.ipynb b/examples/Interactive Notebook.ipynb
index 0fc523e..eb5581e 100644
--- a/examples/Interactive Notebook.ipynb
+++ b/examples/Interactive Notebook.ipynb
@@ -25,6 +25,7 @@
"from smsdk import client\n",
"from datetime import datetime, timedelta\n",
"import pandas as pd\n",
+ "import os\n",
"import ipywidgets as widgets\n",
"import plotly.express as px\n"
]
@@ -35,10 +36,45 @@
"metadata": {},
"outputs": [],
"source": [
- "cli = client.Client('my_tenant')\n",
+ "env_var_tenant = 'ENV_VAR_TENANT'\n",
+ "env_var_api_key = 'ENV_VAR_API_KEY'\n",
+ "env_var_api_secret = 'ENV_VAR_API_SECRET'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_tenant in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " tenant = os.environ[env_var_tenant]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " tenant = 'my_tenant'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_api_key in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " api_key = os.environ[env_var_api_key]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " api_key = 'key_from_my_profile'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_api_secret in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " api_secret = os.environ[env_var_api_secret]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " api_secret = 'secret_from_my_profile'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cli = client.Client(tenant)\n",
"cli.login('apikey', \n",
- " key_id = 'key_from_my_profile', \n",
- " secret_id = 'secret_from_my_profile')"
+ " key_id = api_key, \n",
+ " secret_id = api_secret)"
]
},
{
@@ -173,9 +209,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.7.5"
+ "version": "3.8.18"
}
},
"nbformat": 4,
"nbformat_minor": 2
-}
\ No newline at end of file
+}
diff --git a/examples/KPI Examples.ipynb b/examples/KPI Examples.ipynb
index dd6f92f..bcd790d 100644
--- a/examples/KPI Examples.ipynb
+++ b/examples/KPI Examples.ipynb
@@ -14,85 +14,57 @@
},
{
"cell_type": "code",
- "execution_count": 43,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from smsdk import client\n",
"from datetime import datetime, timedelta\n",
- "import pandas as pd"
+ "import pandas as pd\n",
+ "import os"
]
},
{
"cell_type": "code",
- "execution_count": 44,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "['Downtime',\n",
- " 'Paper_Mill_Finishing_and_Shipping',\n",
- " 'Paper_Mill_PM1_Broke',\n",
- " 'Paper_Mill_PM1_Calender_Stacks',\n",
- " 'Paper_Mill_PM1_Dryer_Section',\n",
- " 'Paper_Mill_PM1_Forming_Section',\n",
- " 'Paper_Mill_PM1_Headbox',\n",
- " 'Paper_Mill_PM1_Lab_Tests',\n",
- " 'Paper_Mill_PM1_Press_Section',\n",
- " 'Paper_Mill_PM1_Production_Status',\n",
- " 'Paper_Mill_PM1_Reel',\n",
- " 'Paper_Mill_PM1_Scale',\n",
- " 'Paper_Mill_PM1_Steam_System',\n",
- " 'Paper_Mill_PM1_Stock_Approach',\n",
- " 'Paper_Mill_PM1_White_Water',\n",
- " 'Paper_Mill_PM2_Broke',\n",
- " 'Paper_Mill_PM2_Calendar',\n",
- " 'Paper_Mill_PM2_Dryer_Section',\n",
- " 'Paper_Mill_PM2_Forming_Section',\n",
- " 'Paper_Mill_PM2_Headbox',\n",
- " 'Paper_Mill_PM2_Lab_Tests',\n",
- " 'Paper_Mill_PM2_Press_Section',\n",
- " 'Paper_Mill_PM2_Production_Status',\n",
- " 'Paper_Mill_PM2_Reel',\n",
- " 'Paper_Mill_PM2_Scale',\n",
- " 'Paper_Mill_PM2_Steam_System',\n",
- " 'Paper_Mill_PM2_Stock_Approach',\n",
- " 'Paper_Mill_PM2_White_Water',\n",
- " 'Pulp_Mill_Num1_OCC_Coarse_Screen',\n",
- " 'Pulp_Mill_Num1_OCC_Disc_Thickener',\n",
- " 'Pulp_Mill_Num1_OCC_Fine_Screen',\n",
- " 'Pulp_Mill_Num1_OCC_HD_Cleaning',\n",
- " 'Pulp_Mill_Num2_OCC_Coarse_Screen',\n",
- " 'Pulp_Mill_Num2_OCC_Fractionator',\n",
- " 'Pulp_Mill_Num2_OCC_HD_Cleaning',\n",
- " 'Pulp_Mill_Num2_OCC_Krofta',\n",
- " 'Pulp_Mill_Num2_OCC_Long_Fiber',\n",
- " 'Pulp_Mill_Num2_OCC_Short_Fiber',\n",
- " 'Pulp_Mill_Pulpers',\n",
- " 'Utilities_Compressed_Air',\n",
- " 'Utilities_Gas_Turbine',\n",
- " 'Utilities_Heat_Recovery_Steam_Generator',\n",
- " 'Utilities_Package_Boiler',\n",
- " 'Utilities_Power_Boiler_2',\n",
- " 'Utilities_Sludge_System',\n",
- " 'Utilities_Steam_Distribution_System',\n",
- " 'Utilities_Steam_Turbine',\n",
- " 'Utilities_Water_Systems',\n",
- " 'Utilities_Wood_Handling',\n",
- " 'Waste_Water_Treatment']"
- ]
- },
- "execution_count": 44,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
- "api_key = ''\n",
- "api_secret = ''\n",
- "tenant = 'demo-continuous'\n",
+ "env_var_tenant = 'ENV_VAR_TENANT'\n",
+ "env_var_api_key = 'ENV_VAR_API_KEY'\n",
+ "env_var_api_secret = 'ENV_VAR_API_SECRET'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_tenant in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " tenant = os.environ[env_var_tenant]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " tenant = 'demo-continuous'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_api_key in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " api_key = os.environ[env_var_api_key]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " api_key = ''\n",
"\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_api_secret in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " api_secret = os.environ[env_var_api_secret]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " api_secret = ''"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
"cli = client.Client(tenant)\n",
"cli.login('apikey', \n",
" key_id = api_key, \n",
@@ -127,49 +99,9 @@
},
{
"cell_type": "code",
- "execution_count": 45,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "[{'name': 'quality',\n",
- " 'display_name': 'Quality',\n",
- " 'formula': 'good_tons / (good_tons + (reject_tons + (random * 100))) * 100 if (good_tons + (reject_tons + (random * 100))) > 0 else None',\n",
- " 'data_type': '',\n",
- " 'dependencies': [{'aggregate': 'sum', 'name': 'reject_tons'},\n",
- " {'aggregate': 'sum', 'name': 'good_tons'},\n",
- " {'aggregate': 'sum', 'name': 'random'}]},\n",
- " {'name': 'performance',\n",
- " 'display_name': 'Performance',\n",
- " 'formula': '(machine_speed / max_speed) * 100 if max_speed > 0 else None',\n",
- " 'data_type': '',\n",
- " 'dependencies': [{'aggregate': 'sum', 'name': 'machine_speed'},\n",
- " {'aggregate': 'sum', 'name': 'max_speed'}]},\n",
- " {'name': 'availability',\n",
- " 'display_name': 'Availability',\n",
- " 'formula': '(availability / denominator) * 100 if denominator > 0 else None',\n",
- " 'data_type': '',\n",
- " 'dependencies': [{'aggregate': 'sum', 'name': 'availability'},\n",
- " {'aggregate': 'sum', 'name': 'denominator'}]},\n",
- " {'name': 'oee',\n",
- " 'display_name': 'OEE',\n",
- " 'formula': '(good_tons / (good_tons + (reject_tons + (random * 100)))) * (machine_speed / max_speed) * (availability / denominator) * 100 if (good_tons + (reject_tons + (random * 100))) > 0 and max_speed > 0 and denominator > 0 else None',\n",
- " 'data_type': '',\n",
- " 'dependencies': [{'aggregate': 'sum', 'name': 'reject_tons'},\n",
- " {'aggregate': 'sum', 'name': 'good_tons'},\n",
- " {'aggregate': 'sum', 'name': 'machine_speed'},\n",
- " {'aggregate': 'sum', 'name': 'max_speed'},\n",
- " {'aggregate': 'sum', 'name': 'availability'},\n",
- " {'aggregate': 'sum', 'name': 'denominator'},\n",
- " {'aggregate': 'sum', 'name': 'random'}]}]"
- ]
- },
- "execution_count": 45,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"kpis_dict = cli.get_kpis()\n",
"kpis_dict"
@@ -177,99 +109,9 @@
},
{
"cell_type": "code",
- "execution_count": 46,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " name | \n",
- " display_name | \n",
- " formula | \n",
- " data_type | \n",
- " dependencies | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " quality | \n",
- " Quality | \n",
- " good_tons / (good_tons + (reject_tons + (rando... | \n",
- " | \n",
- " [{'aggregate': 'sum', 'name': 'reject_tons'}, ... | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " performance | \n",
- " Performance | \n",
- " (machine_speed / max_speed) * 100 if max_speed... | \n",
- " | \n",
- " [{'aggregate': 'sum', 'name': 'machine_speed'}... | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " availability | \n",
- " Availability | \n",
- " (availability / denominator) * 100 if denomina... | \n",
- " | \n",
- " [{'aggregate': 'sum', 'name': 'availability'},... | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " oee | \n",
- " OEE | \n",
- " (good_tons / (good_tons + (reject_tons + (rand... | \n",
- " | \n",
- " [{'aggregate': 'sum', 'name': 'reject_tons'}, ... | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " name display_name \n",
- "0 quality Quality \\\n",
- "1 performance Performance \n",
- "2 availability Availability \n",
- "3 oee OEE \n",
- "\n",
- " formula data_type \n",
- "0 good_tons / (good_tons + (reject_tons + (rando... \\\n",
- "1 (machine_speed / max_speed) * 100 if max_speed... \n",
- "2 (availability / denominator) * 100 if denomina... \n",
- "3 (good_tons / (good_tons + (reject_tons + (rand... \n",
- "\n",
- " dependencies \n",
- "0 [{'aggregate': 'sum', 'name': 'reject_tons'}, ... \n",
- "1 [{'aggregate': 'sum', 'name': 'machine_speed'}... \n",
- "2 [{'aggregate': 'sum', 'name': 'availability'},... \n",
- "3 [{'aggregate': 'sum', 'name': 'reject_tons'}, ... "
- ]
- },
- "execution_count": 46,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# example: create a table with KPIs and formulas\n",
"df_kpis = pd.DataFrame(kpis_dict)\n",
@@ -292,7 +134,7 @@
},
{
"cell_type": "code",
- "execution_count": 47,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -304,103 +146,9 @@
},
{
"cell_type": "code",
- "execution_count": 48,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " name | \n",
- " display_name | \n",
- " unit | \n",
- " type | \n",
- " data_type | \n",
- " stream_types | \n",
- " raw_data_field | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " performance | \n",
- " Performance | \n",
- " | \n",
- " continuous | \n",
- " float | \n",
- " [] | \n",
- " | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " oee | \n",
- " OEE | \n",
- " | \n",
- " continuous | \n",
- " float | \n",
- " [] | \n",
- " | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " quality | \n",
- " Quality | \n",
- " | \n",
- " continuous | \n",
- " float | \n",
- " [] | \n",
- " | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " availability | \n",
- " Availability | \n",
- " | \n",
- " continuous | \n",
- " float | \n",
- " [] | \n",
- " | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " name display_name unit type data_type stream_types \n",
- "0 performance Performance continuous float [] \\\n",
- "1 oee OEE continuous float [] \n",
- "2 quality Quality continuous float [] \n",
- "3 availability Availability continuous float [] \n",
- "\n",
- " raw_data_field \n",
- "0 \n",
- "1 \n",
- "2 \n",
- "3 "
- ]
- },
- "execution_count": 48,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# KPIs by machine type\n",
"machine_types_clean = ['Paper_Mill_PM1_Production_Status', 'Paper_Mill_PM2_Production_Status']\n",
@@ -415,103 +163,9 @@
},
{
"cell_type": "code",
- "execution_count": 49,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " name | \n",
- " display_name | \n",
- " unit | \n",
- " type | \n",
- " data_type | \n",
- " stream_types | \n",
- " raw_data_field | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " performance | \n",
- " Performance | \n",
- " | \n",
- " continuous | \n",
- " float | \n",
- " [] | \n",
- " | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " oee | \n",
- " OEE | \n",
- " | \n",
- " continuous | \n",
- " float | \n",
- " [] | \n",
- " | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " quality | \n",
- " Quality | \n",
- " | \n",
- " continuous | \n",
- " float | \n",
- " [] | \n",
- " | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " availability | \n",
- " Availability | \n",
- " | \n",
- " continuous | \n",
- " float | \n",
- " [] | \n",
- " | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " name display_name unit type data_type stream_types \n",
- "0 performance Performance continuous float [] \\\n",
- "1 oee OEE continuous float [] \n",
- "2 quality Quality continuous float [] \n",
- "3 availability Availability continuous float [] \n",
- "\n",
- " raw_data_field \n",
- "0 \n",
- "1 \n",
- "2 \n",
- "3 "
- ]
- },
- "execution_count": 49,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# check machines of some type\n",
"prod_status_machines = cli.get_machine_names(source_type='Paper_Mill_PM1_Production_Status')\n",
@@ -550,7 +204,7 @@
},
{
"cell_type": "code",
- "execution_count": 50,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -567,7 +221,7 @@
},
{
"cell_type": "code",
- "execution_count": 51,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -585,7 +239,7 @@
},
{
"cell_type": "code",
- "execution_count": 52,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -611,7 +265,7 @@
},
{
"cell_type": "code",
- "execution_count": 53,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -642,88 +296,9 @@
},
{
"cell_type": "code",
- "execution_count": 54,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "[{'i_vals': {'endtime': {'i_pos': 0,\n",
- " 'bin_no': 0,\n",
- " 'bin_min': '2022-07-01T00:00:00+00:00',\n",
- " 'bin_max': '2022-07-01T00:00:00+00:00',\n",
- " 'bin_avg': '2022-07-01T00:00:00+00:00'}},\n",
- " 'd_vals': {'quality': {'avg': 90.7835979686744},\n",
- " 'performance': {'avg': 89.49735351240147},\n",
- " 'availability': {'avg': 89.46474470302188},\n",
- " 'oee': {'avg': 72.6891367095519}},\n",
- " '_count': 2879,\n",
- " 'kpi_dependencies': {'quality': {'reject_tons': 0.0,\n",
- " 'good_tons': 1387960.6101074219,\n",
- " 'random': 1409.0654339132886},\n",
- " 'performance': {'machine_speed': 7980972.46408236,\n",
- " 'max_speed': 8917551.358629227},\n",
- " 'availability': {'availability': 257569.0, 'denominator': 287900.0},\n",
- " 'oee': {'reject_tons': 0.0,\n",
- " 'good_tons': 1387960.6101074219,\n",
- " 'machine_speed': 7980972.46408236,\n",
- " 'max_speed': 8917551.358629227,\n",
- " 'availability': 257569.0,\n",
- " 'denominator': 287900.0,\n",
- " 'random': 1409.0654339132886}}},\n",
- " {'i_vals': {'endtime': {'i_pos': 0,\n",
- " 'bin_no': 291,\n",
- " 'bin_min': '2023-04-18T00:00:00+00:00',\n",
- " 'bin_max': '2023-04-18T00:00:00+00:00',\n",
- " 'bin_avg': '2023-04-18T00:00:00+00:00'}},\n",
- " 'd_vals': {'quality': {'avg': 90.86383081338616},\n",
- " 'performance': {'avg': 89.89583109799267},\n",
- " 'availability': {'avg': 89.98194444444444},\n",
- " 'oee': {'avg': 73.49976800686177}},\n",
- " '_count': 2880,\n",
- " 'kpi_dependencies': {'quality': {'reject_tons': 55.09900024533272,\n",
- " 'good_tons': 1430482.8482055664,\n",
- " 'random': 1437.7697590529494},\n",
- " 'performance': {'machine_speed': 6670069.820485592,\n",
- " 'max_speed': 7419776.578087091},\n",
- " 'availability': {'availability': 259148.0, 'denominator': 288000.0},\n",
- " 'oee': {'reject_tons': 55.09900024533272,\n",
- " 'good_tons': 1430482.8482055664,\n",
- " 'machine_speed': 6670069.820485592,\n",
- " 'max_speed': 7419776.578087091,\n",
- " 'availability': 259148.0,\n",
- " 'denominator': 288000.0,\n",
- " 'random': 1437.7697590529494}}},\n",
- " {'i_vals': {'endtime': {'i_pos': 0,\n",
- " 'bin_no': 292,\n",
- " 'bin_min': '2023-04-19T00:00:00+00:00',\n",
- " 'bin_max': '2023-04-19T00:00:00+00:00',\n",
- " 'bin_avg': '2023-04-19T00:00:00+00:00'}},\n",
- " 'd_vals': {'quality': {'avg': 90.7909047440821},\n",
- " 'performance': {'avg': 89.76194591809336},\n",
- " 'availability': {'avg': 89.85767650354875},\n",
- " 'oee': {'avg': 73.23012702819854}},\n",
- " '_count': 2677,\n",
- " 'kpi_dependencies': {'quality': {'reject_tons': 0.0,\n",
- " 'good_tons': 1314223.0275878906,\n",
- " 'random': 1333.0415731281244},\n",
- " 'performance': {'machine_speed': 6634517.017089844,\n",
- " 'max_speed': 7391235.728271484},\n",
- " 'availability': {'availability': 240549.0, 'denominator': 267700.0},\n",
- " 'oee': {'reject_tons': 0.0,\n",
- " 'good_tons': 1314223.0275878906,\n",
- " 'machine_speed': 6634517.017089844,\n",
- " 'max_speed': 7391235.728271484,\n",
- " 'availability': 240549.0,\n",
- " 'denominator': 267700.0,\n",
- " 'random': 1333.0415731281244}}}]"
- ]
- },
- "execution_count": 54,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"cli.get_kpi_data_viz(machine_sources=this_machine_sources,\n",
" kpis=this_kpis, i_vars=this_i_vars,\n",
@@ -740,42 +315,9 @@
},
{
"cell_type": "code",
- "execution_count": 55,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "{'i_vals': {'endtime': {'i_pos': 0,\n",
- " 'bin_no': 0,\n",
- " 'bin_min': '2022-07-01T00:00:00+00:00',\n",
- " 'bin_max': '2022-07-01T00:00:00+00:00',\n",
- " 'bin_avg': '2022-07-01T00:00:00+00:00'}},\n",
- " 'd_vals': {'quality': {'avg': 91.04619889128857},\n",
- " 'performance': {'avg': 88.7779862177258},\n",
- " 'availability': {'avg': 88.78242677824268},\n",
- " 'oee': {'avg': 71.7619316740485}},\n",
- " '_count': 239,\n",
- " 'kpi_dependencies': {'quality': {'reject_tons': 0.0,\n",
- " 'good_tons': 122937.05456542969,\n",
- " 'random': 120.90059210313545},\n",
- " 'performance': {'machine_speed': 701269.1557617188,\n",
- " 'max_speed': 789913.3395996094},\n",
- " 'availability': {'availability': 21219.0, 'denominator': 23900.0},\n",
- " 'oee': {'reject_tons': 0.0,\n",
- " 'good_tons': 122937.05456542969,\n",
- " 'machine_speed': 701269.1557617188,\n",
- " 'max_speed': 789913.3395996094,\n",
- " 'availability': 21219.0,\n",
- " 'denominator': 23900.0,\n",
- " 'random': 120.90059210313545}}}"
- ]
- },
- "execution_count": 55,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"this_args = {'where': [{\n",
" \"name\": \"shift\",\n",
@@ -788,151 +330,16 @@
" kpis=this_kpis, i_vars=this_i_vars,\n",
" time_selection=this_time_selection,\n",
" **this_args)\n",
- "data_dict[0]"
+ "\n",
+ "if len(data_dict):\n",
+ " data_dict[0]"
]
},
{
"cell_type": "code",
- "execution_count": 56,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "\n",
- "
\n",
- " \n",
- " \n",
- " | \n",
- " endtime | \n",
- " quality | \n",
- " performance | \n",
- " availability | \n",
- " oee | \n",
- " reject_tons | \n",
- " good_tons | \n",
- " random | \n",
- " machine_speed | \n",
- " max_speed | \n",
- " denominator | \n",
- "
\n",
- " \n",
- " \n",
- " \n",
- " 0 | \n",
- " 2022-07-01T00:00:00+00:00 | \n",
- " 91.046199 | \n",
- " 88.777986 | \n",
- " 21219.0 | \n",
- " 71.761932 | \n",
- " 0.000000 | \n",
- " 1.229371e+05 | \n",
- " 120.900592 | \n",
- " 7.012692e+05 | \n",
- " 7.899133e+05 | \n",
- " 23900.0 | \n",
- "
\n",
- " \n",
- " 1 | \n",
- " 2022-07-02T00:00:00+00:00 | \n",
- " 91.097723 | \n",
- " 89.052513 | \n",
- " 128466.0 | \n",
- " 72.373473 | \n",
- " 0.000000 | \n",
- " 7.392190e+05 | \n",
- " 722.381719 | \n",
- " 3.899135e+06 | \n",
- " 4.378467e+06 | \n",
- " 144000.0 | \n",
- "
\n",
- " \n",
- " 2 | \n",
- " 2022-07-03T00:00:00+00:00 | \n",
- " 91.512301 | \n",
- " 88.637716 | \n",
- " 127724.0 | \n",
- " 71.946231 | \n",
- " 29.271001 | \n",
- " 7.749197e+05 | \n",
- " 718.439657 | \n",
- " 3.297092e+06 | \n",
- " 3.719739e+06 | \n",
- " 144000.0 | \n",
- "
\n",
- " \n",
- " 3 | \n",
- " 2022-07-04T00:00:00+00:00 | \n",
- " 93.290032 | \n",
- " 89.719689 | \n",
- " 129369.0 | \n",
- " 75.195306 | \n",
- " 61.870001 | \n",
- " 1.018301e+06 | \n",
- " 731.803363 | \n",
- " 2.959415e+06 | \n",
- " 3.298512e+06 | \n",
- " 144000.0 | \n",
- "
\n",
- " \n",
- " 4 | \n",
- " 2022-07-05T00:00:00+00:00 | \n",
- " 94.105393 | \n",
- " 89.741744 | \n",
- " 107915.0 | \n",
- " 75.883583 | \n",
- " 597.150010 | \n",
- " 9.598014e+05 | \n",
- " 595.232315 | \n",
- " 2.781879e+06 | \n",
- " 3.099872e+06 | \n",
- " 120100.0 | \n",
- "
\n",
- " \n",
- "
\n",
- "
"
- ],
- "text/plain": [
- " endtime quality performance availability oee \n",
- "0 2022-07-01T00:00:00+00:00 91.046199 88.777986 21219.0 71.761932 \\\n",
- "1 2022-07-02T00:00:00+00:00 91.097723 89.052513 128466.0 72.373473 \n",
- "2 2022-07-03T00:00:00+00:00 91.512301 88.637716 127724.0 71.946231 \n",
- "3 2022-07-04T00:00:00+00:00 93.290032 89.719689 129369.0 75.195306 \n",
- "4 2022-07-05T00:00:00+00:00 94.105393 89.741744 107915.0 75.883583 \n",
- "\n",
- " reject_tons good_tons random machine_speed max_speed \n",
- "0 0.000000 1.229371e+05 120.900592 7.012692e+05 7.899133e+05 \\\n",
- "1 0.000000 7.392190e+05 722.381719 3.899135e+06 4.378467e+06 \n",
- "2 29.271001 7.749197e+05 718.439657 3.297092e+06 3.719739e+06 \n",
- "3 61.870001 1.018301e+06 731.803363 2.959415e+06 3.298512e+06 \n",
- "4 597.150010 9.598014e+05 595.232315 2.781879e+06 3.099872e+06 \n",
- "\n",
- " denominator \n",
- "0 23900.0 \n",
- "1 144000.0 \n",
- "2 144000.0 \n",
- "3 144000.0 \n",
- "4 120100.0 "
- ]
- },
- "execution_count": 56,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
+ "outputs": [],
"source": [
"# example: extract a table\n",
"data_list = []\n",
@@ -973,7 +380,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.3"
+ "version": "3.8.18"
},
"orig_nbformat": 4
},
diff --git a/examples/Query Examples.ipynb b/examples/Query Examples.ipynb
index b9e3652..71d3348 100644
--- a/examples/Query Examples.ipynb
+++ b/examples/Query Examples.ipynb
@@ -18,7 +18,43 @@
"source": [
"from smsdk import client\n",
"from datetime import datetime, timedelta\n",
- "import pandas as pd"
+ "import pandas as pd\n",
+ "import os"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "env_var_tenant = 'ENV_VAR_TENANT'\n",
+ "env_var_api_key = 'ENV_VAR_API_KEY'\n",
+ "env_var_api_secret = 'ENV_VAR_API_SECRET'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_tenant in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " tenant = os.environ[env_var_tenant]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " tenant = 'demo'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_api_key in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " api_key = os.environ[env_var_api_key]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " api_key = ''\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_api_secret in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " api_secret = os.environ[env_var_api_secret]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " api_secret = ''"
]
},
{
@@ -58,9 +94,7 @@
}
],
"source": [
- "api_key = ''\n",
- "api_secret = ''\n",
- "cli = client.Client('demo')\n",
+ "cli = client.Client(tenant)\n",
"cli.login('apikey', \n",
" key_id = api_key, \n",
" secret_id = api_secret)\n",
@@ -2078,7 +2112,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.6"
+ "version": "3.8.18"
},
"orig_nbformat": 2,
"vscode": {
diff --git a/examples/Quick Start.ipynb b/examples/Quick Start.ipynb
index 3f69811..64ac8a1 100644
--- a/examples/Quick Start.ipynb
+++ b/examples/Quick Start.ipynb
@@ -1,28 +1,8 @@
{
- "metadata": {
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.7.5-final"
- },
- "orig_nbformat": 2,
- "kernelspec": {
- "name": "python3",
- "display_name": "Python 3",
- "language": "python"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2,
"cells": [
{
+ "cell_type": "markdown",
+ "metadata": {},
"source": [
"# Example: Quick Start\n",
"\n",
@@ -35,18 +15,17 @@
"- Listing machines \n",
"- Listing machine attributes/stats \n",
"- Running a basic query"
- ],
- "cell_type": "markdown",
- "metadata": {}
+ ]
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"from datetime import datetime \n",
- "from smsdk import client"
+ "from smsdk import client\n",
+ "import os"
]
},
{
@@ -55,8 +34,33 @@
"metadata": {},
"outputs": [],
"source": [
- "tenant = 'my_tenant'\n",
- "cli = client.Client(tenant)"
+ "env_var_tenant = 'ENV_VAR_TENANT'\n",
+ "env_var_username = 'ENV_VAR_USERNAME'\n",
+ "env_var_password = 'ENV_VAR_PASSWORD'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_tenant in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " tenant = os.environ[env_var_tenant]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " tenant = 'my_tenant'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_username in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " username = os.environ[env_var_username]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " username = 'me@mycompany.com'\n",
+ "\n",
+ "# Check if the environment variable exists\n",
+ "if env_var_password in os.environ:\n",
+ " # Retrieve the value of the environment variable\n",
+ " password = os.environ[env_var_password]\n",
+ "else:\n",
+ " # Use a default value if the environment variable is not present\n",
+ " password = 'asdf%^&*1234'"
]
},
{
@@ -65,9 +69,7 @@
"metadata": {},
"outputs": [],
"source": [
- "username = 'me@mycompany.com'\n",
- "password = 'asdf%^&*1234'\n",
- "\n",
+ "cli = client.Client(tenant)\n",
"cli.login('basic', email=username, password=password)"
]
},
@@ -121,5 +123,27 @@
"outputs": [],
"source": []
}
- ]
-}
\ No newline at end of file
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.8.18"
+ },
+ "orig_nbformat": 2
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/requirements-codecoverage.txt b/requirements-codecoverage.txt
index 6c4f5d4..3dd89c4 100644
--- a/requirements-codecoverage.txt
+++ b/requirements-codecoverage.txt
@@ -1,4 +1,8 @@
# Use public repo for coverall upload
codecov==2.1.13
-coverage==7.3.2
\ No newline at end of file
+coverage==7.3.2
+ipywidgets==8.1.1
+nbmake==1.4.6
+plotly==5.18.0
+pytest-xdist==3.5.0
\ No newline at end of file