QuISP
Loading...
Searching...
No Matches
RuleEngine.h
Go to the documentation of this file.
1
5#pragma once
6
7#include <unordered_map>
8#include <vector>
9
10#include <omnetpp.h>
11
13#include "IRuleEngine.h"
16#include "messages/BSA_ipc_messages_m.h"
18#include "messages/link_generation_messages_m.h"
20#include "modules/QNIC.h"
24#include "rules/RuleSet.h"
25#include "runtime/Runtime.h"
28
29using namespace omnetpp;
30using namespace quisp::rules;
31
35
36namespace quisp::modules {
39
47
58 public:
60 RuleEngine();
62 int parentAddress; // Parent QNode's address
63 messages::EmitPhotonRequest *emt;
64 int number_of_qnics_all; // qnic,qnic_r,_qnic_rp
68
73
74 void freeResource(int qnic_index, int qubit_index, QNIC_type qnic_type);
75 void freeConsumedResource(int qnic_index, IStationaryQubit *qubit, QNIC_type qnic_type);
76 void ResourceAllocation(int qnic_type, int qnic_index);
77
78 protected:
79 void initialize() override;
80 void handleMessage(cMessage *msg) override;
81 void handleMSMResult(messages::MSMResult *msm_result);
82 void handleLinkGenerationResult(messages::CombinedBSAresults *bsa_result);
83 void handlePurificationResult(messages::PurificationResult *purification_result);
84 void handleSwappingResult(messages::SwappingResult *swapping_result);
85 void handleSingleClickResult(messages::SingleClickResult *click_result);
86 messages::CombinedBSAresults *generateCombinedBSAresults(int qnic_index);
87 void executeAllRuleSets();
88 void sendEmitPhotonSignalToQnic(QNIC_type qnic_type, int qnic_index, int qubit_index, bool is_first, bool is_last);
89 void stopOnGoingPhotonEmission(QNIC_type qnic_type, int qnic_index);
90 void freeFailedEntanglementAttemptQubits(QNIC_type qnic_type, int qnic_index);
91 simtime_t getEmitTimeFromBSMNotification(messages::BSMTimingNotification *notification);
92 void schedulePhotonEmission(QNIC_type qnic_type, int qnic_index, messages::BSMTimingNotification *notification);
93 void scheduleMSMPhotonEmission(QNIC_type qnic_type, int qnic_index, messages::EPPSTimingNotification *notification);
94 void handleStopEmitting(messages::StopEmitting *stop_emit);
95
97 std::unique_ptr<IQNicStore> qnic_store = nullptr;
98
100 std::unordered_map<std::pair<QNIC_type, int>, messages::EmitPhotonRequest *> emit_photon_timer_map;
101 std::unordered_map<std::pair<QNIC_type, int>, std::vector<int>> emitted_photon_order_map;
102
103 struct QubitInfo {
105 PauliOperator correction_operation = PauliOperator::I;
106 };
107
108 struct MSMInfo {
112 unsigned long long photon_index_counter;
115 // map of iteration index and qubit index
116 std::unordered_map<int, int> qubit_info_map;
117 // map of photon index and qubit info
118 std::unordered_map<int, QubitInfo> qubit_postprocess_info;
119 };
120
121 // [Key: qnic_index, Value: qubit_index]
122 std::unordered_map<int, MSMInfo> msm_info_map;
123};
124
126} // namespace quisp::modules
QNIC.
Definition BellPairStore.h:23
Definition IHardwareMonitor.h:74
Definition IRealTimeController.h:10
Definition IRoutingDaemon.h:9
Definition IRuleEngine.h:7
Definition IStationaryQubit.h:20
LoggerBase class integrate abilities to log simulation results into your components.
Definition LoggerBase.h:11
RuleEngine.
Definition RuleEngine.h:57
void handleMSMResult(messages::MSMResult *msm_result)
Definition RuleEngine.cc:262
utils::ComponentProvider provider
Definition RuleEngine.h:96
int number_of_qnics_rp
Definition RuleEngine.h:67
void scheduleMSMPhotonEmission(QNIC_type qnic_type, int qnic_index, messages::EPPSTimingNotification *notification)
Definition RuleEngine.cc:209
void handlePurificationResult(messages::PurificationResult *purification_result)
Definition RuleEngine.cc:329
simtime_t getEmitTimeFromBSMNotification(messages::BSMTimingNotification *notification)
Definition RuleEngine.cc:225
RuleEngine()
Definition RuleEngine.cc:34
IRoutingDaemon * routingdaemon
Definition RuleEngine.h:70
void sendEmitPhotonSignalToQnic(QNIC_type qnic_type, int qnic_index, int qubit_index, bool is_first, bool is_last)
Definition RuleEngine.cc:218
void schedulePhotonEmission(QNIC_type qnic_type, int qnic_index, messages::BSMTimingNotification *notification)
Definition RuleEngine.cc:200
messages::EmitPhotonRequest * emt
Definition RuleEngine.h:63
int number_of_qnics
Definition RuleEngine.h:65
void handleSingleClickResult(messages::SingleClickResult *click_result)
Definition RuleEngine.cc:238
std::unique_ptr< IQNicStore > qnic_store
Definition RuleEngine.h:97
void initialize() override
Definition RuleEngine.cc:42
void freeConsumedResource(int qnic_index, IStationaryQubit *qubit, QNIC_type qnic_type)
Definition RuleEngine.cc:376
~RuleEngine()
Definition RuleEngine.cc:36
IHardwareMonitor * hardware_monitor
Definition RuleEngine.h:69
std::unordered_map< int, MSMInfo > msm_info_map
Definition RuleEngine.h:122
BellPairStore bell_pair_store
Definition RuleEngine.h:72
void handleMessage(cMessage *msg) override
Definition RuleEngine.cc:77
void ResourceAllocation(int qnic_type, int qnic_index)
Definition RuleEngine.cc:355
void handleStopEmitting(messages::StopEmitting *stop_emit)
Definition RuleEngine.cc:318
runtime::RuntimeManager runtimes
Definition RuleEngine.h:99
int parentAddress
Definition RuleEngine.h:62
void stopOnGoingPhotonEmission(QNIC_type qnic_type, int qnic_index)
Definition RuleEngine.cc:227
messages::CombinedBSAresults * generateCombinedBSAresults(int qnic_index)
void handleLinkGenerationResult(messages::CombinedBSAresults *bsa_result)
Definition RuleEngine.cc:292
int number_of_qnics_all
Definition RuleEngine.h:64
std::unordered_map< std::pair< QNIC_type, int >, std::vector< int > > emitted_photon_order_map
Definition RuleEngine.h:101
void handleSwappingResult(messages::SwappingResult *swapping_result)
Definition RuleEngine.cc:341
void executeAllRuleSets()
Definition RuleEngine.cc:374
int number_of_qnics_r
Definition RuleEngine.h:66
std::unordered_map< std::pair< QNIC_type, int >, messages::EmitPhotonRequest * > emit_photon_timer_map
Definition RuleEngine.h:100
void freeFailedEntanglementAttemptQubits(QNIC_type qnic_type, int qnic_index)
Definition RuleEngine.cc:229
IRealTimeController * realtime_controller
Definition RuleEngine.h:71
void freeResource(int qnic_index, int qubit_index, QNIC_type qnic_type)
The QNicStore interface.
Definition IQNicStore.h:14
The QubitRecord interface.
Definition IQubitRecord.h:17
Definition RuntimeManager.h:6
ComponentProvider class provides a way to access other quisp other modules.
Definition ComponentProvider.h:22
Definition RuleEngine.h:32
Definition Application.cc:16
Define_Module(Application)
QNIC_type
Definition QNIC.h:18
Definition Action.cc:3
Definition RuleEngine.h:108
int partner_qnic_index
Definition RuleEngine.h:110
int epps_address
Definition RuleEngine.h:111
std::unordered_map< int, int > qubit_info_map
Definition RuleEngine.h:116
unsigned long long photon_index_counter
Definition RuleEngine.h:112
int partner_address
Definition RuleEngine.h:109
simtime_t total_travel_time
Definition RuleEngine.h:114
int iteration_index
Definition RuleEngine.h:113
std::unordered_map< int, QubitInfo > qubit_postprocess_info
Definition RuleEngine.h:118
Definition RuleEngine.h:103
PauliOperator correction_operation
Definition RuleEngine.h:105
int qubit_index
Definition RuleEngine.h:104
Definition RuleEngine.h:40
unsigned long ruleset_id
Definition RuleEngine.h:41
int shared_tag
Definition RuleEngine.h:42
int operation_type
Definition RuleEngine.h:44
int qubit_index
Definition RuleEngine.h:45
int new_partner_addr
Definition RuleEngine.h:43