Example #1
0
    def test06_sequential_simulation_server_same_file(self):
        """[summary]
        """
        sim_file_path_obj = Path('../data/simple_buck.plecs')
        full_sim_name = str(sim_file_path_obj.absolute())
        plecs_mdl = pyplecs.GenericConverterPlecsMdl(full_sim_name)

        input("Press Enter to continue with next sim 00...")

        plecs42 = pyplecs.PlecsApp()
        plecs42.open_plecs()
        time.sleep(1)
        plecs_server = pyplecs.PlecsServer(plecs_mdl.folder, plecs_mdl.simulation_name)
        plecs_server.run_sim_with_datastream()

        input("Press Enter to continue with next sim 01...")

        ModelVars = dict()
        ModelVars["Vi"] = 250
        ModelVars["Ii_max"] = 25
        ModelVars["Vo_ref"] = 25

        plecs_server = pyplecs.PlecsServer(plecs_mdl.folder, plecs_mdl.simulation_name)
        plecs_server.run_sim_with_datastream(param_dict=ModelVars)

        input("Press Enter to continue with next sim 02...")

        ModelVars["Vi"] = 25
        ModelVars["Ii_max"] = 1
        ModelVars["Vo_ref"] = 5

        plecs_server = pyplecs.PlecsServer(plecs_mdl.folder, plecs_mdl.simulation_name)
        plecs_server.run_sim_with_datastream(param_dict=ModelVars)
Example #2
0
    def test_gui_simulation(self):
        """[summary]
        """
        
        # creating processes

        plecs42 = pyplecs.PlecsApp()
        plecs42.open_plecs()
        
        sim_file_path_obj = Path('../data/simple_buck.plecs')
        full_sim_name = str(sim_file_path_obj.absolute())
        buck_mdl = pyplecs.GenericConverterPlecsMdl(full_sim_name)

        ModelVars = dict()
        ModelVars["Vi"] = 250
        ModelVars["Ii_max"] = 25
        ModelVars["Vo_ref"] = 25

        buck_mdl_01 = pyplecs.generate_variant_plecs_mdl(src_mdl=buck_mdl,
                                                         variant_name='01', variant_vars=ModelVars)

        ModelVars["Vi"] = 25
        ModelVars["Ii_max"] = 1
        ModelVars["Vo_ref"] = 5

        buck_mdl_02 = pyplecs.generate_variant_plecs_mdl(src_mdl=buck_mdl,
                                                         variant_name='02', variant_vars=ModelVars)

        time.sleep(1)
        buck_mdl_01_server = pyplecs.PlecsServer(buck_mdl_01.folder,
                                                 buck_mdl_01.simulation_name)

        time.sleep(1)
        buck_mdl_02_server = pyplecs.PlecsServer(buck_mdl_02.folder,
                                                 buck_mdl_02.simulation_name)

        buck_mdl_01_server.load()
        time.sleep(1)
        plecs42.run_simulation_by_gui(plecs_mdl=buck_mdl_01)

        buck_mdl_02_server.load()
        time.sleep(1)
        plecs42.run_simulation_by_gui(plecs_mdl=buck_mdl_02)
Example #3
0
    def test07_sequential_simulation_server_different_file(self):
        """[summary]
        """
        sim_file_path_obj = Path('../data/simple_buck.plecs')
        full_sim_name = str(sim_file_path_obj.absolute())
        buck_mdl = pyplecs.GenericConverterPlecsMdl(full_sim_name)

        ModelVars = dict()
        ModelVars["Vi"] = 250
        ModelVars["Ii_max"] = 25
        ModelVars["Vo_ref"] = 25

        buck_mdl_01 = pyplecs.generate_variant_plecs_mdl(
            src_mdl=buck_mdl, variant_name='01', variant_vars=ModelVars)

        ModelVars["Vi"] = 25
        ModelVars["Ii_max"] = 1
        ModelVars["Vo_ref"] = 5

        buck_mdl_02 = pyplecs.generate_variant_plecs_mdl(
            src_mdl=buck_mdl, variant_name='02', variant_vars=ModelVars)

        sim_path_buck_mdl_01 = buck_mdl_01.folder
        sim_name_buck_mdl_01 = buck_mdl_01.simulation_name
        print(sim_path_buck_mdl_01)
        print(sim_name_buck_mdl_01)

        sim_path_buck_mdl_02 = buck_mdl_02.folder
        sim_name_buck_mdl_02 = buck_mdl_02.simulation_name

        plecs42 = pyplecs.PlecsApp()
        plecs42.open_plecs()
        time.sleep(1)
        plecs_server = pyplecs.PlecsServer(sim_path_buck_mdl_01,
                                           sim_name_buck_mdl_01)
        plecs_server.run_sim_with_datastream()
        input("Press Enter to continue with next sim...")

        time.sleep(1)
        plecs_server = pyplecs.PlecsServer(sim_path_buck_mdl_02,
                                           sim_name_buck_mdl_02)
        plecs_server.run_sim_with_datastream()
        input("Press Enter to continue with next sim...")
Example #4
0
    def test04_pyplecs_xrpc_server(self):
        """[summary]
        """
        sim_file_path_obj = Path('../data/simple_buck.plecs')
        full_sim_name = str(sim_file_path_obj.absolute())
        plecs_mdl = pyplecs.GenericConverterPlecsMdl(full_sim_name)

        plecs42 = pyplecs.PlecsApp()
        plecs42.kill_plecs()
        plecs42.open_plecs()
        time.sleep(1)
        pyplecs.PlecsServer(plecs_mdl.folder, plecs_mdl.simulation_name)