How does compatibility work
Detailed run down on how compatibility is determined
Compatibility = same interface intent + matching attributes + a valid resource assignment.
ProtoParts expose two things: Resources and Interfaces. The validator joins them with a small set of checks to decide if parts can work together in a project.
Core concepts
ProtoPart
A part definition that groups one or more domains (electrical, mechanical, pneumatic, hydraulic, data).
Resource
An atomic endpoint inside a domain. Defined by one or more functions plus attributes. Examples:
Electrical:
power_output,ground,digital_iowith logic levels, current limits, frequency ranges.Mechanical:
shaft_keyed_5mm,mount_pattern_20mm,bearing_bore_8mm.Fluid:
hose_4mm_pushfit,pressure_input,pressure_outputwith pressure and temperature ratings.
Notes:
Each function has a
directionsuch assource,receiver, orbidirectional.A resource can be marked
shareable_withother functions when physically common (e.g., ground shared with power).
Interface
A named bundle that declares capability and wiring expectations:
protocol:{ "type": <enum>, "role": <enum> }(e.g., digital/output or digital/receiver)requires: list of required functions with counts and optionalshareable_withhintsconstraints: hard rules likemax_connectionsorrequires_matching_voltage_domainOptional
power_delivery,description, andaliases
If two parts implement the same interface with complementary roles and pass constraints, they are compatible.
Decision flow
Interface identity and role complement
Interfaces must have the same
id(or a declared alias) and complementaryrolevalues.Cardinality
Consumer
requiresmust be satisfiable by provider resources and vice versa, including allowed sharing.Type alignment inside the same domain
Functions must be pairable (
digital_iotodigital_io,power_outputtopower_input,hose_4mm_pushfitto the same fitting type, etc.).Hard attribute checks
All required attributes fall within limits. Examples:
Electrical: voltage range, current budget, logic level thresholds, PWM frequency
Data: protocol, bitrate tolerance, address availability, required pull‑ups present
Mechanical: bore size, pattern, fit class, envelope clearance
Fluid: pressure rating, temperature range, medium compatibility
System checks
Cross‑part totals and conflicts: power budget, thermal headroom, bus fanout, I²C/SPI address collisions, timing.
Soft preferences and scoring
Non‑blocking preferences like noise limits, vendor, package. These adjust a score but do not fail the match.
Outcomes
full_compatibility: all hard checks pass and a concrete assignment existscompatible_with_adapter: intent matches but an adapter is needed (e.g., level shifter, connector converter)incompatible: interface mismatch, role conflict, cardinality shortfall, or hard rule failure
Pin and port assignment
Treat resource hookup as a bipartite assignment problem. Build edges only where function and attributes are compatible. If a perfect matching exists that also satisfies hard constraints and cardinality, emit the mapping. Otherwise report the smallest adapter set that would complete the matching, if available.
Example: RC Servo 3‑wire
Intent
A controller provides 5 V power, ground, and a 50 Hz digital control signal. A servo consumes them.
Controller excerpt
Servo excerpt
Result
Interface ID matches. Roles complement. Cardinality satisfied.
Logic levels and PWM frequency compatible. Power budget checked via
power_deliveryand controller current rating.Valid mapping:
{ vout5 → vdd, gnd0 → gnd, pwm0 → sig }.
Adapters
Adapters are parts that present interface_A as a consumer and interface_B as a provider, translating attributes or connectors. The validator can propose a minimal adapter set when intent matches but attributes do not.
Versioning and inheritance
Version interfaces with simple integers or semver. Mark backward‑compatible changes.
Allow specific interfaces to
implementmore general ones (e.g.,i2c_sensorimplementsi2c_device).
Units and normalization
Store numbers in normalized SI in the validator. Keep user‑facing units as metadata. Matching is always performed on normalized values, with converters for display and input.
Validator output shape
Last updated
Was this helpful?

