src.variants.CarMaker.CarMakerRemote module
This module is responsible for the remote control of CarMaker.
It includes one class CarMakerRemote for the CarMaker control. See details in its own documentation.
Contact person: Stefan Riedmaier Creation date: 24.05.2020 Python version: 3.8
- class src.variants.CarMaker.CarMakerRemote.CarMakerRemote(config, domain, instance)
Bases:
objectThis class is responsible for the remote control of CarMaker.
It includes several methods for launching, tcp/ip connection, TestManager control, etc. See the respective function documentations for more details.
- close_tcpip_socket()
This function closes the tcp/ip socket.
- Returns:
- configure_carmaker_before_simulation(parameter_values, erg_path, parameter_name_list)
This function configures CarMaker before each execution of the simulation.
It includes scenario specific settings such as the parameter combinations.
- Parameters:
parameter_values (np.ndarray) – 1d array with parameter values (same order as name list)
erg_path (str) – path where the erg file should be stored
parameter_name_list (list[str]) – list with the parameter names
- Returns:
- configure_carmaker_initially()
This function initialies CarMaker with the desired settings.
It includes constant settings such as the CarMaker project or testrun.
- Returns:
- connect_tcpip_socket()
This function connects the python tpc/ip socket to the CarMaker socket.
- Returns:
- correct_erg_filenames()
This function corrects the erg-file names, since the TestManager always adds a sequence number in parallel mode.
Unfortunately the TestManager always adds _00x.erg to the result file names (sequence option: ?_%s) in parallel mode, even if the sequence option is not chosen. So we have to remove it afterwards.
- Returns:
- execute_simulation()
This function executes the simulation run and waits until it is finished.
- Returns:
- execute_testseries(scenarios_da, erg_path_list)
This function configures and executes a whole test series.
- Parameters:
scenarios_da (xr.DataArray) – array with parameter vectors
erg_path_list (list) – list with erg paths where the results should be stored
- Returns:
- launch_carmaker(detached_flag=True)
This function starts the CarMaker application with TCP/IP port.
- Parameters:
detached_flag (bool) – flag to indicate whether CarMaker should stay alive or not
- Returns:
- receive_tcpip_message(expected_answer)
This function receives an entire tcp/ip message and compares it with an expected answer.
It is aimed at the use case where a certain response from the sender is expected when everything has worked. Otherwise, the answer will be different. The known length of the expected answer is used to determine when the end of the answer is reached.
It compares the expected answer with the received answer up to the same length. It only approves a full match, or aborts otherwise. It does not analyse an unknown content from the sender until reaching a delimiter.
- Parameters:
expected_answer (str) – the answer expected from the sender
- Returns:
- send_tcpip_message(message)
This function sends an entire tcp/ip message.
- Parameters:
message (str) – the desired message to be transferred
- Returns: