Exemple #1
0
 def test_result_dymola_textual_finding_derivative(self):
     """
     Test so that the correct alias derivatives are found.
     """
     res = ResultDymolaTextual(
         os.path.join(path_to_results,
                      "VDP_pack_VDP_Test_result_modified_for_alias.txt"))
     assert res.get_variable_index("vdp.der(x1)") == res.get_variable_index(
         "der(vdp.u)")
Exemple #2
0
 def test_result_dymola_textual_naming_convention(self):
     """
     Assert that we can read both der(PI.x) and PI.der(x) variables. Also tests
     that we can read u[2, 1] and u[2,1].
     """
     res = ResultDymolaTextual(os.path.join(path_to_results, "VDP_pack_VDP_Test_result_correct.txt"))
     assert res.get_variable_index("vdp.der(x1)") == res.get_variable_index("der(vdp.x1)")
     assert res.get_variable_index("u[2,1]") == res.get_variable_index("u[2, 1]")
     
     res = ResultDymolaTextual(os.path.join(path_to_results, "VDP_pack_VDP_Test_result_incorrect.txt"))
     assert res.get_variable_index("vdp.der(x1)") == res.get_variable_index("der(vdp.x1)")
     assert res.get_variable_index("u[2, 1]") == res.get_variable_index("u[2, 1]")
Exemple #3
0
 def test_get_description(self):
     model = Dummy_FMUModelME1([], "CoupledClutches.fmu", os.path.join(file_path, "files", "FMUs", "XML", "ME1.0"), _connect_dll=False)
     model.initialize()
     
     result_writer = ResultHandlerFile(model)
     result_writer.set_options(model.simulate_options())
     result_writer.simulation_start()
     result_writer.initialize_complete()
     result_writer.integration_point()
     result_writer.simulation_end()
     
     res = ResultDymolaTextual('CoupledClutches_result.txt')
     
     assert res.description[res.get_variable_index("J1.phi")] == "Absolute rotation angle of component"
Exemple #4
0
    def test_description_not_stored(self):
        model = Dummy_FMUModelME1([],
                                  "CoupledClutches.fmu",
                                  os.path.join(file_path, "files", "FMUs",
                                               "XML", "ME1.0"),
                                  _connect_dll=False)
        model.initialize()

        opts = model.simulate_options()
        opts["result_store_variable_description"] = False

        result_writer = ResultHandlerFile(model)
        result_writer.set_options(opts)
        result_writer.simulation_start()
        result_writer.initialize_complete()
        result_writer.integration_point()
        result_writer.simulation_end()

        res = ResultDymolaTextual('CoupledClutches_result.txt')

        assert res.description[res.get_variable_index(
            "J1.phi")] == "", "Description is not empty, " + res.description[
                res.get_variable_index("J1.phi")]
Exemple #5
0
    def test_get_description_unicode(self):
        model = Dummy_FMUModelME1([], "Description.fmu", os.path.join(file_path, "files", "FMUs", "XML", "ME1.0"), _connect_dll=False)
        model.initialize()
        
        result_writer = ResultHandlerFile(model)
        result_writer.set_options(model.simulate_options())
        result_writer.simulation_start()
        result_writer.initialize_complete()
        result_writer.integration_point()
        result_writer.simulation_end()
        
        res = ResultDymolaTextual('Description_result.txt')
        desc = res.description[res.get_variable_index("x")] 

        assert desc == u"Test symbols '' ‘’"
Exemple #6
0
 def test_result_dymola_textual_finding_derivative(self):
     """
     Test so that the correct alias derivatives are found.
     """
     res = ResultDymolaTextual(os.path.join(path_to_results, "VDP_pack_VDP_Test_result_modified_for_alias.txt"))
     assert res.get_variable_index("vdp.der(x1)") == res.get_variable_index("der(vdp.u)")