slightly less of a buggy mess
This commit is contained in:
parent
d101e6470a
commit
f56f34dff0
Binary file not shown.
Binary file not shown.
BIN
assets/scene-baked.glb (Stored with Git LFS)
BIN
assets/scene-baked.glb (Stored with Git LFS)
Binary file not shown.
BIN
assets/unbaked/scene.blend (Stored with Git LFS)
BIN
assets/unbaked/scene.blend (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
BIN
assets/unbaked/scene/labels_1.png (Stored with Git LFS)
BIN
assets/unbaked/scene/labels_1.png (Stored with Git LFS)
Binary file not shown.
|
@ -40,7 +40,9 @@ void Evaporator::update(double dt)
|
|||
steam_output = steam / dt;
|
||||
steam = 0;
|
||||
|
||||
double P = 10000; // Pa
|
||||
// get to 101325 Pa
|
||||
|
||||
double P = 101325; // Pa
|
||||
double K = Conversions::Temperature::c_to_k(heat); // K
|
||||
double R = Util::Constants::R; // J/K/mol
|
||||
|
||||
|
@ -48,9 +50,20 @@ void Evaporator::update(double dt)
|
|||
double V_g = (volume - level) * 0.001; // m^3
|
||||
|
||||
double n = (P * V_g) / (R * K); // mol
|
||||
air = n * Util::Constants::M_air; // g
|
||||
|
||||
air = n * Util::Constants::M_air;
|
||||
update_base(dt);
|
||||
// evaporate liquid if above 60C
|
||||
|
||||
double m_thermal = get_thermal_mass();
|
||||
double m_fluid = fluid.l_to_g(level);
|
||||
double m_steam = m_thermal / fluid.jPg * (heat - 40);
|
||||
|
||||
if(m_steam > 0)
|
||||
{
|
||||
level -= fluid.g_to_l(m_steam);
|
||||
steam_output += m_steam / dt;
|
||||
heat = 40;
|
||||
}
|
||||
}
|
||||
|
||||
Evaporator::operator Json::Value() const
|
||||
|
|
|
@ -62,6 +62,7 @@ void Valve::update(double dt)
|
|||
|
||||
if(src->get_gas_volume() == 0 || dst->get_gas_volume() == 0 || (src->get_gas() == 0 && dst->get_gas() == 0))
|
||||
{
|
||||
cleanup:
|
||||
flow = 0;
|
||||
return;
|
||||
}
|
||||
|
@ -79,8 +80,11 @@ void Valve::update(double dt)
|
|||
|
||||
if(remove < 0)
|
||||
{
|
||||
ratio_a = src->get_air() / src->get_gas();
|
||||
ratio_s = src->get_steam() / src->get_gas();
|
||||
double g = src->get_gas();
|
||||
if(g <= 0) goto cleanup;
|
||||
|
||||
ratio_a = src->get_air() / g;
|
||||
ratio_s = src->get_steam() / g;
|
||||
|
||||
mol = FluidHolder::calc_pressure_mol(src->get_heat_k(), src->get_gas_volume(), pressure1 - remove);
|
||||
|
||||
|
@ -90,8 +94,11 @@ void Valve::update(double dt)
|
|||
|
||||
else
|
||||
{
|
||||
ratio_a = dst->get_air() / dst->get_gas();
|
||||
ratio_s = dst->get_steam() / dst->get_gas();
|
||||
double g = dst->get_gas();
|
||||
if(g <= 0) goto cleanup;
|
||||
|
||||
ratio_a = dst->get_air() / g;
|
||||
ratio_s = dst->get_steam() / g;
|
||||
|
||||
mol = FluidHolder::calc_pressure_mol(dst->get_heat_k(), dst->get_gas_volume(), pressure2 - remove);
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void Vessel::init()
|
|||
ss << "Void Ratio\n\n";
|
||||
ss << "Reactor Core\n\n";
|
||||
ss << "Neutron Flux\n\n";
|
||||
// ss << "Increase Rate\n\n";
|
||||
ss << "Energy Output\n\n";
|
||||
ss << "Temperature\nMin\nMax\n\n";
|
||||
ss << "Control Rods\nMin\nMax\nSpeed\n";
|
||||
|
||||
|
@ -99,7 +99,8 @@ void Vessel::update(double dt)
|
|||
show_units( ss, sys.vessel->get_pressure() ) << "Pa\n";
|
||||
ss << show( sys.vessel->get_level() / 1000 ) << " / " << show( sys.vessel->get_volume() / 1000 ) << " kL\n";
|
||||
ss << show( sys.vessel->get_void_ratio() * 100 ) << " %\n\n\n\n";
|
||||
show_units( ss, sys.reactor->get_flux() ) << "n/cm2/s\n\n\n";
|
||||
show_units( ss, sys.reactor->get_flux() ) << "n/cm2/s\n";
|
||||
show_units( ss, sys.reactor->get_energy_output() ) << "W\n\n\n";
|
||||
// ss << show( sys.reactor->flux_rate * 100 ) << " %/s\n\n\n";
|
||||
ss << show( temp_min ) << " C\n";
|
||||
ss << show( temp_max ) << " C\n\n\n";
|
||||
|
|
|
@ -8,7 +8,6 @@ using namespace Sim::Reactor::Fuel;
|
|||
constexpr double fuel_density = 19100000; // g/m^3
|
||||
constexpr double fuel_molar_mass = 238.029; // g/mol
|
||||
constexpr double fuel_molar_density = fuel_density / fuel_molar_mass; // mol/m^3
|
||||
constexpr double energy_density = 165e11; // J/mol
|
||||
|
||||
FuelRod::FuelRod(double fuel) : s(fuel)
|
||||
{
|
||||
|
@ -29,7 +28,7 @@ Json::Value FuelRod::serialize() const
|
|||
|
||||
void FuelRod::display(std::ostream& o) const
|
||||
{
|
||||
double mol = fuel_molar_density * get_volume();
|
||||
double mol = fuel_molar_density * get_volume() * 0.001;
|
||||
|
||||
o << "Fuel: " << (s.get_fuel() * mol) << " / " << (s.get_mass() * mol) << " mol\n";
|
||||
o << "Efficiency: " << (s.get_efficiency() * 100) << " %\n";
|
||||
|
@ -40,16 +39,18 @@ void FuelRod::display(std::ostream& o) const
|
|||
|
||||
double FuelRod::get_energy_output() const
|
||||
{
|
||||
double mol = fuel_molar_density * get_volume();
|
||||
double mol = fuel_molar_density * get_volume() * 0.001;
|
||||
|
||||
return s.get_energy() * mol * energy_density;
|
||||
// mol * J/mol/s
|
||||
|
||||
return s.get_energy() * mol;
|
||||
}
|
||||
|
||||
void FuelRod::update(double secs)
|
||||
{
|
||||
update_rod(secs);
|
||||
|
||||
double mol = fuel_molar_density * get_volume();
|
||||
double mol = fuel_molar_density * get_volume() * 0.001;
|
||||
|
||||
s.clear_energy();
|
||||
s.clear_fast_neutrons();
|
||||
|
@ -57,7 +58,7 @@ void FuelRod::update(double secs)
|
|||
s.add_slow_neutrons(vals[val_t::N_SLOW] / mol);
|
||||
s.update(secs);
|
||||
|
||||
vals[val_t::HEAT] += s.get_energy() * mol * energy_density * secs;
|
||||
vals[val_t::HEAT] += s.get_energy() * mol * secs;
|
||||
vals[val_t::N_FAST] += s.get_fast_neutrons() * mol;
|
||||
vals[val_t::N_SLOW] = s.get_slow_neutrons() * mol;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
using namespace Sim::Reactor::Fuel;
|
||||
|
||||
constexpr double NEUTRON_BG = 1e-30;
|
||||
constexpr double ENERGY_DENSITY_FUEL = 165e11; // J/mol
|
||||
constexpr double ENERGY_DENSITY_WASTE = 192970744461.53494; // J/mol
|
||||
|
||||
Sample::Sample(double fuel)
|
||||
{
|
||||
|
@ -57,7 +59,7 @@ void Sample::update(double secs)
|
|||
// decay waste and extract products
|
||||
waste.update(secs);
|
||||
fast_neutrons += waste.extract_neutrons();
|
||||
energy += waste.extract_energy() * (1.0 / 30.0) / secs;
|
||||
energy += waste.extract_energy() / secs * ENERGY_DENSITY_WASTE;
|
||||
|
||||
// decay Xe-135
|
||||
xe_135 *= half_life::get(secs, half_life::Xe_135);
|
||||
|
@ -94,7 +96,7 @@ void Sample::update(double secs)
|
|||
efficiency = neutrons_fuel / neutrons_total;
|
||||
|
||||
// simulate fuel use
|
||||
energy += neutrons_fuel / secs * 0.8;
|
||||
energy += neutrons_fuel / secs * ENERGY_DENSITY_FUEL;
|
||||
waste.add_fissile(neutrons_fuel * 6);
|
||||
}
|
||||
|
||||
|
|
|
@ -110,10 +110,10 @@ double Rod::get_side_area() const
|
|||
|
||||
void Rod::update_rod(double secs)
|
||||
{
|
||||
// decay the free neutrons
|
||||
double m = std::pow(0.5, secs / 879.4);
|
||||
vals[val_t::N_FAST] *= m;
|
||||
vals[val_t::N_SLOW] *= m;
|
||||
// // decay the free neutrons
|
||||
// double m = std::pow(0.5, secs / 879.4);
|
||||
// vals[val_t::N_FAST] *= m;
|
||||
// vals[val_t::N_SLOW] *= m;
|
||||
|
||||
// clear data
|
||||
for(int i = 0; i < Rod::VAL_N; i++)
|
||||
|
|
|
@ -81,18 +81,19 @@ void System::update(double dt)
|
|||
dt *= speed;
|
||||
clock += dt;
|
||||
|
||||
reactor->update(dt);
|
||||
vessel->update(dt);
|
||||
turbine_inlet_valve->update(dt);
|
||||
turbine_bypass_valve->update(dt);
|
||||
condenser->update(dt);
|
||||
turbine->update(dt);
|
||||
|
||||
primary_pump->update(dt);
|
||||
secondary_pump->update(dt);
|
||||
freight_pump->update(dt);
|
||||
reactor->update(dt);
|
||||
|
||||
vessel->update(dt);
|
||||
turbine->update(dt);
|
||||
condenser->update(dt);
|
||||
evaporator->update(dt);
|
||||
condenser_secondary->update(dt);
|
||||
evaporator->update(dt);
|
||||
}
|
||||
|
||||
System::operator Json::Value() const
|
||||
|
|
|
@ -10,7 +10,8 @@ namespace Sim::Util::Streams
|
|||
|
||||
constexpr double show(double v, double m)
|
||||
{
|
||||
return (v == 0 ? 0 : std::round(v * m) / m);
|
||||
v = std::round(v * m) / m;
|
||||
return v == 0 ? 0 : v;
|
||||
}
|
||||
|
||||
constexpr double show(double v)
|
||||
|
|
Loading…
Reference in New Issue