def test_pump_from_regression_parameteres(): """ :return: :rtype: """ net = pandapipes.create_empty_network("net", add_stdtypes=False) j1 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=283.15) j2 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=283.15) j3 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=283.15) j4 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=283.15) pandapipes.create_pipe_from_parameters(net, j1, j2, k_mm=1., length_km=0.43380, diameter_m=0.1022) pandapipes.create_pipe_from_parameters(net, j3, j4, k_mm=1., length_km=0.26370, diameter_m=0.1022) pandapipes.create_ext_grid(net, j1, 5, 283.15, type="p") pandapipes.create_pump_from_parameters(net, j2, j3, 'P1', regression_parameters=[ -1.48620799e-04, -1.29656785e-02, 6.10000000e+00 ]) pandapipes.create_sink(net, j4, 0.02333) pandapipes.create_fluid_from_lib(net, "lgas", overwrite=True) pandapipes.pipeflow(net, stop_condition="tol", iter=3, friction_model="nikuradse", mode="hydraulics", transient=False, nonlinear_method="automatic", tol_p=1e-4, tol_v=1e-4) data = pd.read_csv(os.path.join(internals_data_path, "test_pump.csv"), sep=';') res_junction = net.res_junction.p_bar.values res_pipe = net.res_pipe.v_mean_m_per_s.values p_diff = np.abs(1 - res_junction / data['p'].dropna().values) v_diff = np.abs(1 - res_pipe / data['v'].dropna().values) assert np.all(p_diff < 0.01) assert np.all(v_diff < 0.01)
def test_additional_tables(): net = pandapipes.create_empty_network() pandapipes.create_junction(net, pn_bar=5, tfluid_k=283) pandapipes.create_junction(net, pn_bar=5, tfluid_k=283) pandapipes.add_new_component(net, Sink) sink_input = list(copy.deepcopy(net.sink.columns)) pandapipes.create_sink(net, 1, mdot_kg_per_s=1) sink_input_create = list(net.sink.columns) assert sink_input == sink_input_create, "Input does not equal create-table" pandapipes.add_new_component(net, Source) source_input = list(copy.deepcopy(net.source.columns)) pandapipes.create_source(net, 1, mdot_kg_per_s=1) source_input_create = list(net.source.columns) assert source_input == source_input_create, "Input does not equal create-table" pandapipes.add_new_component(net, Pump) pump_input = list(copy.deepcopy(net.pump.columns)) pandapipes.create_pump_from_parameters(net, 0, 1, 'P4', [6.1, 5.8, 4], [0, 19, 83], 2) pump_input_create = list(net.pump.columns) assert pump_input == pump_input_create, "Input does not equal create-table" pandapipes.add_new_component(net, CirculationPumpMass) pumpcircmass_input = list(copy.deepcopy(net.circ_pump_mass.columns)) pandapipes.create_circ_pump_const_mass_flow(net, 0, 1, 5, 5, 300, type='pt') pumpcircmass_input_create = list(net.circ_pump_mass.columns) assert pumpcircmass_input == pumpcircmass_input_create, "Input does not equal create-table" pandapipes.add_new_component(net, CirculationPumpPressure) pumpcircpres_input = list(copy.deepcopy(net.circ_pump_pressure.columns)) pandapipes.create_circ_pump_const_pressure(net, 0, 1, 5, 2, 300, type='pt') pumpcircpres_input_create = list(net.circ_pump_pressure.columns) assert pumpcircpres_input == pumpcircpres_input_create, "Input does not equal create-table" pandapipes.add_new_component(net, Valve) valve_input = list(copy.deepcopy(net.valve.columns)) pandapipes.create_valve(net, 0, 1, diameter_m=0.1, opened=False) valve_input_create = list(net.valve.columns) assert valve_input == valve_input_create, "Input does not equal create-table" pandapipes.add_new_component(net, HeatExchanger) hex_input = list(copy.deepcopy(net.heat_exchanger.columns)) pandapipes.create_heat_exchanger(net, 0, 1, 0.2, qext_w=20000) hex_input_create = list(net.heat_exchanger.columns) assert hex_input == hex_input_create, "Input does not equal create-table"
def net_plotting(): net = pandapipes.create_empty_network(fluid="lgas") # create network elements, such as junctions, external grid, pipes, valves, sinks and sources junction1 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Connection to External Grid", geodata=(0, 0)) junction2 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 2", geodata=(2, 0)) junction3 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 3", geodata=(7, 4)) junction4 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 4", geodata=(7, -4)) junction5 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 5", geodata=(5, 3)) junction6 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 6", geodata=(5, -3)) junction7 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 7", geodata=(9, -4)) junction8 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 7", geodata=(9, 4)) pandapipes.create_ext_grid(net, junction=junction1, p_bar=1.1, t_k=293.15, name="Grid Connection") pandapipes.create_pipe_from_parameters(net, from_junction=junction1, to_junction=junction2, length_km=10, diameter_m=0.3, name="Pipe 1", geodata=[(0, 0), (2, 0)]) pandapipes.create_pipe_from_parameters(net, from_junction=junction2, to_junction=junction3, length_km=2, diameter_m=0.3, name="Pipe 2", geodata=[(2, 0), (2, 4), (7, 4)]) pandapipes.create_pipe_from_parameters(net, from_junction=junction2, to_junction=junction4, length_km=2.5, diameter_m=0.3, name="Pipe 3", geodata=[(2, 0), (2, -4), (7, -4)]) pandapipes.create_pipe_from_parameters(net, from_junction=junction3, to_junction=junction5, length_km=1, diameter_m=0.3, name="Pipe 4", geodata=[(7, 4), (7, 3), (5, 3)]) pandapipes.create_pipe_from_parameters(net, from_junction=junction4, to_junction=junction6, length_km=1, diameter_m=0.3, name="Pipe 5", geodata=[(7, -4), (7, -3), (5, -3)]) pandapipes.create_pipe_from_parameters(net, from_junction=junction7, to_junction=junction8, length_km=1, diameter_m=0.3, name="Pipe 6", geodata=[(9, -4), (9, 4)]) pandapipes.create_valve(net, from_junction=junction5, to_junction=junction6, diameter_m=0.05, opened=True) pandapipes.create_heat_exchanger(net, junction3, junction8, diameter_m=0.3, qext_w=20000) pandapipes.create_sink(net, junction=junction4, mdot_kg_per_s=0.545, name="Sink 1") pandapipes.create_source(net, junction=junction3, mdot_kg_per_s=0.234) pandapipes.create_pump_from_parameters(net, junction4, junction7, 'P1') return net
def test_create_pump_from_parameters(create_empty_net): net = copy.deepcopy(create_empty_net) pandapipes.create_junction(net, 1, 293, index=8, geodata=(0, 1)) pandapipes.create_junction(net, 1, 293, index=9, geodata=(2, 2)) pandapipes.create_pump_from_parameters(net, 8, 9, "pump1", pressure_list=[0, 1, 2, 3], flowrate_list=[0, 1, 2, 3], reg_polynomial_degree=1, index=2) try: pandapipes.create_pump_from_parameters(net, 8, 9, "pump1", pressure_list=[0, 1, 2, 3], flowrate_list=[0, 1, 2, 3], reg_polynomial_degree=1, index=2) assert False, "Shouldn't make pump, index exists!" except UserWarning: assert True try: pandapipes.create_pump_from_parameters(net, 8, 10, "pump1", pressure_list=[0, 1, 2, 3], flowrate_list=[0, 1, 2, 3], reg_polynomial_degree=1, index=2) assert False, "Shouldn't make pump, non-existent to_junction!" except UserWarning: assert True try: pandapipes.create_pump_from_parameters(net, 8, 9, "pump1", pressure_list=[0, 1, 2, 3], flowrate_list=[0, 1, 2, 3], reg_polynomial_degree=1, geodata=[(0, 1), (1, 1), (2, 2)]) assert False, "Shouldn't make pump, geodata not possible!" except ValueError: assert True
def test_create_pump_from_parameters(create_empty_net): net = copy.deepcopy(create_empty_net) pandapipes.create_junction(net, 1, 293, index=8, geodata=(0, 1)) pandapipes.create_junction(net, 1, 293, index=9, geodata=(2, 2)) pandapipes.create_pump_from_parameters(net, 8, 9, "pump1", pressure_list=[0, 1, 2, 3], flowrate_list=[0, 1, 2, 3], reg_polynomial_degree=1, index=2) with pytest.raises(UserWarning): pandapipes.create_pump_from_parameters(net, 8, 9, "pump1", pressure_list=[0, 1, 2, 3], flowrate_list=[0, 1, 2, 3], reg_polynomial_degree=1, index=2) with pytest.raises(UserWarning): pandapipes.create_pump_from_parameters(net, 8, 10, "pump1", pressure_list=[0, 1, 2, 3], flowrate_list=[0, 1, 2, 3], reg_polynomial_degree=1, index=2) with pytest.raises(ValueError): pandapipes.create_pump_from_parameters(net, 8, 9, "pump1", pressure_list=[0, 1, 2, 3], flowrate_list=[0, 1, 2, 3], reg_polynomial_degree=1, geodata=[(0, 1), (1, 1), (2, 2)])
def test_collection_lengths(): net = pandapipes.create_empty_network(add_stdtypes=False) d = 40e-3 j1 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=293.15, geodata=(0, 0)) j2 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=293.15, geodata=(2, 0)) j3 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=293.15, geodata=(4, 2)) j4 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=293.15, geodata=(4, 0)) j5 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=293.15, geodata=(4, -2)) j6 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=293.15, geodata=(6, 0)) j7 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=293.15, geodata=(8, 0)) j8 = pandapipes.create_junction(net, pn_bar=5, tfluid_k=293.15, geodata=(10, 0)) pandapipes.create_ext_grid(net, j1, p_bar=5, t_k=293.15) pandapipes.create_sink(net, j5, mdot_kg_per_s=0.5) pandapipes.create_sink(net, j6, mdot_kg_per_s=0.5) pandapipes.create_sink(net, j8, mdot_kg_per_s=0.5) pandapipes.create_pipe_from_parameters(net, j1, j2, 0.1, diameter_m=d, k_mm=0.1, geodata=[(0, 0), (2, 0)]) pandapipes.create_valve(net, j2, j3, diameter_m=d, opened=True, loss_coefficient=5e3) pandapipes.create_valve(net, j2, j4, diameter_m=d, opened=False, loss_coefficient=0.01) pandapipes.create_valve(net, j2, j5, diameter_m=d, opened=False, loss_coefficient=0.01) pandapipes.create_pipe_from_parameters(net, j3, j6, 0.1, diameter_m=d, k_mm=0.1, geodata=[(4, 2), (6, 2), (6, 0)]) pandapipes.create_pipe_from_parameters(net, j4, j6, 0.2, diameter_m=d, k_mm=0.1, geodata=[(4, 0), (6, 0)]) pandapipes.create_pipe_from_parameters(net, j5, j6, 0.2, diameter_m=d, k_mm=0.1, geodata=[(4, -2), (6, -2), (6, 0)]) pandapipes.create_heat_exchanger(net, j6, j7, d, qext_w=20000) pandapipes.create_pump_from_parameters(net, j7, j8, 'P1') pipe_coll_direct = plot.create_pipe_collection(net, use_junction_geodata=True) pipe_coll_real = plot.create_pipe_collection(net) assert np.all( pipe_coll_direct.indices.astype(np.int64) == net.pipe.index.values.astype(np.int64)) assert len(pipe_coll_direct.get_paths()) == len(net.pipe) assert all([len(p) == 2 for p in pipe_coll_direct.get_paths()]) assert all([ len(p) == len(net.pipe_geodata.coords.iloc[i]) for i, p in enumerate(pipe_coll_real.get_paths()) ]) junction_coll = plot.create_junction_collection(net) assert np.all( junction_coll.node_indices.astype(np.int64) == net.junction.index.values.astype(np.int64)) assert len(junction_coll.get_paths()) == len(net.junction) valve_coll_patches, valve_coll_lines = plot.create_valve_collection(net) assert len(valve_coll_patches.get_paths()) == 2 * len(net.valve) assert len(valve_coll_lines.get_paths()) == 2 * len(net.valve) pump_coll_patches, pump_coll_lines = plot.create_pump_collection(net) assert len(pump_coll_patches.get_paths()) == len(net.pump) assert len(pump_coll_lines.get_paths()) == 4 * len(net.pump) hex_coll_patches, hex_coll_lines = plot.create_heat_exchanger_collection( net) assert len(hex_coll_patches.get_paths()) == 2 * len(net.heat_exchanger) assert len(hex_coll_lines.get_paths()) == 2 * len(net.heat_exchanger)
def create_base_net(oos, additional_pumps=True): net = pandapipes.create_empty_network(fluid="lgas") # create network elements, such as junctions, external grid, pipes, valves, sinks and sources junction1 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, in_service=not oos, name="Connection to External Grid", geodata=(0, 0)) junction2 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 2", geodata=(2, 0), in_service=not oos) junction3 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 3", geodata=(7, 4), in_service=not oos) junction4 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 4", geodata=(7, -4), in_service=not oos) junction5 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 5", geodata=(5, 3), in_service=not oos) junction6 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 6", geodata=(5, -3)) junction7 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 7", geodata=(9, -4)) junction8 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 8", geodata=(9, 4)) junction9 = pandapipes.create_junction(net, pn_bar=1.05, tfluid_k=293.15, name="Junction 9", geodata=(9, 0)) pandapipes.create_ext_grid(net, junction=junction1, p_bar=1.1, t_k=293.15, name="Grid Connection") pandapipes.create_pipe_from_parameters(net, from_junction=junction1, to_junction=junction2, length_km=10, diameter_m=0.3, name="Pipe 1", geodata=[(0, 0), (2, 0)], in_service=not oos) pandapipes.create_pipe_from_parameters(net, from_junction=junction2, to_junction=junction3, length_km=2, diameter_m=0.3, name="Pipe 2", geodata=[(2, 0), (2, 4), (7, 4)], in_service=not oos) pandapipes.create_pipe_from_parameters(net, from_junction=junction2, to_junction=junction4, length_km=2.5, diameter_m=0.3, name="Pipe 3", geodata=[(2, 0), (2, -4), (7, -4)], in_service=not oos) pandapipes.create_pipe_from_parameters(net, from_junction=junction3, to_junction=junction5, length_km=1, diameter_m=0.3, name="Pipe 4", geodata=[(7, 4), (7, 3), (5, 3)]) pandapipes.create_pipe_from_parameters(net, from_junction=junction4, to_junction=junction6, length_km=1, diameter_m=0.3, name="Pipe 5", geodata=[(7, -4), (7, -3), (5, -3)]) pandapipes.create_pipe_from_parameters(net, from_junction=junction7, to_junction=junction8, length_km=1, diameter_m=0.3, name="Pipe 6", geodata=[(9, -4), (9, 0)]) pandapipes.create_pipe_from_parameters(net, from_junction=junction7, to_junction=junction8, length_km=1, diameter_m=0.3, name="Pipe 7", geodata=[(9, 0), (9, 4)]) pandapipes.create_valve(net, from_junction=junction5, to_junction=junction6, diameter_m=0.05, opened=True) pandapipes.create_heat_exchanger(net, junction3, junction8, diameter_m=0.3, qext_w=20000) pandapipes.create_sink(net, junction=junction4, mdot_kg_per_s=0.545, name="Sink 1") pandapipes.create_source(net, junction=junction3, mdot_kg_per_s=0.234) pandapipes.create_pump_from_parameters(net, junction4, junction7, 'P1') if additional_pumps: pandapipes.create_circ_pump_const_mass_flow(net, junction9, junction5, 1.05, 1) pandapipes.create_circ_pump_const_pressure(net, junction9, junction6, 1.05, 0.5) if oos: pandapipes.create_ext_grid(net, junction=junction1, p_bar=1.1, t_k=293.15, name="Grid Connection", in_service=False) pandapipes.create_heat_exchanger(net, junction3, junction8, diameter_m=0.3, qext_w=20000, in_service=False) pandapipes.create_sink(net, junction=junction4, mdot_kg_per_s=0.545, name="Sink 2", in_service=False) pandapipes.create_pump_from_parameters(net, junction4, junction7, 'P1', in_service=False) pandapipes.create_source(net, junction=junction3, mdot_kg_per_s=0.234, in_service=False) pandapipes.create_circ_pump_const_mass_flow(net, junction9, junction5, 1.05, 1, in_service=False) pandapipes.create_circ_pump_const_pressure(net, junction9, junction6, 1.05, 0.5, in_service=False) return net
def release_control_test_network(): # empty net net = pp.create_empty_network("net", add_stdtypes=False) # fluid pp.create_fluid_from_lib(net, "water", overwrite=True) # junctions pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 0", index=None, in_service=True, type="junction", geodata=None) pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 1") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 2") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 3") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 4") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 5") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 6") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 7") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 8") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 9") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 10") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 11") pp.create_junction(net, pn_bar=3, tfluid_k=293, height_m=0, name="Junction 12") # pipes pp.create_pipe_from_parameters(net, from_junction=0, to_junction=8, length_km=3, diameter_m=0.01, k_mm=1, loss_coefficient=0, sections=10, alpha_w_per_m2k=10, text_k=293, qext_w=0., name="Pipe 0", index=None, geodata=None, in_service=True, type="pipe") pp.create_pipe_from_parameters(net, 9, 2, length_km=6, diameter_m=0.075, k_mm=.1, sections=10, alpha_w_per_m2k=3, name="Pipe 1") pp.create_pipe_from_parameters(net, 2, 12, length_km=5, diameter_m=0.06, k_mm=.1, sections=10, alpha_w_per_m2k=20, name="Pipe 2") pp.create_pipe_from_parameters(net, 4, 12, length_km=0.1, diameter_m=0.07, k_mm=.1, sections=10, alpha_w_per_m2k=2, name="Pipe 3") pp.create_pipe_from_parameters(net, 5, 3, length_km=1, diameter_m=0.09, k_mm=.1, sections=10, alpha_w_per_m2k=3, name="Pipe 4") pp.create_pipe_from_parameters(net, 4, 11, length_km=2.5, diameter_m=0.08, k_mm=.1, sections=10, alpha_w_per_m2k=15, name="Pipe 5") pp.create_pipe_from_parameters(net, 7, 6, length_km=4.5, diameter_m=0.085, k_mm=.1, sections=10, alpha_w_per_m2k=2.5, name="Pipe 6") pp.create_pipe_from_parameters(net, 1, 7, length_km=4, diameter_m=0.03, k_mm=.1, sections=10, alpha_w_per_m2k=1, name="Pipe 7") # external grids pp.create_ext_grid(net, junction=0, p_bar=3, t_k=300, name="External Grid 0", in_service=True, index=None, type="pt") pp.create_ext_grid(net, 1, p_bar=5, t_k=350, name="External Grid 1", type="pt") # sinks pp.create_sink(net, junction=2, mdot_kg_per_s=0.2, scaling=1., name="Sink 0", index=None, in_service=True, type="sink") pp.create_sink(net, 3, mdot_kg_per_s=0.1, name="Sink 1") pp.create_sink(net, 4, mdot_kg_per_s=0.5, name="Sink 2") pp.create_sink(net, 5, mdot_kg_per_s=0.07, name="Sink 3") pp.create_sink(net, 6, mdot_kg_per_s=0.09, name="Sink 4") pp.create_sink(net, 7, mdot_kg_per_s=0.1, name="Sink 5") # sources pp.create_source(net, junction=8, mdot_kg_per_s=0.1, scaling=1., name="Source 0", index=None, in_service=True, type="source") pp.create_source(net, junction=9, mdot_kg_per_s=0.03, name="Source 1") pp.create_source(net, junction=10, mdot_kg_per_s=0.04, name="Source 2") pp.create_source(net, junction=11, mdot_kg_per_s=0.09, name="Source 3") # valves pp.create_valve(net, from_junction=8, to_junction=9, diameter_m=0.1, opened=True, loss_coefficient=0, name="Valve 0", index=None, type="valve") pp.create_valve(net, 9, 4, diameter_m=0.05, opened=True, name="Valve 1") # pump pp.create_pump_from_parameters(net, from_junction=8, to_junction=3, new_std_type_name="Pump", pressure_list=[6.1, 5.8, 4], flowrate_list=[0, 19, 83], reg_polynomial_degree=2, poly_coefficents=None, name=None, index=None, in_service=True, type="pump") # circulation pump mass pp.create_circ_pump_const_mass_flow(net, from_junction=3, to_junction=4, p_bar=6, mdot_kg_per_s=1, t_k=290, name="Circ. Pump Mass", index=None, in_service=True, type="pt") # circulation pump pressure pp.create_circ_pump_const_pressure(net, from_junction=11, to_junction=5, p_bar=5, plift_bar=2, t_k=290, name="Circ. Pump Pressure", index=None, in_service=True, type="pt") # heat exchanger pp.create_heat_exchanger(net, from_junction=10, to_junction=6, diameter_m=0.08, qext_w=50, loss_coefficient=0, name="Heat Exchanger 0", index=None, in_service=True, type="heat_exchanger") pp.create_heat_exchanger(net, from_junction=4, to_junction=10, diameter_m=0.08, qext_w=28000, loss_coefficient=0, name="Heat Exchanger 1", index=None, in_service=True, type="heat_exchanger") # time series profiles_sink = pd.read_csv(os.path.join(pp_dir, 'test', 'api', 'release_cycle', 'release_control_test_sink_profiles.csv'), index_col=0) profiles_source = pd.read_csv(os.path.join(pp_dir, 'test', 'api', 'release_cycle', 'release_control_test_source_profiles.csv'), index_col=0) ds_sink = DFData(profiles_sink) ds_source = DFData(profiles_source) const_sink = control.ConstControl(net, element='sink', variable='mdot_kg_per_s', element_index=net.sink.index.values, data_source=ds_sink, profile_name=net.sink.index.values.astype(str)) const_source = control.ConstControl(net, element='source', variable='mdot_kg_per_s', element_index=net.source.index.values, data_source=ds_source, profile_name=net.source.index.values.astype(str)) const_sink.initial_run = False const_source.initial_run = False pp.pipeflow(net) pp.to_json(net, os.path.join(path, 'example_%s.json' % pp.__version__)) return net