  ## A simple yet powerful power flow solver accessible as a web-service through a Python API ```				```
# Create two buses
source_bus = Bus(id="sb", phases="abcn")

# Define the reference of potentials to be the neutral of the source bus
ground = Ground(id="gnd")
pref = PotentialRef(id="pref", element=ground)  # Fix the potential of the ground at 0 V
ground.connect(source_bus, phase="n")

# Create a LV source at the first bus
un = 400 / np.sqrt(3)  # Volts (phase-to-neutral because the source is connected to the neutral)
source_voltages = Q_([un, un * np.exp(-2j * np.pi / 3), un * np.exp(2j * np.pi / 3)], "V")
vs = VoltageSource(id="vs", bus=source_bus, phases="abcn", voltages=source_voltages)

# Add a LV line between the source bus and the load bus
lp = LineParameters("lp", z_line=Q_((0.1 + 0.0j) * np.eye(4, dtype=complex), "ohm/km"))  # R = 0.1 Ohm/km, X = 0
line = Line(id="line", bus1=source_bus, bus2=load_bus, phases="abcn", parameters=lp, length=Q_(2.0, "km"))

# Create the electrical network
en = ElectricalNetwork.from_element(source_bus)
# >>> <ElectricalNetwork: 2 buses, 1 branch, 1 load, 1 source, 1 ground, 1 potential ref>

# >>> 2 iterations
```
```

## In need of a trustful load flow solver? We'll share ours!

Roseau Load Flow was originally developed for Roseau Technologies’ internal use, but good things are meant to be shared. That’s why we made a first public release of the solver in February 2023. Give it a try!

## Static power network analysis

Standard load flow computation and other applications such as fault current calculation

## Full support of meshed networks, multiple phases and grid imbalance

• Models of polyphase lines and transformers

#### Accessible from a Python API

• Human-readable, object-oriented modeling of the grid
• Scripting for process automation
• Easy integration with other software

```				```
# Let's use a pq(u) control injecting reactive power
# before reducing active power

fp = FlexibleParameter.pq_u_production(
up_up=Q_(240, "V"),
up_max=250, # Volt by default
uq_min=Q_(200, "V"),
uq_down=Q_(210, "V"),
uq_up=Q_(235, "V"),
uq_max=Q_(240, "V"),
s_max=Q_(4, "kVA")
)

phases="abcn",
powers=Q_([-3.5, 0, 0], "kVA"),
flexible_params=[
fp,
FlexibleParameter.constant(),
FlexibleParameter.constant()
],
)

# >>> 2 iterations

# Get the results
# >>> [242.72 232.62 233.68] <Units('volt')>

```
```

## Fully generic modeling of loads and generators

• Flexible generators can be finely modeled with P(U) and/or Q(U) curves and apparent power limits
• Generic design that makes it easy to add any new type of voltage-dependent loads/generators in the future

## Simplicity and user-friendliness

• Straightforward, transparent mathematical models: no transformation of the natural model, such as eliminating the neutral wire (Kron’s reduction) or changing the units to “p.u.”
• Support for physical units to avoid errors (e.g. confusing W and kW) and let everyone work with their preferred units (metric / imperial)
```				```
# Results per object
# >>> [0.22193 0.22193 0.22193] <Unit('kilovolt')>

abs(line.res_currents)
# >>> [45.06, 45.06, 45.06,  0.  ] <Unit('ampere')>

# Global Results (data frame)
en.res_buses_voltages.transform([np.abs, np.angle]) # in V
# >>>                         voltage
# >>>                absolute         angle
# >>> bus_id phase
# >>> sb     an     230.940108  6.671617e-37
# >>>        bn     230.940108 -2.094395e+00
# >>>        cn     230.940108  2.094395e+00
# >>> lb     an     221.928183  2.599590e-22
# >>>        bn     221.928183 -2.094395e+00
# >>>        cn     221.928183  2.094395e+00

en.res_loads # in A, VA and V
# >>>                 current         power       potential
# >>> load	a	  45.06+0.00j   10000.00-0.00j  221.93-0.00j
# >>>       b    -22.53-39.02j  10000.00-0.00j -110.96-192.20j
# >>>       c    -22.53+39.02j  10000.00+0.00j -110.96+192.20j
# >>>       n	 -0.00+0.00j	 -0.00+0.00j      0.00-0.00j

en.res_line_losses # in VA
# >>>               series_losses shunt_losses	total_losses
# >>> line_id phase
# >>> line	   a	406.07+0.00j  0.00+0.00j	406.07+0.00j
# >>>          b	406.07+0.00j  0.00+0.00j	406.07+0.00j
# >>>          c    406.07+0.00j  0.00+0.00j	406.07+0.00j
# >>>          n      0.00+0.00j  0.00+0.00j    0.00+0.00j

```
```

## Samples of grid data included • A sample of 20 low-voltage and 20 medium-voltage feeders is included for an easy start !
• Each network is given with its summer and winter load point.