File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,8 +56,8 @@ RelocSimulation::~RelocSimulation() {
5656void RelocSimulation::initializeSystem (){
5757 calculateArrivalRates ();
5858
59- // pre-allocate memory for services
60- // nextArrival.resize(1 );
59+ // pre-allocate memory for services and arrivals
60+ nextArrival = new Customer ( 0.0 , 0.0 , 0 , 0 );
6161 maxOcc = 0 ;
6262 for (int widx=0 ; widx<nWards; widx++){
6363 maxOcc += getWardCapacity (widx);
@@ -170,12 +170,15 @@ void RelocSimulation::generateArrival(){
170170 }
171171 }
172172
173- // create
174- nextArrival = new Customer (nextArrivalTime[min_widx][min_pidx],
175- genServiceTime (min_pidx),min_widx,min_pidx);
176- updateArrivalTime (min_widx,min_pidx);
177-
173+ // create new patient arrival
174+ nextArrival->arrivalClock = nextArrivalTime[min_widx][min_pidx];
175+ nextArrival->serviceTime = genServiceTime (min_pidx);
176+ nextArrival->patientType = min_pidx;
177+ nextArrival->wardTarget = min_widx;
178+ nextArrival->active = true ;
179+ nextArrival->serviceClock = numeric_limits<double >::max ();
178180
181+ updateArrivalTime (min_widx,min_pidx);
179182
180183}
181184
You can’t perform that action at this time.
0 commit comments