> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hardwave.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Simulate a voltage divider with Hardwave in minutes

This quickstart builds a simple voltage divider, validates the graph, and runs a steady-state simulation. The result matches hand calculation: I = V / R.

## Prerequisites

Install Hardwave:

```bash theme={null}
pip install hardwave
```

## Build the graph

```python theme={null}
import hardwave
import hardwave.stdlib

from hardwave.simulation import SimulationGraph, SimulationEngine
from hardwave.stdlib.components.passive import VoltageSource, Resistor

graph = SimulationGraph()
graph.add_component(VoltageSource("vs", param_values={"voltage": 9.0}))
graph.add_component(Resistor("r1", param_values={"resistance": 1_000.0}))
graph.add_component(Resistor("r2", param_values={"resistance": 2_000.0}))

graph.connect("vs", "voltage_out", "r1", "voltage")
graph.connect("vs", "voltage_out", "r2", "voltage")
```

Both resistors share the same supply voltage. **Fan-out** from one output to many inputs is always allowed. Hardwave enforces port direction and type compatibility at wiring time.

To wire **fan-in** (many outputs into one input), declare the target port with `aggregating_input_port()`. See [Aggregating Input Ports](/guides/aggregating-ports).

## Validate and simulate

```python theme={null}
graph.validate()

result = SimulationEngine(graph).run(inputs={})

print(result.get_output("r1", "current"))   # → 0.009  A  (9 mA)
print(result.get_output("r2", "current"))   # → 0.0045 A  (4.5 mA)
print(result.get_output("r1", "power"))     # → 0.081  W
```

The simulation matches hand calculation: I = V / R = 9 / 1000 = 9 mA.

## Access results

```python theme={null}
# Scalar output for a single port
value = result.get_output("r1", "current")

# Full result as a JSON-serializable dict
snapshot = result.to_dict()

# Simulation warnings and diagnostics
for diag in result.diagnostics():
    print(diag)

# Filter by severity
warnings = result.get_warnings()
faults = result.get_faults()
```

Components like `DCMotor` and `LiPoCell` emit runtime `WARNING` and `FAULT` diagnostics when operating limits are exceeded. See [Component Faults and Health](/guides/component-faults).

## Next Steps

<CardGroup cols={2}>
  <Card title="Core Concepts" icon="book" href="/guides/core-concepts">
    Understand types, ports, and the component model
  </Card>

  <Card title="Component Faults" icon="triangle-exclamation" href="/guides/component-faults">
    Runtime warnings, faults, and degraded component behaviour
  </Card>

  <Card title="Building Graphs" icon="diagram-project" href="/graphs">
    Learn connection rules, validation, and graph editing
  </Card>

  <Card title="Transient Simulation" icon="chart-line" href="/simulation/transient">
    Step through time and collect time-series data
  </Card>

  <Card title="Aggregating Ports" icon="merge" href="/guides/aggregating-ports">
    Wire multiple sources into one input port
  </Card>

  <Card title="Saving Graphs" icon="floppy-disk" href="/graphs/saving">
    Save graphs and simulation snapshots to the cloud dashboard
  </Card>

  <Card title="Greenhouse Tutorial" icon="leaf" href="/guides/greenhouse-tutorial">
    Build custom components and a composite assembly
  </Card>
</CardGroup>
