LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Toggle main menu visibility
Loading...
Searching...
No Matches
sn_polling_extension.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012-2026, QORE Lab, Imperial College London
3
* All rights reserved.
4
*/
5
#ifndef LINE_API_SN_SN_POLLING_EXTENSION_H
6
#define LINE_API_SN_SN_POLLING_EXTENSION_H
7
8
/**
9
* @file
10
* @ingroup api_sn
11
* Port of matlab/src/api/sn/sn_polling_extension.m.
12
*
13
* The first polling extension a POLLING station of the network carries, as
14
* its feature-registry name ("PollingTable", "PollingOrder" or
15
* "PollingTimer"), or "" when every polling station is a plain cyclic one.
16
* The three settings come from set_polling_table, set_polling_order and
17
* set_polling_timer and live on the Station. Engines that read the polling
18
* type alone (the SSA NRM, the JMT writer) ask this predicate so they refuse
19
* instead of answering the cyclic system.
20
*
21
* ARITHMETIC: none; reads structure only.
22
*/
23
24
#include <cstddef>
25
#include <string>
26
27
#include "
line/lang/lang_types.h
"
28
#include "
line/lang/qn/network_struct.h
"
29
30
namespace
line
{
31
namespace
api
{
32
33
template
<
class
T>
34
std::string
sn_polling_extension
(
const
qn::NetworkStruct<T>
&
sn
) {
35
for
(std::size_t i = 0; i <
sn
.stations.size(); ++i) {
36
const
qn::Station<T>
& st =
sn
.stations[i];
37
if
(st.
sched
!= qn::SchedStrategy::POLLING)
continue
;
38
if
(!st.
polling_table
.empty())
return
"PollingTable"
;
39
if
(st.
polling_order
!=
lang::PollingOrder::CYCLIC
)
return
"PollingOrder"
;
40
if
(st.
polling_timer_scope
!=
lang::PollingTimer::NONE
)
return
"PollingTimer"
;
41
}
42
return
""
;
43
}
44
45
/**
46
* The citation token of the MVA polling analyzer's formula on SN, the hook of
47
* MATLAB `NetworkSolver.citations`: when `family` is "mva" and `method`
48
* contains "stationtime", "polling.table" if the first POLLING station has a
49
* table, else "polling.klimited" if it is K-limited with K > 1, else "".
50
* Append the result to the method tokens passed to io::line_citations.
51
*/
52
template
<
class
T>
53
std::string
sn_polling_citation_token
(
const
qn::NetworkStruct<T>
&
sn
,
const
std::string& family,
54
const
std::string& method) {
55
if
(family !=
"mva"
|| method.find(
"stationtime"
) == std::string::npos)
return
""
;
56
for
(std::size_t i = 0; i <
sn
.stations.size(); ++i) {
57
const
qn::Station<T>
& st =
sn
.stations[i];
58
if
(st.
sched
!= qn::SchedStrategy::POLLING || st.
polling_type
.empty())
continue
;
59
if
(!st.
polling_table
.empty())
return
"polling.table"
;
60
if
(st.
polling_type
[0] ==
lang::PollingType::KLIMITED
&& st.
polling_par
> 1)
61
return
"polling.klimited"
;
62
return
""
;
63
}
64
return
""
;
65
}
66
67
}
// namespace api
68
}
// namespace line
69
70
#endif
// LINE_API_SN_SN_POLLING_EXTENSION_H
line::qn::NetworkStruct
A network plus its refreshed NetworkStruct.
Definition
network_struct.h:1070
lang_types.h
Enumerations and the minimal distribution descriptor shared by the model layer of the C++ port.
line::api
Definition
infer_fmlps.h:69
line::api::sn_polling_citation_token
std::string sn_polling_citation_token(const qn::NetworkStruct< T > &sn, const std::string &family, const std::string &method)
The citation token of the MVA polling analyzer's formula on SN, the hook of MATLAB NetworkSolver....
Definition
sn_polling_extension.h:53
line::api::sn_polling_extension
std::string sn_polling_extension(const qn::NetworkStruct< T > &sn)
Definition
sn_polling_extension.h:34
line::lang::PollingOrder::CYCLIC
@ CYCLIC
fixed cyclic order (or the polling table)
Definition
lang_types.h:399
line::lang::PollingTimer::NONE
@ NONE
no visit timer
Definition
lang_types.h:407
line::lang::PollingType::KLIMITED
@ KLIMITED
serve at most K per visit (K in pollingPar)
Definition
lang_types.h:388
line::sn
Definition
sn_arvr_state_dependent_balance.h:25
line
Conservation laws of a layered queueing network, enumerated from its structure.
Definition
aoi_dist2ph.h:52
network_struct.h
A queueing network and its refreshed NetworkStruct.
line::qn::Station
One station of the network.
Definition
network_struct.h:663
line::qn::Station::sched
SchedStrategy sched
Definition
network_struct.h:666
line::qn::Station::polling_type
std::vector< lang::PollingType > polling_type
Polling parameters for a POLLING station, MATLAB's pollingType, switchoverTime and pollingPar on the ...
Definition
network_struct.h:761
line::qn::Station::polling_par
int polling_par
Definition
network_struct.h:763
line::qn::Station::polling_order
lang::PollingOrder polling_order
Definition
network_struct.h:775
line::qn::Station::polling_table
std::vector< std::size_t > polling_table
The polling extensions (Queue.setPollingTable, setPollingOrder, setPollingTimer).
Definition
network_struct.h:773
line::qn::Station::polling_timer_scope
lang::PollingTimer polling_timer_scope
Definition
network_struct.h:778
include
line
api
sn
sn_polling_extension.h
Generated by
1.18.0