重构文件结构

This commit is contained in:
2025-12-28 19:19:12 +08:00
parent 801c2b6bbb
commit b3d2354bf2
16 changed files with 8 additions and 10 deletions
@@ -74,7 +74,7 @@ thrust_curve = {
0.0005: 0.05,
0.0000: 0.03}
"""
f = open('data/thrust_curve.txt', 'r')
f = open('../data/thrust_curve.txt', 'r')
char = f.readlines()
f.close()
@@ -11,7 +11,7 @@ replace_dict = {'KCLV_YF115': 800, 'launchClamp1': 200}
def get_craft_price(craft_name):
global part_price_dict
file_path = os.path.join('data', f'{craft_name}.craft')
file_path = os.path.join('../data', f'{craft_name}.craft')
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
result_list = [item.replace('.', '_') for item in re.findall(r'part = (.*?)_.*', content)]
@@ -24,10 +24,10 @@ def get_craft_price(craft_name):
def diff_part(craft1, craft2):
file_path = os.path.join('data', f'{craft1}.craft')
file_path = os.path.join('../data', f'{craft1}.craft')
with open(file_path, 'r', encoding='utf-8') as f:
content1 = f.read()
file_path = os.path.join('data', f'{craft2}.craft')
file_path = os.path.join('../data', f'{craft2}.craft')
with open(file_path, 'r', encoding='utf-8') as f:
content2 = f.read()
part_list1 = [item.replace('.', '_') for item in re.findall(r'part = (.*?)_.*', content1)]
@@ -57,7 +57,7 @@ def calculate_config_factor(local_config_dict, target_list):
for key, content in local_config_dict.items():
# full_config = generate_full_config(content, full_config)
full_config = generate_full_config_dict_list(content, full_config, key)
with open('data/full_config.txt', 'w', encoding='utf-8') as file:
with open('../data/full_config.txt', 'w', encoding='utf-8') as file:
file.write(json.dumps(full_config))
# file = open('data/full_config.txt', 'r', encoding='utf-8')
# full_config = json.loads(file.read())
@@ -74,7 +74,7 @@ def cal_fuel_mass_based_on_tank_volume(fuel_type, tank_volume):
if __name__ == '__main__':
path = os.path.join('data', 'CommonResources.cfg')
path = os.path.join('../data', 'CommonResources.cfg')
common_resources_dict = load_common_resources(path)
lqdmethane = common_resources_dict['LqdMethane']
kerosene = common_resources_dict['Kerosene']
@@ -1,6 +1,6 @@
import matplotlib.pyplot as plt
from src.KSP_tools.calculator_dv import cal_dv
from src.KSP_tools.single_script.calculator_dv import cal_dv
def plot_stage_performance(isp, gross_mass, dry_mass, payload, stage_name):
@@ -1,6 +1,4 @@
import math
import load_common_resources
import copy
import time
from matplotlib import pyplot as plt
@@ -11,7 +9,7 @@ from calculator_dv import cal_dv
Vc = 299792458
Ga = 9.80665
path = 'data/CommonResources.cfg'
path = '../data/CommonResources.cfg'
common_resources_dict = load_common_resources.load_common_resources(path)
fuel_density_map = {