moonbit-chemreport

A MoonBit-native report layer for chemical engineering calculations.

chemistry
report
engineering
markdown
html
json
moon add lllg123/moonbit-chemreport@0.3.0
Download zip
Author
Version
0.3.0
License
Apache-2.0
Last updated
38 minutes ago
Downloads
4
README

#moonbit-chemreport

moonbit-chemreport is a MoonBit-native reporting and engineering calculation layer for process engineering software. It turns assumptions, inputs, formulas, balances, results, warnings, sources, and scenario sweeps into one deterministic model for people, scripts, and CI.

#Project positioning

The package is an integration layer, not a process simulator or a thermodynamic property database. It is designed for reactor, distillation, absorption, heat-exchanger, pump, and mass-balance packages that need reproducible calculation evidence and consistent exports.

#Core capabilities

  • Typed ChemReport model with validation and quality gates.
  • Markdown, HTML, JSON, CSV, and table exports from shared data.
  • Unit-aware quantities with dimensional compatibility checks and temperature validation.
  • Material and energy balance closure, recovery, residual, and limiting-component analysis.
  • Reactor, distillation, heat-exchanger, pump, pressure-drop, and safety-review calculations.
  • Statistical summaries, percentiles, moving averages, control limits, and deterministic sweeps.
  • Batch reporting, report comparison, diagnostics, and export benchmarks.

#Quick start

moon update moon check --target all --deny-warn moon test --target all --deny-warn moon run cmd/main

The package has no runtime dependency outside the MoonBit standard toolchain. The CLI prints a Markdown preview followed by the same report encoded as JSON.

#CLI

moon run cmd/main

The CLI is intentionally small: it exercises the public package as a consumer would, keeping the example aligned with the library API.

#Architecture

AreaFilesResponsibility
Domain modelmoonbit-chemreport.mbtReport records, enums, and constructors
Exportersmarkdown_export.mbt, html_export.mbt, json_export.mbt, table.mbtDeterministic human and machine output
Engineering mathunits.mbt, balance.mbt, process_calculations.mbtUnits, balances, equipment and safety calculations
Scenario analysisanalytics.mbt, scenario_engine.mbtStatistics, control limits, sweeps, and sensitivity
Qualityvalidate.mbt, quality.mbt, diagnostics.mbtValidation, diagnostics, regression and publish gates
Integrationreport_pipeline.mbt, benchmark.mbtBuilders, batches, and reproducible export measurements

Public concrete types live in the root package so downstream packages can construct and inspect them without depending on internal implementation paths.

#Benchmark

The benchmark is executable and measures the bytes produced by all three primary exporters over a chosen number of iterations:

let result = benchmark_exports([example_chemreport()], 100)
println(result.to_markdown())

It reports Markdown, HTML, JSON, total, and average bytes. This is an export-size proxy, not a claim about a particular machine's wall-clock performance; run it in the target CI environment when comparing revisions.

#Testing

Tests cover public behavior and boundary cases including incompatible units, absolute-zero validation, balance tolerance, empty and singleton statistics, control-limit classification, HTML/Markdown/CSV escaping, quality gates, and benchmark reproducibility.

moon test --target all --deny-warn moon test --target native --enable-coverage moon coverage report -f summary moon coverage analyze

#CI

.github/workflows/check.yml runs on Ubuntu, macOS, and Windows. Each job installs the current stable MoonBit CLI, updates dependencies, checks all targets, runs tests including native tests and coverage, verifies formatting and generated interfaces, and exercises the CLI.

moon info output is checked into the change review so accidental public API changes remain visible.

#License

Apache-2.0. See LICENSE.

#
Assumption

pub struct Assumption {
statement : String
impact : String
} derive(Eq,
Debug
)

#
BatchReport

pub struct BatchReport {
reports : Array[ChemReport]
labels : Array[String]
} derive(Eq,
Debug
)

#
BatchReport::all_formats

fn BatchReport::all_formats(self : BatchReport) -> Array[ExportBundle]

#
BatchReport::benchmark

fn BatchReport::benchmark(self : BatchReport, iterations : Int) -> BenchmarkResult

#
BatchReport::count

fn BatchReport::count(self : BatchReport) -> Int

#
BatchReport::critical_count

fn BatchReport::critical_count(self : BatchReport) -> Int

#
BatchReport::invalid_count

fn BatchReport::invalid_count(self : BatchReport) -> Int

#
BatchReport::result_count

fn BatchReport::result_count(self : BatchReport) -> Int

#
BatchReport::summary

fn BatchReport::summary(self : BatchReport) -> String

#
BatchReport::to_json

fn BatchReport::to_json(self : BatchReport) -> String

#
BatchReport::to_markdown

fn BatchReport::to_markdown(self : BatchReport) -> String

#
BatchReport::valid_count

fn BatchReport::valid_count(self : BatchReport) -> Int

#
BatchReport::warning_count

fn BatchReport::warning_count(self : BatchReport) -> Int

#
BenchmarkResult

pub struct BenchmarkResult {
iterations : Int
reports : Int
markdown_bytes : Int
html_bytes : Int
json_bytes : Int
} derive(Eq,
Debug
)

#
BenchmarkResult::average_bytes

fn BenchmarkResult::average_bytes(self : BenchmarkResult) -> Float

#
BenchmarkResult::to_markdown

fn BenchmarkResult::to_markdown(self : BenchmarkResult) -> String

#
BenchmarkResult::total_bytes

fn BenchmarkResult::total_bytes(self : BenchmarkResult) -> Int

#
ChemReport

pub struct ChemReport {
metadata : ReportMetadata
summary : String
assumptions : Array[Assumption]
inputs : Array[InputValue]
formulas : Array[FormulaNote]
results : Array[ResultValue]
warnings : Array[WarningNote]
sources : Array[SourceRef]
sections : Array[ReportSection]
tags : Array[String]
} derive(Eq,
Debug
)

#
ChemReport::diagnostics

fn ChemReport::diagnostics(self : ChemReport) -> DiagnosticReport

#
ChemReport::export_table

fn ChemReport::export_table(self : ChemReport) -> ReportTable

#
ChemReport::format

fn ChemReport::format(self : ChemReport, format : String) -> String

#
ChemReport::format_names

fn ChemReport::format_names(_self : ChemReport) -> Array[String]

#
ChemReport::has_blocking_diagnostics

fn ChemReport::has_blocking_diagnostics(self : ChemReport) -> Bool

#
ChemReport::has_tag

fn ChemReport::has_tag(self : ChemReport, tag : String) -> Bool

#
ChemReport::is_publish_ready

fn ChemReport::is_publish_ready(self : ChemReport) -> Bool

#
ChemReport::render_all_formats

fn ChemReport::render_all_formats(self : ChemReport) -> ExportBundle

#
ChemReport::result_names

fn ChemReport::result_names(self : ChemReport) -> Array[String]

#
ChemReport::source_table

fn ChemReport::source_table(self : ChemReport) -> ReportTable

#
ChemReport::to_html

fn ChemReport::to_html(self : ChemReport) -> String

#
ChemReport::to_json

fn ChemReport::to_json(self : ChemReport) -> String

#
ChemReport::to_markdown

fn ChemReport::to_markdown(self : ChemReport) -> String

#
ChemReport::validate

fn ChemReport::validate(self : ChemReport) -> Array[ValidationIssue]

#
ChemReport::warning_count

fn ChemReport::warning_count(self : ChemReport, severity : WarningSeverity) -> Int

#
ChemReport::warning_table

fn ChemReport::warning_table(self : ChemReport) -> ReportTable

#
ChemReport::with_metadata

fn ChemReport::with_metadata(self : ChemReport, metadata : ReportMetadata) -> ChemReport

#
ChemReport::with_results

fn ChemReport::with_results(self : ChemReport, results : Array[ResultValue]) -> ChemReport

#
ChemReport::with_sources

fn ChemReport::with_sources(self : ChemReport, sources : Array[SourceRef]) -> ChemReport

#
ChemReport::with_summary

fn ChemReport::with_summary(self : ChemReport, summary : String) -> ChemReport

#
ChemReport::with_tag

fn ChemReport::with_tag(self : ChemReport, tag : String) -> ChemReport

#
ChemReport::with_warnings

fn ChemReport::with_warnings(self : ChemReport, warnings : Array[WarningNote]) -> ChemReport

#
ChemReport::without_critical_warnings

fn ChemReport::without_critical_warnings(self : ChemReport) -> ChemReport

#
ComponentBalance

pub struct ComponentBalance {
component : String
inlet : Float
outlet : Float
net : Float
relative_error : Float
} derive(Eq,
Debug
)

#
ComponentFlow

pub struct ComponentFlow {
component : String
value : Float
unit : MeasureUnit
} derive(Eq,
Debug
)

#
ControlLimits

pub struct ControlLimits {
center : Float
upper : Float
lower : Float
} derive(Eq,
Debug
)

#
ControlLimits::contains

fn ControlLimits::contains(self : ControlLimits, value : Float) -> Bool

#
ControlLimits::flag

fn ControlLimits::flag(self : ControlLimits, values : Array[Float]) -> Array[ObservationFlag]

#
Diagnostic

pub struct Diagnostic {
code : String
severity : DiagnosticSeverity
path : String
message : String
remediation : String
} derive(Eq,
Debug
)

#
Diagnostic::is_blocking

fn Diagnostic::is_blocking(self : Diagnostic) -> Bool

#
Diagnostic::level

fn Diagnostic::level(self : Diagnostic) -> String

#
DiagnosticReport

pub struct DiagnosticReport {
diagnostics : Array[Diagnostic]
passed : Bool
} derive(Eq,
Debug
)

#
DiagnosticReport::blocking_count

fn DiagnosticReport::blocking_count(self : DiagnosticReport) -> Int

#
DiagnosticReport::count

fn DiagnosticReport::count(self : DiagnosticReport) -> Int

#
DiagnosticReport::errors

#
DiagnosticReport::to_markdown

fn DiagnosticReport::to_markdown(self : DiagnosticReport) -> String

#
DiagnosticReport::warnings

#
DiagnosticSeverity

pub enum DiagnosticSeverity {
DiagHint
DiagWarning
DiagError
DiagBlocker
} derive(Eq,
Debug
)

#
DistillationCase

pub struct DistillationCase {
feed_rate : Float
feed_fraction : Float
distillate_rate : Float
distillate_fraction : Float
bottoms_rate : Float
bottoms_fraction : Float
reflux_ratio : Float
stages : Int
} derive(Eq,
Debug
)

#
DistillationCase::component_balance

fn DistillationCase::component_balance(self : DistillationCase) -> Float

#
DistillationCase::is_closed

fn DistillationCase::is_closed(self : DistillationCase, tolerance? : Float) -> Bool

#
DistillationCase::minimum_stages

fn DistillationCase::minimum_stages(self : DistillationCase) -> Int

#
DistillationCase::recovery

fn DistillationCase::recovery(self : DistillationCase) -> Float

#
DistillationCase::total_balance

fn DistillationCase::total_balance(self : DistillationCase) -> Float

#
EnergyBalance

pub struct EnergyBalance {
inlet : Float
outlet : Float
residual : Float
streams : Array[EnergyStream]
} derive(Eq,
Debug
)

#
EnergyBalance::is_closed

fn EnergyBalance::is_closed(self : EnergyBalance, tolerance? : Float) -> Bool

#
EnergyBalance::specific_duty

fn EnergyBalance::specific_duty(self : EnergyBalance, mass : Quantity) -> Result[Quantity, QuantityError]

#
EnergyStream

pub struct EnergyStream {
name : String
duty : Quantity
direction : StreamDirection
} derive(Eq,
Debug
)

#
ExportBundle

pub struct ExportBundle {
markdown : String
html : String
json : String
} derive(Eq,
Debug
)

#
FormulaNote

pub struct FormulaNote {
name : String
expression : String
explanation : String
} derive(Eq,
Debug
)

#
HeatExchangerCase

pub struct HeatExchangerCase {
hot_inlet : Float
hot_outlet : Float
cold_inlet : Float
cold_outlet : Float
hot_capacity_rate : Float
cold_capacity_rate : Float
area : Float
overall_u : Float
} derive(Eq,
Debug
)

#
HeatExchangerCase::area_margin

fn HeatExchangerCase::area_margin(self : HeatExchangerCase) -> Float

#
HeatExchangerCase::cold_duty

fn HeatExchangerCase::cold_duty(self : HeatExchangerCase) -> Float

#
HeatExchangerCase::duty_residual

fn HeatExchangerCase::duty_residual(self : HeatExchangerCase) -> Float

#
HeatExchangerCase::effectiveness

fn HeatExchangerCase::effectiveness(self : HeatExchangerCase) -> Float

#
HeatExchangerCase::estimated_area

fn HeatExchangerCase::estimated_area(self : HeatExchangerCase) -> Float

#
HeatExchangerCase::hot_duty

fn HeatExchangerCase::hot_duty(self : HeatExchangerCase) -> Float

#
InputValue

pub struct InputValue {
name : String
value : String
unit : String?
note : String?
} derive(Eq,
Debug
)

#
MaterialBalance

pub struct MaterialBalance {
components : Array[ComponentBalance]
total_inlet : Float
total_outlet : Float
} derive(Eq,
Debug
)

#
MaterialBalance::closure_percent

fn MaterialBalance::closure_percent(self : MaterialBalance) -> Float

#
MaterialBalance::component

fn MaterialBalance::component(self : MaterialBalance, name : String) -> ComponentBalance?

#
MaterialBalance::is_closed

fn MaterialBalance::is_closed(self : MaterialBalance, tolerance? : Float) -> Bool

#
MaterialBalance::limiting_component

fn MaterialBalance::limiting_component(self : MaterialBalance) -> String?

#
MaterialBalance::to_markdown

fn MaterialBalance::to_markdown(self : MaterialBalance) -> String

#
MaterialProperty

pub struct MaterialProperty {
name : String
molecular_weight : Float
density : Float
heat_capacity : Float
boiling_point : Float
safety_limit : Float
} derive(Eq,
Debug
)

#
MaterialProperty::is_valid

fn MaterialProperty::is_valid(self : MaterialProperty) -> Bool

#
MaterialProperty::thermal_capacity

fn MaterialProperty::thermal_capacity(self : MaterialProperty, mass : Float) -> Float

#
MeasureUnit

pub enum MeasureUnit {
Kilogram
Gram
Tonne
KgPerHour
Mol
Kmol
Liter
CubicMeter
CubicMeterPerHour
Meter
Pascal
KiloPascal
Bar
Joule
KiloJoule
KiloWatt
Celsius
Kelvin
Second
Minute
Hour
Percent
Ratio
} derive(Eq,
Debug
)

#
MeasureUnit::dimension

fn MeasureUnit::dimension(self : MeasureUnit) -> UnitDimension

#
MeasureUnit::symbol

fn MeasureUnit::symbol(self : MeasureUnit) -> String

#
ObservationFlag

pub enum ObservationFlag {
NormalObservation
AboveControlLimit
BelowControlLimit
} derive(Eq,
Debug
)

#
PressureDropCase

pub struct PressureDropCase {
length : Float
diameter : Float
velocity : Float
density : Float
viscosity : Float
roughness : Float
fittings_k : Float
} derive(Eq,
Debug
)

#
PressureDropCase::friction_factor

fn PressureDropCase::friction_factor(self : PressureDropCase) -> Float

#
PressureDropCase::major_loss

fn PressureDropCase::major_loss(self : PressureDropCase) -> Float

#
PressureDropCase::minor_loss

fn PressureDropCase::minor_loss(self : PressureDropCase) -> Float

#
PressureDropCase::reynolds

fn PressureDropCase::reynolds(self : PressureDropCase) -> Float

#
PressureDropCase::total_loss

fn PressureDropCase::total_loss(self : PressureDropCase) -> Float

#
ProcessStream

pub struct ProcessStream {
name : String
direction : StreamDirection
components : Array[ComponentFlow]
} derive(Eq,
Debug
)

#
PumpCase

pub struct PumpCase {
flow_rate : Float
differential_pressure : Float
efficiency : Float
fluid_density : Float
installed_power : Float
} derive(Eq,
Debug
)

#
PumpCase::hydraulic_power

fn PumpCase::hydraulic_power(self : PumpCase) -> Float

#
PumpCase::is_overloaded

fn PumpCase::is_overloaded(self : PumpCase) -> Bool

#
PumpCase::power_margin

fn PumpCase::power_margin(self : PumpCase) -> Float

#
PumpCase::shaft_power

fn PumpCase::shaft_power(self : PumpCase) -> Float

#
PumpCase::specific_speed

fn PumpCase::specific_speed(self : PumpCase, head : Float) -> Float

#
QualityGate

pub struct QualityGate {
passed : Bool
blockers : Array[String]
notices : Array[String]
} derive(Eq,
Debug
)

#
Quantity

pub struct Quantity {
value : Float
unit : MeasureUnit
} derive(Eq,
Debug
)

#
Quantity::add

fn Quantity::add(self : Quantity, other : Quantity) -> Result[Quantity, QuantityError]

#
Quantity::convert_to

fn Quantity::convert_to(self : Quantity, target : MeasureUnit) -> Result[Float, QuantityError]

#
Quantity::format

fn Quantity::format(self : Quantity, decimals : Int) -> String

#
Quantity::in_unit

fn Quantity::in_unit(self : Quantity, target : MeasureUnit) -> Result[Quantity, QuantityError]

#
Quantity::scale

fn Quantity::scale(self : Quantity, factor : Float) -> Quantity

#
Quantity::subtract

fn Quantity::subtract(self : Quantity, other : Quantity) -> Result[Quantity, QuantityError]

#
Quantity::validate

fn Quantity::validate(self : Quantity) -> Result[MeasureUnit, QuantityError]

#
QuantityError

pub enum QuantityError {
IncompatibleDimensions(UnitDimension, UnitDimension)
BelowAbsoluteZero
InvalidValue
} derive(Eq,
Debug
)

#
ReactorCase

pub struct ReactorCase {
name : String
feed : Float
product : Float
byproduct : Float
residence_time : Float
temperature : Float
pressure : Float
} derive(Eq,
Debug
)

#
ReactorCase::conversion

fn ReactorCase::conversion(self : ReactorCase) -> Float

#
ReactorCase::is_safe

fn ReactorCase::is_safe(self : ReactorCase, temperature_limit : Float, pressure_limit : Float) -> Bool

#
ReactorCase::product_yield

fn ReactorCase::product_yield(self : ReactorCase) -> Float

#
ReactorCase::selectivity

fn ReactorCase::selectivity(self : ReactorCase) -> Float

#
ReactorCase::space_time_yield

fn ReactorCase::space_time_yield(self : ReactorCase) -> Float

#
ReportBuilder

pub struct ReportBuilder {
value : ChemReport
history : Array[String]
} derive(Eq,
Debug
)

#
ReportBuilder::add_assumption

fn ReportBuilder::add_assumption(self : ReportBuilder, statement : String, impact : String) -> ReportBuilder

#
ReportBuilder::add_formula

fn ReportBuilder::add_formula(self : ReportBuilder, name : String, expression : String, explanation : String) -> ReportBuilder

#
ReportBuilder::add_input

fn ReportBuilder::add_input(self : ReportBuilder, name : String, value : String, unit : String?, note : String?) -> ReportBuilder

#
ReportBuilder::add_result

fn ReportBuilder::add_result(self : ReportBuilder, name : String, value : String, unit : String?, status : ResultStatus, note : String?) -> ReportBuilder

#
ReportBuilder::add_section

fn ReportBuilder::add_section(self : ReportBuilder, title : String, kind : SectionKind, body : String) -> ReportBuilder

#
ReportBuilder::add_source

fn ReportBuilder::add_source(self : ReportBuilder, label : String, kind : SourceKind, url : String?, license : String?, note : String?) -> ReportBuilder

#
ReportBuilder::add_warning

fn ReportBuilder::add_warning(self : ReportBuilder, code : String, severity : WarningSeverity, summary : String, action : String) -> ReportBuilder

#
ReportBuilder::build

#
ReportBuilder::events

fn ReportBuilder::events(self : ReportBuilder) -> Array[String]

#
ReportBuilder::is_ready

fn ReportBuilder::is_ready(self : ReportBuilder) -> Bool

#
ReportBuilder::quality

fn ReportBuilder::quality(self : ReportBuilder) -> QualityGate

#
ReportBuilder::summary

fn ReportBuilder::summary(self : ReportBuilder, text : String) -> ReportBuilder

#
ReportBuilder::tag

fn ReportBuilder::tag(self : ReportBuilder, tag : String) -> ReportBuilder

#
ReportMetadata

pub struct ReportMetadata {
report_id : String
title : String
process_unit : String
scenario : String
generated_at : String
tool_version : String
} derive(Eq,
Debug
)

#
ReportSection

pub struct ReportSection {
title : String
kind : SectionKind
body : String
} derive(Eq,
Debug
)

#
ReportTable

pub struct ReportTable {
columns : Array[String]
rows : Array[Array[String]]
} derive(Eq,
Debug
)

#
ReportTable::column_count

fn ReportTable::column_count(self : ReportTable) -> Int

#
ReportTable::is_rectangular

fn ReportTable::is_rectangular(self : ReportTable) -> Bool

#
ReportTable::row_count

fn ReportTable::row_count(self : ReportTable) -> Int

#
ReportTable::to_csv

fn ReportTable::to_csv(self : ReportTable) -> String

#
ReportTable::to_html

fn ReportTable::to_html(self : ReportTable) -> String

#
ReportTable::to_markdown

fn ReportTable::to_markdown(self : ReportTable) -> String

#
ReportTable::validate

fn ReportTable::validate(self : ReportTable) -> Array[String]

#
ResultStatus

pub enum ResultStatus {
Normal
Flagged
Estimated
} derive(Eq,
Debug
)

#
ResultValue

pub struct ResultValue {
name : String
value : String
unit : String?
status : ResultStatus
note : String?
} derive(Eq,
Debug
)

#
SafetyReview

pub struct SafetyReview {
name : String
measured : Float
design_limit : Float
warning_fraction : Float
unit : String
} derive(Eq,
Debug
)

#
SafetyReview::is_exceeded

fn SafetyReview::is_exceeded(self : SafetyReview) -> Bool

#
SafetyReview::is_warning

fn SafetyReview::is_warning(self : SafetyReview) -> Bool

#
SafetyReview::status

fn SafetyReview::status(self : SafetyReview) -> String

#
SafetyReview::utilization

fn SafetyReview::utilization(self : SafetyReview) -> Float

#
ScenarioPoint

pub struct ScenarioPoint {
name : String
input : Float
output : Float
score : Float
status : ResultStatus
note : String
} derive(Eq,
Debug
)

#
ScenarioPoint::efficiency

fn ScenarioPoint::efficiency(self : ScenarioPoint) -> Float

#
ScenarioPoint::is_acceptable

fn ScenarioPoint::is_acceptable(self : ScenarioPoint, minimum_score : Float) -> Bool

#
ScenarioSeries

pub struct ScenarioSeries {
name : String
points : Array[ScenarioPoint]
input_unit : String
output_unit : String
} derive(Eq,
Debug
)

#
ScenarioSeries::acceptable

fn ScenarioSeries::acceptable(self : ScenarioSeries, minimum_score : Float) -> Array[ScenarioPoint]

#
ScenarioSeries::at

fn ScenarioSeries::at(self : ScenarioSeries, index : Int) -> ScenarioPoint?

#
ScenarioSeries::best

#
ScenarioSeries::count

fn ScenarioSeries::count(self : ScenarioSeries) -> Int

#
ScenarioSeries::flagged

#
ScenarioSeries::inputs

fn ScenarioSeries::inputs(self : ScenarioSeries) -> Array[Float]

#
ScenarioSeries::merge

#
ScenarioSeries::normalized

fn ScenarioSeries::normalized(self : ScenarioSeries) -> ScenarioSeries

#
ScenarioSeries::outputs

fn ScenarioSeries::outputs(self : ScenarioSeries) -> Array[Float]

#
ScenarioSeries::quality_gate

fn ScenarioSeries::quality_gate(self : ScenarioSeries, minimum_score : Float, maximum_flagged : Int) -> Bool

#
ScenarioSeries::report_section

fn ScenarioSeries::report_section(self : ScenarioSeries) -> ReportSection

#
ScenarioSeries::scores

fn ScenarioSeries::scores(self : ScenarioSeries) -> Array[Float]

#
ScenarioSeries::summary

#
ScenarioSeries::to_csv

fn ScenarioSeries::to_csv(self : ScenarioSeries) -> String

#
ScenarioSeries::to_markdown

fn ScenarioSeries::to_markdown(self : ScenarioSeries) -> String

#
ScenarioSeries::to_table

fn ScenarioSeries::to_table(self : ScenarioSeries) -> ReportTable

#
ScenarioSeries::with_point

fn ScenarioSeries::with_point(self : ScenarioSeries, point : ScenarioPoint) -> ScenarioSeries

#
ScenarioSeries::worst

#
SectionKind

pub enum SectionKind {
Context
Method
Safety
Notes
} derive(Eq,
Debug
)

#
SourceKind

pub enum SourceKind {
Standard
Datasheet
Literature
Internal
} derive(Eq,
Debug
)

#
SourceRef

pub struct SourceRef {
label : String
kind : SourceKind
url : String?
license : String?
note : String?
} derive(Eq,
Debug
)

#
Statistics

pub struct Statistics {
count : Int
minimum : Float
maximum : Float
mean : Float
variance : Float
standard_deviation : Float
sum : Float
} derive(Eq,
Debug
)

#
StreamDirection

pub enum StreamDirection {
Inlet
Outlet
} derive(Eq,
Debug
)

#
SweepConfig

pub struct SweepConfig {
start : Float
stop : Float
steps : Int
label : String
} derive(Eq,
Debug
)

#
SweepConfig::is_valid

fn SweepConfig::is_valid(self : SweepConfig) -> Bool

#
SweepConfig::values

fn SweepConfig::values(self : SweepConfig) -> Array[Float]

#
UnitDimension

pub enum UnitDimension {
Mass
Amount
Volume
Length
Pressure
Energy
Power
Temperature
Time
Dimensionless
} derive(Eq,
Debug
)

#
ValidationIssue

pub struct ValidationIssue {
path : String
message : String
} derive(Eq,
Debug
)

#
WarningNote

pub struct WarningNote {
code : String
severity : WarningSeverity
summary : String
action : String
} derive(Eq,
Debug
)

#
WarningSeverity

pub enum WarningSeverity {
Info
Warning
Critical
} derive(Eq,
Debug
)

#
above_control_limit

fn above_control_limit() -> ObservationFlag

#
annualized_energy

fn annualized_energy(power : Float, operating_hours : Float) -> Float

#
balance_error_percent

fn balance_error_percent(inlet : Float, outlet : Float) -> Float

#
balance_residual

fn balance_residual(inlet : Float, outlet : Float) -> Float

#
bar

fn bar() -> MeasureUnit

#
base_unit

fn base_unit(dimension : UnitDimension) -> MeasureUnit

#
batch_report

fn batch_report(reports : Array[ChemReport], labels : Array[String]) -> BatchReport

#
below_control_limit

fn below_control_limit() -> ObservationFlag

#
benchmark_exports

fn benchmark_exports(reports : Array[ChemReport], iterations : Int) -> BenchmarkResult

#
carbon_intensity

fn carbon_intensity(energy : Float, emission_factor : Float) -> Float

#
celsius

fn celsius() -> MeasureUnit

#
clamp

fn clamp(value : Float, minimum : Float, maximum : Float) -> Float

#
classify_series

fn classify_series(series : ScenarioSeries, lower : Float, upper : Float) -> ScenarioSeries

#
coefficient_of_variation

fn coefficient_of_variation(values : Array[Float]) -> Float?

#
compare_reports

fn compare_reports(left : ChemReport, right : ChemReport) -> Array[Diagnostic]

#
compatible

fn compatible(left : MeasureUnit, right : MeasureUnit) -> Bool

#
completeness_score

fn completeness_score(report : ChemReport) -> Float

#
component_flow

fn component_flow(component : String, value : Float, unit : MeasureUnit) -> ComponentFlow

#
control_limits

fn control_limits(values : Array[Float]) -> ControlLimits

#
diagnose_report

fn diagnose_report(report : ChemReport) -> DiagnosticReport

#
diagnostic

fn diagnostic(code : String, severity : DiagnosticSeverity, path : String, message : String, remediation : String) -> Diagnostic

#
diagnostic_report

fn diagnostic_report(diagnostics : Array[Diagnostic]) -> DiagnosticReport

#
distillation_case

fn distillation_case(feed_rate : Float, feed_fraction : Float, distillate_rate : Float, distillate_fraction : Float, bottoms_rate : Float, bottoms_fraction : Float, reflux_ratio : Float, stages : Int) -> DistillationCase

#
elasticity

fn elasticity(input_before : Float, input_after : Float, output_before : Float, output_after : Float) -> Float

#
energy_balance

fn energy_balance(streams : Array[EnergyStream]) -> EnergyBalance

#
energy_stream

fn energy_stream(name : String, duty : Quantity, direction : StreamDirection) -> EnergyStream

#
example_chemreport

fn example_chemreport() -> ChemReport

#
froude_number

fn froude_number(velocity : Float, length : Float, gravity : Float) -> Float

#
heat_exchanger_case

fn heat_exchanger_case(hot_inlet : Float, hot_outlet : Float, cold_inlet : Float, cold_outlet : Float, hot_capacity_rate : Float, cold_capacity_rate : Float, area : Float, overall_u : Float) -> HeatExchangerCase

#
inlet

fn inlet() -> StreamDirection

#
interpolate_linear

fn interpolate_linear(x : Float, x_one : Float, y_one : Float, x_two : Float, y_two : Float) -> Float

#
interpolate_scenario

fn interpolate_scenario(series : ScenarioSeries, input : Float) -> Float?

#
kelvin

fn kelvin() -> MeasureUnit

#
kg_per_hour

fn kg_per_hour() -> MeasureUnit

#
latent_duty

fn latent_duty(mass_flow : Float, latent_heat : Float, vapor_fraction : Float) -> Float

#
log_mean_temperature_difference

fn log_mean_temperature_difference(delta_one : Float, delta_two : Float) -> Float

#
loss_fraction

fn loss_fraction(inlet : Float, recovered : Float) -> Float

#
material_balance

fn material_balance(streams : Array[ProcessStream]) -> MaterialBalance

#
material_property

fn material_property(name : String, molecular_weight : Float, density : Float, heat_capacity : Float, boiling_point : Float, safety_limit : Float) -> MaterialProperty

#
mean

fn mean(values : Array[Float]) -> Float?

#
merge_reports

fn merge_reports(left : ChemReport, right : ChemReport) -> ChemReport

#
moving_average

fn moving_average(values : Array[Float], window : Int) -> Array[Float]

#
nearest_scenario

fn nearest_scenario(series : ScenarioSeries, input : Float) -> ScenarioPoint?

#
normal_observation

fn normal_observation() -> ObservationFlag

#
normalized_error

fn normalized_error(observed : Float, expected : Float) -> Float

#
outlet

fn outlet() -> StreamDirection

#
parse_unit

fn parse_unit(text : String) -> MeasureUnit?

#
pascal

fn pascal() -> MeasureUnit

#
percent_change

fn percent_change(before : Float, after : Float) -> Float

#
percentile

fn percentile(values : Array[Float], percentile : Float) -> Float?

#
pressure_drop_case

fn pressure_drop_case(length : Float, diameter : Float, velocity : Float, density : Float, viscosity : Float, roughness : Float, fittings_k : Float) -> PressureDropCase

#
pump_case

fn pump_case(flow_rate : Float, differential_pressure : Float, efficiency : Float, fluid_density : Float, installed_power : Float) -> PumpCase

#
quality_gate

fn quality_gate(report : ChemReport) -> QualityGate

#
quantity

fn quantity(value : Float, unit : MeasureUnit) -> Quantity

#
reactor_case

fn reactor_case(name : String, feed : Float, product : Float, byproduct : Float, residence_time : Float, temperature : Float, pressure : Float) -> ReactorCase

#
recovery

fn recovery(inlet : Float, recovered : Float) -> Float

#
regression_gate

fn regression_gate(baseline : ChemReport, candidate : ChemReport) -> Bool

#
report

fn report(metadata : ReportMetadata, summary : String, assumptions : Array[Assumption], inputs : Array[InputValue], formulas : Array[FormulaNote], results : Array[ResultValue], warnings : Array[WarningNote], sources : Array[SourceRef], sections : Array[ReportSection], tags : Array[String]) -> ChemReport

#
report_builder

fn report_builder(value : ChemReport) -> ReportBuilder

#
required_sections

fn required_sections(report : ChemReport) -> Array[String]

#
residence_time

fn residence_time(volume : Float, flow_rate : Float) -> Float

#
reynolds_number

fn reynolds_number(density : Float, velocity : Float, diameter : Float, viscosity : Float) -> Float

#
run_sweep

fn run_sweep(config : SweepConfig, evaluate : (Float) -> Float) -> ScenarioSeries

#
safety_factor

fn safety_factor(allowable : Float, applied : Float) -> Float

#
safety_review

fn safety_review(name : String, measured : Float, design_limit : Float, warning_fraction : Float, unit : String) -> SafetyReview

#
scenario_distance

fn scenario_distance(left : ScenarioPoint, right : ScenarioPoint) -> Float

#
scenario_point

fn scenario_point(name : String, input : Float, output : Float, score : Float, status : ResultStatus, note : String) -> ScenarioPoint

#
scenario_series

fn scenario_series(name : String, points : Array[ScenarioPoint], input_unit : String, output_unit : String) -> ScenarioSeries

#
scenario_status

fn scenario_status(score : Float, lower : Float, upper : Float) -> ResultStatus

#
sensitivity

fn sensitivity(base : Float, delta : Float, response_base : Float, response_delta : Float) -> Float

#
stream

fn stream(name : String, direction : StreamDirection, components : Array[ComponentFlow]) -> ProcessStream

#
stream_directions

fn stream_directions() -> Array[StreamDirection]

#
sum_negative

fn sum_negative(values : Array[Float]) -> Float

#
sum_positive

fn sum_positive(values : Array[Float]) -> Float

#
summarize

fn summarize(values : Array[Float]) -> Statistics

#
sweep_config

fn sweep_config(start : Float, stop : Float, steps : Int, label : String) -> SweepConfig

#
table

fn table(columns : Array[String], rows : Array[Array[String]]) -> ReportTable

#
thermal_duty

fn thermal_duty(mass_flow : Float, heat_capacity : Float, inlet : Float, outlet : Float) -> Float

#
total_heat_duty

fn total_heat_duty(sensible : Float, latent : Float, reaction : Float) -> Float

#
turnover_rate

fn turnover_rate(volume : Float, flow_rate : Float) -> Float

#
weighted_mean

fn weighted_mean(values : Array[Float], weights : Array[Float]) -> Float?

#
weighted_pressure_drop

fn weighted_pressure_drop(lengths : Array[Float], drops : Array[Float]) -> Float