SOLA
Loading...
Searching...
No Matches
cpps_manager.h
1// Copyright 2023 The SOLA authors
2//
3// This file is part of DAISI.
4//
5// DAISI is free software: you can redistribute it and/or modify it under the terms of the GNU
6// General Public License as published by the Free Software Foundation; version 2.
7//
8// DAISI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
10// Public License for more details.
11//
12// You should have received a copy of the GNU General Public License along with DAISI. If not, see
13// <https://www.gnu.org/licenses/>.
14//
15// SPDX-License-Identifier: GPL-2.0-only
16
17#ifndef DAISI_CPPS_COMMON_CPPS_MANAGER_H_
18#define DAISI_CPPS_COMMON_CPPS_MANAGER_H_
19
20#include <queue>
21#include <unordered_map>
22
23#include "cpps/amr/amr_topology.h"
24#include "manager/core_network.h"
25#include "manager/manager.h"
26#include "ns3/network-module.h"
27#include "scenariofile/cpps_scenariofile.h"
28
29namespace daisi::cpps {
30
32public:
33 explicit CppsManager(const std::string &scenario_config_file);
34
35private:
36 void setupImpl() override;
37 GeneralScenariofile getGeneralScenariofile() const override { return scenario_; }
38 std::string getDatabaseFilename() const override;
39
40 void initAMR(uint32_t index);
41 void connectAMR(uint32_t index);
42 void startAMR(uint32_t index);
43
44 void initMF(uint32_t index);
45 void startMF(uint32_t index);
46
47 void scheduleMaterialFlow(const SpawnInfoScenario &info);
48 void executeMaterialFlow(int index, const std::string &friendly_name);
49
50 void initialSpawn();
51
52 void setupNodes();
53
54 void scheduleEvents();
55
56 uint64_t getNumberOfNodes() const;
57
58 void spawnAMR(uint32_t amr_index, const AmrDescription &description, const Topology &topology);
59
60 // Initiates shutdown of finished TOs
61 void clearFinishedMaterialFlows();
62
63 void checkStarted(uint32_t index);
64
65 CppsScenariofile scenario_;
66
67 std::unordered_map<std::string, AmrDescription> amr_descriptions_;
68 std::unordered_map<std::string, MaterialFlowDescriptionScenario> material_flow_descriptions_;
69
70 std::priority_queue<SpawnInfoScenario, std::vector<SpawnInfoScenario>, std::greater<>>
71 spawn_info_;
72 std::priority_queue<SpawnInfoScenario, std::vector<SpawnInfoScenario>, std::greater<>>
73 schedule_info_;
74
75 // counters for scheduling
76 uint64_t number_material_flows_scheduled_for_execution_ = 0;
77 uint64_t number_material_flows_finished_ = 0;
78
79 // Nodes / Network
80 ns3::NodeContainer amrs_;
81 ns3::NodeContainer material_flows_;
82
83 CoreNetwork core_network_;
84};
85
86} // namespace daisi::cpps
87
88#endif
Network structure with one central L3 router, forming a star topology.
Definition core_network.h:34
Definition manager.h:26
Definition amr_description.h:27
Definition cpps_manager.h:31
Definition amr_topology.h:26
Definition general_scenariofile.h:28
Definition cpps_scenariofile.h:82
Definition spawn_info_scenario.h:58