i need using C/C++ to develop a multi threaded concurent program that simulates a contro system for assembly lines. .
the assembly line i need must consist 3 lines. blue and red objects are transported down line 1 and sort onto line 2(blue) and 3(red)
and also need separate I/O process input from keyboard..
jz like increase, reduce and stop speed of line
can anyone give me an idea how to do it.
im new in C
You can start by making threads or multiple processes. Each process/thread will be doing its own specified task. You will need semaphores to synchronize these tasks. You may also need Queues or Linked lists to simulate the assembly line (elements in queue will be products travelling on assembly line)
You can start by making threads or multiple processes. Each process/thread will be doing its own specified task. You will need semaphores to synchronize these tasks. You may also need Queues or Linked lists to simulate the assembly line (elements in queue will be products travelling on assembly line)
i need to know how to use the keyboard to control the speed of lines..
for example... press 1W wil incress the speed of line 1 and if press 1Q will reduce the speed of line 1. .2Q reduce speed of line 2.
..
Why are you using threads? Is it a school project. Communicate with threads through shared memory and massages.
In general simulation, set up objects that represent generic processes to be simulated , inherit to speicalise them, use update member functions to iterate through time.
Threads are powerful, but complicated, be sure you use the right tool for the job
One could represent each line with a class that implements a FIFO like a conveyor belt. The time iteration function moves the objects along one discrete step at a time. Each different object on the conveyor could be represented by a identifier ( number, string class??) The time iteration must check initial and terminal states of the conveyor and call appropriate handlers e.g. move to next line, pack in box.
Each line is instantiated empty and is filled by an object placement function.
The important concept to grasp is that mathematical models don't have to be physical analogs of the real world and that time is represented by discrete moments that are the minimum one can resolve to.
Good luck.