00001 #ifndef AUTOMATION_INCLUDED
00002 #define AUTOMATION_INCLUDED
00003
00004 #include "odem.h"
00005 #include <cassert>
00006
00007 #include "Location.h"
00008
00009 class BathPlace;
00010 class Crane;
00011 class Loader;
00012 class Furnace;
00013 class BufferStore;
00014 class RingFactory;
00015 class VehicleToFurn;
00016 class VehicleFromFurn;
00017 class ReturnBufferStore;
00018 class CraneRequestq;
00019 class SetOfRingStack;
00020
00021 class Automation : public Discrete {
00022 public:
00023 Automation(
00024
00025 const Crane* c,
00026 Loader* l,
00027 Furnace** f,
00028 BufferStore* leftB,
00029 BufferStore* rightB,
00030 const RingFactory* fa,
00031 VehicleToFurn* vTF,
00032 VehicleFromFurn* vFF,
00033 ReturnBufferStore* leftL,
00034 ReturnBufferStore* rightL,
00035 const CraneRequestq* cReqQ
00036 );
00037 virtual ~Automation();
00038
00039 virtual int main();
00040
00041
00042 void vehicleTFReady(){waitVehicleToFurn.wait();}
00043 void vehicleFFReady(){waitVehicleFromFurn.wait();}
00044 void leftBufferReady(){waitLeftBuffer.wait();}
00045 void rightBufferReady(){waitRightBuffer.wait();}
00046 void leftLoadingReady(){waitLeftLoading.wait();}
00047 void rightLoadingReady(){waitRightLoading.wait();}
00048 void loaderReady(){waitLoader.wait();}
00049
00050
00051 void interrupt (int cause);
00052 void goAhead (int cause);
00053 static bool rightTime();
00054
00055 VehicleFromFurn* getvFF() {return vehicleFromFurn;}
00056
00057
00058 ReturnBufferStore* getLoading();
00059
00060
00061 SetOfRingStack* getNextPalette() {return nextPalette;}
00062
00063
00064 void signalWakeUp();
00065
00066 protected:
00067
00068 static bool working;
00069 Condq* interruptQ;
00070
00071 BathPlace** baths;
00072 const Crane* crane;
00073 Loader* loader;
00074 Furnace** furnaces;
00075 BufferStore* leftBuffer;
00076 BufferStore* rightBuffer;
00077 const RingFactory* factory;
00078 VehicleToFurn* vehicleToFurn;
00079 VehicleFromFurn* vehicleFromFurn;
00080 ReturnBufferStore* leftLoading;
00081 ReturnBufferStore* rightLoading;
00082 const CraneRequestq* craneRequestQ;
00083 Direction nextBuffer;
00084 Direction nextLoading;
00085
00086 SetOfRingStack* nextPalette;
00087
00088 Waitq waitVehicleToFurn;
00089 Waitq waitVehicleFromFurn;
00090 Waitq waitLeftBuffer;
00091 Waitq waitRightBuffer;
00092 Waitq waitLeftLoading;
00093 Waitq waitRightLoading;
00094 Waitq waitLoader;
00095
00096
00097 virtual void holdTransport();
00098
00099 Direction useBuffer();
00100 Direction useLoading();
00101
00102
00103 Direction fLinksRechts();
00104 Direction fLinksPrior();
00105 Direction fNacheinander();
00106 Direction fFairness();
00107 Direction fOfenPrior();
00108 Direction fSpeicherOpt1();
00109 Direction fSpeicherOpt2();
00110 Direction fMulti();
00111
00112 int getFreeOven();
00113
00114
00115 void writeBuffer(std::ostream& os, bool all=false);
00116 };
00117
00118
00119 #endif