重构文件结构
This commit is contained in:
@@ -74,7 +74,7 @@ thrust_curve = {
|
|||||||
0.0005: 0.05,
|
0.0005: 0.05,
|
||||||
0.0000: 0.03}
|
0.0000: 0.03}
|
||||||
"""
|
"""
|
||||||
f = open('data/thrust_curve.txt', 'r')
|
f = open('../data/thrust_curve.txt', 'r')
|
||||||
char = f.readlines()
|
char = f.readlines()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
+3
-3
@@ -11,7 +11,7 @@ replace_dict = {'KCLV_YF115': 800, 'launchClamp1': 200}
|
|||||||
|
|
||||||
def get_craft_price(craft_name):
|
def get_craft_price(craft_name):
|
||||||
global part_price_dict
|
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:
|
with open(file_path, 'r', encoding='utf-8') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
result_list = [item.replace('.', '_') for item in re.findall(r'part = (.*?)_.*', content)]
|
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):
|
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:
|
with open(file_path, 'r', encoding='utf-8') as f:
|
||||||
content1 = f.read()
|
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:
|
with open(file_path, 'r', encoding='utf-8') as f:
|
||||||
content2 = f.read()
|
content2 = f.read()
|
||||||
part_list1 = [item.replace('.', '_') for item in re.findall(r'part = (.*?)_.*', content1)]
|
part_list1 = [item.replace('.', '_') for item in re.findall(r'part = (.*?)_.*', content1)]
|
||||||
+1
-1
@@ -57,7 +57,7 @@ def calculate_config_factor(local_config_dict, target_list):
|
|||||||
for key, content in local_config_dict.items():
|
for key, content in local_config_dict.items():
|
||||||
# full_config = generate_full_config(content, full_config)
|
# full_config = generate_full_config(content, full_config)
|
||||||
full_config = generate_full_config_dict_list(content, full_config, key)
|
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.write(json.dumps(full_config))
|
||||||
# file = open('data/full_config.txt', 'r', encoding='utf-8')
|
# file = open('data/full_config.txt', 'r', encoding='utf-8')
|
||||||
# full_config = json.loads(file.read())
|
# full_config = json.loads(file.read())
|
||||||
+1
-1
@@ -74,7 +74,7 @@ def cal_fuel_mass_based_on_tank_volume(fuel_type, tank_volume):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
path = os.path.join('data', 'CommonResources.cfg')
|
path = os.path.join('../data', 'CommonResources.cfg')
|
||||||
common_resources_dict = load_common_resources(path)
|
common_resources_dict = load_common_resources(path)
|
||||||
lqdmethane = common_resources_dict['LqdMethane']
|
lqdmethane = common_resources_dict['LqdMethane']
|
||||||
kerosene = common_resources_dict['Kerosene']
|
kerosene = common_resources_dict['Kerosene']
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import matplotlib.pyplot as plt
|
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):
|
def plot_stage_performance(isp, gross_mass, dry_mass, payload, stage_name):
|
||||||
+1
-3
@@ -1,6 +1,4 @@
|
|||||||
import math
|
|
||||||
import load_common_resources
|
import load_common_resources
|
||||||
import copy
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from matplotlib import pyplot as plt
|
from matplotlib import pyplot as plt
|
||||||
@@ -11,7 +9,7 @@ from calculator_dv import cal_dv
|
|||||||
Vc = 299792458
|
Vc = 299792458
|
||||||
Ga = 9.80665
|
Ga = 9.80665
|
||||||
|
|
||||||
path = 'data/CommonResources.cfg'
|
path = '../data/CommonResources.cfg'
|
||||||
common_resources_dict = load_common_resources.load_common_resources(path)
|
common_resources_dict = load_common_resources.load_common_resources(path)
|
||||||
|
|
||||||
fuel_density_map = {
|
fuel_density_map = {
|
||||||
Reference in New Issue
Block a user