LCOV - code coverage report
Current view: top level - src/activitygen - AGActivityGen.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 5 5 100.0 %
Date: 2024-05-01 15:34:42 Functions: 1 1 100.0 %

          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    AGActivityGen.h
      17             : /// @author  Piotr Woznica
      18             : /// @author  Daniel Krajzewicz
      19             : /// @author  Walter Bamberger
      20             : /// @author  Michael Behrisch
      21             : /// @date    July 2010
      22             : ///
      23             : // Main class that handles City, Activities and Trips
      24             : /****************************************************************************/
      25             : #pragma once
      26             : #include <config.h>
      27             : 
      28             : #include "city/AGCity.h"
      29             : 
      30             : 
      31             : // ===========================================================================
      32             : // class declarations
      33             : // ===========================================================================
      34             : class OutputDevice;
      35             : class RONet;
      36             : class AGTrip;
      37             : 
      38             : 
      39             : // ===========================================================================
      40             : // class definitions
      41             : // ===========================================================================
      42             : /**
      43             :  * @class AGActivityGen
      44             :  * @brief Central object handling City, Activities and Trips
      45             :  */
      46             : class AGActivityGen {
      47             : public:
      48             :     //AGActivityGen() {};
      49             :     /** @brief Constructor
      50             :      *
      51             :      * @param[in] input input stat-file name (containing information about the city)
      52             :      * @param[in] output xml file in which we'll write the routes generated
      53             :      * @param[in] net network of the city
      54             :      */
      55          10 :     AGActivityGen(std::string input, OutputDevice& output, RONet* net) :
      56          10 :         inputFile(input),
      57          10 :         outputFile(output),
      58          10 :         net(net),
      59             :         //activities(),
      60          10 :         city(net) {};
      61             :     /** @brief build the internal city
      62             :      *
      63             :      * TO CALL 1: First function to be called:
      64             :      * imports the XML input file and generates the whole city.
      65             :      */
      66             :     void importInfoCity();
      67             : 
      68             :     /**@brief build activities and trips of the population and generate routes
      69             :      *
      70             :      * TO CALL 2:
      71             :      * generates City's Activity and the corresponding trips
      72             :      *
      73             :      * @param[in] days      : duration of the simulation (>=0) (day of the end - day of the beginning)
      74             :      * @param[in] beginTime : instant of the simulation beginning (in the first day)
      75             :      * @param[in] endTime   : instant of the simulation ending (in the last day)
      76             :      * NOTE: if (days==0) : endTime > beginTime
      77             :      *
      78             :      * EXAMPLE: if days=1, endTime=0, beginTime=0: The duration
      79             :      * will be 24 hours from 12am to 12amof the next day
      80             :      */
      81             :     void makeActivityTrips(int days = 1, int beginTime = 0, int endTime = 0);
      82             : 
      83             : protected:
      84             :     // @brief xml file statistics on the city and generated routes
      85             :     std::string inputFile;
      86             :     /// @brief The generated routes
      87             :     OutputDevice& outputFile;
      88             :     // @brief network of the city
      89             :     RONet* net;
      90             :     //Activities activities;
      91             :     // @brief city object containing all households and vehicles
      92             :     AGCity city;
      93             :     // @brief time of beginning and ending of the simulation and the duration of the simulation in days (min 1 day (beginning and end in the same day)
      94             :     int durationInDays, beginTime, endTime;
      95             : 
      96             :     /**
      97             :      * @brief validation: compatibility of the given trip
      98             :      *
      99             :      * @param[in] trip to be validated
     100             :      *
     101             :      * @returns whether the trip is compatible with the time boundaries or not.
     102             :      * for this begin, end and duration of the simulation must be defined
     103             :      */
     104             :     bool timeTripValidation(const AGTrip& trip) const;
     105             :     /**
     106             :      * @brief generate the output file (trips or routes) using a trip list
     107             :      *
     108             :      * @param[in] trips generated by the different activities
     109             :      */
     110             :     void generateOutputFile(std::list<AGTrip>& trips);
     111             :     /**
     112             :      * @breif introduce a slight variation into the departure time of "default" vehicles
     113             :      *
     114             :      * @param[in] trip on which a random (normally distributed) variation will be tried
     115             :      */
     116             :     void varDepTime(AGTrip& trip) const;
     117             : 
     118             : private:
     119             :     /// @brief invalidated assignment operator
     120             :     AGActivityGen& operator=(const AGActivityGen&);
     121             : };

Generated by: LCOV version 1.14