107 Report(
"Random activity enabled");
112 Report(
"Random activity disabled");
131 if (!origfloor || !newfloor)
140 Report(
"Heading to floor " + newfloor->
ID);
145 if (elevators.empty() ==
true)
147 Report(
"No route found to floor " + newfloor->
ID);
155 for (
size_t i = 0; i < elevators.size(); i++)
157 Elevator *elevator = elevators[i]->car->GetElevator();
168 route.emplace_back(route_entry);
192 int floor_selection =
route[0].elevator_route->floor_selection;
202 if (
route[0].call_made == 0)
209 if (station &&
route[0].destination ==
false)
215 result = station->
Press(
true);
216 route[0].call_made = 1;
220 result = station->
Press(
false);
221 route[0].call_made = -1;
225 if (station &&
route[0].destination ==
true)
230 route[0].floor_selected =
true;
233 route[0].call_made = 1;
235 route[0].call_made = -1;
250 if (
route[0].floor_selected ==
false || (
route[0].destination ==
true &&
route[0].in_elevator ==
false))
261 if (
route[0].destination ==
false)
279 route[0].elevator_route->car = car;
282 route[0].in_elevator =
true;
289 if (
route[0].destination ==
false)
294 Report(
"Pressing elevator button for floor " + floor->
ID);
304 route[0].floor_selected =
true;
310 Report(
"Can't press elevator button for floor " + floor->
ID);
318 Report(
"Waiting in elevator for floor " + floor->
ID);
328 if ((direction ==
true && station->
GetUpStatus() ==
false) ||
343 std::string floor_status;
346 floor_status =
"destination";
347 else if (
route[0].call_made == 2)
348 floor_status =
"recall";
350 floor_status =
"intermediate";
356 Report(
"Arrived at " + floor_status +
" floor " + floor->
ID);
362 delete route[0].elevator_route;
381 route[0].call_made = 2;
388 route[0].floor_selected =
false;
389 route[0].call_made = 0;
393 else if (elevator->
IsMoving ==
true)
442 if (
route.empty() ==
false)
444 for (
size_t i = 0; i <
route.size(); i++)
446 delete route[i].elevator_route;
462 return "Idle on floor " + floor->
ID;
466 int floor_selection =
route[0].elevator_route->floor_selection;
472 if (
route[0].floor_selected ==
true && car)
477 return "Pressed " + floor->
ID +
" in elevator " +
ToString(elevator_number);
478 else if (
route[0].in_elevator ==
true)
480 if (
route[0].call_made != 2)
482 std::string direction;
483 if (
route[0].call_made == 1)
487 return direction +
" to floor " + floor->
ID +
" in elevator " +
ToString(elevator_number);
490 return "Proceeding to recall floor";
494 if (
route[0].destination ==
false)
496 if (
route[0].call_made == 1)
497 return "Call button Up pressed";
499 if (
route[0].call_made == -1)
500 return "Call button Down pressed";
503 return "Selected floor " +
ToString(floor_selection) +
" on call station";
bool SelectFloor(int floor)
int GetElevatorArrived(int starting_floor, int destination_floor)
int GetElevatorArrivedStandard(int floor, bool direction)
bool Press(bool reverse=false)
Control * GetFloorButton(int floor)
bool AreDoorsOpen(int number=0)
int GetActiveRecallFloor()
bool GetDestinationDispatch()
ElevatorCar * GetCarForFloor(int number, bool report_on_failure=false)
CallStation * GetCallStationForElevator(int elevator)
const std::string & GetName()
virtual bool ReportError(const std::string &message)
virtual void Report(const std::string &message)
void SetValues(const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
void EnableLoop(bool value)
Timer(const std::string &name, Person *parent)
void EnableRandomActivity(bool value)
bool ReportError(const std::string &message)
Person(Object *parent, const std::string &name, int floor, bool service_access=false)
bool IsRandomActivityEnabled()
void GotoFloor(int floor)
std::vector< RouteEntry > route
void Report(const std::string &message)
Elevator * GetElevator(int number)
std::vector< ElevatorRoute * > GetRouteToFloor(int StartingFloor, int DestinationFloor, bool service_access=false)
Real GetConfigFloat(const std::string &key, Real default_value)
void RemovePerson(Person *person)
Floor * GetFloor(int number)
int GetConfigInt(const std::string &key, int default_value)
void Start(int milliseconds=-1, bool oneshot=false)
std::string ToString(int number)
#define SBS_PROFILE(name)
ElevatorRoute * elevator_route
CallStation * callstation