A MoonBit library for process energy balance, thermodynamic property estimates, equipment screening, reaction heat, and process analysis.
///|
test "README sensible heater example" {
let water = water_liquid()
let feed = Stream::pure(
id="feed",
substance=water,
molar_flow=2.0,
temperature=293.15,
)
let hot = feed.with_temperature(333.15)
inspect(heat_duty(feed, hot).round(), content="6024")
}moon run cmd/mainmoon run --target native benchmarksmoon fmt --check
moon check --target all --deny-warn
moon test --target all --deny-warn
moon coverage analyzepub struct AirConditioningReport {
inlet : PsychrometricPoint
outlet : PsychrometricPoint
dry_air_mass_flow_kg_per_s : Double
cooling_duty_w : Double
sensible_duty_w : Double
latent_duty_w : Double
condensate_kg_per_s : Double
sensible_heat_ratio : Double
} derive(Debug)pub struct AuditFinding {
code : AuditFindingCode
message : String
magnitude : Double
} derive(Debug)pub struct AuditReport {
accepted : Bool
finding_count : Int
residual : Double
findings : Array[AuditFinding]
} derive(Debug)pub struct BalanceResult {
inlet_enthalpy_flow : Double
outlet_enthalpy_flow : Double
heat : Double
shaft_work : Double
residual : Double
} derive(Debug)pub struct BalanceTerms {
heat : Double
shaft_work : Double
kinetic : Double
potential : Double
} derive(Debug)fn BalanceTerms::BalanceTerms(heat? : Double, shaft_work? : Double, kinetic? : Double, potential? : Double) -> BalanceTermspub struct BenchmarkResult {
workload : String
iterations : Int
checksum : Double
total_duty_w : Double
total_residual_w : Double
} derive(Debug)pub struct CaseStudyResult {
id : String
duty_w : Double
mass_flow_kg_per_s : Double
equipment_area_m2 : Double
quality_score : Double
summary : String
} derive(Debug)pub struct ConvergenceResult {
value : Double
iterations : Int
residual : Double
converged : Bool
} derive(Debug)fn CoolingCase::CoolingCase(id~ : String, feed~ : Stream, target_temperature~ : Double) -> CoolingCasepub struct CostEstimate {
name : String
annual_cost : Double
annual_energy_kwh : Double
annual_emissions_kg : Double
utility_flow_kg_per_s : Double
} derive(Debug)pub(all) enum CpModel {
Constant(Double)
Linear(Double, Double)
Polynomial(Double, Double, Double, Double)
} derive(Debug)pub struct DutyReport {
unit_id : String
inlet_id : String
outlet_id : String
inlet_temperature : Double
outlet_temperature : Double
molar_flow : Double
duty : Double
service_hint : String
} derive(Debug)pub struct DynamicThermalState {
time_s : Double
temperature_k : Double
energy_j : Double
duty_w : Double
} derive(Debug)pub struct EnvelopeSelection {
point : OperatingPoint
objective_value : Double
rank : Int
explanation : String
} derive(Debug)pub struct EnvelopeSummary {
point_count : Int
feasible_count : Int
infeasible_count : Int
minimum_duty_w : Double
maximum_duty_w : Double
minimum_cost_per_h : Double
maximum_cost_per_h : Double
average_temperature_k : Double
average_flow_kg_per_s : Double
} derive(Debug)pub struct ExchangerCase {
id : String
hot_in : Stream
hot_out_temperature : Double
cold_in : Stream
cold_out_temperature : Double
arrangement : FlowArrangement
} derive(Debug)fn ExchangerCase::ExchangerCase(id~ : String, hot_in~ : Stream, hot_out_temperature~ : Double, cold_in~ : Stream, cold_out_temperature~ : Double, arrangement? : FlowArrangement) -> ExchangerCasepub struct FluidProperties {
temperature_c : Double
density_kg_per_m3 : Double
viscosity_pa_s : Double
heat_capacity_j_per_kg_k : Double
thermal_conductivity_w_per_m_k : Double
vapor_pressure_kpa : Double
} derive(Debug)pub struct HeatRecoveryMatch {
hot_id : String
cold_id : String
duty_kw : Double
hot_outlet_c : Double
cold_outlet_c : Double
feasible : Bool
} derive(Debug)pub struct HeaterSizing {
process_duty_w : Double
design_duty_w : Double
area_m2 : Double
overall_u_w_per_m2_k : Double
approach_k : Double
} derive(Debug)fn HeatingCase::HeatingCase(id~ : String, feed~ : Stream, target_temperature~ : Double) -> HeatingCasepub(all) enum KineticModel {
FirstOrder(rate_constant~ : Double)
SecondOrder(rate_constant~ : Double)
Arrhenius(pre_exponential~ : Double, activation_energy_j_per_mol~ : Double)
} derive(Debug)pub struct KineticPoint {
time_s : Double
concentration : Double
conversion : Double
rate_mol_per_m3_s : Double
} derive(Debug)pub struct LatentHeat {
transition_temperature : Double
heat : Double
direction : PhaseChangeDirection
} derive(Debug)pub struct NetworkConnection {
source_id : String
target_id : String
fraction : Double
} derive(Debug)fn NetworkConnection::NetworkConnection(source_id~ : String, target_id~ : String, fraction~ : Double) -> NetworkConnectionpub struct OperatingConstraints {
minimum_temperature_k : Double
maximum_temperature_k : Double
minimum_flow_kg_per_s : Double
maximum_flow_kg_per_s : Double
minimum_pressure_kpa : Double
maximum_pressure_kpa : Double
minimum_duty_w : Double
maximum_duty_w : Double
maximum_cost_per_h : Double
} derive(Debug)fn OperatingConstraints::new(minimum_temperature_k~ : Double, maximum_temperature_k~ : Double, minimum_flow_kg_per_s~ : Double, maximum_flow_kg_per_s~ : Double, minimum_pressure_kpa~ : Double, maximum_pressure_kpa~ : Double, minimum_duty_w~ : Double, maximum_duty_w~ : Double, maximum_cost_per_h~ : Double) -> OperatingConstraintspub struct OperatingEnvelope {
points : Array[OperatingPoint]
constraints : OperatingConstraints
summary : EnvelopeSummary
} derive(Debug)pub struct OperatingPoint {
temperature_k : Double
flow_kg_per_s : Double
pressure_kpa : Double
duty_w : Double
cost_per_h : Double
emissions_kg_per_h : Double
score : Double
status : EnvelopeStatus
} derive(Debug)pub struct PinchTargets {
hot_target_c : Double
cold_target_c : Double
minimum_hot_utility_kw : Double
minimum_cold_utility_kw : Double
total_hot_duty_kw : Double
total_cold_duty_kw : Double
} derive(Debug)pub struct ProcessIssue {
code : ProcessIssueCode
stream_id : String
message : String
} derive(Debug)pub struct ProcessValidationReport {
valid : Bool
issue_count : Int
issues : Array[ProcessIssue]
} derive(Debug)fn ProcessValidationReport::has_code(self : ProcessValidationReport, code : ProcessIssueCode) -> Boolpub struct PsychrometricPoint {
dry_bulb_c : Double
relative_humidity : Double
humidity_ratio : Double
enthalpy_kj_per_kg_dry : Double
dew_point_c : Double
} derive(Debug)pub struct PumpSizing {
hydraulic_power_w : Double
shaft_power_w : Double
pressure_rise_pa : Double
flow_m3_per_s : Double
} derive(Debug)pub struct QualityResult {
inlet : Double
outlet : Double
absolute_error : Double
relative_error : Double
tolerance : Double
accepted : Bool
} derive(Debug)pub struct RampPlan {
points : Array[OperatingPoint]
total_time_s : Double
total_energy_j : Double
maximum_step_temperature_k : Double
maximum_step_flow_kg_per_s : Double
valid : Bool
} derive(Debug)pub struct RankineCycleResult {
boiler_duty_w : Double
turbine_work_w : Double
pump_work_w : Double
condenser_duty_w : Double
net_work_w : Double
thermal_efficiency : Double
steam_quality_at_turbine_exit : Double
} derive(Debug)pub struct ReactionBalance {
inlet : Array[SpeciesRate]
outlet : Array[SpeciesRate]
extent_mol_per_s : Double
duty_w : Double
mass_residual_kg_per_s : Double
} derive(Debug)pub struct ReactionSpecies {
id : String
molar_mass : Double
formation_enthalpy_kj_per_mol : Double
} derive(Debug)fn ReactionSpecies::ReactionSpecies(id~ : String, molar_mass~ : Double, formation_enthalpy_kj_per_mol~ : Double) -> ReactionSpeciespub struct ScenarioMatrix {
points : Array[ScenarioPoint]
minimum_duty : Double
maximum_duty : Double
minimum_area : Double
maximum_area : Double
} derive(Debug)pub struct ScenarioPoint {
flow : Double
target_temperature : Double
duty : Double
area_m2 : Double
quality_score : Double
} derive(Debug)pub struct ScheduleResult {
entries : Array[ScheduledEntry]
makespan_h : Double
critical_unit_id : String
feasible : Bool
} derive(Debug)pub struct ScheduledEntry {
id : String
start_h : Double
finish_h : Double
slack_h : Double
} derive(Debug)fn ScheduledUnit::ScheduledUnit(id~ : String, duration_h~ : Double, predecessors~ : Array[String]) -> ScheduledUnitpub struct SensitivityPoint {
target_temperature : Double
duty : Double
derivative : Double
relative_derivative : Double
} derive(Debug)pub struct SensitivitySweep {
points : Array[SensitivityPoint]
minimum_duty : Double
maximum_duty : Double
} derive(Debug)pub struct SteamState {
temperature_c : Double
pressure_kpa : Double
enthalpy_kj_per_kg : Double
entropy_kj_per_kg_k : Double
specific_volume_m3_per_kg : Double
quality : Double
region : SteamRegion
} derive(Debug)pub struct SteamTableResult {
value : Double
lower_bound : Double
upper_bound : Double
clamped : Bool
valid : Bool
} derive(Debug)pub struct Stream {
id : String
temperature : Double
components : Array[ComponentFlow]
} derive(Debug)fn Stream::mixture(id~ : String, components~ : Array[ComponentFlow], temperature~ : Double) -> Streampub struct StreamAggregate {
count : Int
total_molar_flow : Double
total_enthalpy_flow : Double
weighted_temperature : Double
total_heat_capacity_flow : Double
} derive(Debug)pub struct StreamSnapshot {
id : String
temperature : Double
molar_flow : Double
enthalpy_flow : Double
heat_capacity_flow : Double
component_count : Int
} derive(Debug)pub struct Substance {
id : String
name : String
phase : Phase
cp_model : CpModel
reference_temperature : Double
formation_enthalpy : Double
latent_heats : Array[LatentHeat]
} derive(Debug)fn Substance::with_latent_heat(self : Substance, transition_temperature~ : Double, heat~ : Double, direction~ : PhaseChangeDirection) -> Substancepub struct TankSizing {
working_volume_m3 : Double
volume_m3 : Double
diameter_m : Double
height_m : Double
residence_time_s : Double
} derive(Debug)pub struct ThermalStreamTarget {
id : String
supply_c : Double
target_c : Double
heat_capacity_flow_kw_per_k : Double
} derive(Debug)fn ThermalStreamTarget::ThermalStreamTarget(id~ : String, supply_c~ : Double, target_c~ : Double, heat_capacity_flow_kw_per_k~ : Double) -> ThermalStreamTargetpub struct TurbineExpansionResult {
inlet_enthalpy_kj_per_kg : Double
outlet_enthalpy_kj_per_kg : Double
specific_work_kj_per_kg : Double
outlet_quality : Double
outlet_temperature_c : Double
} derive(Debug)pub struct UncertaintyEnvelope {
nominal : Double
low : Double
high : Double
relative_half_width : Double
} derive(Debug)pub struct UtilityDesign {
name : String
duty_w : Double
required_mass_flow_kg_per_s : Double
inlet_temperature_c : Double
outlet_temperature_c : Double
cost_index : Double
} derive(Debug)pub struct UtilityEstimate {
name : String
duty : Double
required_flow : Double
inlet_temperature : Double
outlet_temperature : Double
} derive(Debug)pub enum ValidationIssue {
NegativeFlow(String)
EmptyStream(String)
NonPositiveTemperature(String)
InvalidFraction(Double)
} derive(Debug)fn adiabatic_reaction_temperature(inlet_temperature : Double, inlet_heat_capacity_flow : Double, terms : Array[ReactionTerm], extent_mol_per_s : Double) -> Doublefn agitator_power_w(density_kg_per_m3 : Double, impeller_diameter_m : Double, rotational_speed_per_s : Double, power_number : Double) -> Doublefn air_conditioning_report(inlet : PsychrometricPoint, outlet : PsychrometricPoint, dry_air_mass_flow_kg_per_s : Double) -> AirConditioningReportfn air_heater_duty_w(inlet : PsychrometricPoint, outlet_temperature_c : Double, dry_air_mass_flow_kg_per_s : Double) -> Doublefn annualized_capital_cost(capital_cost : Double, interest_rate : Double, lifetime_years : Int, operating_hours_per_year : Double) -> Doublefn apply_reaction(rates : Array[SpeciesRate], terms : Array[ReactionTerm], requested_extent : Double) -> Array[SpeciesRate]fn arrhenius_rate_constant(activation_energy_j_per_mol : Double, reference_temperature_k : Double, temperature_k : Double) -> Doublefn audit_process(inlets : Array[Stream], outlets : Array[Stream], heat_duty_w : Double) -> AuditReportfn average_heat_capacity(substance : Substance, from_temperature : Double, to_temperature : Double) -> Doublefn benchmark_checksum_is_stable(first : BenchmarkResult, second : BenchmarkResult, tolerance : Double) -> Boolfn carbon_cost_model(duty_w : Double, emission_factor_kg_per_kwh : Double, carbon_price_per_kg : Double) -> Doublefn chilled_water_utility(duty_w : Double, inlet_temperature_c : Double, outlet_temperature_c : Double) -> UtilityDesignfn coil_bypass_factor(inlet_temperature_c : Double, outlet_temperature_c : Double, apparatus_dew_point_c : Double) -> Doublefn combine_uncertainties(first_relative : Double, second_relative : Double) -> Doublefn combined_duty_model(temperature_k : Double, flow_kg_per_s : Double, pressure_kpa : Double, target_temperature_k : Double, heat_capacity_j_per_kg_k : Double, pump_efficiency : Double) -> Doublefn compressor_power_w(mass_flow_kg_per_s : Double, inlet_pressure_kpa : Double, outlet_pressure_kpa : Double, efficiency : Double, heat_capacity_ratio : Double) -> Doublefn condensate_recovery_heat_kj_per_kg(pressure_kpa : Double, condensate_temperature_c : Double) -> Doublefn condenser_duty_w(mass_flow_kg_per_s : Double, turbine_exit : SteamState, saturated_liquid : SteamState) -> Doublefn conservation_is_closed(before : Double, after : Double, tolerance : Double) -> Boolfn convection_resistance_m2_k_per_w(heat_transfer_coefficient_w_per_m2_k : Double) -> Doublefn cooling_water_required(duty : Double, cp : Double, delta_t : Double) -> Doublefn cooling_water_utility(duty_w : Double, inlet_temperature_c : Double, outlet_temperature_c : Double) -> UtilityDesignfn cost_saving_percent(reference_cost : Double, improved_cost : Double) -> Doublefn cstr_conversion(model : KineticModel, residence_time_s : Double, temperature_k : Double) -> Doublefn cubic_meters_per_second_to_liters_per_minute(value : Double) -> Doublefn cycle_capacity_factor(cycle : RankineCycleResult, operating_hours : Double, period_hours : Double) -> Doublefn dehumidification_point(inlet : PsychrometricPoint, target_relative_humidity : Double) -> PsychrometricPointfn dew_point_c(dry_bulb_c : Double, humidity_ratio : Double, total_pressure_kpa : Double) -> Doublefn duty_uncertainty_envelope(inlet : Stream, target_temperature : Double, flow_relative_uncertainty : Double, cp_relative_uncertainty : Double) -> UncertaintyEnvelopefn dynamic_step(state : DynamicThermalState, target_temperature_k : Double, heat_capacity_j_per_k : Double, overall_u_w_per_k : Double, step_s : Double) -> DynamicThermalStatefn effectiveness_ntu(counter_current~ : Bool, c_min : Double, c_max : Double, ua : Double) -> Doublefn enthalpy_change_with_formation(substance : Substance, from_temperature : Double, to_temperature : Double) -> Doublefn envelope_best_by(envelope : OperatingEnvelope, direction : ObjectiveDirection, objective : (OperatingPoint) -> Double) -> OperatingPoint?fn envelope_best_weighted(envelope : OperatingEnvelope, cost_weight : Double, duty_weight : Double, emissions_weight : Double, cost_scale : Double, duty_scale : Double, emissions_scale : Double) -> OperatingPoint?fn envelope_filter(envelope : OperatingEnvelope, predicate : (OperatingPoint) -> Bool) -> OperatingEnvelopefn envelope_filter_cost(envelope : OperatingEnvelope, maximum_cost_per_h : Double) -> OperatingEnvelopefn envelope_filter_margin(envelope : OperatingEnvelope, minimum_margin : Double) -> OperatingEnvelopefn envelope_from_points(points : Array[OperatingPoint], constraints : OperatingConstraints) -> OperatingEnvelopefn envelope_interpolate_flow(first : OperatingPoint, second : OperatingPoint, flow_kg_per_s : Double, constraints : OperatingConstraints) -> OperatingPointfn envelope_interpolate_temperature(first : OperatingPoint, second : OperatingPoint, temperature_k : Double, constraints : OperatingConstraints) -> OperatingPointfn envelope_merge_points(points : Array[OperatingPoint], constraints : OperatingConstraints) -> OperatingEnvelopefn envelope_pareto_frontier(envelope : OperatingEnvelope, minimize_cost : Bool, minimize_duty : Bool, minimize_emissions : Bool) -> Array[OperatingPoint]fn envelope_points_in_flow_band(envelope : OperatingEnvelope, lower_kg_per_s : Double, upper_kg_per_s : Double) -> Array[OperatingPoint]fn envelope_points_in_temperature_band(envelope : OperatingEnvelope, lower_k : Double, upper_k : Double) -> Array[OperatingPoint]fn envelope_points_with_minimum_margin(envelope : OperatingEnvelope, margin : Double) -> Array[OperatingPoint]fn envelope_select_by_target(envelope : OperatingEnvelope, target_temperature_k : Double, target_flow_kg_per_s : Double) -> OperatingPoint?fn envelope_selection_from_point(envelope : OperatingEnvelope, point : OperatingPoint, explanation : String) -> EnvelopeSelectionfn envelope_weighted_average(points : Array[OperatingPoint], weights : Array[Double], constraints : OperatingConstraints) -> OperatingPointfn evaluate_scenario_matrix(inlet_temperature : Double, flows : Array[Double], targets : Array[Double]) -> ScenarioMatrixfn evaluate_scenario_point(inlet_temperature : Double, flow : Double, target_temperature : Double) -> ScenarioPointfn evaporative_cooling_duty(dry_air_mass_flow_kg_per_s : Double, from_temperature_c : Double, to_temperature_c : Double, from_ratio : Double, to_ratio : Double) -> Doublefn exchanger_area_m2(duty_w : Double, overall_u_w_per_m2_k : Double, lmtd_k : Double, correction_factor : Double) -> Doublefn exchanger_overdesign_area_m2(required_area_m2 : Double, overdesign_fraction : Double) -> Doublefn feedwater_pump_work_w(mass_flow_kg_per_s : Double, pressure_rise_kpa : Double, density_kg_per_m3 : Double, efficiency : Double) -> Doublefn finite_difference(value_minus : Double, value_plus : Double, step : Double) -> Doublefn first_order_response(initial_value : Double, target_value : Double, time_s : Double, time_constant_s : Double) -> Doublefn flash_vaporize(feed : Stream, vapor_substance : Substance, liquid_substance : Substance, vapor_fraction : Double, temperature : Double) -> FlashResultfn heat_exchanger(hot_in : Stream, hot_out_temperature : Double, cold_in : Stream, cold_out_temperature : Double, arrangement? : FlowArrangement) -> HeatExchangerResultfn heat_exchanger_temperatures_valid(hot_in_c : Double, hot_out_c : Double, cold_in_c : Double, cold_out_c : Double, minimum_approach_c : Double) -> Boolfn heat_loss_to_ambient(area_m2 : Double, overall_u_w_per_m2_k : Double, process_temperature_c : Double, ambient_temperature_c : Double) -> Doublefn heat_recovery_fraction(recovered_duty_kw : Double, available_hot_duty_kw : Double) -> Doublefn heater_duty_sensitivity(inlet : Stream, target_temperature : Double, step : Double) -> SensitivityPointfn heater_sensitivity_table(inlet : Stream, target_temperatures : Array[Double], step : Double) -> Array[SensitivityPoint]fn heating_coil_point(inlet : PsychrometricPoint, target_temperature_c : Double) -> PsychrometricPointfn humidification_point(inlet : PsychrometricPoint, target_humidity_ratio : Double) -> PsychrometricPointfn humidification_water_duty(dry_air_mass_flow_kg_per_s : Double, from_ratio : Double, to_ratio : Double) -> Doublefn humidity_ratio_from_relative_humidity(dry_bulb_c : Double, relative_humidity : Double, total_pressure_kpa : Double) -> Doublefn humidity_ratio_from_vapor_pressure(vapor_pressure_kpa : Double, total_pressure_kpa : Double) -> Doublefn inflation_adjusted_cost(base_cost : Double, inflation_rate : Double, years : Int) -> Doublefn interpolate_table(lower_x : Double, lower_y : Double, upper_x : Double, upper_y : Double, x : Double) -> SteamTableResultfn kinetic_profile(model : KineticModel, initial_concentration : Double, temperature_k : Double, step_s : Double, points : Int) -> Array[KineticPoint]fn least_cost_heating_service(duty_w : Double, candidates : Array[UtilityDesign], operating_hours_per_year : Double, unit_cost_per_kwh : Double) -> CostEstimatefn levelized_cost(capital_cost : Double, annual_operating_cost : Double, annual_output_kwh : Double, lifetime_years : Int) -> Doublefn linear_cost_model(flow_kg_per_s : Double, duty_w : Double, utility_price_per_kwh : Double, demand_charge_per_kw : Double) -> Doublefn linear_duty_model(inlet_temperature_k : Double, target_temperature_k : Double, flow_kg_per_s : Double, heat_capacity_j_per_kg_k : Double) -> Doublefn linear_emissions_model(duty_w : Double, emission_factor_kg_per_kwh : Double) -> Doublefn liters_per_minute_to_cubic_meters_per_second(value : Double) -> Doublefn lmtd(hot_in_temperature : Double, hot_out_temperature : Double, cold_in_temperature : Double, cold_out_temperature : Double, arrangement? : FlowArrangement) -> Doublefn maintenance_cost_per_year(capital_cost : Double, maintenance_fraction : Double) -> Doublefn make_operating_envelope(points : Array[OperatingPoint], constraints : OperatingConstraints) -> OperatingEnvelopefn mass_flow_to_molar_flow(mass_flow_kg_per_s : Double, molar_mass_g_per_mol : Double) -> Doublefn mass_transfer_sherwood(reynolds : Double, schmidt : Double) -> Doublefn match_heat_streams(hot : ThermalStreamTarget, cold : ThermalStreamTarget, minimum_approach_c : Double) -> HeatRecoveryMatchfn mix_air_points(first : PsychrometricPoint, first_mass_flow_kg_per_s : Double, second : PsychrometricPoint, second_mass_flow_kg_per_s : Double) -> PsychrometricPointfn moist_air_density(dry_bulb_c : Double, humidity_ratio : Double, total_pressure_kpa : Double) -> Doublefn moist_air_enthalpy_from_rh(dry_bulb_c : Double, relative_humidity : Double, total_pressure_kpa : Double) -> Doublefn moist_air_enthalpy_kj_per_kg_dry(dry_bulb_c : Double, humidity_ratio : Double) -> Doublefn moist_air_specific_volume(dry_bulb_c : Double, humidity_ratio : Double, total_pressure_kpa : Double) -> Doublefn moisture_mass_flow(dry_air_mass_flow_kg_per_s : Double, humidity_ratio : Double) -> Doublefn moisture_removal_rate(inlet_ratio : Double, outlet_ratio : Double, dry_air_mass_flow_kg_per_s : Double) -> Doublefn molar_flow_to_mass_flow(molar_flow_mol_per_s : Double, molar_mass_g_per_mol : Double) -> Doublefn nearest_feasible_operating_point(envelope : OperatingEnvelope, target : OperatingPoint) -> OperatingPoint?fn nearest_operating_point(envelope : OperatingEnvelope, target : OperatingPoint) -> OperatingPoint?fn nusselt_dittus_boelter(reynolds : Double, prandtl : Double, exponent : Double) -> Doublefn operating_point(temperature_k : Double, flow_kg_per_s : Double, pressure_kpa : Double, duty_w : Double, cost_per_h : Double, emissions_kg_per_h : Double, score : Double, constraints : OperatingConstraints) -> OperatingPointfn operating_point_margin_cost(point : OperatingPoint, constraints : OperatingConstraints) -> Doublefn operating_point_margin_duty(point : OperatingPoint, constraints : OperatingConstraints) -> Doublefn operating_point_margin_flow(point : OperatingPoint, constraints : OperatingConstraints) -> Doublefn operating_point_margin_pressure(point : OperatingPoint, constraints : OperatingConstraints) -> Doublefn operating_point_margin_temperature(point : OperatingPoint, constraints : OperatingConstraints) -> Doublefn operating_point_minimum_margin(point : OperatingPoint, constraints : OperatingConstraints) -> Doublefn operating_point_status(temperature_k : Double, flow_kg_per_s : Double, pressure_kpa : Double, duty_w : Double, cost_per_h : Double, constraints : OperatingConstraints) -> EnvelopeStatusfn operating_point_weighted_distance(first : OperatingPoint, second : OperatingPoint, temperature_weight : Double, flow_weight : Double, pressure_weight : Double) -> Doublefn operating_point_with_cost(point : OperatingPoint, cost_per_h : Double, emissions_kg_per_h : Double, constraints : OperatingConstraints) -> OperatingPointfn operating_point_with_duty(point : OperatingPoint, duty_w : Double, cost_per_h : Double, emissions_kg_per_h : Double, constraints : OperatingConstraints) -> OperatingPointfn operating_point_with_process_state(point : OperatingPoint, temperature_k : Double, flow_kg_per_s : Double, pressure_kpa : Double, constraints : OperatingConstraints) -> OperatingPointfn overall_heat_transfer_coefficient(inside_h_w_per_m2_k : Double, wall_resistance_m2_k_per_w : Double, outside_h_w_per_m2_k : Double, fouling_resistance_m2_k_per_w : Double) -> Doublefn parallel_equipment_count(required_capacity : Double, unit_capacity : Double) -> Intfn parallel_lmtd(hot_in_temperature : Double, hot_out_temperature : Double, cold_in_temperature : Double, cold_out_temperature : Double) -> Doublefn pfr_conversion(model : KineticModel, residence_time_s : Double, temperature_k : Double) -> Doublefn phase_change_heat(substance : Substance, molar_flow : Double, from_temperature : Double, to_temperature : Double) -> Doublefn pinch_targets(hot_streams : Array[ThermalStreamTarget], cold_streams : Array[ThermalStreamTarget], minimum_approach_c : Double) -> PinchTargetsfn pipe_heat_transfer_coefficient(diameter_m : Double, velocity_m_per_s : Double, fluid : FluidProperties) -> Doublefn pipe_velocity_m_per_s(volumetric_flow_m3_per_s : Double, diameter_m : Double) -> Doublefn point_dominates(first : OperatingPoint, second : OperatingPoint, minimize_cost : Bool, minimize_duty : Bool, minimize_emissions : Bool) -> Boolfn point_from_humidity_ratio(dry_bulb_c : Double, humidity_ratio : Double, pressure_kpa : Double) -> PsychrometricPointfn pressure_drop_pa(density_kg_per_m3 : Double, diameter_m : Double, length_m : Double, roughness_m : Double, viscosity_pa_s : Double) -> Doublefn pressure_from_saturation_temperature_c(temperature_c : Double) -> Doublefn pressure_loss_duty(flow_kg_per_s : Double, pressure_kpa : Double, efficiency : Double) -> Doublefn propagate_network(source : Stream, connections : Array[NetworkConnection], max_iterations : Int) -> NetworkResultfn propagated_product_uncertainty(first_value : Double, first_relative_uncertainty : Double, second_value : Double, second_relative_uncertainty : Double) -> UncertaintyEnvelopefn propagated_sum_uncertainty(first_value : Double, first_absolute_uncertainty : Double, second_value : Double, second_absolute_uncertainty : Double) -> UncertaintyEnvelopefn psychrometric_point(dry_bulb_c : Double, relative_humidity : Double, pressure_kpa : Double) -> PsychrometricPointfn pump_power_w(mass_flow_kg_per_s : Double, pressure_rise_pa : Double, efficiency : Double) -> Doublefn ramp_plan(points : Array[OperatingPoint], maximum_temperature_rate_k_per_s : Double, maximum_flow_rate_kg_per_s2 : Double) -> RampPlanfn ramp_step_time_s(first : OperatingPoint, second : OperatingPoint, maximum_temperature_rate_k_per_s : Double, maximum_flow_rate_kg_per_s2 : Double) -> Doublefn rankine_cycle(boiler_temperature_c : Double, condenser_pressure_kpa : Double, mass_flow_kg_per_s : Double, turbine_efficiency : Double, pump_efficiency : Double) -> RankineCycleResultfn reaction_balance(inlet : Array[SpeciesRate], terms : Array[ReactionTerm], requested_extent : Double) -> ReactionBalancefn reaction_conversion(initial_molar_flow : Double, coefficient : Double, extent_mol_per_s : Double) -> Doublefn reaction_conversion_for_species(inlet : Array[SpeciesRate], outlet : Array[SpeciesRate], species_id : String) -> Doublefn reaction_extent_for_conversion(initial_molar_flow : Double, coefficient : Double, conversion : Double) -> Doublefn reaction_heat_per_mass(terms : Array[ReactionTerm], extent_mol_per_s : Double, total_mass_flow_kg_per_s : Double) -> Doublefn reaction_outlet_temperature(inlet_temperature : Double, heat_capacity_flow_w_per_k : Double, duty_w : Double) -> Doublefn reaction_selectivity(outlet : Array[SpeciesRate], desired_id : String, byproduct_id : String) -> Doublefn reaction_yield(inlet : Array[SpeciesRate], outlet : Array[SpeciesRate], reactant_id : String, product_id : String, product_coefficient : Double, reactant_coefficient : Double) -> Doublefn relative_humidity_from_ratio(dry_bulb_c : Double, humidity_ratio : Double, total_pressure_kpa : Double) -> Doublefn relative_uncertainty_envelope(nominal : Double, relative_uncertainty : Double) -> UncertaintyEnvelopefn residence_time_for_conversion(model : KineticModel, conversion : Double, temperature_k : Double) -> Doublefn response_time_to_fraction(time_constant_s : Double, fraction : Double) -> Doublefn reynolds_number(density_kg_per_m3 : Double, velocity_m_per_s : Double, diameter_m : Double, viscosity_pa_s : Double) -> Doublefn reynolds_number_for_fluid(fluid : FluidProperties, velocity_m_per_s : Double, diameter_m : Double) -> Doublefn run_air_drying_case(dry_air_mass_flow_kg_per_s : Double, inlet_temperature_c : Double, inlet_relative_humidity : Double, outlet_temperature_c : Double, outlet_relative_humidity : Double) -> CaseStudyResultfn run_natural_gas_case(molar_flow_mol_per_s : Double, inlet_temperature_k : Double, outlet_temperature_k : Double) -> CaseStudyResultfn run_water_preheat_case(mass_flow_kg_per_s : Double, inlet_temperature_k : Double, outlet_temperature_k : Double) -> CaseStudyResultfn saturated_liquid_enthalpy_kj_per_kg(temperature_c : Double) -> Doublefn saturated_liquid_entropy_kj_per_kg_k(temperature_c : Double) -> Doublefn saturated_liquid_specific_volume_m3_per_kg(temperature_c : Double) -> Doublefn saturated_vapor_enthalpy_kj_per_kg(temperature_c : Double) -> Doublefn saturated_vapor_specific_volume_m3_per_kg(temperature_c : Double, pressure_kpa : Double) -> Doublefn saturated_water_density_kg_per_m3(temperature_c : Double) -> Doublefn scan_operating_envelope(temperatures_k : Array[Double], flows_kg_per_s : Array[Double], pressures_kpa : Array[Double], duty_model : (Double, Double, Double) -> Double, cost_model : (Double, Double, Double, Double) -> Double, emissions_model : (Double, Double, Double, Double) -> Double, constraints : OperatingConstraints) -> OperatingEnvelopefn schmidt_number(viscosity_pa_s : Double, density_kg_per_m3 : Double, diffusivity_m2_per_s : Double) -> Doublefn select_operating_point(envelope : OperatingEnvelope, direction : ObjectiveDirection, objective : (OperatingPoint) -> Double, explanation : String) -> EnvelopeSelection?fn sensible_heat(substance : Substance, molar_flow : Double, from_temperature : Double, to_temperature : Double) -> Doublefn sensible_heat_ratio(sensible_duty_w : Double, total_duty_w : Double) -> Doublefn service_cost_estimate(utility : UtilityDesign, operating_hours_per_year : Double, unit_cost_per_kwh : Double, emission_factor_kg_per_kwh : Double) -> CostEstimatefn simulate_lumped_heating(initial_temperature_k : Double, target_temperature_k : Double, heat_capacity_j_per_k : Double, overall_u_w_per_k : Double, step_s : Double, points : Int) -> Array[DynamicThermalState]fn size_heater(process_duty_w : Double, approach_k : Double, overall_u_w_per_m2_k : Double, design_efficiency : Double) -> HeaterSizingfn size_pump(flow_m3_per_s : Double, pressure_rise_pa : Double, density_kg_per_m3 : Double, efficiency : Double) -> PumpSizingfn size_tank(volumetric_flow_m3_per_s : Double, residence_time_s : Double, working_fraction : Double) -> TankSizingfn snapshot_relative_change(first : Double, second : Double) -> Doublefn solve_recycle_temperature(feed_temperature : Double, recycle_gain : Double, max_iterations : Int, tolerance : Double) -> ConvergenceResultfn stable_time_step(overall_u_w_per_k : Double, heat_capacity_j_per_k : Double, requested_step_s : Double) -> Doublefn steady_state_balance(inlets : Array[Stream], outlets : Array[Stream], terms? : BalanceTerms) -> BalanceResultfn steam_density_kg_per_m3(temperature_c : Double, pressure_kpa : Double) -> Doublefn steam_mass_flow_for_duty(duty_w : Double, pressure_kpa : Double, quality_in : Double, quality_out : Double) -> Doublefn steam_saturation_temperature_c(pressure_kpa : Double) -> Doublefn steam_utility(mass_flow_kg_per_s : Double, inlet_temperature_c : Double, outlet_temperature_c : Double) -> UtilityDesignfn steam_volume_flow_m3_per_s(mass_flow_kg_per_s : Double, temperature_c : Double, pressure_kpa : Double) -> Doublefn sweep_heater_targets(inlet : Stream, start_temperature : Double, end_temperature : Double, step : Double) -> SensitivitySweepfn table_quality_from_enthalpy(pressure_kpa : Double, enthalpy_kj_per_kg : Double) -> SteamTableResultfn target_temperature_for_duty(inlet : Stream, target_duty : Double, lower_temperature : Double, upper_temperature : Double) -> Doublefn temperature_from_sensible_heat(substance : Substance, from_temperature : Double, heat_per_mole : Double, upper_temperature : Double) -> Doublefn thermal_oil_utility(duty_w : Double, inlet_temperature_c : Double, outlet_temperature_c : Double, cp_j_per_kg_k : Double) -> UtilityDesignfn thermal_time_constant_s(overall_u_w_per_k : Double, heat_capacity_j_per_k : Double) -> Doublefn tolerance_for_scale(scale : Double, relative_tolerance : Double, absolute_floor : Double) -> Doublefn total_annual_cost(annualized_capital : Double, utility_cost_per_hour : Double, operating_hours_per_year : Double) -> Doublefn total_molar_heat(substance : Substance, from_temperature : Double, to_temperature : Double) -> Doublefn turbine_expand(inlet : SteamState, outlet_pressure_kpa : Double, isentropic_efficiency : Double) -> TurbineExpansionResultfn uncertainty_margin(nominal : Double, low : Double, high : Double) -> Doublefn utility_emissions_kg_per_h(utility : UtilityDesign, emission_factor_kg_per_kwh : Double) -> Doublefn utility_energy_kwh_per_year(utility : UtilityDesign, operating_hours_per_year : Double) -> Doublefn utility_estimate(name~ : String, duty~ : Double, cp~ : Double, inlet_temperature~ : Double, outlet_temperature~ : Double) -> UtilityEstimatefn utility_operating_cost(utility : UtilityDesign, operating_hours_per_year : Double, unit_cost_per_kwh : Double) -> Doublefn utility_target_after_recovery(process_duty_kw : Double, recovered_duty_kw : Double) -> Doublefn validate_temperature_range(temperatures : Array[Double], lower_k : Double, upper_k : Double) -> Intfn vapor_pressure_from_humidity_ratio(humidity_ratio : Double, total_pressure_kpa : Double) -> Doublefn water_heat_capacity_j_per_kg_k(temperature_c : Double) -> Doublefn water_thermal_conductivity_w_per_m_k(temperature_c : Double) -> Doublefn weighted_operating_score(point : OperatingPoint, cost_weight : Double, duty_weight : Double, emissions_weight : Double, cost_scale : Double, duty_scale : Double, emissions_scale : Double) -> Doublefn wet_bulb_c(dry_bulb_c : Double, humidity_ratio : Double, total_pressure_kpa : Double) -> Doublefn within_tolerance(actual : Double, expected : Double, tolerance : Double) -> Boolfn worst_case_interval(values : Array[Double], relative_uncertainty : Double) -> UncertaintyEnvelopeInstall
Download zipA MoonBit library for process energy balance, thermodynamic property estimates, equipment screening, reaction heat, and process analysis.