Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 3d949d5271
Fetching contributors…

Cannot retrieve contributors at this time

69 lines (56 sloc) 1.779 kb
#include "../Headers/internlib.h"
#include "../Headers/PoissRand.h"
#include "../Headers/passenger.h"
#include "../Headers/floor.h"
#include "../Headers/qt/emulator.h"
#include <QApplication>
using namespace std;
/* FcfsElevator's flash process, P means premium */
int PFcfsFlash();
/* Declaration of Passenger static member */
int Elevator::capacity = 20;
int Elevator::throughput = 0;
int Passenger::maxWaitTime = 0;
int Passenger::minWaitTime = INT_MAX;
int Passenger::total = 0;
int Passenger::totalWaitTime = 0;
int Passenger::maxDuration = 0;
int Passenger::minDuration = INT_MAX;
int Passenger::nCompleteDuration = 0;
int Passenger::totalDuration = 0;
/* Declaration of Emulator static member, similar to glable variable */
int Emulator::dual;
int Emulator::nElevator ;
int Emulator::UNIT_TIME = 2;
int Emulator::nFloor;
list<Order*> Emulator::orders;
vector<Elevator*> Emulator::elevators;
double Emulator::lambda;
string Emulator::elevatorType;
Floor Emulator::floors[30];
double Elevator::acceleration = 1;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
/* Generate random number seed with current time */
srand(time(NULL));
/* Set runtime parameters */
Emulator::nFloor = 10;
Emulator::lambda = 0.1;
Emulator::nElevator = 10;
Emulator::elevatorType = "PFCFS";
/* Initialize elevators */
for(int i = 0; i < Emulator::nElevator; i++) {
Elevator *ele;
if (Emulator::elevatorType == "PFCFS") {
Elevator* elev = new Elevator();
ele = elev;
}
Emulator::elevators.push_back(ele);
}
Emulator window;
window.resize(800, 600);
window.show();
window.setWindowTitle("Elevator Emulator");
return app.exec();
}
Jump to Line
Something went wrong with that request. Please try again.