import pandapipes as pp
#create empty net
net = pp.create_empty_network(fluid="lgas")
# create junction
j1 = pp.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 1")
j2 = pp.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 2")
j3 = pp.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 3")
# create junction elements
ext_grid = pp.create_ext_grid(net, junction=j1, p_bar=1.1, t_k=293.15, name="Grid Connection")
sink = pp.create_sink(net, junction=j3, mdot_kg_per_s=0.045, name="Sink")
# create branch element
pipe = pp.create_pipe_from_parameters(net, from_junction=j1, to_junction=j2, length_km=0.1, diameter_m=0.05, name="Pipe 1")
valve = pp.create_valve(net, from_junction=j2, to_junction=j3, diameter_m=0.05, opened=True, name="Valve 1")
Note that the fluid used here is lgas. You can find 4 predefined fluids in pandapipes: - lgas - hgas - water - air
And that the predefined valve element is an ideal valve.
Each dataframe in a pandapipes net object contains the information about one pandapipes element, such as pipe, sink, valve etc.
net.junction
net.pipe
net.ext_grid
We now run a pipe flow:
pp.pipeflow(net)
And check out at the results for junctions and pipes:
net.res_junction
They're is no pressure loss between junction 2 and junction 3 because of the ideal valve.
net.res_pipe
We now close the valve between junction 2 and junction 3:
# Problem can not run pipeflow if valve closed
net.valve.opened = False
The closed valve cuts the sink from the external grid:
This can be verified by running a power flow and inspecting the results. The pressure and temperature at junction 2 is given as NaN:
pp.pipeflow(net)
net.res_junction
Also the results from the pipe show that the mass flow is almost zero and the speed of the mass flow is zero.
net.res_pipe