This commit is contained in:
2025-07-01 15:50:40 +08:00
parent b7d59835ce
commit 1d86109d64
7 changed files with 144 additions and 60 deletions
+64 -56
View File
@@ -100,66 +100,74 @@ def cal_dv_step_by_step_fusion(reactor_efficiency, engine_efficiency, thrust, dr
if __name__ == '__main__':
merlin_fuel_burned = cal_fuel_burned(314.3, 931, 1)
merlin_kinetic_energy = cal_kinetic_energy(314.3, 931, 1, 1)
theoretical_kerosene_burn_heat = 0.27785743459149853 * merlin_fuel_burned * 43.11 * 1000000
print(0.000005 * HYDROGEN_FUSION_EFFICIENCY * Vc * Vc / 3600/500)
raptor_fuel_burned = cal_fuel_burned(355, 2450, 1)
raptor_kinetic_energy = cal_kinetic_energy(355, 2450, 1, 1)
theoretical_methane_burn_heat = 0.20836197008574792 * raptor_fuel_burned * 55 * 1000000
light_speed_engine_power_requirement = cal_kinetic_energy(3000000, 4800, 1, 1)
# arc_reactor_power_output = 0.5*0.01*Vc*Vc
new_element_arc_output = 1*10**9
ratio = 1072*new_element_arc_output / light_speed_engine_power_requirement
print('111')
# first_stage_fuel = cal_fuel_burned(328, 812.05*4, 148)
# x = cal_fuel_burned(333, 80, 610) + cal_fuel_burned(350, 823.2, 148)
# x = cal_dv(338.2, 55000, 70000)
# xx = cal_fuel_burned(21000, 400, 1)
# payload_mass = 30
# structural_mass = 8
# return_fuel_mass = 8
# outbound_fuel_mass = 47
# return_dv = cal_dv(475, structural_mass, return_fuel_mass)
# out_bound_dv = cal_dv(475, payload_mass+structural_mass+return_fuel_mass, outbound_fuel_mass)
# total_mass = payload_mass + structural_mass + return_fuel_mass + outbound_fuel_mass
payload_mass = 45
structural_mass = 10
return_fuel_mass = 10
outbound_fuel_mass = 65
return_dv = cal_dv(475, structural_mass, return_fuel_mass)
out_bound_dv = cal_dv(475, payload_mass + structural_mass + return_fuel_mass, outbound_fuel_mass)
total_mass = payload_mass + structural_mass + return_fuel_mass + outbound_fuel_mass
# payload_mass = 30
# merlin_fuel_burned = cal_fuel_burned(314.3, 931, 1)
# merlin_kinetic_energy = cal_kinetic_energy(314.3, 931, 1, 1)
# theoretical_kerosene_burn_heat = 0.27785743459149853 * merlin_fuel_burned * 43.11 * 1000000
#
# raptor_fuel_burned = cal_fuel_burned(355, 2450, 1)
# raptor_kinetic_energy = cal_kinetic_energy(355, 2450, 1, 1)
# theoretical_methane_burn_heat = 0.20836197008574792 * raptor_fuel_burned * 55 * 1000000
#
#
# # first_stage_fuel = cal_fuel_burned(328, 812.05*4, 148)
# # x = cal_fuel_burned(333, 80, 610) + cal_fuel_burned(350, 823.2, 148)
# # x = cal_dv(338.2, 55000, 70000)
# # xx = cal_fuel_burned(21000, 400, 1)
#
# # payload_mass = 30
# # structural_mass = 8
# # return_fuel_mass = 8
# # outbound_fuel_mass = 47
# # return_dv = cal_dv(475, structural_mass, return_fuel_mass)
# # out_bound_dv = cal_dv(475, payload_mass+structural_mass+return_fuel_mass, outbound_fuel_mass)
# # total_mass = payload_mass + structural_mass + return_fuel_mass + outbound_fuel_mass
#
# payload_mass = 45
# structural_mass = 10
# return_fuel_mass = 14
# outbound_fuel_mass = 71
# return_dv = cal_dv(382, structural_mass, return_fuel_mass)
# out_bound_dv = cal_dv(382, payload_mass + structural_mass + return_fuel_mass, outbound_fuel_mass)
# return_fuel_mass = 10
# outbound_fuel_mass = 65
# return_dv = cal_dv(475, structural_mass, return_fuel_mass)
# out_bound_dv = cal_dv(475, payload_mass + structural_mass + return_fuel_mass, outbound_fuel_mass)
# total_mass = payload_mass + structural_mass + return_fuel_mass + outbound_fuel_mass
tank_mass = 0.000001 * 179380.1868 + 0.00003 * 41395.42773
x = cal_kinetic_energy(350, 2450, 1, 1)
# x = cal_kinetic_energy(314.3, 931, 1, 1)
y = cal_kinetic_energy(21000, 800, 1, 1)
print(y / x)
y = cal_fusion_input_mass(HYDROGEN_FUSION_EFFICIENCY * 0.1, x)
test = cal_burn_time(310, 1.95, 3)
ship_dry_mass = 2000*1000 # 2000t
ship_fuel_mass = 500*1000 # 500t
main_engine_thrust = 10000 # 10000KN
ship_isp, flow_rate = cal_best_isp_relativity_speed(reactor_efficiency=0.45, engine_efficiency=0.8,
thrust=main_engine_thrust)
exhaust_velocity = ship_isp * Ga / Vc
dv = cal_dv(ship_isp, ship_dry_mass + ship_fuel_mass / 2, ship_fuel_mass / 2)
dv2 = cal_dv_step_by_step_fusion(reactor_efficiency=0.45, engine_efficiency=0.8, thrust=main_engine_thrust,
dry_mass=ship_dry_mass, fuel_mass=ship_fuel_mass, interval=1)
burn_time = ship_fuel_mass / flow_rate / 86400
x = 27632994.05705879
xxx = cal_fuel_burned(335.1, 1339.48, 174)
#
# # payload_mass = 30
# # structural_mass = 10
# # return_fuel_mass = 14
# # outbound_fuel_mass = 71
# # return_dv = cal_dv(382, structural_mass, return_fuel_mass)
# # out_bound_dv = cal_dv(382, payload_mass + structural_mass + return_fuel_mass, outbound_fuel_mass)
# # total_mass = payload_mass + structural_mass + return_fuel_mass + outbound_fuel_mass
#
# tank_mass = 0.000001 * 179380.1868 + 0.00003 * 41395.42773
#
# x = cal_kinetic_energy(350, 2450, 1, 1)
# # x = cal_kinetic_energy(314.3, 931, 1, 1)
# y = cal_kinetic_energy(21000, 800, 1, 1)
# print(y / x)
# y = cal_fusion_input_mass(HYDROGEN_FUSION_EFFICIENCY * 0.1, x)
#
# test = cal_burn_time(310, 1.95, 3)
# ship_dry_mass = 2000*1000 # 2000t
# ship_fuel_mass = 500*1000 # 500t
# main_engine_thrust = 10000 # 10000KN
# ship_isp, flow_rate = cal_best_isp_relativity_speed(reactor_efficiency=0.45, engine_efficiency=0.8,
# thrust=main_engine_thrust)
# exhaust_velocity = ship_isp * Ga / Vc
# dv = cal_dv(ship_isp, ship_dry_mass + ship_fuel_mass / 2, ship_fuel_mass / 2)
# dv2 = cal_dv_step_by_step_fusion(reactor_efficiency=0.45, engine_efficiency=0.8, thrust=main_engine_thrust,
# dry_mass=ship_dry_mass, fuel_mass=ship_fuel_mass, interval=1)
# burn_time = ship_fuel_mass / flow_rate / 86400
# x = 27632994.05705879
#
# xxx = cal_fuel_burned(335.1, 1339.48, 174)
print('done')
+14 -4
View File
@@ -6,6 +6,8 @@ import time
from matplotlib import pyplot as plt
from tqdm import tqdm
from calculator_dv import cal_dv
Vc = 299792458
Ga = 9.80665
@@ -257,6 +259,7 @@ if __name__ == '__main__':
176: 0.9, 177: 1, 180: 1, 190: 1},
}
# # CBC: 173s S1: 227s S2: 212s S3: 800s
# cbc_fuel_mass = 510000
# cbc_dry_mass = 50000
@@ -300,9 +303,16 @@ if __name__ == '__main__':
# Lanyue = Vessel([[S1], [S2]], name='Lanyue', payload=200, duration=0.05)
# Lanyue.run_sim_new()
booster = Stage(163560, 16000, 4740, 285, 'solid', 'SRB')
S1 = Stage(350000, 25000, 3500, 456.5, 'hydrolox', 'Hydrolox Core Stage')
S2 = Stage(54000, 5000, 392, 450, 'hydrolox', 'Upper Stage')
SMART_LV = Vessel([[booster, S1], [S2]], name='SMART_LV', payload=20000, duration=0.05)
# booster = Stage(163560, 16000, 4740, 285, 'solid', 'SRB')
# S1 = Stage(350000, 25000, 3500, 456.5, 'hydrolox', 'Hydrolox Core Stage')
# S2 = Stage(54000, 5000, 392, 450, 'hydrolox', 'Upper Stage')
# SMART_LV = Vessel([[booster, S1], [S2]], name='SMART_LV', payload=20000, duration=0.05)
# SMART_LV.run_sim_new()
S1 = Stage(1200000, 300000, 1860*12, 452, 'hydrolox', 'Hydrolox Core Stage')
# S2 = Stage(200000, 20000, 1307, 448, 'hydrolox', 'J-2X Upper Stage')
S2 = Stage(250000, 20000, 2093, 460, 'hydrolox', 'RS-25-150 Upper Stage')
SMART_LV = Vessel([[S1], [S2]], name='SMART_LV', payload=30000, duration=0.05)
SMART_LV.run_sim_new()
print('Stage 0 return dv:', cal_dv(452, 100000, 200000))
print('done')
View File
+25
View File
@@ -0,0 +1,25 @@
import json
import os
from pathlib import Path
from langchain_openai import ChatOpenAI
from pydantic import SecretStr
PROJECT_PATH = Path(__file__).parent.parent.parent.absolute()
if os.path.exists(os.path.join(PROJECT_PATH, "config", "config_local.json")):
CONFIG_PATH = os.path.join(PROJECT_PATH, "config", "config_local.json")
elif os.path.exists(os.path.join(PROJECT_PATH, "config", "config.json")):
CONFIG_PATH = os.path.join(PROJECT_PATH, "config", "config.json")
else:
raise FileNotFoundError('Unable to locate config file, check src/config/config.json')
with open(CONFIG_PATH, 'r', encoding='utf-8') as config_file:
project_config = json.load(config_file)
LLM = ChatOpenAI(model=project_config['llm_model_name'], api_key= SecretStr(project_config['llm_secret_key']),
base_url=project_config['llm_base_url'], temperature=0.01)
+41
View File
@@ -0,0 +1,41 @@
import os
from pathlib import Path
PROJECT_PATH = Path(__file__).resolve().parent.parent.parent.absolute()
DATA_PATH = os.path.join(PROJECT_PATH, 'data')
def split_string(text, max_length):
"""Splits a string into chunks, each with a maximum length.
Args:
text (str): The string to split.
max_length (int): The maximum length of each chunk.
Returns:
list: A list of strings, each with a length no more than max_length.
"""
result = []
start = 0
while start < len(text):
end = min(start + max_length, len(text))
result.append(text[start:end])
start = end
return result
novel_path = os.path.join(DATA_PATH, '如果,宅.txt')
with open(novel_path, 'r', encoding='ANSI') as f:
novel = f.readlines()
new_novel = ''
for novel_line in novel:
line_list = split_string(novel_line, 30)
new_novel += '\n'.join(line_list)
new_novel += '\n'
with open(os.path.join(DATA_PATH, 'target.txt'), 'w', encoding='utf-8') as f:
f.write(new_novel)
print('done')