/hoist-control-simulator

The code to design, develop, test and deploy is an interactive simulator of hoist with 2 d.o.f, in which two different consoles allow the user to activate the hoist.

Primary LanguageShell

hoist-control-simulator

The code to design, develop, test and deploy is an interactive simulator of hoist with 2 d.o.f, in which two different consoles allow the user to activate the hoist.

In the octagonal box there are two motors mx and mz, which displace the hoist along the two respective axes. Motions along axes have their bounds, say 0 - max_x and 0 - max_z. From the user side there are two consoles (shell windows) and keys with different aims, that simulate a real system.

Project Description:

The simulator consists of the following parts:

  1. main process: forks and executes its child processes (inspection and command consoles) and also detects if there is any error during the execution.

  2. command console: gets commands from user through keyboard inputs and sends them to motors using myfifo and myfifo2.

  3. inspection console: forks and excutes its child processes (motor_x and motor_z). it gets motors position through myfifo3 and myfifo4. it also sends SIGUSR1 to motors if it detects SIGINT(ctrl+c) and sends SIGUSR2 if it detects SIGTSTP(ctrl+z)

  4. motor x: simulates the hoist motor in x axis. it gets command from command console through myfifo and sends its position data to inspection console through myfifo3. It stops immediately if it gets SIGUSR1, and also resets if it gets SIGUSR2 from inspection console.

  5. motor z: simulates the hoist motor in z axis. it gets command from command console through myfifo2 and sends its position data to inspection console through myfifo4. It stops immediately if it gets SIGUSR1, and also resets if it gets SIGUSR2 from inspection console.

  6. watchdog: Always waits for SIGUSR1 from all other processes and if it didn't catch any for 60 seconds, it will send SIGKILL to all of them.

  7. logfiles: the are two logfiles which are generated by motor processses. motors position data store in these files during the simulation process.