eqcost

module
v0.0.0-...-da0c98e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: MIT

README

eqcost — equipment cost estimation & optimization

A single, dependency-free Go binary for process-equipment costing and 1-D economic optimization using the Turton bare-module method. It ships a Cobra CLI plus an interactive Bubble Tea TUI — both drive the same in-process compute core (internal/core): Turton Cp0/Fp/Fm correlations, CEPCI escalation, golden-section + Newton optimizers, plant cost sheets, and CSV/TXT export.

No Python, no runtime dependencies, no config — the equipment catalog is compiled into the binary. Run it from anywhere.

┌─ eqcost (one static binary) ─────────────────────────────┐
│  internal/cli   Cobra commands                            │
│  internal/tui   Bubble Tea app (Boardroom theme)          │
│  internal/core  Turton costing · optimizers · projects    │
│                 · export · embedded catalog.toml          │
└───────────────────────────────────────────────────────────┘

Install

go install github.com/Jubel075/eqcost/cmd/eqcost@latest

Or grab a prebuilt binary from the Releases page (linux / macOS / Windows, amd64 + arm64). Build from source:

git clone https://github.com/Jubel075/eqcost
cd eqcost
go build -o eqcost ./cmd/eqcost

Requires Go ≥ 1.24 to build; the binary itself has no dependencies.

Use

eqcost                        # interactive TUI (or: eqcost tui)
eqcost estimate --type pump_centrifugal --size 50 --material CS --pressure 50
eqcost tower --type tower_sieve --diameter 1.5 --trays 25 --material CS  # composite tower
eqcost optimize --case economic_pipe_diameter            # live convergence
eqcost batch --file examples/batch.toml                  # cost a list with totals
eqcost project new "Ammonia plant" --from examples/batch.toml  # saved cost sheet
eqcost list                                              # catalog
eqcost validate                                          # sanity-check a catalog
eqcost version                                           # build + schema info

Add --json to any command to emit the raw result bundle instead of a table.

Composite tray tower

tower costs a distillation column as one item — a vertical-vessel shell plus N trays, with Turton's tray-quantity factor F_q on the tray group — instead of hand-composing it via batch. The shell's pressure factor uses the real column diameter (a column's L/D ≫ 3, so deriving it from volume would be wrong).

eqcost tower --type tower_sieve --diameter 1.5 --trays 25 --material CS --pressure 5
eqcost tower --type tower_sieve --diameter 2.0 --trays 12 --height 14   # explicit height

Catalog highlights: the fired heater carries alloy factors (CS/Cr-Mo/SS) and a pressure factor; a centrifugal fan (fan_centrifugal_backward, whose pressure input is ΔP in kPa rise, shown in the output) and a fixed-roof storage tank round out the set. Fan/tank F_BM are figure-read approximates — flagged in catalog.toml for verification off Turton Fig. A.19; the Cp0 + pressure factors are cited/verified.

Operating cost (annualized TAC)

Supply a utility draw to fold annual operating cost + capital recovery into a total annualized cost (TAC) alongside the installed-capital numbers:

eqcost estimate --type pump_centrifugal --size 50 --util-rate 50 --util-price 0.12 \
                --hours 8000 --rate 0.10 --life 10 --capital-basis c_tm

--util-rate is consumption per operating hour in whatever unit --util-price is quoted against (kept unit-agnostic). Omit --util-rate for capital only.

Sensitivity sweep

Vary one economic parameter across a range and watch the optimum move (re-runs the case at each sample). Available in the TUI optimize form (a Sweep picker) and headless:

eqcost optimize --case economic_pipe_diameter \
    --sweep electricity_price --sweep-lo 0.04 --sweep-hi 0.24 --sweep-points 6
Export a run

Write any single run — an estimate, tower, optimize, or sweep — to a CSV (field/value, or a points table for a sweep) or a TXT report. Add --export PATH; the format follows the extension (.csv/.txt, default TXT) or an explicit --export-format:

eqcost estimate --type pump_centrifugal --size 50 --export pump.csv
eqcost tower --type tower_sieve --diameter 1.5 --trays 25 --export tower.txt
eqcost optimize --case vessel_ld --volume 10 --export vessel.csv

In the TUI, press e on a results screen, pick the format, and it writes an auto-named file (e.g. centrifugal-pump.txt) to the working directory.

CEPCI escalation

Costs escalate by CEPCI from the 2001 correlation basis to --year (table in the catalog). For a year past the table, pin the index directly instead of extrapolating:

eqcost estimate --type pump_centrifugal --size 50 --year 2027 --cepci 820
Custom catalog

The bundled catalog (equipment correlations + CEPCI table) is compiled into the binary as the default data source. Point at your own TOML with --config:

eqcost estimate --config ./my_catalog.toml --type pump_centrifugal --size 50 ...
eqcost validate --config ./my_catalog.toml
Plant projects (saved cost sheets)

A project turns the ephemeral batch into a named, saved equipment list you can reopen, edit, re-cost (to a new year), and export. Each project is one human-editable TOML file <slug>.toml under the XDG data dir (~/.local/share/eqcost/projects/).

eqcost project new "Ammonia plant" --year 2022 --from examples/batch.toml
eqcost project add ammonia-plant --tag P-101 --type pump_centrifugal --size 50 \
                  --pressure 50 --service "reflux pump"
eqcost project list                          # saved projects
eqcost project show ammonia-plant            # cost sheet + category subtotals
eqcost project show ammonia-plant --year 2024  # re-escalate to a new year
eqcost project rm ammonia-plant --tag P-101  # remove an item by tag
eqcost project export ammonia-plant --csv    # or --txt; --out PATH overrides
eqcost project delete ammonia-plant

Exports land in the current directory by default (--out to override): CSV (row per item + a TOTAL row, for spreadsheets) or TXT (a printable report — title block, aligned item table, totals + category subtotals, service notes).

In the TUI, the Projects menu entry opens a picker (+ New project or a saved sheet); the editor adds s save · S save-as · e export · o open · n new · d delete (in the picker) on top of add/delete/live-totals.

Tool preferences

Optional defaults live in ~/.config/eqcost/config.toml (XDG). Both are overridable per command:

[defaults]
year    = 2024                 # default --year (CEPCI escalation)
catalog = "/path/catalog.toml" # default --config

Layout

Path Role
cmd/eqcost main — wires up the Cobra root
internal/core Turton costing, optimizers, projects, export, embedded catalog; Run job dispatcher
internal/cli Cobra commands
internal/tui Bubble Tea app (Boardroom theme)
internal/paths XDG data/config path resolution (projects dir, config file)
internal/contract typed job/result structs

Method & validation

Costing follows Turton, Bailie, Whiting & Shaeiwitz, Analysis, Synthesis and Design of Chemical Processes (App. A): log10(Cp0) polynomials, the F_BM = B1 + B2·Fm·Fp factor form (and direct F_BM per material), and CEPCI escalation from the 2001 basis. Optimizers cross-check two independent methods (golden-section vs Newton) and validate the numeric optimum against a closed form.

internal/core ships tests that reproduce the Turton hand-calcs (pump, exchanger, vessel, fired heater, fan/tank, tray tower) and the optimizer closed-form gates:

go test ./...

License

MIT © 2026 Guillian

Directories

Path Synopsis
cmd
eqcost command
Command eqcost is the Go frontend for the equipment-cost tool: a Cobra CLI over a Python compute core (subprocess + JSON/NDJSON over stdio).
Command eqcost is the Go frontend for the equipment-cost tool: a Cobra CLI over a Python compute core (subprocess + JSON/NDJSON over stdio).
internal
cli
Package cli wires the Cobra command tree.
Package cli wires the Cobra command tree.
contract
Package contract holds the Go structs that mirror the Python wire contract (equipment_cost/contract.py).
Package contract holds the Go structs that mirror the Python wire contract (equipment_cost/contract.py).
core
Package core is the Go port of the equipment_cost Python compute core: the Turton bare-module costing engine, single-variable optimizers, plant-project persistence, and run export.
Package core is the Go port of the equipment_cost Python compute core: the Turton bare-module costing engine, single-variable optimizers, plant-project persistence, and run export.
jsonx
Package jsonx holds tiny helpers for reading values out of the untyped (map[string]any) result bundles decoded from the Python core.
Package jsonx holds tiny helpers for reading values out of the untyped (map[string]any) result bundles decoded from the Python core.
paths
Package paths resolves eqcost's on-disk locations per the XDG Base Directory spec (the correct Linux convention):
Package paths resolves eqcost's on-disk locations per the XDG Base Directory spec (the correct Linux convention):
tui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL