Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CustomerRequest.h

Go to the documentation of this file.
00001 #ifndef CUSTOMERREQUEST_INCLUDED
00002 #define CUSTOMERREQUEST_INCLUDED
00003 
00004 #include <cassert>
00005 #include <odem.h>
00006 #include <string>
00007 #include <list>
00008 
00009 #include "HStorage.h"
00010 #include "Bath.h"
00011 
00012 #include "ConfigParser.h"
00013 
00014 //const char* ProcString[] =  {"N+V","V","T","QT","TQ+T","V+E","N+V+E","NT","N","TN","G+A","other","unknown",0};
00015 extern const char* ProcString[];
00016 extern const char* ProcStringForReport[];
00017 
00018 enum Procedure  {       
00019                                         NV,V,T,QT,TQT,  // Variante 1
00020                                         VE,NVE,                 // Variante 2
00021                                         NT,                             // Variante 3
00022                                         N,TN,                   // Variante 4
00023                                         GA,                             // Variante 5
00024                                         Other           // nicht zu berücksichtigen
00025                                 };
00026 
00027 int variante(Procedure p);
00028 
00029 Procedure proc (const char* s);
00030 BathType String2BathType (const char* s);
00031 
00032 class Treatment {
00033         static std::list<Treatment*> all;
00034         Procedure p;
00035         double temp1;
00036         double temp2;
00037         BathType c;
00038         Treatment (Procedure proc, double ptemp1, double ptemp2, BathType cool): p(proc), temp1(ptemp1), temp2(ptemp2), c(cool){}
00039 public:
00040         static Treatment* newTreatment(Procedure proc, double temp1, double temp2, BathType cool)
00041         {
00042                 Treatment* newT = new Treatment(proc, temp1, temp2, cool);
00043                 for (std::list<Treatment*>::iterator it=all.begin(); it!=all.end(); ++it)
00044                         if (**it==*newT) { delete newT; return *it; }
00045                 all.push_back(newT);
00046                 return newT;
00047         }
00048                 
00049         bool operator==(const Treatment& other) const { 
00050                 return p==other.p && c==other.c && temp1==other.temp1 && temp2==other.temp2; 
00051         }
00052         friend std::ostream& operator<<(std::ostream& o, const Treatment& t)
00053         {
00054                 return o<<ProcString[t.p]<<'\t'<<t.temp1<<'\t'<<t.temp2<<'\t'<<BathString[t.c]<<'\n';
00055         }
00056         static void printAll(std::ostream& os) {
00057                 for (std::list<Treatment*>::iterator it=all.begin(); it!=all.end(); ++it)
00058                         os<<**it;
00059         }
00060 
00061 
00062         // Vorabkühlung der Palette noch außerhalb, oder schon im Ofen 
00063         double timePreCool()const{ double time = conf.getONPALETTE(variante(p)); return time;}
00064         // depricated!
00065         double timeOnPalette()const { std::cerr<<"\ntimeOnPalette depricated: use timePrePaletteCool instead\n";
00066                                                                   return timePreCool(); }
00067 
00068         // erste Ofenphase: für alle Aufträge zu berücksichtigen
00069         double timeOven1()const     { double time = conf.getOVEN1(variante(p)); return time;}
00070         
00071         // zweite Ofenphase: nur für Aufträge der Varianten 1 - 3 (nicht N, G+A)
00072         double timeOven2()const     { 
00073                 assert (("oventime 2 not allowed", p < N));
00074                 double time = conf.getOVEN2(variante(p)); return time;
00075         }
00076 
00077         // Nachkühlung der Palette: immer außerhalb des Ofens
00078         double timePostCool()const{ double time = conf.getCOOLING  (variante(p)); return time;}
00079         // depricated!
00080         double timeEndCooling()const{ std::cerr<<"\ntimeEndCooling depricated: use timePostCool instead\n";
00081                                                                   return timePostCool(); }
00082 
00083         // Abschreckung, falls noch eine 2. Ofenphase folgt, nur für Aufträge der Varianten 1 - 3 (nicht N, G+A)
00084         double timeChill1()const        { 
00085                 assert (("chilltime 1 not allowed", p < N));
00086                 double time = conf.getCHILL(variante(p), c); return time; 
00087         }
00088         
00089         // Abschreckung, falls KEINE 2. Ofenphase folgt, nur für Aufträge der Varianten 4 und 5 (N, G+A)
00090         double timeChill2()const        { 
00091                 assert (("chilltime 2 not allowed", p >= N));
00092                 double time = conf.getCHILL(variante(p), c); return time; 
00093         }                                                       
00094         
00095         // Palette mit Ofenabkühlung (OAK)! Zeit noch unspezifiziert!
00096         double timeCool1()const { 
00097                 return 0; 
00098         }       
00099 
00100         // Ofenabkühlzeit (Ofen leer) vor Neubeschickung: Zeit noch unspezifiziert!
00101         double timeCool2() const     { return 0; }
00102 
00103         // Abschreckung in beiden Bädern:
00104         // A: Zeit im Wasserbad
00105         double timeChill_A()const       { return 10;}
00106         // B: Zeit im Polymerbad
00107         double timeChill_B()const       { return 30;}
00108 
00109         Procedure getProcedure() const {return p;}
00110         BathType getBath() const  {return c;}
00111 };
00112 
00113 
00114 
00115 class CustomerRequest: public Msg {
00116 public:
00117         // given parameters per input
00118         
00119         double                  diameter;                       // Durchmesser der Ringe des Auftrages
00120 
00121         double                  height;                         // Höhe eines Ringes
00122 
00123         double                  mass;
00124         
00125         Treatment*      treatment;                      // Veredelungsverfahren für alle Ringe
00126         
00127         std::string             material;
00128         
00129         SIMTIME         startTime;                      // Beginn der Auftragsrealisierung
00130         SIMTIME         endTime;                        // Ende der Auftragsabarbeitung
00131 
00132         Buff_tail*      outputAreaH;
00133 
00134 private:
00135         int                     no;                                     // Auftragsnummer
00136         int                     noOfRings;                      // Gesamtzahl von Ringen
00137 
00138         int                     openNumberOfRings;      // Zähler von Ringen, die noch nicht fertig sind
00139 
00140 private:
00141         // request monitoring
00142         static CustomerRequest* firstRequest;
00143         CustomerRequest* nextRequest;   // pointer to next request for concatenation
00144 
00145 public:
00146         CustomerRequest(int number, int numberOfRings, 
00147                                         double diameter, double height, double mass, Treatment* treatment, 
00148                                         std::string material, Buff_tail* oa);
00149 
00150         int getNumber() const {return no;}
00151         int getNumberOfRings() const {return noOfRings;}
00152         int getOpenNumberOfRings() const {return openNumberOfRings;}
00153         Treatment* getTreatment() const {return treatment;}
00154         void setNumberOfRings(int n);
00155 
00156 protected:
00157         ~CustomerRequest(); // CustomerRequest may not be deleted
00158 
00159 public:
00160         // Data
00161         int getRequestNumber() const {return no;}
00162 
00163         // Vergleiche
00164         bool isCompatibleTo(const CustomerRequest* r);
00165 
00166 public:
00167         // request monitoring
00168         static CustomerRequest* getFirstRequest() {return firstRequest;}
00169         static CustomerRequest* getRequest(int number) {
00170                 CustomerRequest* r = getFirstRequest();
00171                 while (r!=0 && r->no!=number) r=r->nextRequest;
00172                 return r;
00173         }
00174         const CustomerRequest* getNextRequest() const {return nextRequest;}
00175 
00176         bool isLastRequest() const {return nextRequest==0;}
00177         bool isDone() const {return openNumberOfRings==0;}
00178 
00179         SIMTIME productionTime() const {return endTime - startTime;}
00180 
00181         // palette done
00182         void ringFinished();
00183 };
00184 
00185 
00186 #endif
00187 

Generated on Tue Apr 26 14:42:42 2005 for rollingmill by doxygen 1.3.6