Skip to content

Commit 1fee905

Browse files
committed
Fixing test_pipe fail
1 parent 61af906 commit 1fee905

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

h2integrate/transporters/test/test_pipe.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
1+
import numpy as np
12
import pytest
23
import openmdao.api as om
3-
from pytest import approx
4+
from pytest import approx, fixture
45

56
from h2integrate.transporters.pipe import PipePerformanceModel
67

78

9+
@fixture
10+
def plant_config():
11+
plant_dict = {
12+
"plant": {
13+
"plant_life": 30,
14+
"simulation": {"n_timesteps": 8760, "dt": 3600},
15+
}
16+
}
17+
return plant_dict
18+
19+
820
@pytest.mark.unit
9-
def test_pipe_with_hydrogen():
21+
def test_pipe_with_hydrogen(plant_config):
1022
"""Test the pipe transport with hydrogen as transport_item."""
1123

1224
# Create the pipe component with hydrogen as transport item
13-
pipe = PipePerformanceModel(transport_item="hydrogen")
25+
pipe = PipePerformanceModel(plant_config=plant_config, transport_item="hydrogen")
1426

1527
# Create OpenMDAO problem and add the component
1628
prob = om.Problem()
1729
prob.model.add_subsystem("pipe", pipe, promotes=["*"])
1830

1931
# Add independent variable component for input
2032
ivc = om.IndepVarComp()
21-
ivc.add_output("hydrogen_in", val=10.0, units="kg/s")
33+
hydrogen_profile = np.full(8760, 10.0)
34+
ivc.add_output("hydrogen_in", val=hydrogen_profile, units="kg/s")
2235
prob.model.add_subsystem("ivc", ivc, promotes=["*"])
2336

2437
# Setup and run the model
2538
prob.setup()
26-
prob.set_val("hydrogen_in", 10.0, units="kg/s")
39+
prob.set_val("hydrogen_in", val=hydrogen_profile, units="kg/s")
2740
prob.run_model()
2841

2942
# Check that output equals input (pass-through pipe with no losses)

0 commit comments

Comments
 (0)