Exemplo n.º 1
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 = ResultHandlerBinaryFile(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 = ResultDymolaBinary('CoupledClutches_result.mat')
     
     assert res.description[res.get_variable_index("J1.phi")] == "Absolute rotation angle of component"
Exemplo n.º 2
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 = ResultHandlerBinaryFile(model)
        result_writer.set_options(opts)
        result_writer.simulation_start()
        result_writer.initialize_complete()
        result_writer.integration_point()
        result_writer.simulation_end()

        res = ResultDymolaBinary('CoupledClutches_result.mat')

        assert res.description[res.get_variable_index(
            "J1.phi")] == "", "Description is not empty, " + res.description[
                res.get_variable_index("J1.phi")]
Exemplo n.º 3
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 = ResultHandlerBinaryFile(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 = ResultDymolaBinary('Description_result.mat')
     
     desc = res.description[res.get_variable_index("x")]
     #This handling should in the future be nativly handled by the IO module        
     desc = desc.encode("latin_1", "replace").decode("utf-8", "replace")
     
     assert desc == u"Test symbols '' ‘’"