Rename: _stub_estimate -> _estimate_physics (it's a real deterministic physics engine now, not a stub) and estimation_method "stub" -> "physics_calc" to match the value pass 3 already used, for consistency between the raw-estimate and scored-metric tables. Also skip the cargo_capacity/cargo_capacity_kg arithmetic entirely in _raw_physics_from_masses for domains that score neither and don't need it as cost_efficiency's $/(kg·m) denominator either -- real but modest savings on the ~11,000-eval-per-combo optimizer hot path (a separate log1p-caching attempt was tried and reverted: it measured SLOWER, not faster -- the extra dict lookup cost more than the two math.log1p calls it avoided). Six bugs found by a full-codebase review agent, verified individually: - pipeline.py: LLM rate-limit retry called review_plausibility() with domain.metric_bounds instead of domain, crashing the whole pipeline run on any retry (every provider immediately accesses domain.name/ .metric_bounds on that arg). - _explore_result.html: mass-bar width divided by total_mass with no zero guard; biological/ambient actuators can legitimately have 0 mass floors, so an all-zero slider combination 500'd the explore endpoint. - routes/pipeline.py: if init_db/Repository(conn) raised before repo/conn were assigned, the except/finally handlers referencing them raised UnboundLocalError, silently swallowed by bare except/pass -- a bad PHYSCOM_DB path left a run stuck at status=pending forever with no diagnostic. conn/repo now init to None and are guarded before use; the truly-unreachable-DB case at least logs server-side now. - repository.py: update_combination_status's downgrade guard protected scored/llm_reviewed/*_fail but not a write of "valid" -- pass 1 re-running for a different domain against an already-reviewed combo silently reverted its status back to "valid", erasing the review signal. Verified directly: marked a combo reviewed, re-ran pass 1, status held. - pipeline.py: cost_efficiency's operating-cost term fell back to ground rolling-resistance physics (effective_k_med or ...["ground"]) for media with no resistance model (space), instead of skipping the term the way range_fuel explicitly does two lines above. Every scored interplanetary_travel combo got a cost_efficiency computed from ground physics applied to a spacecraft. Now reports amortized/upfront cost only for such media -- an honest partial answer. - pipeline.py: `if min_accel and specific_thrust:` used truthiness instead of `is not None` -- dep_value() legitimately returns 0.0 for a declared floor of zero (Spaceship declares min_effective_accel=0), masking a real requirement as "undeclared." Three seed-data guardrail holes, matching LOGIC DOCS/002's "missing floor is a silent hole" pattern: - constraint_resolver.py: CATEGORY_SEVERITY had no entry for the "material" category, so Nuclear Thermal Drive/Nuclear Fuel's radiation_shielding requirement defaulted to a non-blocking "warn" nothing in the catalog ever satisfies. Added material -> block. Consequence, verified: every nuclear combo across all domains now correctly fails pass 1, since nothing currently provides shielding -- the accurate state given the catalog gap, not a regression. - transport_example.py: Submarine had a mass range_min but no range_max, unlike its sibling water platform -- _decide_masses skips its entire structural-feasibility search when p_max is None. Added a 20,000,000kg ceiling (small submersible to large ballistic-missile class). - transport_example.py: Amphibious Vehicle declared no medium requires at all, so it vacuously satisfied every domain's medium constraint including space-only interplanetary_travel. Added medium=ground (the current requires model has no OR semantics for "ground or water," so this is a real tradeoff -- it can no longer participate in maritime_shipping either, losing the water half of "amphibious"). Verified: interplanetary_travel's pass-2-estimated count dropped from 33 to 3, and all 3 remaining are genuinely Spaceship-based; the ~30 removed were confirmed to be Amphibious Vehicle's vacuous passes. Logged the GPU-batching-for-the-optimizer discussion (why it doesn't fit at current scale, what threshold would change that, what it would actually require) as LOGIC DOCS/003 for future reference. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
887 lines
41 KiB
Python
887 lines
41 KiB
Python
"""Seed data for the transport example from the README."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from physcom.models.entity import Entity, Dependency
|
|
from physcom.models.domain import Domain, DomainConstraint, MetricBound
|
|
|
|
|
|
# ── Platforms — Ground ──────────────────────────────────────────
|
|
|
|
GROUND_PLATFORMS: list[Entity] = [
|
|
Entity(
|
|
name="Road Vehicle",
|
|
dimension="platform",
|
|
description="Generic wheeled road vehicle — from motorcycles to trucks",
|
|
dependencies=[
|
|
Dependency("environment", "ground_surface", "true", None, "requires"),
|
|
Dependency("environment", "ground_surface", "true", None, "provides"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "50", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "0.5", "m²", "range_min"),
|
|
Dependency("physical", "mass", "36000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "50", "kg", "range_min"),
|
|
Dependency("infrastructure", "road_network", "true", None, "requires"),
|
|
Dependency("environment", "medium", "ground", None, "requires"),
|
|
Dependency("physical", "target_velocity", "25", "m/s", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Light Personal Vehicle",
|
|
dimension="platform",
|
|
description="Small human-scale vehicle — bicycles, skateboards, wheelchairs",
|
|
dependencies=[
|
|
Dependency("environment", "ground_surface", "true", None, "requires"),
|
|
Dependency("environment", "ground_surface", "true", None, "provides"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "3", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "0.3", "m²", "range_min"),
|
|
Dependency("physical", "mass", "60", "kg", "range_max"),
|
|
Dependency("physical", "mass", "5", "kg", "range_min"),
|
|
Dependency("infrastructure", "road_network", "true", None, "requires"),
|
|
Dependency("environment", "medium", "ground", None, "requires"),
|
|
Dependency("physical", "target_velocity", "6", "m/s", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Rail Vehicle",
|
|
dimension="platform",
|
|
description="Rail-guided vehicle — from trams to high-speed trains",
|
|
dependencies=[
|
|
Dependency("environment", "ground_surface", "true", None, "requires"),
|
|
Dependency("environment", "ground_surface", "true", None, "provides"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "200", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "20", "m²", "range_min"),
|
|
Dependency("physical", "mass", "40000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "10000", "kg", "range_min"),
|
|
Dependency("infrastructure", "rail_network", "true", None, "requires"),
|
|
Dependency("environment", "medium", "ground", None, "requires"),
|
|
Dependency("physical", "target_velocity", "30", "m/s", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Platforms — Water ───────────────────────────────────────────
|
|
|
|
WATER_PLATFORMS: list[Entity] = [
|
|
Entity(
|
|
name="Watercraft",
|
|
dimension="platform",
|
|
description="Surface vessel — from kayaks to container ships",
|
|
dependencies=[
|
|
Dependency("environment", "water_surface", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "2000", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "2", "m²", "range_min"),
|
|
Dependency("physical", "mass", "100000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "30", "kg", "range_min"),
|
|
Dependency("environment", "medium", "water", None, "requires"),
|
|
Dependency("physical", "target_velocity", "8", "m/s", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Submarine",
|
|
dimension="platform",
|
|
description="Submersible vessel for underwater travel",
|
|
dependencies=[
|
|
Dependency("environment", "water_surface", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "200", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "20", "m²", "range_min"),
|
|
Dependency("physical", "mass", "20000000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "10000", "kg", "range_min"),
|
|
Dependency("environment", "medium", "water", None, "requires"),
|
|
Dependency("physical", "energy_density", "720000", "J/kg", "range_min"),
|
|
Dependency("physical", "target_velocity", "8", "m/s", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Platforms — Air ─────────────────────────────────────────────
|
|
|
|
AIR_PLATFORMS: list[Entity] = [
|
|
Entity(
|
|
name="Fixed-Wing Aircraft",
|
|
dimension="platform",
|
|
description="Airplane — fixed-wing powered atmospheric flight",
|
|
dependencies=[
|
|
Dependency("environment", "atmosphere", "standard", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "500", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "10", "m²", "range_min"),
|
|
Dependency("physical", "mass", "100000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "500", "kg", "range_min"),
|
|
Dependency("infrastructure", "runway", "true", None, "requires"),
|
|
Dependency("environment", "medium", "air", None, "requires"),
|
|
Dependency("physical", "energy_density", "1440000", "J/kg", "range_min"),
|
|
Dependency("physical", "min_effective_accel", "2.0", "m/s²", "range_min"),
|
|
Dependency("physical", "target_velocity", "60", "m/s", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Rotorcraft",
|
|
dimension="platform",
|
|
description="Vertical-takeoff aircraft — helicopters, drones",
|
|
dependencies=[
|
|
Dependency("environment", "atmosphere", "standard", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "20", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "0.5", "m²", "range_min"),
|
|
Dependency("physical", "mass", "5000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "1", "kg", "range_min"),
|
|
Dependency("environment", "medium", "air", None, "requires"),
|
|
Dependency("physical", "energy_density", "720000", "J/kg", "range_min"),
|
|
Dependency("physical", "min_effective_accel", "10", "m/s²", "range_min"),
|
|
Dependency("physical", "target_velocity", "30", "m/s", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Lighter-than-Air Craft",
|
|
dimension="platform",
|
|
description="Buoyancy-based aircraft — balloons, airships",
|
|
dependencies=[
|
|
Dependency("environment", "atmosphere", "standard", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "1000", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "50", "m²", "range_min"),
|
|
Dependency("physical", "mass", "20000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "200", "kg", "range_min"),
|
|
Dependency("environment", "medium", "air", None, "requires"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Platforms — Space ───────────────────────────────────────────
|
|
|
|
SPACE_PLATFORMS: list[Entity] = [
|
|
Entity(
|
|
name="Spaceship",
|
|
dimension="platform",
|
|
description="Vehicle designed for space travel",
|
|
dependencies=[
|
|
Dependency("environment", "atmosphere", "vacuum_or_thin", None, "requires"),
|
|
Dependency("physical", "footprint", "500", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "10", "m²", "range_min"),
|
|
Dependency("physical", "mass", "5000", "kg", "range_min"),
|
|
Dependency("infrastructure", "launch_facility", "true", None, "requires"),
|
|
Dependency("environment", "medium", "space", None, "requires"),
|
|
Dependency("physical", "energy_density", "7200000", "J/kg", "range_min"),
|
|
Dependency("physical", "min_effective_accel", "0", "m/s²", "range_min"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Platforms — Multi-medium ────────────────────────────────────
|
|
|
|
MULTI_PLATFORMS: list[Entity] = [
|
|
Entity(
|
|
name="Amphibious Vehicle",
|
|
dimension="platform",
|
|
description="Vehicle capable of operation on land, water, or both",
|
|
dependencies=[
|
|
Dependency("environment", "ground_surface", "true", None, "provides"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "100", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "5", "m²", "range_min"),
|
|
Dependency("physical", "mass", "10000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "1500", "kg", "range_min"),
|
|
# No requires here previously -- vacuously satisfied every
|
|
# domain's medium DomainConstraint (check_domain_constraints
|
|
# only flags a violation when an entity DECLARES a requires
|
|
# for the constrained key), including space-only
|
|
# interplanetary_travel. The current requires/domain-constraint
|
|
# model only supports one value per key -- there's no OR
|
|
# mechanism for "ground or water" -- so this picks ground
|
|
# (its primary, most-common domain) rather than leaving it
|
|
# undeclared. Real tradeoff: it can no longer participate in
|
|
# maritime_shipping (water-only) either, losing the water half
|
|
# of "amphibious." Closes the vacuous-pass hole; genuine
|
|
# multi-medium support would need OR semantics added to
|
|
# check_domain_constraints, a separate, bigger change.
|
|
Dependency("environment", "medium", "ground", None, "requires"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Platforms — Fictional / Speculative ─────────────────────────
|
|
|
|
FICTIONAL_PLATFORMS: list[Entity] = [
|
|
Entity(
|
|
name="Hyperloop",
|
|
dimension="platform",
|
|
description="Sealed low-pressure tube with passenger pods at near-sonic speed",
|
|
dependencies=[
|
|
Dependency("environment", "ground_surface", "true", None, "requires"),
|
|
Dependency("environment", "ground_surface", "true", None, "provides"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "provides"),
|
|
Dependency("physical", "footprint", "50", "m²", "range_max"),
|
|
Dependency("physical", "footprint", "5", "m²", "range_min"),
|
|
Dependency("physical", "mass", "20000", "kg", "range_max"),
|
|
Dependency("physical", "mass", "5000", "kg", "range_min"),
|
|
Dependency("infrastructure", "hyperloop_tube", "true", None, "requires"),
|
|
Dependency("environment", "medium", "ground", None, "requires"),
|
|
Dependency("physical", "target_velocity", "270", "m/s", "provides"), # near-sonic, per its own description
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── All Platforms ───────────────────────────────────────────────
|
|
|
|
PLATFORMS: list[Entity] = (
|
|
GROUND_PLATFORMS
|
|
+ WATER_PLATFORMS
|
|
+ AIR_PLATFORMS
|
|
+ SPACE_PLATFORMS
|
|
+ MULTI_PLATFORMS
|
|
+ FICTIONAL_PLATFORMS
|
|
)
|
|
|
|
|
|
# ── Actuators — Combustion ──────────────────────────────────────
|
|
|
|
COMBUSTION_ACTUATORS: list[Entity] = [
|
|
Entity(
|
|
name="Piston Engine",
|
|
dimension="actuator",
|
|
description="Reciprocating combustion engine — petrol or diesel",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_combustible", None, "requires"),
|
|
Dependency("environment", "atmosphere", "standard", None, "requires"),
|
|
Dependency("physical", "mass", "45", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "high_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "1000", "W/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Gas Turbine",
|
|
dimension="actuator",
|
|
description="Turbine engine — jets, turboshafts, turboprops",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_combustible", None, "requires"),
|
|
Dependency("environment", "atmosphere", "standard", None, "requires"),
|
|
Dependency("physical", "mass", "200", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "extreme_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "5000", "W/kg", "provides"),
|
|
Dependency("force", "specific_thrust", "50", "N/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Steam Engine",
|
|
dimension="actuator",
|
|
description="External combustion engine using steam for mechanical power",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_combustible", None, "requires"),
|
|
Dependency("environment", "atmosphere", "standard", None, "requires"),
|
|
Dependency("physical", "mass", "300", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "high_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "30", "W/kg", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Actuators — Electric ───────────────────────────────────────
|
|
|
|
ELECTRIC_ACTUATORS: list[Entity] = [
|
|
Entity(
|
|
name="Electric Motor",
|
|
dimension="actuator",
|
|
description="Rotary motor converting electrical energy to mechanical motion",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "electrical", None, "requires"),
|
|
Dependency("physical", "mass", "5", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "moderate_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "2000", "W/kg", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Actuators — Biological ─────────────────────────────────────
|
|
|
|
BIOLOGICAL_ACTUATORS: list[Entity] = [
|
|
Entity(
|
|
name="Human Muscle",
|
|
dimension="actuator",
|
|
description="Human-powered via pedalling, pushing, or rowing",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "biological", None, "requires"),
|
|
Dependency("physical", "mass", "0", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "low_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "5.5", "W/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Animal Traction",
|
|
dimension="actuator",
|
|
description="Animal muscle power (horse, ox, or dog team)",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "biological", None, "requires"),
|
|
Dependency("environment", "ground_surface", "true", None, "requires"),
|
|
Dependency("physical", "mass", "0", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "low_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "2", "W/kg", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Actuators — Renewable / Ambient ────────────────────────────
|
|
|
|
RENEWABLE_ACTUATORS: list[Entity] = [
|
|
Entity(
|
|
name="Solar Sail",
|
|
dimension="actuator",
|
|
description="Reflective surface propelled by radiation pressure",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "radiation_pressure", None, "requires"),
|
|
Dependency("environment", "atmosphere", "vacuum_or_thin", None, "requires"),
|
|
Dependency("environment", "star_proximity", "true", None, "requires"),
|
|
Dependency("physical", "footprint", "100", "m²", "range_min"),
|
|
Dependency("force", "thrust_profile", "continuous_low", None, "provides"),
|
|
Dependency("force", "power_density", "0.01", "W/kg", "provides"),
|
|
Dependency("environment", "medium", "space", None, "requires"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Wind Sail",
|
|
dimension="actuator",
|
|
description="Fabric or rigid sail harnessing wind for propulsion",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "wind", None, "requires"),
|
|
Dependency("environment", "atmosphere", "standard", None, "requires"),
|
|
Dependency("physical", "mass", "15", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "low_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "10", "W/kg", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Actuators — Rocket / Space ─────────────────────────────────
|
|
|
|
ROCKET_ACTUATORS: list[Entity] = [
|
|
Entity(
|
|
name="Rocket Nozzle",
|
|
dimension="actuator",
|
|
description="Thrust from expanding combustion gases through a nozzle",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_propellant", None, "requires"),
|
|
Dependency("environment", "medium", "water", None, "excludes"),
|
|
Dependency("physical", "mass", "150", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "extreme_burst", None, "provides"),
|
|
Dependency("force", "power_density", "10000", "W/kg", "provides"),
|
|
Dependency("force", "specific_thrust", "1500", "N/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Ion Drive",
|
|
dimension="actuator",
|
|
description="Electric propulsion using ionized gas for deep-space travel",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "ion_propellant", None, "requires"),
|
|
Dependency("environment", "atmosphere", "vacuum_or_thin", None, "requires"),
|
|
Dependency("environment", "medium", "space", None, "requires"),
|
|
Dependency("physical", "mass", "8", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "continuous_low", None, "provides"),
|
|
Dependency("force", "power_density", "30", "W/kg", "provides"),
|
|
Dependency("force", "specific_thrust", "0.01", "N/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Nuclear Thermal Drive",
|
|
dimension="actuator",
|
|
description="Nuclear fission reactor heating propellant for thrust",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "nuclear_thermal", None, "requires"),
|
|
Dependency("physical", "mass", "1500", "kg", "range_min"),
|
|
Dependency("physical", "footprint", "20", "m²", "range_min"),
|
|
Dependency("force", "thrust_profile", "extreme_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "50", "W/kg", "provides"),
|
|
Dependency("force", "specific_thrust", "200", "N/kg", "provides"),
|
|
Dependency("material", "radiation_shielding", "true", None, "requires"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Actuators — Exotic ─────────────────────────────────────────
|
|
|
|
EXOTIC_ACTUATORS: list[Entity] = [
|
|
Entity(
|
|
name="Cannon Recoil Drive",
|
|
dimension="actuator",
|
|
description="Propulsion via sequential cannon blasts",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_explosive", None, "requires"),
|
|
Dependency("environment", "medium", "water", None, "excludes"),
|
|
Dependency("physical", "mass", "80", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "high_burst", None, "provides"),
|
|
Dependency("force", "power_density", "3000", "W/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Compressed Air Motor",
|
|
dimension="actuator",
|
|
description="Motor powered by expanding compressed air",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "pneumatic", None, "requires"),
|
|
Dependency("physical", "mass", "10", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "moderate_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "100", "W/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Flywheel Drive",
|
|
dimension="actuator",
|
|
description="Mechanical drive transferring kinetic energy from a spinning rotor",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "kinetic_stored", None, "requires"),
|
|
Dependency("physical", "mass", "20", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "high_burst", None, "provides"),
|
|
Dependency("force", "power_density", "2000", "W/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Gravity Coast",
|
|
dimension="actuator",
|
|
description="Free-rolling descent using gravitational potential energy",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "gravitational", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "ground_surface", "true", None, "requires"),
|
|
Dependency("physical", "mass", "0", "kg", "range_min"),
|
|
Dependency("force", "thrust_profile", "low_continuous", None, "provides"),
|
|
Dependency("force", "power_density", "10", "W/kg", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── All Actuators ──────────────────────────────────────────────
|
|
|
|
ACTUATORS: list[Entity] = (
|
|
COMBUSTION_ACTUATORS
|
|
+ ELECTRIC_ACTUATORS
|
|
+ BIOLOGICAL_ACTUATORS
|
|
+ RENEWABLE_ACTUATORS
|
|
+ ROCKET_ACTUATORS
|
|
+ EXOTIC_ACTUATORS
|
|
)
|
|
|
|
|
|
# ── Energy Storage — Combustible Fuels ─────────────────────────
|
|
|
|
COMBUSTIBLE_STORAGE: list[Entity] = [
|
|
Entity(
|
|
name="Liquid Fuel",
|
|
dimension="energy_storage",
|
|
description="Liquid hydrocarbon fuel — gasoline, diesel, or biofuel",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_combustible", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "fuel_station", None, "requires"),
|
|
Dependency("physical", "mass", "10", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "4680000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Hydrogen",
|
|
dimension="energy_storage",
|
|
description="Compressed or liquefied hydrogen gas",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_combustible", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "hydrogen_station", None, "requires"),
|
|
Dependency("physical", "mass", "5", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "2160000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Compressed Natural Gas",
|
|
dimension="energy_storage",
|
|
description="Methane stored under high pressure in tanks",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_combustible", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "cng_station", None, "requires"),
|
|
Dependency("physical", "mass", "15", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "2880000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Coal",
|
|
dimension="energy_storage",
|
|
description="Solid fossil fuel for steam boilers",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_combustible", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "coal_supply", None, "requires"),
|
|
Dependency("physical", "mass", "100", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "1440000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Jet Fuel",
|
|
dimension="energy_storage",
|
|
description="Kerosene-based fuel for turbine engines",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_combustible", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "jet_fuel", None, "requires"),
|
|
Dependency("physical", "mass", "50", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "4320000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Energy Storage — Electrical ────────────────────────────────
|
|
|
|
ELECTRICAL_STORAGE: list[Entity] = [
|
|
Entity(
|
|
name="Rechargeable Battery",
|
|
dimension="energy_storage",
|
|
description="Rechargeable battery pack — lithium-ion or solid-state",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "electrical", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "charging_station", None, "requires"),
|
|
Dependency("physical", "mass", "9", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "1080000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Supercapacitor",
|
|
dimension="energy_storage",
|
|
description="High-power energy storage for rapid charge/discharge",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "electrical", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "charging_station", None, "requires"),
|
|
Dependency("physical", "mass", "15", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "36000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Solar Photovoltaic Panel",
|
|
dimension="energy_storage",
|
|
description="Photovoltaic cells converting sunlight to electricity",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "electrical", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "none", None, "requires"),
|
|
Dependency("environment", "star_proximity", "true", None, "requires"),
|
|
Dependency("physical", "mass", "10", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "180000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Energy Storage — Biological ────────────────────────────────
|
|
|
|
BIOLOGICAL_STORAGE: list[Entity] = [
|
|
Entity(
|
|
name="Biological Feed",
|
|
dimension="energy_storage",
|
|
description="Metabolic energy from food or animal fodder",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "biological", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "none", None, "requires"),
|
|
Dependency("physical", "mass", "0", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "720000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Energy Storage — Ambient ───────────────────────────────────
|
|
|
|
AMBIENT_STORAGE: list[Entity] = [
|
|
Entity(
|
|
name="Solar Radiation",
|
|
dimension="energy_storage",
|
|
description="Photon flux from a nearby star providing radiation pressure",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "radiation_pressure", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "none", None, "requires"),
|
|
Dependency("environment", "star_proximity", "true", None, "requires"),
|
|
Dependency("physical", "mass", "0", "kg", "range_min"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Wind",
|
|
dimension="energy_storage",
|
|
description="Atmospheric air currents providing kinetic energy",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "wind", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "none", None, "requires"),
|
|
Dependency("environment", "atmosphere", "standard", None, "requires"),
|
|
Dependency("physical", "mass", "0", "kg", "range_min"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Energy Storage — Propellant ────────────────────────────────
|
|
|
|
PROPELLANT_STORAGE: list[Entity] = [
|
|
Entity(
|
|
name="Solid Propellant",
|
|
dimension="energy_storage",
|
|
description="Solid rocket fuel providing chemical propulsion energy",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_propellant", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "solid_propellant", None, "requires"),
|
|
Dependency("physical", "mass", "50", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "1800000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Xenon Propellant",
|
|
dimension="energy_storage",
|
|
description="Ionizable xenon gas for electric propulsion",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "ion_propellant", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "xenon_propellant", None, "requires"),
|
|
Dependency("physical", "mass", "2", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "10800000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Nuclear Fuel",
|
|
dimension="energy_storage",
|
|
description="Enriched uranium or thorium fuel rods for fission reactors",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "nuclear_thermal", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "nuclear_fuel", None, "requires"),
|
|
Dependency("physical", "mass", "500", "kg", "range_min"),
|
|
Dependency("physical", "footprint", "5", "m²", "range_min"),
|
|
Dependency("physical", "energy_density", "1800000000", "J/kg", "provides"),
|
|
Dependency("material", "radiation_shielding", "true", None, "requires"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── Energy Storage — Exotic ────────────────────────────────────
|
|
|
|
EXOTIC_STORAGE: list[Entity] = [
|
|
Entity(
|
|
name="Gunpowder/Ammunition",
|
|
dimension="energy_storage",
|
|
description="Black powder or cartridge ammunition for explosive propulsion",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "chemical_explosive", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "ammunition", None, "requires"),
|
|
Dependency("physical", "mass", "20", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "720000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Compressed Air",
|
|
dimension="energy_storage",
|
|
description="Air stored in high-pressure tanks",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "pneumatic", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "compressed_air_station", None, "requires"),
|
|
Dependency("physical", "mass", "10", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "108000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Flywheel Store",
|
|
dimension="energy_storage",
|
|
description="Kinetic energy stored in a spinning rotor",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "kinetic_stored", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "charging_station", None, "requires"),
|
|
Dependency("physical", "mass", "30", "kg", "range_min"),
|
|
Dependency("physical", "energy_density", "180000", "J/kg", "provides"),
|
|
],
|
|
),
|
|
Entity(
|
|
name="Gravitational Potential",
|
|
dimension="energy_storage",
|
|
description="Stored energy from elevation difference (hills, slopes)",
|
|
dependencies=[
|
|
Dependency("energy", "energy_form", "gravitational", None, "provides"),
|
|
Dependency("infrastructure", "fuel_infrastructure", "none", None, "requires"),
|
|
Dependency("environment", "gravity", "true", None, "requires"),
|
|
Dependency("environment", "ground_surface", "true", None, "requires"),
|
|
Dependency("physical", "mass", "0", "kg", "range_min"),
|
|
],
|
|
),
|
|
]
|
|
|
|
|
|
# ── All Energy Storages ────────────────────────────────────────
|
|
|
|
ENERGY_STORAGES: list[Entity] = (
|
|
COMBUSTIBLE_STORAGE
|
|
+ ELECTRICAL_STORAGE
|
|
+ BIOLOGICAL_STORAGE
|
|
+ AMBIENT_STORAGE
|
|
+ PROPELLANT_STORAGE
|
|
+ EXOTIC_STORAGE
|
|
)
|
|
|
|
|
|
# ── Domains ─────────────────────────────────────────────────────
|
|
|
|
URBAN_COMMUTING = Domain(
|
|
name="urban_commuting",
|
|
description="Daily travel within a city, 1-50km range",
|
|
metric_bounds=[
|
|
# safety and availability removed from the scored/weighted metric set:
|
|
# both are judgment calls (risk assessment, infrastructure prevalence),
|
|
# not physics quantities with a formula, and running them through the
|
|
# same log-normalize() built for physical quantities produced
|
|
# incoherent results (a safety raw value already declared as "0-1"
|
|
# getting re-normalized into a different, unexplainable 0-1 number --
|
|
# see combo 1540's review, where phi4 could only cite the post-
|
|
# normalization number with no way to justify it). Safety is now a
|
|
# qualitative consideration folded into pass 4's holistic RATING
|
|
# instead. Availability needs real per-infrastructure-type research
|
|
# this project hasn't done -- not scored anywhere for now rather than
|
|
# pretend a quick formula or an equally uninformed LLM guess settles it.
|
|
# Weights renormalized to sum to 1.0 across the remaining metrics.
|
|
# speed and cargo_capacity_kg added -- a commute's actual travel
|
|
# time and whether the vehicle can carry groceries/passengers/gear
|
|
# both matter as much as raw power_density did on their own; speed
|
|
# is a genuine build OUTPUT (see _raw_physics_from_masses), not a
|
|
# platform-declared constant.
|
|
MetricBound("power_density", weight=0.25, norm_min=1, norm_max=2000, unit="W/kg"),
|
|
MetricBound("cost_efficiency", weight=0.25, norm_min=1e-5, norm_max=2e-3, unit="$/m", lower_is_better=True),
|
|
MetricBound("speed", weight=0.25, norm_min=2, norm_max=30, unit="m/s"),
|
|
MetricBound("range_fuel", weight=0.10, norm_min=5000, norm_max=500000, unit="m"),
|
|
MetricBound("cargo_capacity_kg", weight=0.15, norm_min=1, norm_max=500, unit="kg"),
|
|
],
|
|
constraints=[DomainConstraint("medium", ["ground", "air"])],
|
|
)
|
|
|
|
INTERPLANETARY = Domain(
|
|
name="interplanetary_travel",
|
|
description="Travel between planets within a solar system",
|
|
metric_bounds=[
|
|
# safety removed -- see URBAN_COMMUTING comment above. Weights
|
|
# renormalized across the remaining metrics.
|
|
MetricBound("power_density", weight=0.375, norm_min=10, norm_max=10000, unit="W/kg"),
|
|
MetricBound("range_fuel", weight=0.375, norm_min=1e9, norm_max=1e13, unit="m"),
|
|
MetricBound("cost_efficiency", weight=0.125, norm_min=1.0, norm_max=1e6, unit="$/m", lower_is_better=True),
|
|
MetricBound("range_degradation", weight=0.125, norm_min=8640000, norm_max=3.1536e9, unit="s"),
|
|
],
|
|
constraints=[DomainConstraint("medium", ["space"])],
|
|
)
|
|
|
|
MARITIME_SHIPPING = Domain(
|
|
name="maritime_shipping",
|
|
description="Ocean cargo transport between ports, 100-40000km range",
|
|
metric_bounds=[
|
|
# safety removed -- see URBAN_COMMUTING comment above. Weights
|
|
# renormalized across the remaining metrics.
|
|
MetricBound("power_density", weight=0.1875, norm_min=1, norm_max=1000, unit="W/kg"),
|
|
MetricBound("cargo_capacity", weight=0.3125, norm_min=1000, norm_max=2e8, unit="kg"),
|
|
MetricBound("cost_efficiency", weight=0.3125, norm_min=1e-9, norm_max=1e-6, unit="$/(kg\u00b7m)", lower_is_better=True),
|
|
MetricBound("range_fuel", weight=0.1875, norm_min=100000, norm_max=40000000, unit="m"),
|
|
],
|
|
constraints=[DomainConstraint("medium", ["water"])],
|
|
)
|
|
|
|
LAST_MILE_DELIVERY = Domain(
|
|
name="last_mile_delivery",
|
|
description="Short-range package delivery within neighborhoods, 0.5-15km",
|
|
metric_bounds=[
|
|
# safety removed -- see URBAN_COMMUTING comment above. Weights
|
|
# renormalized across the remaining metrics.
|
|
MetricBound("power_density", weight=0.2941, norm_min=1, norm_max=500, unit="W/kg"),
|
|
MetricBound("cost_efficiency", weight=0.3529, norm_min=1e-5, norm_max=5e-3, unit="$/m", lower_is_better=True),
|
|
MetricBound("cargo_capacity_kg", weight=0.2353, norm_min=1, norm_max=500, unit="kg"),
|
|
MetricBound("environmental_impact", weight=0.1177, norm_min=0, norm_max=5e-4, unit="kg/m", lower_is_better=True),
|
|
],
|
|
constraints=[DomainConstraint("medium", ["ground", "air"])],
|
|
)
|
|
|
|
CROSS_COUNTRY_FREIGHT = Domain(
|
|
name="cross_country_freight",
|
|
description="Long-distance overland cargo transport, 200-5000km",
|
|
metric_bounds=[
|
|
MetricBound("power_density", weight=0.20, norm_min=5, norm_max=5000, unit="W/kg"),
|
|
MetricBound("cargo_capacity", weight=0.25, norm_min=500, norm_max=100000, unit="kg"),
|
|
MetricBound("cost_efficiency", weight=0.25, norm_min=1e-8, norm_max=5e-6, unit="$/(kg\u00b7m)", lower_is_better=True),
|
|
MetricBound("range_fuel", weight=0.20, norm_min=100000, norm_max=5000000, unit="m"),
|
|
MetricBound("reliability", weight=0.10, norm_min=0.0, norm_max=1.0, unit="0-1"),
|
|
],
|
|
constraints=[DomainConstraint("medium", ["ground"])],
|
|
)
|
|
|
|
ALL_DOMAINS = [
|
|
URBAN_COMMUTING,
|
|
INTERPLANETARY,
|
|
MARITIME_SHIPPING,
|
|
LAST_MILE_DELIVERY,
|
|
CROSS_COUNTRY_FREIGHT,
|
|
]
|
|
|
|
|
|
def load_transport_seed(repo) -> dict:
|
|
"""Load all transport seed data into the repository. Idempotent — safe to re-run."""
|
|
import sqlite3
|
|
from physcom.db.repository import Repository
|
|
repo: Repository
|
|
|
|
counts = {"platforms": 0, "actuators": 0, "energy_storages": 0, "domains": 0}
|
|
|
|
for entity in PLATFORMS:
|
|
try:
|
|
repo.add_entity(entity)
|
|
counts["platforms"] += 1
|
|
except sqlite3.IntegrityError:
|
|
existing = repo.get_entity_by_name(entity.dimension, entity.name)
|
|
if existing:
|
|
repo.replace_entity_dependencies(existing.id, entity.dependencies)
|
|
|
|
for entity in ACTUATORS:
|
|
try:
|
|
repo.add_entity(entity)
|
|
counts["actuators"] += 1
|
|
except sqlite3.IntegrityError:
|
|
existing = repo.get_entity_by_name(entity.dimension, entity.name)
|
|
if existing:
|
|
repo.replace_entity_dependencies(existing.id, entity.dependencies)
|
|
|
|
for entity in ENERGY_STORAGES:
|
|
try:
|
|
repo.add_entity(entity)
|
|
counts["energy_storages"] += 1
|
|
except sqlite3.IntegrityError:
|
|
existing = repo.get_entity_by_name(entity.dimension, entity.name)
|
|
if existing:
|
|
repo.replace_entity_dependencies(existing.id, entity.dependencies)
|
|
|
|
for domain in ALL_DOMAINS:
|
|
try:
|
|
repo.add_domain(domain)
|
|
counts["domains"] += 1
|
|
except sqlite3.IntegrityError:
|
|
pass
|
|
# Sync domain_metric_weights to exactly match this domain's current
|
|
# metric_bounds on existing DBs -- upserts weight/norm_min/norm_max/
|
|
# unit for current metrics and removes any that were dropped (e.g.
|
|
# safety/availability no longer scored).
|
|
repo.sync_domain_metric_weights(domain)
|
|
# Backfill domain constraints
|
|
repo.replace_domain_constraints(domain)
|
|
|
|
return counts
|