You are on page 1of 22

LogixPro TrafficControlLabUtilizingWordComparison

1Exercise#1TrafficControlutilizing1Timer FromtheSimulationsMenuatthetopoftheLogixProscreen,SelecttheTrafficLight Simulation

Utilizing a single timer, employ the use of Word Comparison instructions to control our simulated traffic light. The sequence of operation and timing durations are set outinfollowingtimingdiagram. Your program should incorporate a 1 second period (delayed green) when both directions will have only their RED lights illuminated. Note that the timing diagram belowonlyshowsoneofthese1secondintervals,buttwoareactuallyrequired. Red=O:2/00 Green O:2/06 8Sec. = Amber O:2/05 4Sec. = Green O:2/02 Red=O:2/04 1 8Sec. 4Sec. = Amber O:2/01 =

If a one second delay proves insuficient to get these drivers under control then just goaheadandjackthedelayuptotwo!

2Exercise#2DealingwithPedestrians Modify your program so that the crosswalks are also controlled. This is not necessarily a word comparison exercise, but it's a task that needs doing, and you should now have sufficient expertise to accomplish it. It might not be all that easy however!

Yourprogramshouldoperateasfollows: When depressed, the crosswalk pushbutton will cause the appropriate Walk Sign to be illuminated at the next occurence of a Red to Green transition for theappropriatedirection. If the Green light is already illuminated when the button is pressed then the Walk signal sequence will be delayed until the next Red to Green transistion ocurrs. OncetheWalkSignisilluminated,itwillremainsoforthedurationoftheGreen signal. When the Amber light appears, the Walk Sign will commence to flash On and OffandcontinuetodosountiltheRedsignalappears. You might consider using a bit from the freerunning timer located in S2:4 to create thecautionaryflashingeffect.

LogixPro TheBatchMixLabUtilizingPLCCounters

3Exercise#1FillingtheBatchMixingTank From the Simulations Menu at the top of the screen, Select the Batch Mixing Simulation.

Using your knowledge of PLC counters, design a program to meet the followingrequirements: When the Start switch (I:1/0) is pressed, pump P1 will be energized and the tank will start to fill. The pulses generated by Flowmeter 1 should be usedtoincrementacounter. Whenthecountreachesavaluewherethetankisapproximately90%full, the pump is to be shutoff and and the control panels FULL light is to be energized. Thefillingoperationistohaltimmediatelyifthestopswitchispressed. While testing, utilize the "Reset Simulation" and the "Reset Timers and Counters"entriesintheSimulationsmenutorestartyourprogram. To make it a little easier to see what is happening with the counter, you might wanttoaddthefollowingrungtotheendofyourprogram.

If correctly entered, the TOD (To BCD) instruction will take the integer value in the counters accumulator, convert it to Binary Coded Decimal, and then move (copy) this BCD value to the control panel LED display (O:4). The TOD instruction can be located in the Compute/Math group of instructions in the Edit Panel. Be sure to alter the Source entry to match the counter number you areusing. 4Exercise#2EmptyingtheBatchMixTank Modifyyourprogramsothatitmeetsthefollowingadditionalrequirements: Themixerwillrunfor8secondsoncethetankisfull. Whenthemixingiscomplete,drainpumpP3istobestartedandthetank istobedrained.Flowmeter3willbeemployedtodecrementtheexisting counter, and draining will be allowed to continue till the counters accumulatorreacheszero. Once the tank is empty again, pressing the Start switch will cause the sequencetorepeat. 5Exercise#3ContinuousOperation Modify your program so that the filling and emptying sequence will repeat continuouslyonceithasbeenstartedbytheinitialpressingoftheStartswitch. Ensure that the RUN light is energized when the mixer or either pump is running. The STANDBY light should light and the process should halt when the Stopbuttonispressed. The process should restart where it left off if the the Start button is pressedfollowingaStop.

LogixPro DualCompressorStudentExercises

6Exercise#1SingleCompressorOperation In this first exercise, the pressure switch PE1 (I:1/02) is to be utilized alone to control theoperationofmotor(O:2/0)andmaintainthecompressor'sstoragetankpressure. ThepressurerangewillbedictatedbythesettingsshownforPE1.Usingyour mouse, adjust both the limit (make 120PSI), and the adjustable span setting (20PSI) of PE1 to matchthesettingsshownbelow.

Allow the user to start and stop the air system using the appropriate panel mounted switches, and ensure that the "Run" lamp is illuminated whenever the system is enabled. Lamp "C1" should be illuminated only when compressor #1 is actually running. Prior to testing your program, adjust the system's discharge flow rate to 50% as shown.Thissettingshouldprovetobelowenoughthatasinglecompressorwillthen beabletosupplytheneedsofthisparticularpneumaticsystem. Once you have created your program, download it to the PLC and test out it's operation. When the start button is pressed, the Compressor should start and begin to build up pressure within the storage tank. Once the pressure reaches 120PSI, the compressor should stop, and remain idle until the pressure in the storage tank drops below100PSI.

7Exercise#2AlternatingCompressorswhenLoadingisLight In this exercise, each compressor is to take it's turn bringing the storage tank pressure back up to the selected pressure setting. Pneumatic/Electric switch PE1 will continue to be utilized for this purpose, and the settings will remain the same as thoseusedinthepreviousexercise.

The task of alternating back and forth between loads is sometimes referred to as a load toggle function, and there are numerous methods to accomplish this in relay logic.Inthisexercisehowever,youareaskedtolimityourselftousingonlybasicrelay typeinstructionswhencreatingyoursolution. Priortotestingyourprogram,adjustthesystem'sdischargeflowrateagainto50%as shown. As we have already determined, this flow rate can be readily maintained by a single compressor. Adding a second compressor however, will share the loading and allowforanextendedcoolingperiodbetweencycles. Onceyouhavecreatedyourprogram,downloadittothePLCandthoroughlytestout it'soperation. Finally,adjusttheflowratewhichcontrolstheamountofairleavingthestoragetank to80%andthen100%andnotetheeffect.Athigherratesofflow,asinglecompressor will not have the capacity to supply this system's peak needs on it's own. Obviously wewillneedabitofhelpattimesfromthesecondcompressor.

8Exercise#3CopingwithLargeDemandsforPlantAir Your current program should be suitable for maintaining the desired pressure range as long as the plant air consumption remains relatively modest. As the plant air consumption approaches 100% capacity however, it becomes obvious that we will needtohavebothcompressorsrunninginordertosatisfythisincreasedloading.

Modify your program so that the second pressure switch PE2 will detect when the storage tank pressure drops below our current minimum setting of 100PSI. This situation will occur if a single compressor is unable to keep up to the load and the tank pressure continues to drop. If and when the pressure drops to 98PSI, the idle compressor should be started, and both compressors will then continue to run until thetankisuptofullpressure. Itislikelythatyourmodificationswillalsoresultinbothcompressorsbeingrunwhen the system is first started and the tank pressure is initially being brought to within range of the pressure switches. This action will reduce the time it takes to bring the plant air system up to pressure, and is therefore considered desirable. Please ensure thatyoursystemdoesactuallyoperateinthisfashion. Onceyouhavecreatedyourprogram,downloadittothePLCandthoroughlytestout it's operation at both 50% and 100% rates of flow. When at 50% loading, the compressors should alternate with each taking a turn. At 100% loading, both compressors should engage once it is detected that the pressure is continuing to drop.Your program should now be able to handle both light and heavy demands for air quite effectively. While this current solution likely performs as well as most systems employing relay logic, with just a bit more effort you should still be able to evenimproveuponthis.Beforecontinuingtothenextexercise,runyoursystemwith the flow rate adjusted to 78%, 80%, and then 82%, and carefully note the result. You shouldnowhaveagoodideaofwhereimprovementsmightbemade.

LogixPro AdvancedBottleLineExercise

GettingStarted There are always numerous ways to accomplish tasks in programming, but a quick review of the Allen Bradley bit shift instructions should surely point to them as an ideal tool for use in this particular process. In the bottle line simulation, we are faced with detecting and tracking a few Boolean details having to do with the bottles entering the line. Sensors are provided to detect the presence of a new bottle, the bottle size, and whether the bottle is fully intact. Essentially 3 Boolean states describingthepropertiesofeachbottlethatenterstheline.Ifweanalyzethevarious waysthatwemightprocessthesebottles,itshouldquicklybecomeapparentthatwe willhaveampleinformationformakingsuchdecisions,assumingwekeeptrackofit.

A single BSR or BSL instruction can be used to track a single Boolean state (0 or 1) which inturn can describe a unique property of a product. In the initial exercise you will be asked to track the 3 Boolean values describing each bottle entering our processline.TheBooleanstateswillbereferredtoas"Exists","Large",and"Broken" and these states are to be tracked by you, utilizing 3 separate BSL (bit shift left) instructions. It can be argued that "Exists" need not be tracked (=correct), as bottles continuously enter the line, and therefore must exist. We will even use this fact to strobe our BSL instructions and cause a shifting of our tracked information. Later when you start diverting broken bottles to scrap however, they will nolonger Exist. These missing bottles could be detected after they are scrapped by using the "Broken"state,butfornowIwantyoutotrackall3statesusing3separatebitarrays.

9Exercise#1Trackingthebottles Create a program which allows the operator to start and stop the process using the available panel mounted switches. When the process is running, the main conveyor should be energized, and bottles should continuously enter and exit the line. For these exercises please utilize the bits in word B3:0 if and when single bits such as flagsetc.arerequired. UtilizingLS1(Exists),strobe3BSLinstructionstoshift3separatebitarraysconsisting of two 16 bit words each. Please use files #B3:2, #B3:4, and #B3:6 forthis purpose. By restricting you to these particular files in the binary table, it will be much easier for you, and your instructor to monitor what is happening with your program using the datatabledisplay.

Test your program out, and using the Data Table display monitor, take note of how the bits representing "Exist", "Large", and "Broken" are being shifted within their appropriate bit arrays. You may find that it will be necessary to slow the scan rate using the slider in the PLC panel to see this activity clearly. If your program is operating correctly, you should now have a means of determining the properties associatedwitheachbottlethatpassesdownthebottlingline.

10Exercise#2UtilizingtheBooleanData If you paid careful attention to the bits being shifted along in each bit array, you wouldhavelikelynotedthatthereisanoffsetbetweeneachofthese3arrays.Thisis due to the fact that the 3 limit switches are located exactly 2 bottle widths apart. In order to use LS1 to strobe the data from all 3 switches at the same time, this spacing is actually critical, and must be an exact multiple of a bottle width. The number of bottlewidthsinturndeterminestheoffsetweencounterwithinourarrays. We cannot easily compensate for this offset when using a BSL instruction as the switch data will always load into bit 0 of the array. There may be ways to overcome this, but for these exercises it will be your responsibility to compensate for these offsets. You will have to adjust for this whenever you employ any of these bits to determineaparticularbottle'sproperties.

Modify your program so that all Large bottles are diverted to the lower conveyor located on the right hand side of the simulation. This is to be accomplished by utilizing the appropriate bit in the "Large" bit array to invoke the transfer. Also, pleaseensurethatthebottlesarenotdamagedintheprocess. If you are successful in completing the above, you should be well prepared to deal withthetaskofdivertingbrokenbottlestoscrap.

11Exercise#3BoxingtheBrokenBottles Toaddalittleinteresttothesimulation,I'vedecidedtohaveyougrindupthebroken bottles that occasionally come down the line. Of course it is your responsibility to ensure that the ground glass is placed into boxes, and to bring new boxes into place asrequired.

The cost of providing cardboard boxes can be significant over time. For this reason it is essential that you fill each box to it's maximum capacity, and do so without spillage.Sinceasmallbottleonlyproduces2/3asmuchgroundglassasalargebottle, youwillhavetoadjustforthisdifferenceinyourprogramlogic. In creating the logic for this exercise,you may find that you are faced with initializing variables or clearing counters etc. each time you edit and then restart your program. Just to make it a little easier to find this logic, I would ask that you add the following rungtothetopofyourprogram.

Thereisnosenseclutteringupyourprogramwithlogicthatonlyexecutesonceeach time it is run, so please place this logic into a subroutine where it is out of the way, yeteasilylocated. Once you have come up with a solution for the scrap problem, then you are now enteringthehomestretch.

12Exercise#4FillandCaptheBottles There aren't many details that need to be explained about the filling operation. Energizing the fill tube solenoid O:2/6 will cause the fill tube to extend and enter the positioned bottle. You then must make a choice of discharging a large or small quantity of product into the bottle utilizing the appropriate charge solenoid O:2/7 or O:2/8. Once again, the Boolean data contained in the bit arrays will be used in determiningthecorrectactiontobetaken.

Thebottlecappingstationcontrolshouldbejustamatterofcappingeachbottlethat comes along. The capping ram solenoid O:2/9 must be energized to extend the ram, but you need not adjust for bottle size with this particular capping equipment. Attempting to cap a bottle that does not exist will cause little harm, but is a waste of caps, plus adds to clutter on the plant floor. Due to the foregoing, ensure that you onlycapbottlesthatactuallyexist. I will leave issues such as when to stop and start the line to you. Keep in mind however, that we want to maintain the highest level of production possible with the equipmentatourdisposal. Once you have the filling and capping operations operating at maximum efficiency, we can then move on to the job of keeping the operator fully informed of the productiondetails.

13Exercise#5TrackingtheProductionNumbers The operator control panel has been equipped with four, quaddigit LED display units which were included so that the operator might easily view current production counts etc... In order to reduce the number of PLC output signals required to control this many displays, it was decided to multiplex the four display units, and 4 manufactured quaddigit display units complete with builtin latches were selected forthispurpose... The 16 data inputs of each quaddisplay unit were wired to a shared 16bit data bus, and these shared data lines were inturn wired to a 16bit output card addressed as O:4... Four spare outputs from card O:2 were then wired to control the strobe (latch enable) line of each individual quaddisplay unit; one output for each of the 4 quad displayunits... To view a wiring diagram, plus obtain further insight into multiplexing 7Segment displays,pleaseselectthefollowinglink: Interfacingto7SegmentDisplays....includesBottleLinewiringdetails

The multiplexed displays may be individually written to by placing the BCD representationofthenumbertobedisplayedintooutputcardO:4,andthenstrobing the appropriate latch enable line from low to high, and then back to low again... The data is allowed to enter and pass through the builtin latches of the selected display unit when it's latch enable line is taken high, and the data is latched, or effectively frozen when the latch enable line is taken low... Once low, further changes to the data input lines will be ignored, and the display will continue to display the numeric representation of the data held in the latches... The display will continue to show the samenumeralsuntilthelatchenableisagaintakenhigh,orpowerislost... Your task, should you accept this assignment [grin], is to update the multiplexed

displays with the running totals of the large and small bottles produced, bottles scrapped, and boxes filled. The rate at which the updates take place, should be high enough that single counts are not skipped, but not so high as to burden the PLC unnecessarily. This particular task of updating the LED displays lends itself well to modularization, and ideally should be executed in a subroutine. Even if you call this subroutine unconditionally each scan, there are still benefits to this approach. Placing this logic where it will be out of the way, yet readily accessible can make for a much less cluttered,andeasiertoreadprogram.

The task of writing the subroutine will be left to you, and there are many methods that might be employed to accomplish the task. One possibility is to employ a self resetting timer, and then write to each display unit at a unique but regular time interval.. You might first send the desired BCD data to card O:4 and enable the selected display's latch enable at the same time... Follow this by disabling the same latch enable at the next time base interval, and you would then be set to repeat the same sequence for the next display unit... If you do use a timer, remember that the subroutine will need to be unconditionally called (as shown above) on each scan, in orderforasubroutinelocatedtimertobeupdatedproperly Once you have the completed the foregoing, all that should be left is to handle the details. Allowing the operator to set the count of bottles to be processed might be a feature worth implementing. Reviewing your program and making certain that it is clearlydocumentedisamust.Addingsomethingnewsuchastrackingequipmentrun timeisanoption.

14Exercise#6(Optional!)JustasmallModification In the introduction to this series of exercises for the bottle line, I stated that "There are always numerous ways to accomplish tasks in programming". In order to prove the statement was accurate, I'm now going to ask that you modify your program so thatBSR(bitshiftright)instructionsareusedinplaceofBSL.Atthesametime,Ialso want you limit yourself to the use of just 2 bit arrays for tracking the bottle properties.

If only the "Large" and "Broken" bit arrays are used, you should still be able to determineifa bottleexistsby examiningthe"Broken" propertyofthe bottle.Thisof course assumes that the broken bottle has been diverted to scrap, and therefore no longerexists. While you are making the required modifications, carefully review the AB documentation for the BSR instruction, and see if you can come up with a way of eliminatingtheoffsetwehadinthepreviousbitarrays.

LogixPro MultiFloorElevatorStudentExercise

GettingStarted As we've seen previously, modularizing portions of a program and placing the requiredlogicintosubroutinesoftenresultsinaprogramwhichisbotheasiertoread and understand. In extreme cases, a programmer may even elect to modularize the total program. If this approach is taken, then the resultant core or main program will often be nothing more then a list of calls to subroutines where the details are dealt with.VerymuchliketheIndexforabook.Theindexprovidesanoverviewfromwhich the reader can readily discern where particular topics are located, and then readily movetothatlocationforfurtherdetails. In the case of the Elevator simulation, it isn't too hard to visualize how we might modularize many, if not all the tasks that are going to be required. The tasks of closing and opening the door are obvious candidates for modularization. Almost all programs require an initialization section, and even tasks that require continual execution, such as catching a button press which denotes a request for the elevator to arrive, can often be grouped into a subroutine, and then simply called unconditionally on every scan. Add a module to track the elevator's motion, and we shouldalreadyhaveafairlygoodtopicaloutlineforourprogram'sIndex. Another factor which is somewhat unique to this exercise, is that we are going to need a fair number of flags to keep track of what we are doing, and what must be done next. Fortunately, the switch closures which denote a request to have the elevator arrive, will lead us to latching the builtin lamp of the switch so as to visually confirm the request has been recognized. The lamp for this switch should remain energized until the elevator car arrives, and hence that lamp can serve the dual purposeofflaggingthatpendingrequestsexists,it'sfloor,andindirectlytherequired directionoftravel.EmployingI/Ointhisdualpurposemannershouldnotbenew,but utilizing latch (L) and unlatch (U) instructions has until now been generally discouraged. You should be well aware of the reasoning behind this by now, but there are situations where the latching instructions are ideally suited to the task, and thishappenstobeoneofthem.

15Exercise#1PreparingYourProgram'sIndex. Open a new program, and enter the rungs shown below into the main or LAD2 section of this program. Once this is accomplished, all further logic that you add to your program should be placed into the appropriate subroutine which has been allocatedfortheparticulartaskathand.

You will note that a number of flags have already been predefined, and these are to be employed to control the logic flow of your final program. Just to make life a little easier on your instructor, you are asked to utilize unused bits in word B3:0 if and whenanyadditionalflagsarerequired.

16Exercise#2TakingtheElevatortotheTop. In this exercise you will add all the appropriate logic to detect when the wall mounted 4th floor switch (I:1/11) is pressed. When this occurs, the elevator is to be putintomotionandproceedupwardsuntilitarrivesatthe4thfloorwhereitwillhalt. This of course assumes that the elevator starts out in it's default location at the first floor.

It's imperative that you accomplish this task while maintaining compatibility with the current program structure. To this end, all 6 subroutines will be utilized, and therefore each must first be programmed with the appropriate logic to accomplish thisinitialtask. U3,InitializationSubroutine: Each time you test your program, you should first reset the simulation using the selection in the simulations menu. This will ensure that elevator is back at the first floorandallthehardwareisinit'sinitialstate.Whenyouplaceyourprogramintothe run mode, U3 will be executed, and it is here where you should ensure that all flags etc are in their correct initial state. In particular, the "DoNext or Wait" flag should be latched true which will ensure that subroutine U7 (Next Request or Wait) will be activelyscannedatthistime. U4,CatchFloorRequests: This subroutine is where the logic that will detect, and react to the closure of the 4th floorwallswitchshouldbeplaced.Thelampforthisswitchshouldbelatchedon,but this should only occur if the elevator is not already at the 4th floor. In later exercises, additional logic will be added for the other switches that can initiate a change in the elevator'slocation. U5,NextRequestorWait: This subroutine is where the decision to move the elevator will be made. The builtin lamps of the wall mounted switches may be used as a flag to initiate a move of the

elevator car. For now it will only be necessary to monitor flag (lamp) O:2/11 and set the "Close and Go" flag in response. This will inturn invoke the "Close Door and Move"subroutine(U7)whichwilltakecareofgettingtheelevatorunderway. U6,CloseDoorandMove: In this subroutine, locate the logic to close the door, and then energize the motor to get the elevator underway. The desired direction is obvious in this case, but later you will most certainly require flags to indicate which direction to proceed in. Before exitingthissubroutinemakesurethatboththe"DoNextorWait" andthe"Closeand Go"flagsarecleared(unlatched),andsetthe"CarisMoving"flagsothatpositioning ofthecarwillbecontrolled. U7,TrackCarMovement: Once the car is moving, this subroutine takes control, and is responsible for deciding wheretostopthecar.Inthisexercisethedirectionanddestinationarefixed(up,4th floor),so youwillonly berequiredtodeterminewhenthecarhasreachedthefourth floor. Once there, the car's location should be flagged by updating the appropriate floorindicatorlamps,andthe"StopandOpen"flagshouldbeset(latched)whichwill inturn invoke the "Stop and Open Door" subroutine. The car's vertical position can be determined by reading the motor's shaft encoder (I:5), and equating this reading tothoseyouhavegatheredfortheindividualfloors.Itmaytakealittletrialanderror to initially gather these values, but the task can be made easier if you temporarily slowLogixPro'sscanratedownsomewhat. U8,StopandOpenDoor: Thefirstthingtodohereistostopthemotorandreset(unlatch)the"CarisMoving" flag.Youshouldalsoextinguishthebuiltinlampofthewallmountedrequestswitch. The floor indicator lamps above the door can be utilized to determine which lamp is to be extinguished. Lastly a small 2 second settling delay should be allowed for, followedbyopeningthedoor. Once you have your program to the point where the elevator can be moved from it's initial location to the 4th floor as outlined, you should then be ready to deal with returningittothe1stfloor.

17Exercise#3AComplete2FloorElevatorControl. In this exercise, you are asked to add the required logic to implement a complete 2 floor elevator control system. Floors 1 and 4 will be used for this purpose, and all switches and lamps associated with these floors are to be made fully operational. All added logic should be placed into the subroutine deemed appropriate for the particulartask,andadditionalflagsmaybeaddedasrequired.

Whennotactivelymoving,theelevatorwillbelocatedatoneofthe2servicedfloors, sitting at rest with the elevator car door opened. When at rest, the only lamps illuminated will be the appropriate floor indicator lamp located directly above the elevator door. Additionally, your program should not respond to a switch press associatedwiththeelevator'scurrentlocation On arrival at a floor, the builtin switch lamp for that floor should be extinguished, and the appropriate floor indicator lamp above the door should be illuminated. The door should then be made to open 2 seconds later. Additionally, the door must remain open for a minimum of 5 seconds before being allowed to process another floor request. Floor requests occurring during this delay period should not be ignored,butonlydelayedinprocessing. While working on a solution for this exercise, keep in mind that you will soon have to extend this control to all 4 floors. Flags to indicate in which direction the elevator is travelingwillbeamust.Fortunatelywithjust2floors,determiningwhichdirectionto goisatrivialtask,butonethatwillbecomequitecomplexwhenadditionalfloorsare added. Once you have assured that you can fully control the operation of this 2 floor elevator,youshouldbewellpreparedtomoveontothemultifloorexercise.

18Exercise#4MultiFloorElevatorControl. Extending your program to accommodate multiple floors, would appear to be a relatively simple matter of just adding the logic to deal with the additional switches andlamps.Thismustbedoneofcourse,butanewissuearisesinamultifloorsystem whichcanprovetobequiteachallengetosolvefor. With a 2 floor elevator, you really have only one choice when deciding in which direction the elevator should move. In a multifloor system however, you can be faced with 2 choices of travel whenever the elevator is at an intermediate floor. In addition, you must also take into account whether the elevator is at rest with no requests for service pending, or has stopped temporarily at the intermediate floor whileproceedingtoafloorfurtherbeyondinthatsamedirection.

Inourmultifloorsystem,theelevatorshouldcontinueinit'sinitialdirectionoftravel, stopping at each intermediate floor which has a request pending for that particular direction, and continue in this same direction until the farthest request for service is reached. At this point the direction of travel should then be reversed if further requests are pending. Any requests associated with this new direction of travel shouldthenbeserviced. Oncemovingtowardsthefarthestrequestedfloor,theelevatorshouldnotstopatan intermediate floor if the request at that floor is for the opposite direction; unless this is the farthest request. Otherwise the floor should be bypassed and serviced when theelevatorlaterapproachesthefloorfromtheoppositedirectionoftravel. Keeping track of the direction of travel will be critical in this control scheme. It's therefore suggested that you employ both "Going Up" and "Going Down" flags to helpinthedecisionmakingprocess.Onlywhen therearenorequestspendingwould theelevatorbedeemedtobeatrest(Waiting),andbothdirectionflagswouldbeset false (unlatched). The first new request detected can then be used to determine the initial direction of travel, and the appropriate flag set (latched). Once a direction has been flagged, then motion and servicing will continue until all pending requests are serviced. If required, the direction may be changed, but not until all requests are

servicedwillbothdirectionflagsonceagainbecomefalse. The logic associated with determining the initial direction, change in direction, and achieving a state of rest, ideally belongs in the "Next Request or Wait" subroutine. This logic will definitely not be trivial to develop, and you are strongly advised to utilize whatever tools you have at your disposal, including pen and paper to attain a suitablesolution.

You might also like