> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/pybamm-team/PyBaMM/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Run your first battery simulation with PyBaMM in minutes.

This guide walks you through running your first battery simulation with PyBaMM. By the end, you'll have a working simulation and know how to access and visualize results.

<Steps>
  <Step title="Install PyBaMM">
    Install PyBaMM using pip or conda:

    <CodeGroup>
      ```bash pip theme={null}
      pip install pybamm
      ```

      ```bash conda theme={null}
      conda install -c conda-forge pybamm
      ```
    </CodeGroup>

    <Tip>
      Use a virtual environment to avoid dependency conflicts. See the [Installation guide](/installation) for full instructions.
    </Tip>
  </Step>

  <Step title="Run a basic 1C discharge">
    The simplest simulation is a 1C constant-current discharge using the Doyle-Fuller-Newman model:

    ```python Basic discharge theme={null}
    import pybamm

    model = pybamm.lithium_ion.DFN()   # Doyle-Fuller-Newman model
    sim = pybamm.Simulation(model)
    sim.solve([0, 3600])               # solve for 1 hour
    sim.plot()
    ```

    This runs the DFN model with default parameters (Chen2020) and plots all key variables interactively.
  </Step>

  <Step title="Simulate a charge/discharge experiment">
    Define a multi-step experiment with plain English strings:

    ```python Charge/discharge cycle theme={null}
    import pybamm

    experiment = pybamm.Experiment(
        [
            (
                "Discharge at C/10 for 10 hours or until 3.3 V",
                "Rest for 1 hour",
                "Charge at 1 A until 4.1 V",
                "Hold at 4.1 V until 50 mA",
                "Rest for 1 hour",
            )
        ]
        * 3,  # repeat 3 times
    )
    model = pybamm.lithium_ion.DFN()
    sim = pybamm.Simulation(model, experiment=experiment)
    sim.solve()
    sim.plot()
    ```
  </Step>

  <Step title="Access solution variables">
    After solving, you can extract any model variable from the solution:

    ```python Access solution data theme={null}
    import pybamm

    model = pybamm.lithium_ion.SPM()
    sim = pybamm.Simulation(model)
    sol = sim.solve([0, 3600])

    # Access terminal voltage
    voltage = sol["Terminal voltage [V]"]
    print(voltage.entries)      # numpy array of values
    print(voltage.t)            # time points (seconds)

    # Access other variables
    current = sol["Current [A]"]
    temperature = sol["Cell temperature [K]"]

    # Access by time
    v_at_t = voltage(t=1800)    # voltage at 30 minutes
    ```
  </Step>

  <Step title="Try a different model and parameters">
    Swap the model and parameter set with minimal changes:

    ```python Different model and parameters theme={null}
    import pybamm

    # Use SPM (faster) instead of DFN
    model = pybamm.lithium_ion.SPM()

    # Load a different parameter set
    param = pybamm.ParameterValues("Marquis2019")

    # Override a single parameter
    param["Current function [A]"] = 1.5

    sim = pybamm.Simulation(model, parameter_values=param)
    sol = sim.solve([0, 3600])
    print(f"Minimum voltage: {sol['Terminal voltage [V]'].entries.min():.4f} V")
    ```

    Available parameter sets include: `Chen2020`, `Marquis2019`, `OKane2022`, `ORegan2022`, `Ecker2015`, and more. See [Parameter Sets](/api/parameters/parameter-sets) for the full list.
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Battery Models" icon="battery-full" href="/models/lithium-ion">
    Explore SPM, SPMe, DFN, MPM, MSMR and other physics-based models.
  </Card>

  <Card title="Simulations Guide" icon="play" href="/guides/simulations">
    Learn all Simulation options: solvers, parameters, saving, and loading.
  </Card>

  <Card title="Experiments Guide" icon="flask" href="/guides/experiments">
    Define complex charge/discharge protocols with experiment strings.
  </Card>

  <Card title="API Reference" icon="code" href="/api/simulation">
    Full reference for every class, method, and parameter.
  </Card>
</CardGroup>

<Note>
  You can run PyBaMM notebooks interactively in Google Colab without any local installation by opening notebooks from the [PyBaMM GitHub repository](https://github.com/pybamm-team/PyBaMM/tree/main/docs/source/examples/notebooks/getting_started) in Colab.
</Note>
