Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2010-2024 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 AGFreeTime.h 17 : /// @author Piotr Woznica 18 : /// @author Daniel Krajzewicz 19 : /// @author Walter Bamberger 20 : /// @author Michael Behrisch 21 : /// @date July 2010 22 : /// 23 : // Generates trips related to after-work activities 24 : // like visiting the family or party. 25 : /****************************************************************************/ 26 : #pragma once 27 : #include <config.h> 28 : 29 : #include <activitygen/city/AGHousehold.h> 30 : #include "AGActivity.h" 31 : 32 : 33 : // =========================================================================== 34 : // class definitions 35 : // =========================================================================== 36 1506 : class AGFreeTime : public AGActivity { 37 : public: 38 : AGFreeTime(AGHousehold* hh, AGDataAndStatistics* das, std::list<AGTrip>* prevTrips) : 39 : AGActivity(hh, das, prevTrips, 2), 40 : freqOut(das->freeTimeActivityRate), 41 : nbrDays(1) {}; 42 1506 : AGFreeTime(AGHousehold* hh, AGDataAndStatistics* das, std::list<AGTrip>* prevTrips, int days) : 43 : AGActivity(hh, das, prevTrips, 2), 44 1506 : freqOut(das->freeTimeActivityRate), 45 1506 : nbrDays(days) {}; 46 : 47 : /** 48 : * @Overwrite 49 : */ 50 : bool generateTrips(); 51 : 52 : /** 53 : * returns the type of trip that will be done on this household 54 : * there is also the case: no free time trip 55 : * 0 = non 56 : * 1 = during the day 57 : * 2 = in the evening 58 : * 4 = during the night 59 : * (combinations using '+' are available for possibleTypeOfTrip()) 60 : */ 61 : int possibleTypeOfTrip(); 62 : int decideTypeOfTrip(); 63 : /** 64 : * The different type of trips that are available: 65 : * one function is called among all the following 66 : */ 67 : bool typeFromHomeDay(int day); 68 : bool typeFromHomeEvening(int day); 69 : bool typeFromHomeNight(int day); 70 : 71 : /** 72 : * returns the moment when everybody is back home and ready 73 : * to do some thing else using everyday trips 74 : */ 75 : int whenBackHome(); 76 : /** 77 : * moment when everybody is back home using all trips applicable for the given day 78 : * if no car is used: return 0 79 : */ 80 : int whenBackHomeThisDay(int day); 81 : /** 82 : * moment when the first person takes the car to go somewhere 83 : * id no car is used: return 2400 (midnight at the end of the given day) 84 : */ 85 : int whenBeginActivityNextDay(int day); 86 : 87 : private: 88 : /** 89 : * frequency of going out or see family is assumed to be once a week (in mean) 90 : */ 91 : double freqOut; 92 : /** 93 : * number of days for the simulation 94 : * households are likely to go out some days but not others 95 : */ 96 : int nbrDays; 97 : /** 98 : * time ready to do something else 99 : * everybody is back home 100 : */ 101 : int tReady; 102 : /** 103 : * possible type of trips for this household 104 : */ 105 : int possibleType; 106 : 107 : static const int DAY;// = 1; 108 : static const int EVENING;// = 2; 109 : static const int NIGHT;// = 4; 110 : 111 : static const int TB_DAY;// = 800; 112 : static const int TE_DAY;// = 1800; 113 : static const int TB_EVENING;// = 1900; 114 : static const int TE_EVENING;// = 2400; 115 : static const int TB_NIGHT;// = 2300; 116 : static const int TE_NIGHT;// = 500; 117 : 118 : };