Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/activitygen/activities/AGWorkAndSchool.h
169678 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4
// activitygen module
5
// Copyright 2010 TUM (Technische Universitaet Muenchen, http://www.tum.de/)
6
// This program and the accompanying materials are made available under the
7
// terms of the Eclipse Public License 2.0 which is available at
8
// https://www.eclipse.org/legal/epl-2.0/
9
// This Source Code may also be made available under the following Secondary
10
// Licenses when the conditions for such availability set forth in the Eclipse
11
// Public License 2.0 are satisfied: GNU General Public License, version 2
12
// or later which is available at
13
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
14
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
15
/****************************************************************************/
16
/// @file AGWorkAndSchool.h
17
/// @author Piotr Woznica
18
/// @author Daniel Krajzewicz
19
/// @author Walter Bamberger
20
/// @date July 2010
21
///
22
// Generates trips to work and to school
23
/****************************************************************************/
24
#pragma once
25
#include <config.h>
26
27
#include <activitygen/city/AGHousehold.h>
28
#include <activitygen/city/AGPosition.h>
29
#include "AGActivity.h"
30
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
class AGWorkAndSchool : public AGActivity {
36
public:
37
AGWorkAndSchool(AGHousehold* hh, AGDataAndStatistics* das, std::list<AGTrip>* prevTrips) :
38
AGActivity(hh, das, prevTrips, 1) {};
39
40
/**
41
* @Overwrite
42
*/
43
bool generateTrips();
44
45
/**
46
* generate objects
47
*/
48
//void buildDestinations();
49
void buildChildrenAccompaniment();
50
void buildWorkDestinations();
51
52
/**
53
* allocation of cars to the convenient adult:
54
* the adult able to accompany the other (adult) and children in need.
55
*/
56
void carAllocation();
57
58
/**
59
* trip generation for adults and children
60
*/
61
bool carsToTrips();
62
63
/**
64
* returns true if there is an unused car that can be driven by an adult
65
*/
66
bool isThereUnusedCar();
67
68
/**
69
* main function of Accompaniment trip management:
70
* simple trips are analyzed whether they can be grouped together or not.
71
* return true if every thing worked well
72
*/
73
bool checkAndBuildTripConsistancy();
74
75
/**
76
* checks whether the driver is able to accompany all people
77
* or if the others have to go too late to work for him
78
*/
79
bool checkDriversScheduleMatching();
80
81
/**
82
* function generating Trip objects using the local objects
83
*/
84
void generateListTrips();
85
86
/**
87
* function adding new drivers when a not used car is needed
88
* + when the person prefer the car to the bus (choice variable)
89
*/
90
void makePossibleDriversDrive();
91
92
/**
93
* return the name of a car that is not used by another adult driver of the household
94
* in fact there is only 1 or 2 adults, so if the number of cars is greater that 1
95
* at least one car isn't used
96
*/
97
std::string getUnusedCar();
98
99
private:
100
/**
101
* list of destinations for children, which can be reach only using a car (too far from home)
102
* and therefore need to be accompanied:
103
* waiting list for the accompaniment
104
*/
105
//std::list<Position> childrenCarAccompaniment;
106
std::list<AGChild> childrenNeedingCarAccompaniment;
107
/**
108
* adult needing a car having a car but this car is not available because of an other person
109
*/
110
//std::list<Position> adultCarAccompaniment;
111
std::list<AGAdult> adultNeedingCarAccompaniment;
112
/**
113
* list of destinations for work by bus or car,
114
* car being possible (other wise bus or feet)
115
*/
116
//std::list<Position> workDestinations;
117
std::list<AGAdult> workingPeoplePossCar;
118
/**
119
* work destinations with use of car
120
*/
121
//std::list<Position> carDestinations;
122
std::list<AGAdult> personsDrivingCars;
123
/**
124
* adults of the household who are not in need of car for work
125
* but are able to accompany someone. used only in case of need.
126
*/
127
std::list<AGAdult> notNeedingDrivers;
128
/**
129
* list of temporary trips:
130
* contains accompaniment trips without any return to home.
131
*/
132
std::list<AGTrip> tempAccTrip;
133
std::list<AGTrip> tempTrip;
134
};
135
136