NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
802_22.h
1/************************************************************************************
2 * Copyright (C) 2023 *
3 * TETCOS, Bangalore. India *
4 * *
5 * Tetcos owns the intellectual property rights in the Product and its content. *
6 * The copying, redistribution, reselling or publication of any or all of the *
7 * Product or its content without express prior written consent of Tetcos is *
8 * prohibited. Ownership and / or any other right relating to the software and all *
9 * intellectual property rights therein shall remain at all times with Tetcos. *
10 * *
11 * Author: Shashi Kant Suman *
12 * *
13 * ---------------------------------------------------------------------------------*/
14#ifndef _NETSIM_802_22_H_
15#define _NETSIM_802_22_H_
16//For MSVC compiler. For GCC link via Linker command
17#pragma comment(lib,"CognitiveRadio.lib")
18#pragma comment(lib,"Metrics.lib")
19#pragma comment(lib,"NetworkStack.lib")
20#pragma comment(lib,"PropagationModel.lib")
21
22#include "ErrorModel.h"
23#define CHANNEL_LOSS -1.7
24//2 bits binary number
25#define B2_00 0
26#define B2_01 1
27#define B2_10 2
28#define B2_11 3
29
30//3 bits binary number
31#define B3_000 0
32#define B3_001 1
33#define B3_010 2
34#define B3_011 3
35#define B3_100 4
36#define B3_101 5
37#define B3_110 6
38#define B3_111 7
39
40//4 bits binary number
41#define B4_0000 0
42#define B4_0001 1
43#define B4_0010 2
44#define B4_0011 3
45#define B4_0100 4
46#define B4_0101 5
47#define B4_0110 6
48#define B4_0111 7
49#define B4_1000 8
50#define B4_1001 9
51#define B4_1010 10
52#define B4_1011 11
53#define B4_1100 12
54#define B4_1101 13
55#define B4_1110 14
56#define B4_1111 15
57
58/** 16 bit Binary number */
59#define B16_1111111111111111 65535
60
61/** Mac Subheader bit
62 Table 4, IEEE802.22-2011-page 36
63 */
64#define UPSTREAM_GRANT_MANAGEMENT_BIT 0
65#define FRAGMANET_BIT 1
66#define EXTENDED_BIT 2
67#define ARQ_FEEDBACK_BIT 3
68#define BW_REQUEST_BIT 4
69
70/* Seed value for Incumbent operation */
71static unsigned long ulIncumbentSeed1 = 12345678;
72static unsigned long ulIncumbentSeed2 = 23456789;
73
74#define MAX_FID 8
75#define MAX_SID 512
76//Typedef for struct
78typedef struct stru_802_22_Frame_Control_Header FCH;
79typedef struct stru_802_22_General_MAC_Header GMH;
80typedef struct stru_802_22_FragmentSubHeader FRAGMENT_SUB_HEADER;
81typedef struct stru_802_22_BS_MAC BS_MAC;
82typedef struct stru_802_22_BS_Phy BS_PHY;
83typedef struct stru_802_22_CPE_MAC CPE_MAC;
84typedef struct stru_802_22_CPE_PHY CPE_PHY;
85typedef struct stru_802_22_Incumbent INCUMBENT;
86typedef struct stru_802_22_SymbolParameter SYMBOL_PARAMETER;
87typedef struct stru_802_22_DSMAP DSMAP;
88typedef struct stru_802_22_DSMAP_IE DSMAP_IE;
89typedef struct stru_802_22_UCD_Message_Format UCD;
90typedef struct stru_802_22_DCD_Message_Format DCD;
92typedef struct stru_802_22_USMAP_MessageFormat USMAP;
93typedef struct stru_802_22_DSBurst DS_BURST;
94typedef struct stru_802_22_USMAPIE USMAP_IE;
95typedef struct stru_802_22_Service CR_SERVICE;
96typedef struct stru_DSx_IE DSX_IE;
97typedef struct stru_DSA_REQ DSA_REQ;
98typedef struct stru_DSA_RSP DSA_RSP;
99typedef struct stru_DSD_REQ DSD_REQ;
100typedef struct stru_DSD_RSP DSD_RSP;
101typedef struct stru_BWRequestSubHeader BW_REQUEST;
102typedef struct stru_802_22_UplinkAlloctioninfo UPLINKALLOCINFO;
103typedef struct stru_802_22_UCD_IE UCD_IE;
104typedef struct stru_802_22_SSFOutput SSF_OUTPUT;
105typedef struct stru_802_22_SSFInput SSF_INPUT;
106typedef struct stru_NetSim_CR_BS_Metrics BS_METRICS;
107typedef struct stru_NetSim_CR_Incumbent_Metrics INCUMBENT_METRICS;
108typedef struct stru_NetSim_CR_Channel_Metrics CHANNEL_METRICES;
109typedef struct stru_NetSim_CR_CPE_Metrics CPE_METRICS;
110
111//Typedef for enum
112typedef enum enum_802_22_MAC_Management_Message MANAGEMENT_MESSAGE;
113typedef enum enum_802_22_Modulation MODULATION_TECHNIQUE;
114typedef enum enum_802_22_CodingRate CODING_RATE;
115typedef enum enum_802_22_ChannelState CHANNEL_STATE;
116typedef enum enum_802_22_IncumbentStatus INCUMBENT_STATUS;
117typedef enum enum_802_22_SubEvent SUBEVENT;
118
119# define SCH_SIZE 45 ///< SCH Size is 45 Bytes
120# define FCH_SIZE 3 ///< FCH Size is 3 Bytes
121# define GMH_SIZE 4 ///< GMH Size is 4 Bytes
122# define CRC 4 ///< CRC Size is 4 Bytes
123# define FRAGMENT_SIZE 3 ///< Fragment size is 3 Bytes
124# define MAX_SDU_SIZE 255 ///< SDU Size is 255 Bytes
125#define SCH_DURATION 160000 ///< SCH Duration is 160 milli seconds
126#define SCH_PHY_MODE 2
127#define FCH_PHY_MODE 4
128#define MAX_PHY_MODE 17
129#define DUPLEX_TDD 1
130#define MULTIPLEACCESS_OFDMA 1
131
132unsigned int g_FragmentId;
133
134/** Enumeration for channel set */
135enum enum_802_22_ChannelState
136{
137 ChannelState_DISALLOWED,
138 ChannelState_OPERATING,
139 ChannelState_BACKUP,
140 ChannelState_CANDIDATE,
141 ChannelState_PROTECTED,
142 ChannelState_UNCLASSIFIED,
143};
144/** Enumeration for 802.22 Subevent*/
145enum enum_802_22_SubEvent
146{
147 INCUMBENT_OPERATION_START=MAC_PROTOCOL_IEEE802_22*100+1,
148 INCUMBENT_OPERATION_END,
149 TRANSMIT_SCH,
150 FORM_DS_BURST,
151 TRANSMIT_DS_BURST,
152 FORM_US_BURST,
153 DSA_RSP_TIMEOUT,
154 DSA_RVD_TIMEOUT,
155 TRANSMIT_US_BURST,
156 TRANSMIT_US_BURST_CONTROL,
157 QUIET_PERIOD,
158
159 /* Spectrum Manager subevent
160 * Table 234 IEEE802.22-2011
161 */
162 SM_DBS,
163 SM_SignalDetected,
164 SM_Geolocation,
165 SM_UPDATECHANNEL,
166};
167/** Enumeration for MAC MANAGEMENT MESSAGE
168 Source: IEEE802.22-2011, table 19, page 46-47
169 */
170enum enum_802_22_MAC_Management_Message
171{
172 MMM_DCD=0, /**< Downstream channel descriptor, defines the characteristics of downstream physical channel.
173 Transmitted by BS at periodic interval. */
174 MMM_DS_MAP, ///< Downstream access definition, defines the access to the downstream information.
175 MMM_UCD, /**< Upstream channel descriptor, defines the characteristics of upstream physical channel.
176 Transmitted by BS at periodic interval.*/
177 MMM_US_MAP, ///< Upstream access definition, defines the access to the upstream information.
178 MMM_RNG_REQ, ///< Not implemented
179 MMM_RNG_CMD, ///< Not implemented
180 MMM_REG_REQ, ///< Not implemented
181 MMM_REG_RSP, ///< Not implemented
182 MMM_DSA_REQ, ///< Dynamic service addition request, This message is sent by BS or CPE to create new service request.
183 MMM_DSA_RSP, ///< This message is generated in response to DSA-REQ message.
184 MMM_DSA_ACK, ///< Dynamic service addition acknowledgement
185 MMM_DSC_REQ, ///< Dynamic service change request
186 MMM_DSC_REP, ///< Dynamic service change reply.
187 MMM_DSC_ACK, ///< Dynamic service change Acknowledgement.
188 MMM_DSD_REQ, ///< Dynamic service deletion request
189 MMM_DSD_REP,
190 MMM_DSX_RVD,
191 MMM_MCA_REQ, ///< Not implemented
192 MMM_MCA_RSP, ///< Not implemented
193 MMM_CBC_REQ, ///< Not implemented
194 MMM_CBC_RSP, ///< Not implemented
195 MMM_DREG_CMD, ///< Not implemented
196 MMM_DREG_REQ, ///< Not implemented
197 MMM_ARQFeedback,///< Not implemented
198
199 MMM_ARQ_Discard,///< Not implemented
200
201 MMM_ARQ_Reset, ///< Not implemented
202
203 MMM_CHS_REQ, ///< Channel switch request, Sent by BS in order to switch the entire cell operation to new channel.
204 MMM_CHS_REP,
205
206 MMM_CHQ_REQ, ///< Channel quiet request
207 MMM_CHQ_REP,
208
209 MMM_IPC_UPD, ///< Not implemented
210
211 MMM_BLM_REQ, ///< Bulk measurement request
212 MMM_BLM_RSP,
213
214 MMM_BLM_REP, ///< Bulk measurement report
215 MMM_BLM_ACK,
216
217 MMM_TFTP_CPLT, ///< Not implemented
218
219 MMM_TFTP_RSP, ///< Not implemented
220
221 MMM_SCM_REQ, ///< Not implemented
222
223 MMM_SCM_RSP, ///< Not implemented
224
225 MMM_FRM_UPD, ///< Not implemented
226
227 MMM_CBP_RLY, ///< Not implemented
228
229 /**NOT IN STANDARD. Included here for commonality*/
230 MMM_FCH,
231 MMM_SCH,
232 MMM_BW_REQUEST,
233 MMM_UCS_NOTIFICATION,
234};
235#define CR_CONTROL_PACKET(MMM) MAC_PROTOCOL_IEEE802_22*100+MMM
236
237/** Enumeration for coding rate */
238enum enum_802_22_CodingRate
239{
240 Coding_UNCODED,
241 Coding_1_2_REP4,
242 Coding_1_2_REP3,
243 Coding_1_2_REP2,
244 Coding_1_2,
245 Coding_2_3,
246 Coding_3_4,
247 Coding_5_6,
248};
249
250
251/** Enumeration for Incumbent operational status */
252enum enum_802_22_IncumbentStatus
253{
254 IncumbentStatus_NONOPERATIONAL,
255 IncumbentStatus_OPERATIOAL,
256};
257
258/** Super frame control header structure.
259 Ref: IEEE802.22-2011 Table 1, page 31-34
260 */
262{
263 PNETSIM_MACADDRESS sz_BS_Id; ///< 48 bits, Base station mac address
264 unsigned short int n_FrameAllocationMap; /**<
265 16 bits, Indicates which frame of current superframe
266 is allocated to BS transmitting SCH
267 */
268
269 unsigned int n_SuperframeNumber:8; /**<
270 8 bits, Positive integer that represents the superframe number (modulo 256).
271 This field shall be incremented by 1 upon every new superframe.
272 */
273
274 unsigned int n_CP:2; /**<
275 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
276 2 bits, Cyclic Prefix Factor
277 Specifies the size of the cyclic prefix used by the PHY in the frame
278 transmissions in this superframe. Pre-determined values are
279 00: 1/4 TFFT
280 01: 1/8 TFFT
281 10: 1/16 TFFT
282 11: 1/32 TFFT
283 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
284 */
285
286 unsigned int n_FCH_EncodingFlag:2; /**<
287 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
288 Encoding Flag 2 bit
289 00: FCH packet encoded with PHY mode 5
290 11: FCH packet encoded with PHY mode 4
291 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292 */
293
295 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
296 4 bits
297 0000: no self-coexistence capability supported
298 0001: only Spectrum Etiquette
299 0010: Spectrum Etiquette and Frame Contention
300 0011–1111: Reserved
301 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302 */
303
304 unsigned int n_MAC_version:8; /**<
305 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
306 8 bits IEEE 802.22 MAC version to which the message originator conforms.
307 0x01: IEEE Std 802.22
308 0x02–0xFF: Reserved
309 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
310 */
311
313 8 bits Specified in number of superframes, it indicates the spacing between the
314 superframes for which the intra-frame quiet period specification is valid.
315 For example, if this field is set to 1, the Quiet Period Cycle repeats every
316 superframe; if it is set to 2, the Quiet Period Cycle repeats every 2
317 superframes, etc.
318 If this field is set to 0, no intra-frame quiet period is scheduled or the
319 current intra-frame quiet period is cancelled.
320 */
321
323 8 bits Valid only if Current Intra-frame Quiet period Cycle Length > 0.
324 Specified in number of superframes, it indicates the offset from this SCH
325 transmission to the beginning of the first superframe in the Current Intraframe
326 Quiet period Cycle Length.
327 */
328
330 16 bits Valid only if Current Intra-frame Quiet Period Cycle Length > 0.
331 Valid for each superframe identified by the Current Intra-frame Quiet
332 Period Cycle Length, each bit in the bitmap corresponds to one frame
333 within the superframe. If the bit is set to 0, no intra-frame quiet period
334 shall be scheduled in the corresponding frame. If the bit is set to 1, an
335 intra-frame quiet period shall be scheduled within the corresponding
336 frame for the duration specified by the Current Intra-frame Quiet period
337 Duration.
338 */
339
341 8 bits Valid only if Current Intra-frame Quiet Period Cycle Length > 0.
342 If this field is set to a value different from 0 (zero), it indicates the
343 number of symbols starting from the end of the frame during which no
344 transmission shall take place.
345 */
346
348 8 bits Specified in number of superframes, it indicates the spacing between the
349 superframes for which the intra-frame quiet period specification claimed
350 by a BS would be valid. For example, if this field is set to 1, the Quiet
351 Period Cycle would repeat every superframe; if it is set to 2, the Quiet
352 Period Cycle would repeat every 2 superframes, etc.
353 If this field is set to 0, no intra-frame quiet period is claimed by the BS.
354 */
355
357 8 bits Valid only if Claimed Intra-frame Quiet Period Cycle Length > 0.
358 Specified in number of superframes, it indicates the offset from this SCH
359 transmission to the time where the Claimed Quiet Period Cycle resulting
360 from the inter-BS negotiation (see 2H7.21.2) shall become the Current Intraframe
361 Quiet Period Cycle.
362 */
363
365 16 bits Valid only if Claimed Intra-frame Quiet Period Cycle Length > 0.
366 Valid for each superframes identified by the Claimed Intra-frame Quiet
367 Period Cycle Length, each bit in the bitmap corresponds to one frame
368 within each specified superframe. If the bit is set to 0, no intra-frame
369 quiet period will be scheduled in the corresponding frame. If the bit is set
370 to 1, an intra-frame quiet period will be scheduled within the
371 corresponding frame for the duration specified by Claimed Intra-frame
372 Quiet period Duration.
373 */
374
376 8 bits Valid only if Claimed Intra-frame Quiet Period Cycle Length > 0.
377 If this field is set to a value different from 0 (zero): it indicates the
378 number of symbols starting from the end of the frame during which no
379 transmission will take place.
380 */
381
383 8 bits Valid only if Claimed Intra-frame Quiet Period Cycle Length > 0.
384 This field is used for the purpose of synchronizing the Claimed Intraframe
385 Quiet Period rate among overlapping BSs in order to allow
386 dynamic reduction of the Intra-frame Quiet Period rate. This Quiet Period
387 rate is defined as the number of frames with quiet periods identified by
388 the Cycle Frame Bitmap in the superframes designated by the Cycle
389 Length, divided by this Quiet Period Cycle Length (see 23H7.21.2).
390 */
391
393 8 bits Valid only if Claimed Intra-frame Quiet Period Duration > 0.
394 This field is used for the purpose of synchronizing the Claimed Intraframe
395 Quiet Period Durations among overlapping BSs in order to allow
396 dynamic reduction of the Intra-frame Quiet Period Duration (see 24H7.21.2).
397 */
398
400 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401 4 bits Duration of Quiet Period
402 It indicates the duration of the next scheduled quiet period in number of
403 frames.
404 If this field is set to a value different from 0 (zero), it indicates the
405 number of frames that shall be used to perform in-band inter-frame
406 sensing.
407 If this field is set to 0, no inter-frame quiet period is scheduled or the
408 current inter-frame quiet period is cancelled.
409 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
410 */
411
413 It indicates the time span between the transmission of this information
414 and the next scheduled quiet period for in-band inter-frame sensing.
415 The 8 left most bits (MSB) indicate the superframe number and the 4
416 right most bits (LSB) indicate the frame number when the next scheduled
417 quiet period for inter-frame sensing shall start.
418 */
419
420 unsigned int n_SCW_Cycle_Length:8; /**<
421 8 bits Specified in number of superframes. If this field is set to 0, then no SCW
422 cycle is scheduled. This field has to be 1 or larger to be effective. To
423 limit the number of possibilities, the field shall be one of five following
424 choices {1, 2, 4, 8, 16}. For example, if this field is set to 1, SCW Cycle
425 repeats every superframe, if it is set to 2, SCW Cycle repeats every 2
426 superframes, etc.
427 */
428
429 unsigned int n_SCW_Cycle_Offset:8; /**<
430 8 bits Specified in number of superframes, it indicates the offset from this SCH
431 transmission to the superframe where the SCW cycle starts, or repeats
432 (i.e., the superframe contains SCWs and is specified by the SCW Cycle
433 Frame Bitmap). For example, if this field is set to 0, the SCW cycle starts
434 from the current superframe. The value of the field shall be less than
435 SCW Cycle length unless initial countdown. For initial countdown, this
436 field can equal or be larger than SCW Cycle Length. Larger initial
437 countdown gives neighboring WRANs longer time to discover and avoid
438 any potential SCW reservation collision.
439 */
440
441 unsigned int n_SCW_Cycle_Frame_Bitmap:32; /**<
442 32 bits Valid for a unit of superframe, each 2-bit in the bitmap corresponds to
443 one frame within the superframe. If the 2-bit is set to 00, this means that
444 there is no SCW scheduled for this frame. If the 2-bit is set to 11, a
445 reservation-based SCW (reserved by the current WRAN) is scheduled in
446 the corresponding frame. If the 2-bit is set to 10, a reservation-based
447 SCW has been scheduled by a direct-neighbor WRAN cell in the
448 corresponding frame and needs to be avoided by other WRAN cells
449 receiving this SCH. If the 2-bit is set to 01, a contention-based SCW (that
450 could be shared with other WRANs) is scheduled by the current WRAN
451 cell in the corresponding frame.
452 The number of reservation-based SCWs cannot exceed 2 per WRAN cell
453 per SCW Cycle. At least one contention-based SCW shall be scheduled
454 in one SCW Cycle (code 01). The BSs shall start scheduling their
455 contention-based SCWs from the last frame of the superframe, going
456 backward for multiple contention-based SCWs.
457 This bitmap applies only to the superframes scheduled by the SCW
458 Cycle.
459 NOTE—Quiet period scheduling should be done prior to the SCW
460 scheduling so that SCWs avoid frames already reserved for QP. If SCW
461 conflicts with QP, QP overrides the SCW.
462 */
463
464 unsigned int n_Current_DS_US_Split:6; /**<
465 6 bits Effective start time (in OFDM symbols from the start of the frame
466 including all preambles) of the first symbol of the upstream allocation
467 when a BS-to-BS interference situation has been identified by direct
468 reception of this parameter by a BS from a SCH or a CBP burst
469 transmitted by another BS. The Allocation Start Time as provided in the
470 US-MAP (see 25HTable 34) shall be equal to this value if BS-to-BS
471 interference has been identified. This value shall be set to zero if no BSto-
472 BS interference has been identified (i.e., BS has not received this
473 parameter from another BS). In this case, the Allocation Start Time in the
474 US-MAP (see 26HTable 34) can be defined independently on a frame-byframe
475 basis by the respective BSs based on their traffic requirement.
476 */
477
478 unsigned int n_Claimed_US_DS_Split:6; /**<
479 6 bits Specified by each BS in the case of BS-to-BS interference (i.e., when
480 SCH and/or CBP burst can be received by a BS directly from another
481 BS) indicating the required DS/US split based in the traffic requirement
482 of the transmitting BS and the negotiation process between the BSs (see
483 27H7.20.3). This value shall be set to zero if no BS-to-BS interference has
484 been identified.
485 */
486
487 unsigned int n_DS_US_Change_Offset:12; /**<
488 12 bits It indicates the time span between the transmission of this information
489 and the next scheduled change of the DS/US split where the “Claimed
490 DS/US split” value will become the “Current DS/US split” value. The 8
491 left most bits (MSB) indicate the superframe number and the 4 right most
492 bits (LSB) indicate the frame number when the next DS/US split change
493 shall take place. The value of this parameter is determined by the
494 negotiation process between concerned BSs (see 28H7.20.3). This value shall
495 be set to zero if no BS-to-BS interference has been identified.
496 */
497
499 32 bits In the case where the BS is informed by the database service that it can
500 continue operating on the current channel even though its CPEs are
501 repetitively reporting an incumbent detection situation (i.e., on N or
502 N±1), the BS can use this parameter to inhibit such reporting by the CPEs
503 for a specified period of time. This will avoid the CPEs flooding the
504 upstream subframe with unnecessary incumbent detection reports.
505 Bit 0–4: Signal type (see 29HTable 237)
506 Bit 5–31: Inhibit Period (number of frames)
507 */
508
509 unsigned int n_HCS:8; ///< 8 bits Header Check Sequence
510
511 unsigned int n_Padding_bits; /**<
512 56 bits Padding bits to fill the rest of the 360 bits of the SCH symbol. All bits
513 shall be set to 0.
514 */
515};
516
517
518/** Frame control header structure.
519 Ref: IEEE802.22-2011 Table 2, page 34
520 */
522{
523 unsigned int n_Length_of_the_frame:6; /**<
524 6 bits Indicates the length of the frame in number
525 of OFDM symbols from the start of the frame including all preambles. */
526
527 unsigned int n_Length_of_the_MAP_message:10; /**<
528 10 bits This field specifies the length of the MAP
529 information element following the FCH in
530 OFDM slots. A length of 0 (zero) indicates
531 the absence of any burst in the frame.
532 */
533
534 unsigned int n_HCS:8; ///< 8 bits Header Check Sequence
535};
536
537/** Generic MAC header structure.
538 Ref: IEEE802.22-2011 Table 3, page 36
539 */
541{
542
543 unsigned int n_Length:11; /**<
544 11 bits The length in bytes of the MAC PDU including the MAC
545 header and the CRC. Any length smaller than 4 bytes shall be
546 reserved for future use and the data shall be discarded by
547 receivers only able to comply with this standard release.
548 */
549
550 unsigned int n_UCS:1; /**<
551 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
552 1 bit Urgent Coexistence Situation
553 Used by the CPE to alert the BS about an UCS with
554 incumbents in the channel currently being used by the BS or
555 either of its adjacent channels:
556 0: no incumbent (default)
557 1: incumbent detected
558 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
559 */
560
561 unsigned int n_QPA:1; /**<
562 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
563 1 bit Quiet Period Adjustment sent by the CPE when it is missing
564 QP opportunities to complete its in-band sensing within the
565 required in-band detection time (see 245H10.3.3):
566 0: no adjustment needed (default)
567 1: increase of the number of quiet periods is needed
568 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
569 */
570
571 unsigned int n_EC:1; /**<
572 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
573 1 bit Encryption control:
574 0: payload is not encrypted
575 1: payload is encrypted
576 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
577 */
578
579 unsigned int n_EKS:2; /**<
580 2 bits Encryption key sequence
581 The index of the traffic encryption key (TEK) and
582 initialization vector used to encrypt the payload. This field is
583 only meaningful if the EC field is set to 1. When transitioning
584 to newer TEK/GTEK (see 246H8.3.1.4 and 247H8.3.1.5), EKS is
585 incremented +1 (modulo 4).
586 */
587
588 char sz_Type[6]; /**< 5 bits Indicates the subheaders and special payload types present in the message payload.*/
589
590 unsigned int n_FID:3; ///< 3 bits Flow ID
591
592 unsigned int n_HCS:8; /**<
593 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
594 8 bits Header check sequence
595 The transmitter shall calculate the HCS value for the content
596 of the header excluding the HCS field, and insert the result
597 into the HCS field which is the last byte of the header). It
598 shall be the remainder of the division (Modulo 2) by the
599 generator polynomial g(D = D8 + D2 + D + 1) of the
600 polynomial D8 multiplied by the content of the header
601 excluding the HCS field. (Example: [Length=0x447, UCS=0,QPA=0, EC=1, EKS=01, Type=11001, FID=010;
602 the resulting GMH=0x88E5CB and the HCS calculated over it = 0x27]).
603 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
604 */
605 void* subheader[5]; ///< Subheader
606};
607/** Structure for fragment sub header */
609{
610 unsigned int purpos:1;
611 unsigned int FC:2;
612 unsigned int FSN:10;
613 unsigned int length:11;
614 unsigned int nFragmentId; //NetSim Variable to keep track of fragment
615};
616/** Structure for up link allocation information. */
618{
619 unsigned int nSID;
620 unsigned int nSlotRequested;
621 unsigned int nSlotAllocated;
622 SERVICE_TYPE nQoS;
624};
625/** CR_BS Metrics structure */
627{
628 NETSIM_ID nBSID;
629 unsigned int nSCHSent;
630 unsigned int nFCHSent;
631 unsigned int nDSA_REQReceived;
632 unsigned int nDSA_REPSent;
633 unsigned int nDSD_REQReceived;
634 unsigned int nDSC_REQReceived;
635 unsigned int nDSC_REPSent;
636 unsigned int nDSD_REPSent;
637 unsigned int nCHS_REQSent;
638};
639/// Incumbent Metrics
641{
642 unsigned int nOperationTime;
643 unsigned int nIdleTime;
644 unsigned int nInterferenceTime;
645 unsigned int nPrevTime;
646 double dInterferenceStartTime;
647};
648/// Channel Metrics
650{
651 unsigned int nChannelNumber;
652 char* szFrequency;
653 double dEfficiency;
654 double dUsage;
655};
656/// CPE Metrics
658{
659 NETSIM_ID nCPEID;
660 unsigned int nSCHReceived;
661 unsigned int nFCHReceived;
662 unsigned int nDSA_REQSent;
663 unsigned int nDSC_REQSent;
664 unsigned int nDSD_REQSent;
665 unsigned int nDSA_REPReceived;
666 unsigned int nDSC_REPReceived;
667 unsigned int nDSD_REPReceived;
668 unsigned int nCHS_REQReceived;
669 unsigned int nUCSSent;
670};
671
672/** Base station structure for 802.22 MAC */
674{
675 int nDuplexMode;
676 bool nSelfCoexitenceFlag;
677 int nDSXRequestRetries; ///< 3 fixed
678 int nDSXResponseReties; ///< 3 fixed
679 double T7; ///< Wait for DSA/DSC/DSD Response timeout. Max 1 sec
680 double T8; ///< Wait for DSA/DSC Acknowledge timeout. Max 300 ms
681 double T31; ///! Wait for BLM-REP timeout. >= 1MAC frame
683 The time during which a channel SHALL be
684 checked for the presence of licensed incumbent
685 signals having a level above the Incumbent
686 Detection Threshold prior to the commencement
687 of WRAN operation in that channel, and in the
688 case of TV, a related channel at an EIRP level
689 that can affect the measured channel
690 Default- 30 sec
691 */
692
694 The required period during which WRAN
695 device transmissions SHALL NOT occur in a
696 given channel because of the detected presence
697 of an incumbent signal in that channel above the
698 Incumbent Detection Threshold or, in the case
699 of TV, above a given EIRP level.
700 Min - 10 min
701 */
702
704 The maximum time taken by a WRAN device to
705 detect a licensed incumbent signal above the
706 Incumbent Detection Threshold within a given
707 channel during normal WRAN operation.
708 Default - 2 sec
709 */
710
712 In sensing modes 0 and 1 this value specifies the
713 maximum probability of false alarm for each
714 sensing mode decision in the signal present array
715 Range - 0.0 to 0.255
716 */
717
719 The time taken by a WRAN system to cease all
720 interfering transmissions on the current channel
721 upon detection of a licensed incumbent signal
722 above the relevant Incumbent Detection
723 Threshold or, in the case TV, to alternatively
724 reduce its EIRP to that which is allowable
725 within a given channel upon detection of a TV
726 signal in the same or a related channel
727 Default - 2 sec
728 */
729
731 Number of sensing periods field in a Sensing
732 Window Specification Array entry
733 Range 0-127
734 Default - 1
735 */
736
738 Duration of sensing period field (in units of
739 OFDM symbols) in a Sensing Window
740 Specification Array entry
741 Range 0-1023
742 Default - 16
743 */
744
746 Periodicity of Sensing period field in a Sensing
747 Window Specification Array entry
748 Range 0-2047
749 Default 200
750 */
751
752 int nSensingMode; /**<
753 The sensing mode a CPE supports. Negotiated
754 during CPE initialization.
755 Default - No sensing
756 */
757
759 Maximum time interval allowed before sensing
760 is performed on the candidate channel to ensure
761 that no incumbents are detected.
762 Range 1-10 sec
763 Default 6 sec
764 */
765
767 Maximum time interval allowed before sensing
768 is performed on the backup channel to ensure
769 that no incumbents are detected.
770 Range 1-10 sec
771 Default 6 sec
772 */
773
775 Minimum time duration without detection of
776 any incumbent for a candidate channel to
777 transition to the backup channel.
778 Range 1-100 sec
779 Default 30 sec
780 */
781
783 Waiting time before which the BS moves to the
784 first backup channel. This is used to make sure
785 that all the CPEs are ready to move to the
786 backup channel before BS switches operation to
787 this backup channel.
788 Range 1-256*16 frames
789 */
790
791 char szISOCountryCode[4]; /**<
792 3 character, ASCII string denoteing the
793 regulatory domain of operation (e.g., “USA” is
794 for United States of America)
795 */
796 NETSIM_ID nIncumbentCount;
797 INCUMBENT** pstruIncumbent;
798 unsigned int nDSBurst; ///< Current DS burst
799 DS_BURST** pstruDSBurst; ///< DS-Burst each is one symbol long
800 DSMAP* pstruDSMAP;
801 USMAP* pstruUSMAP;
802 int *anSIDFromDevId; ///< Have the list of CPE associated with BS. If SID is set CPE is associated else not
803 UCD* pstruUCD;
804 DCD* pstruDCD;
805 double dSuperframeStartTime;
806 double dDSFrameTime;
807 double dFrameStartTime;
808 struct stru_802_22_UplinkAlloctioninfo* uplinkAllocInfo;
809 unsigned int nUIUC;
810 unsigned int nDIUC;
811 NetSim_PACKET* pstruFragmentPacketList;
812 NetSim_PACKET* pstruBroadcastPDU;
813 FLAG nCHSREQFlag;
814 int chsFrameCount;
815 BS_METRICS struBSMetrics;
816 NetSim_PACKET* pstruDSPacketList;
817};
819{
820 unsigned int nSlotCount;
821 unsigned int nUnfilledSlot;
822 NetSim_PACKET* pstruMACPDU;
823};
824
825/** Base structure for 802.22 Phy */
827{
828 unsigned int nSuperframeNumber:8; ///< Current super frame number
829 unsigned int nFrameNumber; ///< Current super frame number
830 unsigned int nMAXFrequency; ///< Maximum frequency <=862 MHz
831 unsigned int nMINFrequency; ///! Minimum frequency >=54 MHz
832 unsigned int nChannelBandwidth; ///< 6,7,8 MHz
833 double dSamplingFactor;
834 PHY_MODULATION nModulation;
835 CODING_RATE nCodingRate;
836 int nMultipleAccess;
837 int nFFT;
838 unsigned int nCP:2;
839 struct stru_802_22_Channel* pstruChannelSet; ///< Channel set where BS can operate
840 struct stru_802_22_Channel* pstruOpratingChannel; ///< Currently operating channel
841 int nPhyMode;
842 double dTXPower;
843 double dAntennaHeight;
844 double dAntennaGain;
845 int nSelfCoexitenceCapability;
846 double dDCDInterval; ///< Time between transmission of DCD messages. Max 10 sec
847 double dUCDInterval;
848 int nBWRequestBackoffStart; ///< Initial size of BW Request opportunity used by CPEs to contend to send BW requests to BS. Range 0-15
849 int nBWRequestBackoffEnd; ///< Final size of BW Request opportunity used by CPEs to contend to send BW requests to BS. Range 1-15
850 double dUpstreamChannelChangeResponseWaitTime;
851 double dTTG; ///< Transmit Transition Gap. 105-333 micro sec. default 210 µs
852 double dRTG; ///<Receive Transition Gap
853 double dDlUlRatio;
854 SYMBOL_PARAMETER* pstruSymbolParameter;
855 unsigned int nIntraFrameQuietPeriodCycleLength;
856 char szIntraframeQuietPeiordBitmap[17];
857 unsigned int nIntraFrameQuietPeriodDuration;
858 unsigned int nIFQPOffset;
859};
861{
862 USMAP_IE* pstruUSMAPIE;
863 double dBytesRequested;
864 double dBytesAllocated;
865 double dStartTime;
866};
867/// CPE structure for IEEE 802.22 MAC
869{
870 NETSIM_ID nBSID;
871 NETSIM_ID nBSInterface;
872 /// Unique station idetifier
873 unsigned int nSID:9;
874 /// 3 fixed
876 /// 3 fixed
878 /// Wait for DSA/DSC/DSD Response timeout. Max 1 sec
879 double T7;
880 /// Wait for DSA/DSC Acknowledge timeout. Max 300 ms
881 double T8;
882 /// Wait for DSx-RSP/DSX-RVD Timeout. Max 200 ms
883 double T14;
884 /// Wait for bandwidth request grant. Min 10 ms
885 double T16;
886 /// Wait for BLM-ACK timeout. Range 10-300 ms
887 double T29;
888 /// Number of retries allowed for sending BLMREP. Default 3
890 struct stru_802_22_CPE_BWRequestInfo *BWRequestInfo;
891 NetSim_PACKET* pstruQueuedPacketList[MAX_FID];
892 CR_SERVICE* pstruServiceParameter;
893 NetSim_PACKET* pstruUSBurst;
894 NetSim_PACKET* pstruFragmentPacketList;
895 char szCountryCode[4];
896 unsigned int nMaxProbabilityofFalseAlarm;
897 CPE_METRICS struCPEMetrics;
898};
899
900/// CPE structure for CPE PHY.
902{
903 /// Time the CPE searches for preambles on a given channel
904 double T20;
905 /// Initial size of BW Request opportunity used by CPEs to contend to send BW requests to BS. Range 0-15
907 /// Final size of BW Request opportunity used by CPEs to contend to send BW requests to BS. Range 1-15
909 /// Same parameter as BS have
910 SYMBOL_PARAMETER* pstruSymbol;
911 unsigned int nIntraFrameQuietPeriodLength;
912 char szIntraFrameQuietPeriodBitmap[17];
913 unsigned int nIntraFrameQuietPeriodDuration;
914 unsigned int nFrameNumber;
915 double dTXPower;
916 double dAntennaHeight;
917 double dAntennaGain;
918 struct stru_802_22_Channel* pstruOperatingChannel;
919 struct stru_802_22_Channel* pstruChannelSet;
920};
921/** Channel structure */
923{
924 unsigned int nChannelNumber;
925 double dUpperFrequency;
926 double dLowerFrequency;
927 double dChannelBandwidth;
928 CHANNEL_STATE nChannelState;
929 CHANNEL_METRICES struChannelMetrics;
930 struct stru_802_22_Channel* pstruNextChannel;
931};
932
933/** Structure for IEEE 802.22 phy mode */
935{
936 unsigned int n_PhyMode;
937 MODULATION_TECHNIQUE n_Modulation;
938 CODING_RATE n_CodingRate;
939 double dDataRate; //In mbps
940 double dSpectralEfficency;
941};
942extern struct stru_802_22_Phy_Mode struPhyMode[MAX_PHY_MODE];
943
944/** Structure for symbol parameter
945 Ref:IEEE802.22-2011, table 199,200,201, page 309-310
946 */
948{
949 // Sub carrier
950 /// Channel Bandwidth in MHz
952 double dSamplingFactor;
953 /// Sampling Frequency Fs (in MHz)
955 /// Inter carrier spacing ^f (Hz) = Fs/2048 Hz
957 /// Sub carrier spacing Tfft (micro sec) = 1/^f
959 /// Time Unit TU = Tfft/2048
960 double dTimeUnit;
961 /// Symbol duration
962 int nCP;
963 /// Tcp In micro sec
964 double dCPDuration;
965 /// Tsym = Tfft + Tcp in µs
967
968 /// Transmission Parameter
969 /// Sub carrier count Nfft = 2048
971 /// Guard Sub-carrier count Ng = 368
973 /// Used Sub-carrier count Nt = 1680
975 /// Data Sub-carrier count Nd = 1440
977 /// Pilot Sub-carrier count Np = 240
979
980 int nSubChannelCount;
981 /// OFDM Slot = 1 symbol * 1 subChannel
983 int nBitsCountInOneSlot;
984 /// Data subCarrier count*Bits based on modulation * coding rate
986 /// Number of uncoded bits/OFDM symbol duration
987 double dDataRate;
988 unsigned int nUPlinkSymbol;
989 unsigned int nDownLinkSymbol;
990 unsigned int nUPlinkFrameStartSymbol;
991};
992
993/** Structure for WRAN frame parameter
994 Ref: IEEE802.22-2011, table 203, page 313,
995 */
997{
998 /// Channel Bandwidth in MHz
1000 double dCP;
1001 int nSymbolsPerFrame;
1002 /// Transmitter-receiver turnaround gap. in TU
1003 int nTTG;
1004 /// Receiver_transmitter turnaround gap. in TU
1005 int nRTG;
1006};
1007/// Structure for incumbent
1009{
1010 int nId;
1011 int nStartFrequeny;
1012 int nEndFrequency;
1013 int nOperationalTime;
1014 int nOperationalIntervalTime;
1015 DISTRIBUTION nOperationalDistribution;
1016 INCUMBENT_STATUS nIncumbentStatus;
1017 double dPrevOperationalTime;
1018 double dPrevOperationalInterval;
1019 double dKeepOutDistance;
1020 NetSim_COORDINATES* position;
1021 INCUMBENT_METRICS struIncumbentMetrics;
1022};
1023
1024
1025
1026/** Table 26 IEEE 802.22-2011 page 50
1027 DS-MAP Information Element
1028 */
1030{
1031 unsigned int DIUC:6;
1032 unsigned int SID:9;
1033 unsigned int length:12;
1034 unsigned int boosting:3;
1035};
1036/** Table 25 IEEE 802.22-2011 page 49
1037 DS-MAP Message Format
1038 */
1040{
1041 unsigned int nManagementMessageType:8;
1042 unsigned int nDCDCount:8;
1043 unsigned int nIECount;
1044 struct stru_802_22_DSMAP_IE** pstruIE;
1045 unsigned int nPaddingBits:7;
1046};
1047
1048/** Table 31 IEEE 802.22-2011 page 53
1049 UCD Channel Information Element
1050 */
1052{
1053 unsigned int nUpstreamBurstProfile;
1054 unsigned int nContentionBasedReservationTimeOut;
1055 unsigned int nBWRequestOpportunitySize;
1056 unsigned int nUCSNotificationRequestOpportunitySize;
1057 unsigned int nInitialRangingCode;
1058 unsigned int nPeriodicRangingCode;
1059 unsigned int nBandwidthRequestCode;
1060 unsigned int nUCSNotificationRequestCode;
1061 unsigned int nStartOfCDMACodeGroups;
1062};
1063/** Table 30 IEEE 802.22-2011 page 52
1064 UCD Message Format
1065 */
1067{
1068 unsigned int nManagementMessageType:8;
1069 unsigned int nConfigurationChangeCount:8;
1070 unsigned int nBWRequestBackoffStart:4;
1071 unsigned int nBWRequestBackoffEnd:4;
1072 unsigned int nUCSNotificationBackoffStart:4;
1073 unsigned int nUCSNotificationBackoffEnd:4;
1074 UCD_IE struUCDIE;
1075 unsigned int nUpstreamBurstProfileCount:6;
1076 struct stru_802_22_Upstream_Burst_profile_Format** pstruUPStreamBurstProfile;
1077};
1078
1079/** Table 33 IEEE 802.22-2011 Page 54
1080 Upstream burst profile information element
1081 */
1083{
1084 unsigned int nRangingDataRatio;
1085 unsigned int nNormalizedCNROverride;
1086};
1087
1088/** Table 32 IEEE 802.22-2011 Page 53
1089 Upstream Burst profile format
1090 */
1092{
1093 unsigned int nType:8;
1094 unsigned int nLength:8;
1095 unsigned int nUUIC:6;
1096 unsigned int nReserved:2;
1097 struct stru_802_22_Upstream_Burst_profile_IE pstruUBPIE;
1098};
1099
1100/** Table 21 IEEE 802.22-2011 Page 48
1101 DCD Channel Information Element
1102 */
1104{
1105 unsigned int nDownStreamBurstProfile;
1106 unsigned int EIRP:8;
1107 unsigned int TTG:8;
1108 unsigned int RSS:8;
1109 unsigned int nChannelAction:3;
1110 unsigned int nActionMode:1;
1111 unsigned int nActionSuperframeNumber:8;
1112 unsigned int nActionFrameNumber:4;
1113 unsigned int nBackupChannelCount:4;
1115 {
1116 unsigned int nElementId:8;
1117 unsigned int nLength:8;
1118 unsigned int nChannelCount:8;
1119 unsigned int* nChannelNumber;
1120 }struBackupChannelList;
1121 unsigned int nMACVersion:8;
1122};
1123/** Table 20 IEEE 802.22-2011 page 47
1124 DCD Message Format
1125 */
1127{
1128 unsigned int nManagementMessageType:8;
1129 unsigned int nConfigurationChangeCount:8;
1130 struct stru_802_22_DCD_Channel_Information_Element pstruDCDChannelIE;
1131 unsigned int nDownStreamBurstProfileCount;
1132 DBPF** pstruDBPF;
1133};
1135{
1136 unsigned int nType:8;
1137 unsigned int nLength:8;
1138 unsigned int nDIUC:6;
1139 unsigned int nReserved:2;
1141 {
1142 unsigned int nDIUCManadatoryExitThershold:8;
1143 unsigned int nDIUCMinimumEntruThershold:8;
1144 }struDBPIE;
1145};
1146
1147/** Table 34 IEEE802.22-2011 Page 53
1148 US-MAP Message format
1149 */
1151{
1152 MANAGEMENT_MESSAGE nManagementMessageType;
1153 unsigned int nUCDCount:8;
1154 unsigned int nAllocationStartTime:6;
1155 unsigned int nIECount:12;
1156 struct stru_802_22_USMAPIE** pstruUSMAPIE;
1157};
1158/** Table 35 IEEE802.22-2011 Page 55
1159 US-MAP Information Element
1160 */
1162{
1163 unsigned int nSID:9;
1164 unsigned int nUIUC:6;
1165
1167 {
1168 unsigned int nCBPFrameNumber:4;
1170 {
1171 unsigned int nTimingAdvance:16;
1172 unsigned int nEIRPDensityLevel:8;
1173 }UIUC_0;
1175 {
1176 unsigned int nChannelNumber:8;
1177 unsigned int nSynchronizationMode:1;
1178 }UIUC_1;
1179 }UIUC_0_1;
1181 {
1182 unsigned int nSubChannelCount:4;
1183 }UIUC_2_3;
1185 {
1186 unsigned int nSubChannelCount:4;
1187 unsigned int nSubSymbolsCount:4;
1188 }UIUC_4_6;
1190 {
1191 void* CDMA_Allocation_IE;
1192 }UIUC_7;
1194 {
1195 unsigned int nSubChannelCount:4;
1196 }UIUC_8;
1198 {
1199 void* USMAP_EIRP_Control_IE;
1200 }UIUC_9;
1202 {
1203 void* US_extended_IE;
1204 }UIUC_62;
1206 {
1207 unsigned int nBurstType:1;
1208 unsigned int nDuration:12;
1209 unsigned int nMDP:1;
1210 unsigned int nMRT:1;
1211 unsigned int nCMRP:1;
1212 }UIUC;
1213};
1214
1215/** Table 5, IEEE802.22-2011 page 37
1216 Bandwidth request sub header
1217 */
1219{
1220 unsigned int nType:1;
1221 unsigned int nBR:20;
1222};
1223
1224PROPAGATION_HANDLE propagationHandle;
1225//Propagation macro
1226#define GET_RX_POWER_dbm(tx, rx) (propagation_get_received_power_dbm(propagationHandle, tx, 1, rx, 1, pstruEventDetails->dEventTime))
1227#define GET_RX_POWER_mw(tx,rx) (DBM_TO_MW(GET_RX_POWER_dbm(tx,rx)))
1228
1229
1230//Function definition
1231_declspec(dllexport) int fn_NetSim_CR_CopyPacket_F(const NetSim_PACKET* pstruDestPacket,const NetSim_PACKET* pstruSrcPacket);
1232int fn_NetSim_CR_TransmitP2PPacket(NetSim_PACKET* pstruPacket,NETSIM_ID nDevId,NETSIM_ID nInterface);
1233_declspec(dllexport) int fn_NetSim_CR_Configure_F(void** var);
1234_declspec(dllexport) int fn_NetSim_CR_Init_F(struct stru_NetSim_Network *NETWORK_Formal,\
1235 NetSim_EVENTDETAILS *pstruEventDetails_Formal,char *pszAppPath_Formal,\
1236 char *pszWritePath_Formal,int nVersion_Type,void **fnPointer);
1237_declspec(dllexport) int fn_NetSim_CR_FreePacket_F(const NetSim_PACKET* pstruPacket);
1238int fn_NetSim_CR_Metrics_F(PMETRICSWRITER metricsWriter);
1239_declspec(dllexport) int fn_NetSim_CR_Finish_F();
1240int fn_NetSim_CR_PacketArrive();
1241int fn_NetSim_CR_GetFID(QUALITY_OF_SERVICE nQOS);
1242QUALITY_OF_SERVICE fnGetQOS(char* Qos);
1243int fn_NetSim_CR_AllocBandwidth(NETSIM_ID nSID,QUALITY_OF_SERVICE nQos,UPLINKALLOCINFO** ppstruInfo,unsigned int nSlotRequired,unsigned int nTotalSlot);
1244int fn_NetSim_Check_Interference(unsigned int nChannelNumber,
1245struct stru_802_22_Channel* pstruChannelList,
1246 unsigned int nLowerFrequency,
1247 unsigned int nHigherFrequency);
1248int fn_NetSim_CR_UpdateInfo(BS_MAC* pstruBSMAC,BS_PHY* pstruBSPHY);
1249int fn_NetSim_AddPacketToList(NetSim_PACKET** list,NetSim_PACKET* packet);
1250long long int fn_NetSim_CR_TransmitPacket(NetSim_PACKET* pstruPacket, int nDevId, int nInterfaceId, int nConDevId,int nConInterface);
1251double fn_NetSim_CR_CalculateTransmissionTime(double dPacketSize,SYMBOL_PARAMETER* pstruSymbolParameter);
1252_declspec(dllexport) char* fn_NetSim_CR_Trace_F(int nSubEvent);
1253int fn_NetSim_CR_InitIncumbent(BS_MAC* pstruBSMAC, NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
1254int fn_NetSim_CR_IniScanChannel(BS_MAC* pstruBSMAC,BS_PHY* pstruBSPhy);
1255int fn_NetSim_CR_UpdateOperatingChannel(BS_PHY* pstruBSPhy);
1256int fn_NetSim_CR_StartSCH(int nBTSId,int nInterfaceId);
1257int fnIsinRange(double l1, double u1, double l2, double u2);
1258int fn_NetSim_CR_ConfigIncumbent(void* xmlNetSimNode,BS_MAC* pstruBSMAC);
1259int fn_NetSim_CR_BroadCastPacket(NetSim_PACKET* pstruPacket,NETSIM_ID nDevId,NETSIM_ID nInterface);
1260int fn_NetSim_CR_MulticastPacket(NetSim_PACKET* pstruPacket, NETSIM_ID nDevId, NETSIM_ID nInterface);
1261NetSim_PACKET* fn_NetSim_CR_GenerateBroadcastCtrlPacket(int nDeviceId,int nInterfaceId,MANAGEMENT_MESSAGE nMessageType);
1262int fn_NetSim_CR_FillDSFrame(unsigned int size/*Bytes*/,DS_BURST** pstruDSBurst,SYMBOL_PARAMETER* pstruSymbolParameter,int nFlag,unsigned int* nSlotRequire);
1263int fn_NetSim_CR_AddPacketToDSBurst(DS_BURST* pstruDSBurst,NetSim_PACKET* pstruPacket);
1264NetSim_PACKET* fn_NetSim_CR_UNFillSlot(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, unsigned int nBurstId);
1265int fn_NetSim_CR_UpdateIncumbentMetrics(BS_MAC* pstruBSMAC,BS_PHY* pstruBSPHY,double dTime);
1266
1267//802_22 dll function
1268int fn_NetSim_CR_BS_MACIN();
1269int fn_NetSim_CR_CPE_PhysicalOut();
1270_declspec(dllexport) char* fn_NetSim_CR_Trace(int nSubEvent);
1271int fn_NetSim_CR_BS_AllocateBandwidth();
1272int fn_NetSim_CR_ScanChannel(BS_MAC* pstruBSMAC,BS_PHY* pstruBSPhy);
1273int fn_NetSim_CR_FormUSBurst();
1274int fn_NetSim_CR_FormChannelSet(BS_PHY* pstruBSPhy);
1275int fn_NetSim_Init_OFDMA(BS_PHY* pstruBSPhy);
1276int fn_NetSim_CR_SSA_Initialization(BS_MAC* pstruBSMAC,BS_PHY* pstruBSPHY);
1277int fn_NetSim_CR_AssociateCPE(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
1278int fn_NetSim_CR_FragmentPacket(NetSim_PACKET* pstruPacket,double dSDUSize);
1279int fn_NetSim_CR_CreateServiceFlow(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId,int nId,NetSim_PACKET* packet,double dTime);
1280int fn_NetSim_CR_IncumbentStart();
1281int fn_NetSim_CR_IncumbentEnd();
1282int fn_NetSim_CR_TransmitSCH();
1283int fn_NetSim_CR_TransmitFCH();
1284int fn_NetSim_CR_TransmitDSBurst();
1285int fn_NetSim_CR_TransmitUSBurst();
1286int fn_NetSim_CR_QuietPeriod();
1287int fn_NetSim_CR_UpdateChannel();
1288int fn_NetSim_CR_CPE_ProcessSCH(NetSim_PACKET* pstruPacket);
1289int fn_NetSim_CR_CPE_ProcessFCH(NetSim_PACKET* pstruPacket);
1290int fn_NetSim_CR_CPE_ProcessDSMAP();
1291int fn_NetSim_CR_CPE_ProcessUSMAP();
1292int fn_NetSim_CR_CPE_ProcessDSA_RSP();
1293int fn_NetSim_CR_CPE_ProcessDSD_REP();
1294int fn_NetSim_CR_CPE_SwitchChannel();
1295int fn_NetSim_CR_CPE_PackPacket();
1296int fn_NetSim_CR_BS_ForwardDataPacket();
1297int fn_NetSim_CR_BS_ProcessDSAReq();
1298int fn_NetSim_CR_BS_ProcessDSDReq();
1299int fn_NetSim_CR_BS_UCS();
1300NetSim_PACKET* fn_NetSim_CR_FormDSMAP(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId);
1301NetSim_PACKET* fn_NetSim_CR_FormUSMAP(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId);
1302NetSim_PACKET* fn_NetSim_CR_FormUCD(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
1303NetSim_PACKET* fn_NetSim_CR_FormDCD(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
1304int fn_NetSim_CR_FormDSFrame(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId,double dTime);
1305NetSim_PACKET* fn_NetSim_CR_BS_PackPacket(BS_MAC* pstruBSMac,NetSim_PACKET* pstruPacket);
1306int fn_Netsim_CR_SM_ScheduleQuietPeriod(BS_PHY* pstruBSPhy,SCH* pstruSCH);
1307struct stru_802_22_SSFOutput* fn_NetSim_CR_CPE_SSF(struct stru_802_22_SSFInput* input,NETSIM_ID nDevId,NETSIM_ID nInterfaceId);
1308int fn_NetSim_TerminateServiceFlow(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NetSim_PACKET* pstruPacket);
1309int fn_NetSim_CR_CalulateReceivedPower();
1310#include "DSx.h"
1311#endif
1312
int nDSXRequestRetries
3 fixed
Definition 802_22.h:677
int nDSXResponseReties
3 fixed
Definition 802_22.h:678
int nCandidateChannelRefreshTime
Definition 802_22.h:758
char szISOCountryCode[4]
Definition 802_22.h:791
unsigned int nDSBurst
Current DS burst.
Definition 802_22.h:798
int nBackupChannelRefreshTime
Definition 802_22.h:766
double dChannelAvailabilityCheckTime
! Wait for BLM-REP timeout. >= 1MAC frame
Definition 802_22.h:682
int nCandidateChannelTransitionTime
Definition 802_22.h:774
int * anSIDFromDevId
Have the list of CPE associated with BS. If SID is set CPE is associated else not.
Definition 802_22.h:802
double T8
Wait for DSA/DSC Acknowledge timeout. Max 300 ms.
Definition 802_22.h:680
DS_BURST ** pstruDSBurst
DS-Burst each is one symbol long.
Definition 802_22.h:799
double dSensingPeriodDuration
Definition 802_22.h:737
int nFalseAlramProbability
Definition 802_22.h:711
int nNonOccupancyPeriod
Definition 802_22.h:693
double dSensingPeriodInterval
Definition 802_22.h:745
int nWaitBeforeChannelMove
Definition 802_22.h:782
double T7
Wait for DSA/DSC/DSD Response timeout. Max 1 sec.
Definition 802_22.h:679
int nChannelDetectionTime
Definition 802_22.h:703
double dTTG
Transmit Transition Gap. 105-333 micro sec. default 210 µs.
Definition 802_22.h:851
unsigned int nSuperframeNumber
Current super frame number.
Definition 802_22.h:828
unsigned int nFrameNumber
Current super frame number.
Definition 802_22.h:829
double dRTG
Receive Transition Gap.
Definition 802_22.h:852
int nBWRequestBackoffEnd
Final size of BW Request opportunity used by CPEs to contend to send BW requests to BS....
Definition 802_22.h:849
struct stru_802_22_Channel * pstruOpratingChannel
Currently operating channel.
Definition 802_22.h:840
int nBWRequestBackoffStart
Initial size of BW Request opportunity used by CPEs to contend to send BW requests to BS....
Definition 802_22.h:848
unsigned int nMAXFrequency
Maximum frequency <=862 MHz.
Definition 802_22.h:830
struct stru_802_22_Channel * pstruChannelSet
Channel set where BS can operate.
Definition 802_22.h:839
double dDCDInterval
Time between transmission of DCD messages. Max 10 sec.
Definition 802_22.h:846
unsigned int nChannelBandwidth
! Minimum frequency >=54 MHz
Definition 802_22.h:832
CPE structure for IEEE 802.22 MAC.
Definition 802_22.h:869
double T7
Wait for DSA/DSC/DSD Response timeout. Max 1 sec.
Definition 802_22.h:879
int nDSXResponseReties
3 fixed
Definition 802_22.h:877
int nDSXRequestRetries
3 fixed
Definition 802_22.h:875
int nBLM_REPRetries
Number of retries allowed for sending BLMREP. Default 3.
Definition 802_22.h:889
double T16
Wait for bandwidth request grant. Min 10 ms.
Definition 802_22.h:885
double T8
Wait for DSA/DSC Acknowledge timeout. Max 300 ms.
Definition 802_22.h:881
unsigned int nSID
Unique station idetifier.
Definition 802_22.h:873
double T29
Wait for BLM-ACK timeout. Range 10-300 ms.
Definition 802_22.h:887
double T14
Wait for DSx-RSP/DSX-RVD Timeout. Max 200 ms.
Definition 802_22.h:883
CPE structure for CPE PHY.
Definition 802_22.h:902
SYMBOL_PARAMETER * pstruSymbol
Same parameter as BS have.
Definition 802_22.h:910
double T20
Time the CPE searches for preambles on a given channel.
Definition 802_22.h:904
int nBWRequestBackoffStart
Initial size of BW Request opportunity used by CPEs to contend to send BW requests to BS....
Definition 802_22.h:906
int nBWRequestBackoffEnd
Final size of BW Request opportunity used by CPEs to contend to send BW requests to BS....
Definition 802_22.h:908
unsigned int n_Length_of_the_frame
Definition 802_22.h:523
unsigned int n_HCS
8 bits Header Check Sequence
Definition 802_22.h:534
unsigned int n_Length_of_the_MAP_message
Definition 802_22.h:527
int nChannelBandwidth
Channel Bandwidth in MHz.
Definition 802_22.h:999
int nTTG
Transmitter-receiver turnaround gap. in TU.
Definition 802_22.h:1003
int nRTG
Receiver_transmitter turnaround gap. in TU.
Definition 802_22.h:1005
void * subheader[5]
Subheader.
Definition 802_22.h:605
unsigned int n_FID
3 bits Flow ID
Definition 802_22.h:590
Structure for incumbent.
Definition 802_22.h:1009
Spectrum Sensing Function output signals.
unsigned int n_Synchronization_Counter_for_Intra_frame_Quiet_Period_Duration
Definition 802_22.h:392
unsigned int n_Current_Intra_frame_Quiet_Period_Duration
Definition 802_22.h:340
unsigned int n_Inter_frame_Quiet_Period_Duration
Definition 802_22.h:399
unsigned short int n_FrameAllocationMap
Definition 802_22.h:264
unsigned int n_Self_coexistence_Capability_Indicator
Definition 802_22.h:294
unsigned int n_HCS
8 bits Header Check Sequence
Definition 802_22.h:509
unsigned int n_Current_Intra_frame_Quiet_Period_Cycle_Offset
Definition 802_22.h:322
unsigned int n_Current_Intra_frame_Quiet_Period_Cycle_Length
Definition 802_22.h:312
PNETSIM_MACADDRESS sz_BS_Id
48 bits, Base station mac address
Definition 802_22.h:263
unsigned int n_Claimed_Intra_frame_Quiet_Period_Duration
Definition 802_22.h:375
char sz_Current_Intra_frame_Quiet_period_Cycle_Frame_Bitmap[17]
Definition 802_22.h:329
unsigned int n_Claimed_Intra_frame_Quiet_Period_Cycle_Offset
Definition 802_22.h:356
unsigned int n_Incumbent_detection_reporting_inhibit_timer
Definition 802_22.h:498
unsigned int n_Claimed_Intra_frame_Quiet_Period_Cycle_Length
Definition 802_22.h:347
unsigned int n_Inter_frame_Quiet_Period_Offset
Definition 802_22.h:412
unsigned int n_Synchronization_Counter_for_Intra_frame_Quiet_Period_Rate
Definition 802_22.h:382
unsigned int n_Claimed_Intra_frame_Quiet_period_Cycle_Frame_Bitmap
Definition 802_22.h:364
double dIntercarrierSpacing
Inter carrier spacing ^f (Hz) = Fs/2048 Hz.
Definition 802_22.h:956
int nCP
Symbol duration.
Definition 802_22.h:962
int nBitsCountInOneSymbol
Data subCarrier count*Bits based on modulation * coding rate.
Definition 802_22.h:985
double dDataRate
Number of uncoded bits/OFDM symbol duration.
Definition 802_22.h:987
int nUsedSubCarrierCount
Used Sub-carrier count Nt = 1680.
Definition 802_22.h:974
int nDataSubCarrierCount
Data Sub-carrier count Nd = 1440.
Definition 802_22.h:976
int nOFDMSlots
OFDM Slot = 1 symbol * 1 subChannel.
Definition 802_22.h:982
int nChannelBandwidth
Channel Bandwidth in MHz.
Definition 802_22.h:951
double dSubCarrierSpacing
Sub carrier spacing Tfft (micro sec) = 1/^f.
Definition 802_22.h:958
double dTimeUnit
Time Unit TU = Tfft/2048.
Definition 802_22.h:960
double dSymbolDuration
Tsym = Tfft + Tcp in µs.
Definition 802_22.h:966
int nPilotSubCarrierCount
Pilot Sub-carrier count Np = 240.
Definition 802_22.h:978
int nGuardSubcarrierCount
Guard Sub-carrier count Ng = 368.
Definition 802_22.h:972
double dBasicSamplingFrequency
Sampling Frequency Fs (in MHz)
Definition 802_22.h:954
double dCPDuration
Tcp In micro sec.
Definition 802_22.h:964