Merge branch 'main' of 91.92.155.224:Innovenergy/Innovenergy_trunk
This commit is contained in:
commit
015e8e38b5
|
@ -914,7 +914,8 @@ def create_batch_of_csv_files():
|
||||||
csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x)))
|
csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x)))
|
||||||
|
|
||||||
# keep the 30 MOST RECENT FILES
|
# keep the 30 MOST RECENT FILES
|
||||||
recent_csv_files = csv_files[-30:] if len(csv_files) > 30 else csv_files
|
#recent_csv_files = csv_files[-30:] if len(csv_files) > 30 else csv_files
|
||||||
|
recent_csv_files = csv_files[-600:] if len(csv_files) > 600 else csv_files
|
||||||
|
|
||||||
# get the name of the first csv file
|
# get the name of the first csv file
|
||||||
if not csv_files:
|
if not csv_files:
|
||||||
|
@ -1087,6 +1088,7 @@ def create_csv_files(signals, statuses, node_numbers, alarms_number_list, warnin
|
||||||
csv_filename = f"{timestamp}.csv"
|
csv_filename = f"{timestamp}.csv"
|
||||||
csv_path = os.path.join(CSV_DIR, csv_filename)
|
csv_path = os.path.join(CSV_DIR, csv_filename)
|
||||||
# Append values to the CSV file
|
# Append values to the CSV file
|
||||||
|
if not os.path.exists(csv_path):
|
||||||
with open(csv_path, 'a', newline='') as csvfile:
|
with open(csv_path, 'a', newline='') as csvfile:
|
||||||
csv_writer = csv.writer(csvfile, delimiter=';')
|
csv_writer = csv.writer(csvfile, delimiter=';')
|
||||||
# Add a special row for the nodes configuration
|
# Add a special row for the nodes configuration
|
||||||
|
|
|
@ -589,7 +589,8 @@ def create_batch_of_csv_files():
|
||||||
csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x)))
|
csv_files.sort(key=lambda x: os.path.getctime(os.path.join(CSV_DIR, x)))
|
||||||
|
|
||||||
# keep the 30 MOST RECENT FILES
|
# keep the 30 MOST RECENT FILES
|
||||||
recent_csv_files = csv_files[-30:] if len(csv_files) > 30 else csv_files
|
#recent_csv_files = csv_files[-30:] if len(csv_files) > 30 else csv_files
|
||||||
|
recent_csv_files = csv_files[-600:] if len(csv_files) > 600 else csv_files
|
||||||
|
|
||||||
# get the name of the first csv file
|
# get the name of the first csv file
|
||||||
if not csv_files:
|
if not csv_files:
|
||||||
|
@ -683,12 +684,13 @@ def create_batch_of_csv_files():
|
||||||
def create_csv_files(signals, statuses, node_numbers, alarms_number_list, warnings_number_list):
|
def create_csv_files(signals, statuses, node_numbers, alarms_number_list, warnings_number_list):
|
||||||
timestamp = int(time.time())
|
timestamp = int(time.time())
|
||||||
if timestamp % 2 != 0:
|
if timestamp % 2 != 0:
|
||||||
timestamp-=1
|
timestamp -= 1
|
||||||
if not os.path.exists(CSV_DIR):
|
if not os.path.exists(CSV_DIR):
|
||||||
os.makedirs(CSV_DIR)
|
os.makedirs(CSV_DIR)
|
||||||
csv_filename = "{}.csv".format(timestamp)
|
csv_filename = "{}.csv".format(timestamp)
|
||||||
csv_path = os.path.join(CSV_DIR, csv_filename)
|
csv_path = os.path.join(CSV_DIR, csv_filename)
|
||||||
|
|
||||||
|
if not os.path.exists(csv_path):
|
||||||
with open(csv_path, 'ab') as csvfile:
|
with open(csv_path, 'ab') as csvfile:
|
||||||
csv_writer = csv.writer(csvfile, delimiter=';')
|
csv_writer = csv.writer(csvfile, delimiter=';')
|
||||||
nodes_config_path = "/Config/Devices/BatteryNodes"
|
nodes_config_path = "/Config/Devices/BatteryNodes"
|
||||||
|
|
Loading…
Reference in New Issue