diff --git a/controller/README.md b/controller/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3f710311b4e6b006bce22a74980acaaea0105db9 --- /dev/null +++ b/controller/README.md @@ -0,0 +1,23 @@ +Install the controller and its dependencies +by following these instructions: + +Please make sure that you are using Python 3.9 or higher. + +Please make sure that you have installed setuptools for python3 +if not: + sudo apt install python3-setuptools + or + pip install setuptools + +1. Navigate to /detectorwritesim/controller +2. Create a new Python3.9 or higher virtual environment: + python3 -m venv cenv +3. Activate the environment: + source cenv/bin/activate +4. Build the controller: + python3 setup.py install + +Now you have completed the setup process, +you can start the controller by entering the following command: + +controller_run \ No newline at end of file diff --git a/controller/setup.py b/controller/setup.py index aa79bcb8799a5a9af0f04013ea542320ac220d9d..82953ab5d7bac55797334c3e85a6c0573b8503fb 100644 --- a/controller/setup.py +++ b/controller/setup.py @@ -15,7 +15,7 @@ setup( ], entry_points={ 'console_scripts': [ - 'mein_programm=controller.main:main' + 'controller_run=controller.main:main' ] } ) diff --git a/simrunner/simrunner.py b/simrunner/simrunner.py new file mode 100644 index 0000000000000000000000000000000000000000..8ee801cf692e0734db86bf0b7d3c6574f4a467a4 --- /dev/null +++ b/simrunner/simrunner.py @@ -0,0 +1,22 @@ +import os +import subprocess + + +def start_cpp_program(program_path, arguments): + command = [program_path] + arguments + process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + return process + + +def send_input(program_path, arguments): + command = [program_path] + arguments + process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE) + output = process.stdout.readline().decode() + return output + + +# Beispielverwendung +cpp_program_path = os.path.join(os.path.dirname(__file__), "../build/src/detsim") +arguments = ["-o", "output", "--posixDataDir", "protokoll", "-n", "100", "-s", "2M", "-i", "0.1s", "-N", "4"] + +send_input(cpp_program_path, arguments)