// main.h: defines the class Sim, used to create one object "sim". // // The object sim is declared here for inclusion everywhere, but defined // and initialized in main.cc. It carries global variables and constants // used throughout the simulation. class Sim { public: double simulationTime; // What time is it? int simulating; // set to false by end-of-simulation event double reportInterval; // How often should we report? // quantities that determine how we model the real world // In a more elaborate program, these might be input data. // economics: profit per litre of gas, and cost to operate one pump for a day double profit; double pumpCost; // demand: minimum and maximum amount of gas needed by a car // See Car constructor. double litresNeededMin; double litresNeededRange; // service times: constant base time + time per litre + random spread // See Pump.serviceTime(). double serviceTimeBase; double serviceTimePerLitre; double serviceTimeSpread; // customer behaviour: probability of balking depends on three // ad-hoc constants. See Arrival.doesCarBalk(). double balkA; double balkB; double balkC; // customer arrival rate // See Arrival.interarrivalTime(). double meanInterarrivalTime; // seconds // random-number streams used to model the world class Random *arrivalStream; // auto arrival times class Random *litreStream; // number of litres needed class Random *balkingStream; // balking probability class Random *serviceStream; // service times // major data structures class EventList *eventList; class CarQueue *carQueue; class PumpStand *pumpStand; class Statistics *stats; }; extern Sim *sim;