Add file influxdb_info and use information from the file
This commit is contained in:
@@ -5,7 +5,7 @@ import schedule
|
||||
import time
|
||||
from influxdb_client import InfluxDBClient, BucketsApi, WriteApi, OrganizationsApi, Point, QueryApi
|
||||
import simulation
|
||||
|
||||
import influxdb_info
|
||||
|
||||
# 2025/02/01
|
||||
def get_next_time() -> str:
|
||||
@@ -108,9 +108,9 @@ def realtime_task() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
url = "http://localhost:8086" # 替换为你的InfluxDB实例地址
|
||||
token = "Z4UZj9HuLwLlwoApywvT2nGVP3bwLy18y-sJQ7enzZlJd8YMzMWbBA6F-q4gBiZ-7-IqdxR5aR9LvicKiSNmnA==" # 替换为你的InfluxDB Token
|
||||
org_name = "beibei" # 替换为你的Organization名称
|
||||
url = influxdb_info.url
|
||||
token = influxdb_info.token
|
||||
org_name = influxdb_info.org
|
||||
|
||||
client = InfluxDBClient(url=url, token=token)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ from datetime import datetime, timedelta, timezone
|
||||
import schedule
|
||||
import time
|
||||
from influxdb_client import InfluxDBClient, BucketsApi, WriteApi, OrganizationsApi, Point, QueryApi
|
||||
import influxdb_info
|
||||
|
||||
|
||||
# 2025/02/06
|
||||
@@ -69,9 +70,9 @@ def store_non_realtime_SCADA_data_task() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
url = "http://localhost:8086" # 替换为你的InfluxDB实例地址
|
||||
token = "Z4UZj9HuLwLlwoApywvT2nGVP3bwLy18y-sJQ7enzZlJd8YMzMWbBA6F-q4gBiZ-7-IqdxR5aR9LvicKiSNmnA==" # 替换为你的InfluxDB Token
|
||||
org_name = "beibei" # 替换为你的Organization名称
|
||||
url = influxdb_info.url
|
||||
token = influxdb_info.token
|
||||
org_name = influxdb_info.org
|
||||
|
||||
client = InfluxDBClient(url=url, token=token)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ from datetime import datetime, timedelta, timezone
|
||||
import schedule
|
||||
import time
|
||||
from influxdb_client import InfluxDBClient, BucketsApi, WriteApi, OrganizationsApi, Point, QueryApi
|
||||
import influxdb_info
|
||||
|
||||
|
||||
# 2025/02/01
|
||||
@@ -49,9 +50,9 @@ def store_realtime_SCADA_data_task() -> None:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
url = "http://localhost:8086" # 替换为你的InfluxDB实例地址
|
||||
token = "Z4UZj9HuLwLlwoApywvT2nGVP3bwLy18y-sJQ7enzZlJd8YMzMWbBA6F-q4gBiZ-7-IqdxR5aR9LvicKiSNmnA==" # 替换为你的InfluxDB Token
|
||||
org_name = "beibei" # 替换为你的Organization名称
|
||||
url = influxdb_info.url
|
||||
token = influxdb_info.token
|
||||
org_name = influxdb_info.org
|
||||
|
||||
client = InfluxDBClient(url=url, token=token)
|
||||
|
||||
|
||||
@@ -12,11 +12,12 @@ from tjnetwork import *
|
||||
import schedule
|
||||
import threading
|
||||
import globals
|
||||
import influxdb_info
|
||||
|
||||
# influxdb数据库连接信息
|
||||
url = "http://localhost:8086" # 替换为你的InfluxDB实例地址
|
||||
token = "Z4UZj9HuLwLlwoApywvT2nGVP3bwLy18y-sJQ7enzZlJd8YMzMWbBA6F-q4gBiZ-7-IqdxR5aR9LvicKiSNmnA==" # 替换为你的InfluxDB Token
|
||||
org_name = "beibei" # 替换为你的Organization名称
|
||||
url = influxdb_info.url
|
||||
token = influxdb_info.token
|
||||
org_name = influxdb_info.org
|
||||
client = InfluxDBClient(url=url, token=token, org=org_name)
|
||||
|
||||
# # 所有实时更新数据的SCADA设备的ID
|
||||
@@ -1303,9 +1304,9 @@ def query_curve_by_ID_property_daterange(ID: str, type: str, property: str, star
|
||||
|
||||
# 示例调用
|
||||
if __name__ == "__main__":
|
||||
url = "http://localhost:8086" # 替换为你的InfluxDB实例地址
|
||||
token = "Z4UZj9HuLwLlwoApywvT2nGVP3bwLy18y-sJQ7enzZlJd8YMzMWbBA6F-q4gBiZ-7-IqdxR5aR9LvicKiSNmnA==" # 替换为你的InfluxDB Token
|
||||
org_name = "beibei" # 替换为你的Organization名称
|
||||
url = influxdb_info.url
|
||||
token = influxdb_info.token
|
||||
org_name = InfluxDBClient.org
|
||||
|
||||
client = InfluxDBClient(url=url, token=token)
|
||||
|
||||
|
||||
4
influxdb_info.py
Normal file
4
influxdb_info.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# influxdb数据库连接信息
|
||||
url = "http://localhost:8086" # 替换为你的InfluxDB实例地址
|
||||
token = "xGDM5RZqRJAuzAGS-otXUdC2NFdY75qJAjRLqAB4p5WcIIAlIUpOpT8_yA16AOHmJWerwQ_08gwb84sy42jnZQ==" # 替换为你的InfluxDB Token
|
||||
org = "TJWATERORG" # 替换为你的Organization名称
|
||||
@@ -19,8 +19,19 @@ import chardet
|
||||
# burst analysis 01
|
||||
############################################################
|
||||
|
||||
def burst_analysis(prj_name, date_time, burst_ID: list | str,
|
||||
burst_size: list | float | int = None, duration=900, pump_control=None, valve_closed=None) -> str:
|
||||
def burst_analysis(prj_name, date_time, burst_ID: list | str, burst_size: list | float | int = None, duration=900, pump_control=None, valve_closed=None) -> str:
|
||||
'''
|
||||
burst 分析
|
||||
:param prj_name:
|
||||
:param date_time:
|
||||
:param burst_ID:
|
||||
:param burst_siz:
|
||||
:param duration:
|
||||
:param pump_control:
|
||||
:param valve_closed:
|
||||
:return:
|
||||
'''
|
||||
|
||||
print(datetime.now(pytz.timezone('Asia/Shanghai')).strftime("%Y-%m-%d %H:%M:%S") + " -- Start Analysis.")
|
||||
new_name = f'burst_Anal_{prj_name}'
|
||||
|
||||
|
||||
@@ -19,3 +19,10 @@ pg 信息
|
||||
Port: 5432 (默认)
|
||||
User: 就是Windows的用户名,这台机器也就是 Administrator
|
||||
Password: 密码为空
|
||||
|
||||
influx db 信息
|
||||
# influxdb数据库连接信息
|
||||
influx_url = "http://localhost:8086" # 替换为你的InfluxDB实例地址
|
||||
influx_token = "xGDM5RZqRJAuzAGS-otXUdC2NFdY75qJAjRLqAB4p5WcIIAlIUpOpT8_yA16AOHmJWerwQ_08gwb84sy42jnZQ==" # 替换为你的InfluxDB Token
|
||||
influx_org_name = "TJWATERORG" # 替换为你的Organization名称
|
||||
influx_client = InfluxDBClient(url=influx_url, token=influx_token, org=influx_org_name)
|
||||
|
||||
Reference in New Issue
Block a user