Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

C/C++ for developing a multi threaded program that simulates a control system

Status
Not open for further replies.

Cleong

Member level 2
Joined
Feb 17, 2006
Messages
53
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,789
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
 

Re: C help

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)
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
Re: C help

agent_009 said:
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.
..

tq
 

Re: C help

I guess you will have to take input as string. Then parse the string and then use values as speed and line no.

For example: from 1W separate '1' and 'W'. Then see which line is it and what speed. You will also have to perform validity checks on it first.
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
Re: C help

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

Swingbyte
 

    Cleong

    Points: 2
    Helpful Answer Positive Rating
Re: C help

Can i know how to write the code if i wan A and B are transported down to line 1 randomly.

jz like it wil show us A A A B A B............
randomly..
 

Re: C help

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.

Swingbyte
 

Re: C help

can someone give me the simple code for 1st window will produce blue and red
, 2nd and 3rd windows is separately receive blue and red . .. .
tqtqtq
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top