diff --git a/tests/test_graphs.py b/tests/test_graphs.py index 8acf62a76..8090742d5 100644 --- a/tests/test_graphs.py +++ b/tests/test_graphs.py @@ -119,6 +119,49 @@ def test_get_heatflow_graph(mc): assert almost_equal(y1[3], 11.68) +def test_get_fea_graph(mc): + reset_to_default_file(mc) + + mc.set_variable("TorqueCalculation", True) + mc.set_variable("ElectromagneticForcesCalc_Load", True) + + mc.do_magnetic_calculation() + + x, y = mc.get_fea_graph("Bt Gap (on load)", 1) + assert len(x) == len(y) == 181 + assert almost_equal(x[16], 4) + assert almost_equal(y[16], 0.344792719, 2) + + +def test_get_fea_graph_transient(mc): + reset_to_default_file(mc) + + mc.set_variable("TorqueCalculation", True) + mc.set_variable("ElectromagneticForcesCalc_Load", True) + + mc.do_magnetic_calculation() + + x, y = mc.get_fea_graph("Br Gap (stator) (on load transient)", 1, 0) + assert len(x) == len(y) == 4 + assert almost_equal(x[1], 120) + assert almost_equal(y[1], 0.626116165, 2) + + +def test_get_magnetic_3d_graph(mc): + reset_to_default_file(mc) + + mc.set_variable("TorqueCalculation", True) + mc.set_variable("ElectromagneticForcesCalc_Load", True) + + mc.do_magnetic_calculation() + + graph_result = mc.get_magnetic_3d_graph("Ft_Stator_OL", 1) + assert len(graph_result.x) == 481 + assert len(graph_result.y) == 4 + # Note that graph viewer shows in kN, result is in N + assert almost_equal(graph_result.data[1][1], -0.560483068, 3) + + # #Not fully ready submitted an issue # def test_get_fea_graph_point(): # reset_to_default_file(mc)