Chapter 3.9            Simulation and Real-time Processing.3.9 (a)        Real-time Applications.A real-time system is one...
thermistor increases, it is this voltage which gives a measurement of the temperature.Note that any temperature may be rep...
Imagine a car production line. Each car is built on a flat bed which is on wheels and runsalong a track from one building ...
different growing conditions can be shown in seconds rather than waiting 6 months forthe sunflower to grow. One can imagin...
and the calculations are simple. If the predictions are based on a more complexrelationship then the computer becomes usef...
Upcoming SlideShare
Loading in …5



Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Chapter 3.9 Simulation and Real-time Processing.3.9 (a) Real-time Applications.A real-time system is one that can react quickly enough to data input to affect the realworld. If this is true it implies that the output from the system must be produced quicklyenough to produce the effect on the world outside the computer before that world hasenough time to alter. Consider the case of the airline booking system. The “world” thatwe are talking about is the world of the database that contains all the booking details. Theuse of a real-time system here refers to the concept that if a ticket is bought by a memberof the public, the database must be updated before the next person has a chance to book aticket. Notice that the idea of working “incredibly fast” or “in billionths of a second” doesnot apply here. In some real-time applications these comments may be reasonable, but itdepends on the „world‟ that the application is concerned with.When asked to describe a real-time application the first thing that needs to be described isthe world of the application. Everything else falls into place. Students should thendescribe the hardware necessary to allow input and output from that world and thedecisions that the software must take.A nuclear reactor may start to react too violently and sensors inform the computercontrolling the reaction that this is happening. The computer takes the decision to insertthe graphite rods to slow the reaction down. This is a real-time application. The world ofthe application has been identified, the input devices are the sensors that inform thecomputer of the state of the reaction, the computer makes an immediate decision and thegraphite rods are now moved into place. Notice that the rods moving is not immediate butwill take place over a period of time, however the decision was taken immediately. Notealso that the sensors simply report on the state of the world, there is no hint at decisionmaking on the part of the sensors. Many students would phrase their answer in the formof “The sensors spot that the reaction is too violent and the processor makes …”. Here,the sensors are being credited with having processing power in that they can interpret thereadings that are produced.Students should also be able to identify when a real-time system is appropriate asopposed to a system where the decision making is in some way delayed.3.9 (b) Sensors and ActuatorsA sensor is a device that measures physical quantities. A physical quantity is somethingthat exists in the real world as opposed to the computer world. Examples would belength, time, temperature, light, flow, pressure. Sensors can be divided into two groups,one is analogue whilst the other is digital. Digital sensors produce an output that isdigital. For example, a burglar alarm may have a pressure pad by the front door whichproduces a signal if it is trodden on. The signal is either that it has been trodden on, orthat it has not. It cannot be half trodden on. A thermistor which is measuring thetemperature for a chemical reaction will send different signals according to thetemperature that it detects. As the temperature increases the voltage produced by the 1
  2. 2. thermistor increases, it is this voltage which gives a measurement of the temperature.Note that any temperature may be reported, hence the reading is analogue. The computerwill require the signals from such sensors to be passed through an analogue/digitalconverter because the computers with which we are dealing are digital computers andhence can only use digital signals as input.Most sensors are surprisingly simple, relying on one of two methods to gain information.They either use some type of spring mechanism to physically change the position ofsomething in the sensor, or a means of turning some reading into a variable voltage. Thespring ones are like the pressure pad, held open by a spring which is overcome by theweight of the burglar. Similarly, a bumper around a robot vehicle can be kept away fromthe body of the vehicle by springs which are overcome if the robot moves too close tosomething blocking its path. A thermistor, used to measure the room temperature for acentral heating system converts the ambient temperature to a voltage so that a decisioncan be made by the processor. A light meter at a cricket match converts the availablelight to a voltage so that the processor can decide whether there is enough light for play.Notice that the digital sensors are really switches. If the bumper around the robot isdepressed is it necessary for a processor to make a decision? Probably not, the switchwould simply switch off the motor. The question arises whether this is a sensor in the truesense of a sensor in computing. The answer is that the action of turning the motor offrequired no decision and hence no processing, but that the need to do so will be reportedto the processor because it now has to make a decision about what to do next and theinput from that sensor is going to be an important part of that decision.One last point about sensors. There are as many different sensors as there are physicalquantities that need measuring, but their reports need to be kept as simple as possible toallow the processor to make decisions quickly. The idea of a sensor being a TV camerabecause it can show the processor what is going on in a large area is unrealistic because itwould provide too much information. What would be possible would be a TV picturewhich could be scanned by a processor for any kind of movement in order to indicate thepresence of a burglar. Never lose sight of the idea that the processor is limited in theamount of data that can be interpreted, as is the software that the processor is running.When the processor makes its decisions it must be able to take some action. In the type ofscenario we are talking about it will probably be necessary to alter something in thephysical world. This may involve making the robot move in a different direction, it maybe a matter of switching on some lights or telephoning the police station to report anintruder on the premises. Some of these are simple electric circuits that the computer cantrip by itself, however, making the robot change direction is rather more complex. Suchmovement involves the use of an actuator. An actuator is the device that can accept asignal from the computer and turn it into a physical movement.3.9 (c) The Use of RobotsThe first thing to understand is what constitutes a robot.A robot is a mechanical device which is under the control of a processor. 2
  3. 3. Imagine a car production line. Each car is built on a flat bed which is on wheels and runsalong a track from one building process to the next. It stops at the area where the wheelsare fitted, then it moves along the track to have the engine put in, then moves again tohave the doors fitted and so on. This flat bed is not a robot it is simply a machinefollowing a preset course. Now imagine the same system but at the start of the productionline the computer controlling the flat bed is told the parameters for that particular car.This is to be a 3 door coupe with the 1700cc engine. It stops to have the wheels fitted butmust then make a decision to go to the correct area for a 1700cc engine, from there itmust go to the area that has the correct body shell for a 3 door coupe. This machine isnow making decisions and can be considered a robot.Why are robots used?The first thing to consider is cost. Never say that robots are used because they arecheaper. They are not. They are extremely expensive. What must be considered are twotypes of cost. The first is the capital cost of buying the equipment, the second is the costof running the system, it is here that savings will probably be made in relation to the costof employing a person.People can get tired and when they do get tired the work that they produce can be of apoorer quality than it otherwise would have been. The robot will not necessarily do abetter job than the human (indeed, it is not as adaptable and therefore may produce worseresults) however, it is consistent. It never gets tired.There are some places that are particularly hazardous for human beings, for instance theinside of a nuclear reactor, but maintenance must still be carried out. These are naturalenvironments for a robot to work in because there is no human equivalent.A robot does not need the peripheral things that a human being needs. There is no needfor light or air in a factory. There is no need for a canteen or for restrooms or for atransport infrastructure to get the workers to work and home again. There is no need for acar park or for an accounts department to work out the pay for all the workers. There is aneed, however, to employ technicians to service the machines and programmers toprogram every task that they need to undertake. Notice the need for a human workforcehas not disappeared but the workforce is made up of different types of worker, generallymore skilled than was previously the case.3.9 (d) Simulation.A computer system has the ability to perform a large number of calculations in a shortspace of time. If a physical action can be portrayed as the result of a series of formulaeand their results, acting upon one another, then the computer can, by doing thecalculations, pretend to be carrying out the physical action. This is what is meant by asimulation.The rate of growth of a sunflower is known from observations taken over many years.The effects of different chemicals on the growth of sunflowers are known from simpleexperiments using one chemical at a time. The effects of different combinations of thechemicals are not known. If the computer is programmed with all the relevant formulaedictating how it should grow in certain circumstances, the computer can play the part ofthe sunflower and show how a real one can be expected to react. In this way the effects of 3
  4. 4. different growing conditions can be shown in seconds rather than waiting 6 months forthe sunflower to grow. One can imagine that in the course of a day a programmer cancome up with a suitable cocktail of additives to allow sunflowers to grow on the fringesof a desert and consequently create a cash crop for farmers, in such conditions, wherethey had no cash crop before. This is an example of the use of a computer simulation tospeed up a process in order to give results in a more reasonable time scale.Simulation can be used to predict the results of actions, or model situations that would beotherwise too dangerous. What will happen when a certain critical condition is exceededin a nuclear reactor? I don‟t want them to try it on the one down the road from where Ilive and I‟m sure no one else does either. Program a computer to pretend to be a nuclearreactor and it is no longer necessary to do it for real.Some things are impossible. It is not possible to fly through the rings of Saturn. Programa computer to pretend and a virtual reality world can be created to make it seem possible.A car company is planning a new suspension system for a range of cars. One way oftesting different designs is to build prototypes and take them out in different conditions totest how they work. This is very expensive, as well as time consuming. A computer canbe programmed to take the characteristics of each possible system and report how wellthey will work, at a fraction of the cost. The same simulation can be made to vary theconditions under which it operates. A fairly simple change to the parameters of one of theformulae being used can simulate driving on a motorway or on a country lane.People can have ideas which need testing to see if they are valid. An engineer may designa new leaf spring for a suspension system. The hypothesis is that the spring will givemore steering control when travelling on rough surfaces. The computer can be set up tosimulate the conditions and give evidence to either support or contradict the hypothesis.A financial package stores data concerning the economy. It can be used to provideinformation about past performance of the various criteria being measured or it can be setup to predict what will happen in the future. If the graph of a particular measure is linearthen extrapolation of what will happen in a year‟s time is not difficult, in fact youcertainly don‟t need a computer to provide the prediction. However, if the graph is nonlinear the mathematics becomes more difficult. More importantly, economic indicators donot exist in isolation. If the unemployment figures go up then there is less money in theeconomy, so people can buy less, so firms sell less, so more people are laid off. Unlessthe bank of England brings down interest rates which will encourage people to borrowmore and hence buy more, so firms need to employ more people in order to put moregoods in shops… When the relationships become intertwined like this the calculations ofpredictions become very complex and computers are needed.3.9 (e) The Need for Parallel ArchitectureAs mentioned before, if the predictions are best on a simple linear relationship betweentwo variables then there is little need for a computer because there is little to calculate 4
  5. 5. and the calculations are simple. If the predictions are based on a more complexrelationship then the computer becomes useful but only in terms of a glorified calculator.However, if the predictions are based on complex, multiple, relationships the calculationsbecome immense and must be done quickly, if related to a time sensitive example like theweather, otherwise, if tomorrow‟s weather forecast takes two weeks to compute, itdoesn‟t matter how accurate the results are, they are useless.This combination of the vast quantities of data, the inter relationships and the consequentvolume of calculations means that computer power becomes essential to giving a sensibleresult. Indeed, with something like the weather forecast, ordinary computers are too slow.There is a need for high speed calculation, a need that is satisfied by the use of parallelprocessing.3.9 (f) Advantages of SimulationThis has already been discussed in this section. Briefly, the advantages of simulation totesting are that tests can be carried out safely, at a fraction of the normal cost and in afraction of the time that the testing would otherwise have taken.Limitations of SimulationThe syllabus no longer expects the limitations to be taught as a separate topic, but thevalue of computer simulations cannot be appreciated without considering suchlimitations. Those students with a mathematical background will know the difficulty ofcoming up with true randomness and particularly in relation to physical events. In thiscontext random events must be interpreted as unpredicted or unpredictable events. Theprevious sections have discussed problems associated with unpredicted events like theeffect of the sun storms on the weather. It is not suggested that the effects of these stormscould not be included in our model, simply that it was not considered when the modelwas created, hence this is a fault of the model and not a suggestion that because of sunstorms it is impossible to predict the weather. However, there are some situations that arenot predictable. They are to do with events that are so complex that it is impossible todesign a model for them, or to do with human beings, the behaviour of which does notnormally follow easily interpreted relationships.If it were possible to predict the outcome of the lottery draw then there would be somevery rich computer programmers. Mathematically, the outcome is not random and shouldbe predictable, perhaps by modelling the behaviour of the individual atoms inside themachine that chooses the balls. However, this is impossible, certainly with presenttechnology.If it were possible to predict accurately that human beings would all buy a particular songin preference to another, then the record industry would not have to produce such avolume of material in order to have a single hit. Human behaviour is very difficult topredict. 5
  6. 6. 6