Introduction

The laboratory is to design a simulator for a simple industrial process and then to implement that in C following standard software engineering principles.

The industrial Process

This industrial process may be described as follows:

  • The process is part of an overall manufacturing process.
  • For purposes of simplicity, the input to the process can be regarded as a random sequence of units that can be described symbolically as A, B, C and D.
  • One unit arrives at the station every time unit.
  • At the station is an input selector unit and four manufacturing units. The selector unit operates as follows:
    • If the input unit is an A, it passes it to machine 1.
    • If the input unit is a B, it passes it to machine 2.
    • If the input unit is a C AND the previous unit was a B, then it passes it to machine 2
    • If the input unit is a D, it passes it to machine 3.
    • If the input unit is a B AND the previous unit was a D, then it passes it to machine 3.
    • If the input unit is a C AND the previous unit was a B AND the unit before that was a D, it passes it to machine 3.
    • Anything else is passed to machine 4.
  • Machine 1 takes 1 time unit to generate an output unit V.
  • Machine 2 takes 1 unit to generate an output W if the input was B. If the input was BC, it takes 2 time units and produces an output X.
  • Machine 3 takes 3 time units if the input was a D and generates an output Y, but 4 if it was DB and generates an output U. If it was DBC then it takes 7 time units to produce an output Z.
  • Machine 4 takes 5 time units and generates an output T.
  • The outputs are queued and an output selector generates a single stream of units. After start-up, there must be one output unit generated every time unit.

A question you must answer. How long is each queue to ensure a continuous output?

Development requirements

You are to write this simulator in ANSI standard C only. You should look to how you can visually display on a terminal the simulated system, or at the very least, the input and output streams.

You are to develop this simulator according to software engineering principles. These will be covered n the lecture program. However, to start the lab you might like to think on the following:

  • All the specifications you need are listed above.
  • Plan your activities for the semester. Note how long to takes to write a report and work back from there.
  • Begin by looking at the major blocks of the program. Sketch these out.
  • This is a timed system. More technically, it is a discrete event simulation. Then one of the key things you have to consider in developing your software is how to treat time.
  • How are you going to visually display this simulation?

Working at home

If you go to the web you will find numerous C editors available as freeware. Look for one that is context sensitive; that is, it recognises key words, indents automatically and so on. Some of these editors are coupled to particular compilers. The best known free compiler is the GNU compiler. ( Also search for ECC or OSF compiler ). It is very good indeed. Make sure any compiler you choose is ANSI C compatible; not all are! There are also a number of C tutorials on the web, but their quality is disappointing and many are rather dated.

For those of you who like a challenge, you might like to download Eclipse. This is the most popular IDE ( integrated Design Environment ) in the world and is written in Java hence it will run on almost any machine. It is an exceptional and very powerful IDE, BUT it takes some getting used to. If you expect to do a lot of programming, though, it would be a good idea to at least have a look at it as once you work out how to use it, life can be a breeze. To stress again, though, this is a professional tool, so if you want to be a professional investigate and of you dont you will probably be better off with something simpler.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.