forked from bpswenson/sst_airport_sim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAirport.hpp
62 lines (49 loc) · 1.76 KB
/
Airport.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include <sst/core/component.h>
#include <sst/core/link.h>
#include <sst/core/output.h>
#include <sst/core/params.h>
#include <sst/core/sst_types.h>
#include <random>
#include "Common.hpp"
#include "RoughAirLink.hpp"
namespace AirportSim {
class Airport : public SST::Component {
public:
SST_ELI_REGISTER_COMPONENT(
Airport, "AirportSim", "Airport", SST_ELI_ELEMENT_VERSION(1, 0, 1), "AirportSim", COMPONENT_CATEGORY_NETWORK)
SST_ELI_DOCUMENT_PARAMS(
{"name", "Airport Name", "Empty_Airport"},
{"num_connectors", "Number of flight links to other airports", "0"},
{"num_planes", "Number of initial flights out of airport", "0"},
)
SST_ELI_DOCUMENT_PORTS(
{"airport_connector_%(num_connectors)d", "Airport Connection Flights", {""}})
Airport(SST::ComponentId_t id, SST::Params ¶ms);
~Airport() override;
protected:
void finish() override;
void complete(unsigned int) override;
void handle_incoming_plane(SST::Event* ev, uint32_t idx);
void handle_self_event(SST::Event *ev);
bool clock(SST::Cycle_t cycle);
void setup() override;
SST::Clock::Handler<Airport> *m_clock;
private:
std::uniform_int_distribution<uint32_t> destination_dist;
std::uniform_int_distribution<uint32_t> delay_dist;
std::uniform_int_distribution<uint32_t> passenger_count_dist;
uint32_t m_num_planes;
uint32_t m_total_passenger_departures;
uint32_t m_total_aircraft_departures;
uint32_t m_total_aircraft_arrivals;
uint32_t m_total_passenger_arrivals;
std::random_device rd;
std::mt19937 mt;
uint64_t m_clock_count;
String m_name;
uint32_t m_num_connectors;
SST::Link *m_self_link; //!< SST Link for sending delayed events to myself
Vector<RoughAirLink*> m_connector_links;
};
} // namespace AirportSim