{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "source": [ "from google.colab import drive\n", "drive.mount('/content/drive')" ], "metadata": { "id": "2o-B9SBpv8a3", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "5fb6484f-9284-4bfa-fa03-41aa2414ba39" }, "execution_count": 2, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Mounted at /content/drive\n" ] } ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "id": "2lr6h9SKvcqA", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "6d57a97c-76c0-4292-fc98-4fcc41b1ca71" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "/content/drive/MyDrive/AI/euro\n", "1.csv 2.csv 3.csv 4.csv 5.csv 6.csv a.json forecasting.ipynb\n", "1.txt 2.txt 3.txt 4.txt 5.txt 6.txt b.json\n" ] } ], "source": [ "%cd /content/drive/MyDrive/AI/euro\n", "!ls" ] }, { "cell_type": "code", "source": [ "import glob\n", "map = open('1.txt', 'r').read()\n", "m = eval(map)\n", "\n", "mapping = {}\n", "for el in m:\n", " if el[2] == 'Уставки':\n", " name = el[0] + ' ' + el[1] + ' ' + col_name + ' ' + el[3] \n", " else:\n", " name = el[0] + ' ' + el[1] + ' ' + el[2] + ' ' + el[3] \n", " col_name = el[2]\n", " mapping[''.join([x for x in el[4] if x != '\\\\'])] = name\n", "\n", "len(mapping.keys())" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "PgBn5DC1Tdy3", "outputId": "ed2e056d-1d27-48c3-8244-b467c8d4dd7c" }, "execution_count": 138, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "121" ] }, "metadata": {}, "execution_count": 138 } ] }, { "cell_type": "code", "source": [ "import json\n", "json.dump(mapping, open('mapping.json', 'w'))" ], "metadata": { "id": "AG2jcZAlIw8F" }, "execution_count": 330, "outputs": [] }, { "cell_type": "code", "source": [ "import pandas as pd\n", "import numpy as np\n", "import sklearn\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "from tqdm import tqdm" ], "metadata": { "id": "kMCQhNUixBoX" }, "execution_count": 139, "outputs": [] }, { "cell_type": "code", "source": [ "df = pd.read_csv('1.csv', parse_dates=['timestamp'])\n", "df.columns= ['timestamp'] + [''.join([x for x in el if x != '\\\\']) for el in df.columns if el != 'timestamp']\n", "df = df.rename(columns=mapping)\n", "df = df.set_index('timestamp').resample('5T').first().reset_index()\n", "df" ], "metadata": { "id": "xU89tPEKxJKW" }, "execution_count": 243, "outputs": [] }, { "cell_type": "code", "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from statsmodels.tsa.stattools import adfuller\n", "from statsmodels.graphics.tsaplots import plot_acf, plot_pacf\n", "from statsmodels.tsa.arima.model import ARIMA" ], "metadata": { "id": "p-0xx_BzrUpC" }, "execution_count": 129, "outputs": [] }, { "cell_type": "code", "source": [ "df.columns[70:110]" ], "metadata": { "id": "mYCmqxhFakGu" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "from datetime import datetime, timedelta\n", "\n", "# создание списка с датами\n", "date_list = [df['timestamp'].min() + timedelta(minutes=x) for x in range(0, 60*24*60*60, 15)]\n", "\n", "len(date_list)\n", "\n", "df = df[df['timestamp'].isin(date_list)]\n", "df.shape" ], "metadata": { "id": "aiH2Yt5jefeY" }, "execution_count": 132, "outputs": [] }, { "cell_type": "code", "source": [ "df = df.set_index('timestamp').resample('5T').first().reset_index()\n", "df" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 748 }, "id": "D4jyD4bwj2xT", "outputId": "20590b8c-7cc6-4584-927d-1798e98ad85d" }, "execution_count": 245, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " timestamp \\\n", "0 2023-01-25 09:30:00 \n", "1 2023-01-25 09:35:00 \n", "2 2023-01-25 09:40:00 \n", "3 2023-01-25 09:45:00 \n", "4 2023-01-25 09:50:00 \n", "... ... \n", "6642 2023-02-17 11:00:00 \n", "6643 2023-02-17 11:05:00 \n", "6644 2023-02-17 11:10:00 \n", "6645 2023-02-17 11:15:00 \n", "6646 2023-02-17 11:20:00 \n", "\n", " Подшипник 1 Температура нагрева Температура temperature \\\n", "0 62.800003 \n", "1 62.800003 \n", "2 62.800003 \n", "3 62.800003 \n", "4 62.800003 \n", "... ... \n", "6642 61.800003 \n", "6643 61.800003 \n", "6644 61.800003 \n", "6645 61.899994 \n", "6646 61.899994 \n", "\n", " Подшипник 1 Температура нагрева Температура alarm_max \\\n", "0 75.0 \n", "1 75.0 \n", "2 75.0 \n", "3 75.0 \n", "4 75.0 \n", "... ... \n", "6642 75.0 \n", "6643 75.0 \n", "6644 75.0 \n", "6645 75.0 \n", "6646 75.0 \n", "\n", " Подшипник 1 Температура нагрева Температура alarm_min \\\n", "0 0.0 \n", "1 0.0 \n", "2 0.0 \n", "3 0.0 \n", "4 0.0 \n", "... ... \n", "6642 0.0 \n", "6643 0.0 \n", "6644 0.0 \n", "6645 0.0 \n", "6646 0.0 \n", "\n", " Подшипник 1 Температура нагрева Температура warning_max \\\n", "0 65.0 \n", "1 65.0 \n", "2 65.0 \n", "3 65.0 \n", "4 65.0 \n", "... ... \n", "6642 65.0 \n", "6643 65.0 \n", "6644 65.0 \n", "6645 65.0 \n", "6646 65.0 \n", "\n", " Подшипник 1 Температура нагрева Температура warning_min \\\n", "0 0.0 \n", "1 0.0 \n", "2 0.0 \n", "3 0.0 \n", "4 0.0 \n", "... ... \n", "6642 0.0 \n", "6643 0.0 \n", "6644 0.0 \n", "6645 0.0 \n", "6646 0.0 \n", "\n", " Подшипник 1 Вибрация Осевая vibration_axial \\\n", "0 0.381944 \n", "1 0.381944 \n", "2 0.387731 \n", "3 0.381944 \n", "4 0.381944 \n", "... ... \n", "6642 0.243056 \n", "6643 0.254630 \n", "6644 0.254630 \n", "6645 0.254630 \n", "6646 0.254630 \n", "\n", " Подшипник 1 Вибрация Осевая alarm_max \\\n", "0 7.1 \n", "1 7.1 \n", "2 7.1 \n", "3 7.1 \n", "4 7.1 \n", "... ... \n", "6642 7.1 \n", "6643 7.1 \n", "6644 7.1 \n", "6645 7.1 \n", "6646 7.1 \n", "\n", " Подшипник 1 Вибрация Осевая alarm_min \\\n", "0 0.0 \n", "1 0.0 \n", "2 0.0 \n", "3 0.0 \n", "4 0.0 \n", "... ... \n", "6642 0.0 \n", "6643 0.0 \n", "6644 0.0 \n", "6645 0.0 \n", "6646 0.0 \n", "\n", " Подшипник 1 Вибрация Осевая warning_max ... \\\n", "0 4.5 ... \n", "1 4.5 ... \n", "2 4.5 ... \n", "3 4.5 ... \n", "4 4.5 ... \n", "... ... ... \n", "6642 4.5 ... \n", "6643 4.5 ... \n", "6644 4.5 ... \n", "6645 4.5 ... \n", "6646 4.5 ... \n", "\n", " Положение задвижки gas_valve_closed \\\n", "0 0.0 \n", "1 0.0 \n", "2 0.0 \n", "3 0.0 \n", "4 0.0 \n", "... ... \n", "6642 0.0 \n", "6643 0.0 \n", "6644 0.0 \n", "6645 0.0 \n", "6646 0.0 \n", "\n", " Положение задвижки gas_valve_open \\\n", "0 1.0 \n", "1 1.0 \n", "2 1.0 \n", "3 1.0 \n", "4 1.0 \n", "... ... \n", "6642 1.0 \n", "6643 1.0 \n", "6644 1.0 \n", "6645 1.0 \n", "6646 1.0 \n", "\n", " Положение задвижки gas_valve_position Главный привод rotor_current \\\n", "0 0.0 1.0 \n", "1 0.0 1.0 \n", "2 0.0 1.0 \n", "3 0.0 1.0 \n", "4 0.0 1.0 \n", "... ... ... \n", "6642 0.0 1.0 \n", "6643 0.0 1.0 \n", "6644 0.0 1.0 \n", "6645 0.0 1.0 \n", "6646 0.0 1.0 \n", "\n", " Главный привод rotor_voltage Главный привод stator_current \\\n", "0 0.0 180.850937 \n", "1 0.0 184.624741 \n", "2 0.0 179.877045 \n", "3 0.0 182.871750 \n", "4 0.0 180.802231 \n", "... ... ... \n", "6642 0.0 184.089111 \n", "6643 0.0 182.725662 \n", "6644 0.0 185.817764 \n", "6645 0.0 184.770828 \n", "6646 0.0 183.675201 \n", "\n", " Главный привод stator_voltage Маслосистема oil_level \\\n", "0 1.0 83.547989 \n", "1 1.0 83.452797 \n", "2 1.0 83.631989 \n", "3 1.0 83.525589 \n", "4 1.0 83.475189 \n", "... ... ... \n", "6642 1.0 78.676224 \n", "6643 1.0 78.564224 \n", "6644 1.0 78.799423 \n", "6645 1.0 78.357040 \n", "6646 1.0 78.726616 \n", "\n", " Маслосистема oil_pressure Работа эксгаустера work \n", "0 2.156743 1.0 \n", "1 2.145085 1.0 \n", "2 2.151311 1.0 \n", "3 2.159490 1.0 \n", "4 2.153874 1.0 \n", "... ... ... \n", "6642 2.147954 1.0 \n", "6643 2.151006 1.0 \n", "6644 2.154912 1.0 \n", "6645 2.149358 1.0 \n", "6646 2.145085 1.0 \n", "\n", "[6647 rows x 122 columns]" ], "text/html": [ "\n", "
\n", " | timestamp | \n", "Подшипник 1 Температура нагрева Температура temperature | \n", "Подшипник 1 Температура нагрева Температура alarm_max | \n", "Подшипник 1 Температура нагрева Температура alarm_min | \n", "Подшипник 1 Температура нагрева Температура warning_max | \n", "Подшипник 1 Температура нагрева Температура warning_min | \n", "Подшипник 1 Вибрация Осевая vibration_axial | \n", "Подшипник 1 Вибрация Осевая alarm_max | \n", "Подшипник 1 Вибрация Осевая alarm_min | \n", "Подшипник 1 Вибрация Осевая warning_max | \n", "... | \n", "Положение задвижки gas_valve_closed | \n", "Положение задвижки gas_valve_open | \n", "Положение задвижки gas_valve_position | \n", "Главный привод rotor_current | \n", "Главный привод rotor_voltage | \n", "Главный привод stator_current | \n", "Главный привод stator_voltage | \n", "Маслосистема oil_level | \n", "Маслосистема oil_pressure | \n", "Работа эксгаустера work | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "2023-01-25 09:30:00 | \n", "62.800003 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.381944 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "180.850937 | \n", "1.0 | \n", "83.547989 | \n", "2.156743 | \n", "1.0 | \n", "
1 | \n", "2023-01-25 09:35:00 | \n", "62.800003 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.381944 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "184.624741 | \n", "1.0 | \n", "83.452797 | \n", "2.145085 | \n", "1.0 | \n", "
2 | \n", "2023-01-25 09:40:00 | \n", "62.800003 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.387731 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "179.877045 | \n", "1.0 | \n", "83.631989 | \n", "2.151311 | \n", "1.0 | \n", "
3 | \n", "2023-01-25 09:45:00 | \n", "62.800003 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.381944 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "182.871750 | \n", "1.0 | \n", "83.525589 | \n", "2.159490 | \n", "1.0 | \n", "
4 | \n", "2023-01-25 09:50:00 | \n", "62.800003 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.381944 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "180.802231 | \n", "1.0 | \n", "83.475189 | \n", "2.153874 | \n", "1.0 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
6642 | \n", "2023-02-17 11:00:00 | \n", "61.800003 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.243056 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "184.089111 | \n", "1.0 | \n", "78.676224 | \n", "2.147954 | \n", "1.0 | \n", "
6643 | \n", "2023-02-17 11:05:00 | \n", "61.800003 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.254630 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "182.725662 | \n", "1.0 | \n", "78.564224 | \n", "2.151006 | \n", "1.0 | \n", "
6644 | \n", "2023-02-17 11:10:00 | \n", "61.800003 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.254630 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "185.817764 | \n", "1.0 | \n", "78.799423 | \n", "2.154912 | \n", "1.0 | \n", "
6645 | \n", "2023-02-17 11:15:00 | \n", "61.899994 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.254630 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "184.770828 | \n", "1.0 | \n", "78.357040 | \n", "2.149358 | \n", "1.0 | \n", "
6646 | \n", "2023-02-17 11:20:00 | \n", "61.899994 | \n", "75.0 | \n", "0.0 | \n", "65.0 | \n", "0.0 | \n", "0.254630 | \n", "7.1 | \n", "0.0 | \n", "4.5 | \n", "... | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "183.675201 | \n", "1.0 | \n", "78.726616 | \n", "2.145085 | \n", "1.0 | \n", "
6647 rows × 122 columns
\n", "