mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-10-31 18:58:01 +00:00 
			
		
		
		
	wlan_theoretical_sta: Fix whitespace
Signed-off-by: matthew <stidmatt@gmail.com>
This commit is contained in:
		| @@ -1,6 +1,6 @@ | |||||||
| #!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||||
|  |  | ||||||
| ''' | """ | ||||||
|  |  | ||||||
| Candela Technologies Inc. | Candela Technologies Inc. | ||||||
| Info : Standard Script for WLAN Capaity Calculator | Info : Standard Script for WLAN Capaity Calculator | ||||||
| @@ -13,7 +13,7 @@ This Script has three classes : | |||||||
|           3. ac11_calculator : It will take all the user input of 802.11ac station,calculate Intermediate values and Theoretical values. |           3. ac11_calculator : It will take all the user input of 802.11ac station,calculate Intermediate values and Theoretical values. | ||||||
| All classes have different functions: input_parameter() that calculates intermediate values and generate theroretical data | All classes have different functions: input_parameter() that calculates intermediate values and generate theroretical data | ||||||
|  |  | ||||||
| ''' | """ | ||||||
|  |  | ||||||
| import argparse | import argparse | ||||||
| import json | import json | ||||||
| @@ -22,8 +22,7 @@ import json | |||||||
| # Class to take all user input (802.11a/b/g Standard) | # Class to take all user input (802.11a/b/g Standard) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class abg11_calculator: | ||||||
| class abg11_calculator(): |  | ||||||
|  |  | ||||||
|     def __init__(self, Traffic_Type, PHY_Bit_Rate, Encryption, QoS, MAC_Frame_802_11, Basic_Rate_Set, Preamble, |     def __init__(self, Traffic_Type, PHY_Bit_Rate, Encryption, QoS, MAC_Frame_802_11, Basic_Rate_Set, Preamble, | ||||||
|                  slot_name, Codec_Type, RTS_CTS_Handshake, CTS_to_self): |                  slot_name, Codec_Type, RTS_CTS_Handshake, CTS_to_self): | ||||||
| @@ -39,9 +38,6 @@ class abg11_calculator(): | |||||||
|         self.RTS_CTS_Handshake = RTS_CTS_Handshake |         self.RTS_CTS_Handshake = RTS_CTS_Handshake | ||||||
|         self.CTS_to_self = CTS_to_self |         self.CTS_to_self = CTS_to_self | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     # This function is for calculate intermediate values and Theoretical values |     # This function is for calculate intermediate values and Theoretical values | ||||||
|  |  | ||||||
|     @staticmethod |     @staticmethod | ||||||
| @@ -329,7 +325,7 @@ class abg11_calculator(): | |||||||
|  |  | ||||||
|         # CWmin_str (leave alone for default) |         # CWmin_str (leave alone for default) | ||||||
|  |  | ||||||
|         if (PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11): |         if PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11: | ||||||
|             CWmin_str = 31 |             CWmin_str = 31 | ||||||
|         else: |         else: | ||||||
|             if ( |             if ( | ||||||
| @@ -376,7 +372,7 @@ class abg11_calculator(): | |||||||
|  |  | ||||||
|         # PHY Bit Rate of Control Frames |         # PHY Bit Rate of Control Frames | ||||||
|  |  | ||||||
|         if (PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11): |         if PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11: | ||||||
|             data = 1 |             data = 1 | ||||||
|         else: |         else: | ||||||
|             data = 6 |             data = 6 | ||||||
| @@ -406,7 +402,7 @@ class abg11_calculator(): | |||||||
|             Preamble_1 = float(192) |             Preamble_1 = float(192) | ||||||
|  |  | ||||||
|         if (PHY_Bit == 1) or (PHY_Bit == 2) or (PHY_Bit == 5.5) or (PHY_Bit == 11): |         if (PHY_Bit == 1) or (PHY_Bit == 2) or (PHY_Bit == 5.5) or (PHY_Bit == 11): | ||||||
|             Ttxframe = (14 * 8) / PHY_Bit + (Preamble_1) |             Ttxframe = (14 * 8) / PHY_Bit + Preamble_1 | ||||||
|  |  | ||||||
|             Ttxframe_new = format(Ttxframe, '.2f') |             Ttxframe_new = format(Ttxframe, '.2f') | ||||||
|         else: |         else: | ||||||
| @@ -415,7 +411,7 @@ class abg11_calculator(): | |||||||
|  |  | ||||||
|         # RTS/CTS Handshake Overhead |         # RTS/CTS Handshake Overhead | ||||||
|  |  | ||||||
|         if (PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11): |         if PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11: | ||||||
|             SIFS_value = float(10) |             SIFS_value = float(10) | ||||||
|         else: |         else: | ||||||
|             SIFS_value = float(16) |             SIFS_value = float(16) | ||||||
| @@ -425,7 +421,7 @@ class abg11_calculator(): | |||||||
|  |  | ||||||
|         elif "Yes" in self.RTS_CTS_Handshake: |         elif "Yes" in self.RTS_CTS_Handshake: | ||||||
|             if (PHY_Bit == 1) or (PHY_Bit == 2) or (PHY_Bit == 5.5) or (PHY_Bit == 11): |             if (PHY_Bit == 1) or (PHY_Bit == 2) or (PHY_Bit == 5.5) or (PHY_Bit == 11): | ||||||
|                 RTS_CTS_Handshake = ((20 + 14) * 8) / PHY_Bit + (Preamble_1) |                 RTS_CTS_Handshake = ((20 + 14) * 8) / PHY_Bit + Preamble_1 | ||||||
|  |  | ||||||
|             else: |             else: | ||||||
|                 RTS_CTS_Handshake = int(((20 + 14) * 8 + 22 + PHY_Bit * 4 - 1) / (PHY_Bit * 4)) * 4 + 2 * 20 |                 RTS_CTS_Handshake = int(((20 + 14) * 8 + 22 + PHY_Bit * 4 - 1) / (PHY_Bit * 4)) * 4 + 2 * 20 | ||||||
| @@ -441,26 +437,26 @@ class abg11_calculator(): | |||||||
|                 CTS_to_self_Handshake = 0 |                 CTS_to_self_Handshake = 0 | ||||||
|             else: |             else: | ||||||
|                 if (PHY_Bit == 1) or (PHY_Bit == 2) or (PHY_Bit == 5.5) or (PHY_Bit == 11): |                 if (PHY_Bit == 1) or (PHY_Bit == 2) or (PHY_Bit == 5.5) or (PHY_Bit == 11): | ||||||
|                     CTS_to_self_Handshake = (14 * 8) / PHY_Bit + (Preamble_1) + SIFS_value |                     CTS_to_self_Handshake = (14 * 8) / PHY_Bit + Preamble_1 + SIFS_value | ||||||
|                 else: |                 else: | ||||||
|                     CTS_to_self_Handshake = int( |                     CTS_to_self_Handshake = int( | ||||||
|                         (14 * 8 + 22 + PHY_Bit * 4 - 1) / (PHY_Bit * 4)) * 4 + 20 + SIFS_value |                         (14 * 8 + 22 + PHY_Bit * 4 - 1) / (PHY_Bit * 4)) * 4 + 20 + SIFS_value | ||||||
|  |  | ||||||
|         # DIFS calulation |         # DIFS calulation | ||||||
|  |  | ||||||
|         if (PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11): |         if PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11: | ||||||
|             DIFS_value = 50 |             DIFS_value = 50 | ||||||
|         elif ("Short" in self.slot_name): |         elif "Short" in self.slot_name: | ||||||
|             DIFS_value = 34 |             DIFS_value = 34 | ||||||
|         else: |         else: | ||||||
|             DIFS_value = 50 |             DIFS_value = 50 | ||||||
|  |  | ||||||
|         # MeanBackoff calculation |         # MeanBackoff calculation | ||||||
|  |  | ||||||
|         if (PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11): |         if PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11: | ||||||
|             c4 = (CWmin_str * 20 / 2) |             c4 = (CWmin_str * 20 / 2) | ||||||
|             MeanBackoff_value = float(c4) |             MeanBackoff_value = float(c4) | ||||||
|         elif ("Short" in self.slot_name): |         elif "Short" in self.slot_name: | ||||||
|             d2 = (CWmin_str * 9 / 2) |             d2 = (CWmin_str * 9 / 2) | ||||||
|             MeanBackoff_value = float(d2) |             MeanBackoff_value = float(d2) | ||||||
|         else: |         else: | ||||||
| @@ -474,7 +470,7 @@ class abg11_calculator(): | |||||||
|         Nbits_value = (MAC_MPDU_Size * 8) |         Nbits_value = (MAC_MPDU_Size * 8) | ||||||
|  |  | ||||||
|         # Tmac, time for MAC frame and  Tplcp, time for MAC PLCP |         # Tmac, time for MAC frame and  Tplcp, time for MAC PLCP | ||||||
|         if (PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11): |         if PHY_Bit_Rate_int == 1 or PHY_Bit_Rate_int == 2 or PHY_Bit_Rate_int == 5 or PHY_Bit_Rate_int == 11: | ||||||
|             Tmac_value = Nbits_value / yellow_cell |             Tmac_value = Nbits_value / yellow_cell | ||||||
|             if "Short" in self.Preamble: |             if "Short" in self.Preamble: | ||||||
|                 Tplcp = float(96) |                 Tplcp = float(96) | ||||||
| @@ -597,8 +593,6 @@ class abg11_calculator(): | |||||||
|             IP_Throughput_C6_new = "N/A" |             IP_Throughput_C6_new = "N/A" | ||||||
|             IP_Throughput_C7_new = "N/A" |             IP_Throughput_C7_new = "N/A" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         Voice_Call = Max_Frame_Rate_C1 / Codec_Frame_rate |         Voice_Call = Max_Frame_Rate_C1 / Codec_Frame_rate | ||||||
|         Voice_Call_value = round(Voice_Call) |         Voice_Call_value = round(Voice_Call) | ||||||
|  |  | ||||||
| @@ -620,18 +614,18 @@ class abg11_calculator(): | |||||||
|             self.Estimated_MOS_Score = "N/A" |             self.Estimated_MOS_Score = "N/A" | ||||||
|             self.Maximum_Bidirectional_Voice_Calls = "N/A" |             self.Maximum_Bidirectional_Voice_Calls = "N/A" | ||||||
|         else: |         else: | ||||||
|             if (Voice_Call_value <= 1): |             if Voice_Call_value <= 1: | ||||||
|                 Maximum_Bidirectional_Voice_Calls1 = self.Max_Frame_Rate_C1_round / Codec_Frame_rate |                 Maximum_Bidirectional_Voice_Calls1 = self.Max_Frame_Rate_C1_round / Codec_Frame_rate | ||||||
|             elif (Voice_Call_value <= 2): |             elif Voice_Call_value <= 2: | ||||||
|                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C2_round / Codec_Frame_rate |                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C2_round / Codec_Frame_rate | ||||||
|             elif (Voice_Call_value <= 5): |             elif Voice_Call_value <= 5: | ||||||
|                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C3_round / Codec_Frame_rate |                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C3_round / Codec_Frame_rate | ||||||
|  |  | ||||||
|             elif (Voice_Call_value <= 10): |             elif Voice_Call_value <= 10: | ||||||
|                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C4_round / Codec_Frame_rate |                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C4_round / Codec_Frame_rate | ||||||
|             elif (Voice_Call_value <= 20): |             elif Voice_Call_value <= 20: | ||||||
|                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C5_round / Codec_Frame_rate |                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C5_round / Codec_Frame_rate | ||||||
|             elif (Voice_Call_value <= 50): |             elif Voice_Call_value <= 50: | ||||||
|                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C6_round / Codec_Frame_rate |                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C6_round / Codec_Frame_rate | ||||||
|             else: |             else: | ||||||
|                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C7_round / Codec_Frame_rate |                 Maximum_Bidirectional_Voice_Calls1 = Max_Frame_Rate_C7_round / Codec_Frame_rate | ||||||
| @@ -648,14 +642,13 @@ class abg11_calculator(): | |||||||
|                                                     100 - self.Maximum_Theoretical_R_value) * 7 * 0.000001 |                                                     100 - self.Maximum_Theoretical_R_value) * 7 * 0.000001 | ||||||
|                     self.Estimated_MOS_Score = round(Estimated_MOS_Score_1, 2) |                     self.Estimated_MOS_Score = round(Estimated_MOS_Score_1, 2) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     def get_result(self): |     def get_result(self): | ||||||
|  |  | ||||||
|         print("\n" + "******************Station : 11abgCalculator*****************************" + "\n") |         print("\n" + "******************Station : 11abgCalculator*****************************" + "\n") | ||||||
|         print("Theoretical Maximum Offered Load" + "\n") |         print("Theoretical Maximum Offered Load" + "\n") | ||||||
|         print("1 Client:") |         print("1 Client:") | ||||||
|         All_theoretical_output = {'Packet Interval(usec)': self.Client_1_new, 'Max Frame Rate(fps)': self.Max_Frame_Rate_C1_round, |         All_theoretical_output = {'Packet Interval(usec)': self.Client_1_new, | ||||||
|  |                                   'Max Frame Rate(fps)': self.Max_Frame_Rate_C1_round, | ||||||
|                                   'Max. Offered Load (802.11)(Mb/s)': self.Max_Offered_Load_C1_new, |                                   'Max. Offered Load (802.11)(Mb/s)': self.Max_Offered_Load_C1_new, | ||||||
|                                   'Offered Load Per 802.11 Client(Mb/s)': self.Offered_Load_Per_Client1_new, |                                   'Offered Load Per 802.11 Client(Mb/s)': self.Offered_Load_Per_Client1_new, | ||||||
|                                   'Offered Load (802.3 Side)(Mb/s)': self.Offered_Load_C1_new, |                                   'Offered Load (802.3 Side)(Mb/s)': self.Offered_Load_C1_new, | ||||||
| @@ -677,7 +670,8 @@ class n11_calculator(abg11_calculator): | |||||||
|     def __init__(self, Traffic_Type, Data_Voice_MCS, Channel_Bandwidth, Guard_Interval_value, Highest_Basic_str, |     def __init__(self, Traffic_Type, Data_Voice_MCS, Channel_Bandwidth, Guard_Interval_value, Highest_Basic_str, | ||||||
|                  Encryption, QoS, |                  Encryption, QoS, | ||||||
|                  IP_Packets_MSDU_str, MAC_Frames_per_A_MPDU_str, BSS_Basic_Rate, MAC_MPDU_Size_Data_Traffic, |                  IP_Packets_MSDU_str, MAC_Frames_per_A_MPDU_str, BSS_Basic_Rate, MAC_MPDU_Size_Data_Traffic, | ||||||
|                  Codec_Type, PLCP, CWmin, RTS_CTS_Handshake, CTS_to_self,PHY_Bit_Rate=None,MAC_Frame_802_11=None,Basic_Rate_Set=None,Preamble=None,slot_name=None): |                  Codec_Type, PLCP, CWmin, RTS_CTS_Handshake, CTS_to_self, PHY_Bit_Rate=None, MAC_Frame_802_11=None, | ||||||
|  |                  Basic_Rate_Set=None, Preamble=None, slot_name=None): | ||||||
|         super().__init__(Traffic_Type, PHY_Bit_Rate, Encryption, QoS, MAC_Frame_802_11, Basic_Rate_Set, Preamble, |         super().__init__(Traffic_Type, PHY_Bit_Rate, Encryption, QoS, MAC_Frame_802_11, Basic_Rate_Set, Preamble, | ||||||
|                          slot_name, Codec_Type, RTS_CTS_Handshake, CTS_to_self) |                          slot_name, Codec_Type, RTS_CTS_Handshake, CTS_to_self) | ||||||
|         self.Data_Voice_MCS = Data_Voice_MCS |         self.Data_Voice_MCS = Data_Voice_MCS | ||||||
| @@ -691,7 +685,6 @@ class n11_calculator(abg11_calculator): | |||||||
|         self.PLCP = PLCP |         self.PLCP = PLCP | ||||||
|         self.CWmin = CWmin |         self.CWmin = CWmin | ||||||
|  |  | ||||||
|  |  | ||||||
|     # This function is for calculate intermediate values and Theoretical values |     # This function is for calculate intermediate values and Theoretical values | ||||||
|  |  | ||||||
|     def calculate(self): |     def calculate(self): | ||||||
| @@ -875,7 +868,7 @@ class n11_calculator(abg11_calculator): | |||||||
|             MAC_MPDU_Size = int(self.MAC_MPDU_Size_Data_Traffic) |             MAC_MPDU_Size = int(self.MAC_MPDU_Size_Data_Traffic) | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
|             if ((IP_Packets_MSDU == 0)): |             if IP_Packets_MSDU == 0: | ||||||
|                 MAC_MPDU_Size = (Codec_IP_Packet_Size + 28 + QoS_Hdr + Encrypt_Hdr + 8) |                 MAC_MPDU_Size = (Codec_IP_Packet_Size + 28 + QoS_Hdr + Encrypt_Hdr + 8) | ||||||
|  |  | ||||||
|             else: |             else: | ||||||
| @@ -890,7 +883,7 @@ class n11_calculator(abg11_calculator): | |||||||
|  |  | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
|             MSDU_1 = (MAC_MPDU_Size - 28 - QoS_Hdr - Encrypt_Hdr - (IP_Packets_MSDU) * (14 + 3)) |             MSDU_1 = (MAC_MPDU_Size - 28 - QoS_Hdr - Encrypt_Hdr - IP_Packets_MSDU * (14 + 3)) | ||||||
|             MSDU_final = MSDU_1 / IP_Packets_MSDU |             MSDU_final = MSDU_1 / IP_Packets_MSDU | ||||||
|  |  | ||||||
|         if MSDU_final < 0: |         if MSDU_final < 0: | ||||||
| @@ -1076,7 +1069,7 @@ class n11_calculator(abg11_calculator): | |||||||
|  |  | ||||||
|         # g22 A-MPDU Pad |         # g22 A-MPDU Pad | ||||||
|  |  | ||||||
|         if ((MAC_Frames_per_A_MPDU == 0)): |         if MAC_Frames_per_A_MPDU == 0: | ||||||
|             MPDU_Pad = int(0) |             MPDU_Pad = int(0) | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
| @@ -1087,7 +1080,7 @@ class n11_calculator(abg11_calculator): | |||||||
|         # c26 Nbits, Bits per MAC PPDU |         # c26 Nbits, Bits per MAC PPDU | ||||||
|  |  | ||||||
|         MAC_Frames_per_A_MPDU_loc = MAC_Frames_per_A_MPDU + 1 |         MAC_Frames_per_A_MPDU_loc = MAC_Frames_per_A_MPDU + 1 | ||||||
|         if (MAC_Frames_per_A_MPDU == 0): |         if MAC_Frames_per_A_MPDU == 0: | ||||||
|             Nbits_Bits_per_MAC_PPDU = MAC_MPDU_Size * 8 |             Nbits_Bits_per_MAC_PPDU = MAC_MPDU_Size * 8 | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
| @@ -1100,7 +1093,7 @@ class n11_calculator(abg11_calculator): | |||||||
|             Guard_Interval_1 = 1 |             Guard_Interval_1 = 1 | ||||||
|         elif "800" in self.Guard_Interval_value: |         elif "800" in self.Guard_Interval_value: | ||||||
|             Guard_Interval_1 = 0 |             Guard_Interval_1 = 0 | ||||||
|         calculation = (((Data_Voice_MCS_int > 7 and PLCP_Configuration_int == 2) or PLCP_Configuration_int == 1)) |         calculation = ((Data_Voice_MCS_int > 7 and PLCP_Configuration_int == 2) or PLCP_Configuration_int == 1) | ||||||
|         if (Guard_Interval_1 == 1) and calculation: |         if (Guard_Interval_1 == 1) and calculation: | ||||||
|             Tsymbol_Data_Symbol_Period = 3.60 |             Tsymbol_Data_Symbol_Period = 3.60 | ||||||
|  |  | ||||||
| @@ -1132,7 +1125,7 @@ class n11_calculator(abg11_calculator): | |||||||
|             (22 + 32 * 8 + PHY_Bit_Rate_of_Control_Frames * 4 - 1) / (PHY_Bit_Rate_of_Control_Frames * 4)) * 4 + 20 |             (22 + 32 * 8 + PHY_Bit_Rate_of_Control_Frames * 4 - 1) / (PHY_Bit_Rate_of_Control_Frames * 4)) * 4 + 20 | ||||||
|  |  | ||||||
|         # g20 Use BlockAck |         # g20 Use BlockAck | ||||||
|         if (MAC_Frames_per_A_MPDU == 0): |         if MAC_Frames_per_A_MPDU == 0: | ||||||
|             Use_BlockAck = False |             Use_BlockAck = False | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
| @@ -1228,14 +1221,14 @@ class n11_calculator(abg11_calculator): | |||||||
|         Client_14_new = format(Max_PPDU_Rate_7, '.2f') |         Client_14_new = format(Max_PPDU_Rate_7, '.2f') | ||||||
|  |  | ||||||
|         # c44 Max_MAC_MPDU_Rate_1 |         # c44 Max_MAC_MPDU_Rate_1 | ||||||
|         if (MAC_Frames_per_A_MPDU > 0): |         if MAC_Frames_per_A_MPDU > 0: | ||||||
|             Max_MAC_MPDU_Rate_1 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_1 |             Max_MAC_MPDU_Rate_1 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_1 | ||||||
|             Max_MAC_MPDU_Rate_2 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_2 |             Max_MAC_MPDU_Rate_2 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_2 | ||||||
|             Max_MAC_MPDU_Rate_3 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_3 |             Max_MAC_MPDU_Rate_3 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_3 | ||||||
|             Max_MAC_MPDU_Rate_4 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_4 |             Max_MAC_MPDU_Rate_4 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_4 | ||||||
|             Max_MAC_MPDU_Rate_5 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_5 |             Max_MAC_MPDU_Rate_5 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_5 | ||||||
|             Max_MAC_MPDU_Rate_6 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_6 |             Max_MAC_MPDU_Rate_6 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_6 | ||||||
|             Max_MAC_MPDU_Rate_7 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_7 |             Max_MAC_MPDU_Rate_7 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_7 | ||||||
|         else: |         else: | ||||||
|             Max_MAC_MPDU_Rate_1 = Max_PPDU_Rate_1 |             Max_MAC_MPDU_Rate_1 = Max_PPDU_Rate_1 | ||||||
|             Max_MAC_MPDU_Rate_2 = Max_PPDU_Rate_2 |             Max_MAC_MPDU_Rate_2 = Max_PPDU_Rate_2 | ||||||
| @@ -1255,14 +1248,14 @@ class n11_calculator(abg11_calculator): | |||||||
|  |  | ||||||
|         # Max MAC MSDU Rate |         # Max MAC MSDU Rate | ||||||
|  |  | ||||||
|         if (IP_Packets_MSDU > 0): |         if IP_Packets_MSDU > 0: | ||||||
|             Max_MAC_MSDU_Rate_1 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_1 |             Max_MAC_MSDU_Rate_1 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_1 | ||||||
|             Max_MAC_MSDU_Rate_2 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_2 |             Max_MAC_MSDU_Rate_2 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_2 | ||||||
|             Max_MAC_MSDU_Rate_3 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_3 |             Max_MAC_MSDU_Rate_3 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_3 | ||||||
|             Max_MAC_MSDU_Rate_4 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_4 |             Max_MAC_MSDU_Rate_4 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_4 | ||||||
|             Max_MAC_MSDU_Rate_5 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_5 |             Max_MAC_MSDU_Rate_5 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_5 | ||||||
|             Max_MAC_MSDU_Rate_6 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_6 |             Max_MAC_MSDU_Rate_6 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_6 | ||||||
|             Max_MAC_MSDU_Rate_7 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_7 |             Max_MAC_MSDU_Rate_7 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_7 | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
|             Max_MAC_MSDU_Rate_1 = Max_MAC_MPDU_Rate_1 |             Max_MAC_MSDU_Rate_1 = Max_MAC_MPDU_Rate_1 | ||||||
| @@ -1458,8 +1451,6 @@ class n11_calculator(abg11_calculator): | |||||||
|         else: |         else: | ||||||
|             self.Maximum_Bidirectional_Voice_Calls = round(Maximum_Bidirectional, 2) |             self.Maximum_Bidirectional_Voice_Calls = round(Maximum_Bidirectional, 2) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     def get_result(self): |     def get_result(self): | ||||||
|  |  | ||||||
|         print("\n" + "******************Station : 11nCalculator*****************************" + "\n") |         print("\n" + "******************Station : 11nCalculator*****************************" + "\n") | ||||||
| @@ -1488,11 +1479,10 @@ class n11_calculator(abg11_calculator): | |||||||
|  |  | ||||||
| class ac11_calculator(n11_calculator): | class ac11_calculator(n11_calculator): | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     def __init__(self, Traffic_Type, Data_Voice_MCS, spatial, Channel_Bandwidth, Guard_Interval_value, |     def __init__(self, Traffic_Type, Data_Voice_MCS, spatial, Channel_Bandwidth, Guard_Interval_value, | ||||||
|                  Highest_Basic_str, Encryption, QoS,IP_Packets_MSDU_str, MAC_Frames_per_A_MPDU_str, BSS_Basic_Rate, MAC_MPDU_Size_Data_Traffic, |                  Highest_Basic_str, Encryption, QoS, IP_Packets_MSDU_str, MAC_Frames_per_A_MPDU_str, BSS_Basic_Rate, | ||||||
|                  Codec_Type, CWmin, RTS_CTS,PLCP = None,RTS_CTS_Handshake=None,CTS_to_self=None): |                  MAC_MPDU_Size_Data_Traffic, | ||||||
|  |                  Codec_Type, CWmin, RTS_CTS, PLCP=None, RTS_CTS_Handshake=None, CTS_to_self=None): | ||||||
|         super().__init__(Traffic_Type, Data_Voice_MCS, Channel_Bandwidth, Guard_Interval_value, Highest_Basic_str, |         super().__init__(Traffic_Type, Data_Voice_MCS, Channel_Bandwidth, Guard_Interval_value, Highest_Basic_str, | ||||||
|                          Encryption, QoS, |                          Encryption, QoS, | ||||||
|                          IP_Packets_MSDU_str, MAC_Frames_per_A_MPDU_str, BSS_Basic_Rate, MAC_MPDU_Size_Data_Traffic, |                          IP_Packets_MSDU_str, MAC_Frames_per_A_MPDU_str, BSS_Basic_Rate, MAC_MPDU_Size_Data_Traffic, | ||||||
| @@ -1501,7 +1491,6 @@ class ac11_calculator(n11_calculator): | |||||||
|         self.spatial = spatial |         self.spatial = spatial | ||||||
|         self.RTS_CTS = RTS_CTS |         self.RTS_CTS = RTS_CTS | ||||||
|  |  | ||||||
|  |  | ||||||
|     # This function is for calculate intermediate values and Theoretical values |     # This function is for calculate intermediate values and Theoretical values | ||||||
|  |  | ||||||
|     def calculate(self): |     def calculate(self): | ||||||
| @@ -1695,7 +1684,7 @@ class ac11_calculator(n11_calculator): | |||||||
|             MAC_MPDU_Size = int(self.MAC_MPDU_Size_Data_Traffic) |             MAC_MPDU_Size = int(self.MAC_MPDU_Size_Data_Traffic) | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
|             if (IP_Packets_MSDU == 0): |             if IP_Packets_MSDU == 0: | ||||||
|                 MAC_MPDU_Size = (Codec_IP_Packet_Size + 28 + QoS_Hdr + Encrypt_Hdr + 8) |                 MAC_MPDU_Size = (Codec_IP_Packet_Size + 28 + QoS_Hdr + Encrypt_Hdr + 8) | ||||||
|  |  | ||||||
|             else: |             else: | ||||||
| @@ -1711,8 +1700,8 @@ class ac11_calculator(n11_calculator): | |||||||
|  |  | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
|             MSDU_1 = (MAC_MPDU_Size - 28 - QoS_Hdr - Encrypt_Hdr - (IP_Packets_MSDU) * (14 + 3)) |             MSDU_1 = (MAC_MPDU_Size - 28 - QoS_Hdr - Encrypt_Hdr - IP_Packets_MSDU * (14 + 3)) | ||||||
|             MSDU_final = (int(MSDU_1 / (IP_Packets_MSDU))) |             MSDU_final = (int(MSDU_1 / IP_Packets_MSDU)) | ||||||
|         if MSDU_final < 0: |         if MSDU_final < 0: | ||||||
|             MSDU = MSDU_final - 1 |             MSDU = MSDU_final - 1 | ||||||
|         else: |         else: | ||||||
| @@ -1775,7 +1764,7 @@ class ac11_calculator(n11_calculator): | |||||||
|         elif "800" in self.Guard_Interval_value: |         elif "800" in self.Guard_Interval_value: | ||||||
|             Guard_Interval_1 = 0 |             Guard_Interval_1 = 0 | ||||||
|  |  | ||||||
|         calculation = (((Data_Voice_MCS_int > 7 and plcp == 2) or plcp == 1)) |         calculation = ((Data_Voice_MCS_int > 7 and plcp == 2) or plcp == 1) | ||||||
|  |  | ||||||
|         if (Guard_Interval_1 == 1) and calculation: |         if (Guard_Interval_1 == 1) and calculation: | ||||||
|             Tsymbol_Data_Symbol_Period = 3.60 |             Tsymbol_Data_Symbol_Period = 3.60 | ||||||
| @@ -1839,7 +1828,7 @@ class ac11_calculator(n11_calculator): | |||||||
|         # Nbits, Bits per MAC PPDU |         # Nbits, Bits per MAC PPDU | ||||||
|         # A-MPDU Pad |         # A-MPDU Pad | ||||||
|  |  | ||||||
|         if ((MAC_Frames_per_A_MPDU == 0)): |         if MAC_Frames_per_A_MPDU == 0: | ||||||
|             MPDU_Pad = int(0) |             MPDU_Pad = int(0) | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
| @@ -1848,7 +1837,7 @@ class ac11_calculator(n11_calculator): | |||||||
|             MPDU_Pad = int((y % 4)) |             MPDU_Pad = int((y % 4)) | ||||||
|  |  | ||||||
|         MAC_Frames_per_A_MPDU_loc = MAC_Frames_per_A_MPDU + 1 |         MAC_Frames_per_A_MPDU_loc = MAC_Frames_per_A_MPDU + 1 | ||||||
|         if (MAC_Frames_per_A_MPDU == 0): |         if MAC_Frames_per_A_MPDU == 0: | ||||||
|             Nbits_Bits_per_MAC_PPDU = MAC_MPDU_Size * 8 |             Nbits_Bits_per_MAC_PPDU = MAC_MPDU_Size * 8 | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
| @@ -1925,7 +1914,7 @@ class ac11_calculator(n11_calculator): | |||||||
|         # c37 Ack Response Overhead |         # c37 Ack Response Overhead | ||||||
|         # g20 Use BlockAck |         # g20 Use BlockAck | ||||||
|  |  | ||||||
|         if (MAC_Frames_per_A_MPDU == 0): |         if MAC_Frames_per_A_MPDU == 0: | ||||||
|             Use_BlockAck = False |             Use_BlockAck = False | ||||||
|         else: |         else: | ||||||
|             Use_BlockAck = True |             Use_BlockAck = True | ||||||
| @@ -1987,14 +1976,14 @@ class ac11_calculator(n11_calculator): | |||||||
|  |  | ||||||
|         # c44 Max_MAC_MPDU_Rate_1 |         # c44 Max_MAC_MPDU_Rate_1 | ||||||
|  |  | ||||||
|         if (MAC_Frames_per_A_MPDU > 0): |         if MAC_Frames_per_A_MPDU > 0: | ||||||
|             Max_MAC_MPDU_Rate_1 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_1 |             Max_MAC_MPDU_Rate_1 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_1 | ||||||
|             Max_MAC_MPDU_Rate_2 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_2 |             Max_MAC_MPDU_Rate_2 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_2 | ||||||
|             Max_MAC_MPDU_Rate_3 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_3 |             Max_MAC_MPDU_Rate_3 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_3 | ||||||
|             Max_MAC_MPDU_Rate_4 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_4 |             Max_MAC_MPDU_Rate_4 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_4 | ||||||
|             Max_MAC_MPDU_Rate_5 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_5 |             Max_MAC_MPDU_Rate_5 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_5 | ||||||
|             Max_MAC_MPDU_Rate_6 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_6 |             Max_MAC_MPDU_Rate_6 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_6 | ||||||
|             Max_MAC_MPDU_Rate_7 = (MAC_Frames_per_A_MPDU) * Max_PPDU_Rate_7 |             Max_MAC_MPDU_Rate_7 = MAC_Frames_per_A_MPDU * Max_PPDU_Rate_7 | ||||||
|         else: |         else: | ||||||
|             Max_MAC_MPDU_Rate_1 = Max_PPDU_Rate_1 |             Max_MAC_MPDU_Rate_1 = Max_PPDU_Rate_1 | ||||||
|             Max_MAC_MPDU_Rate_2 = Max_PPDU_Rate_2 |             Max_MAC_MPDU_Rate_2 = Max_PPDU_Rate_2 | ||||||
| @@ -2014,14 +2003,14 @@ class ac11_calculator(n11_calculator): | |||||||
|  |  | ||||||
|         # Max MAC MSDU Rate |         # Max MAC MSDU Rate | ||||||
|  |  | ||||||
|         if (IP_Packets_MSDU > 0): |         if IP_Packets_MSDU > 0: | ||||||
|             Max_MAC_MSDU_Rate_1 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_1 |             Max_MAC_MSDU_Rate_1 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_1 | ||||||
|             Max_MAC_MSDU_Rate_2 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_2 |             Max_MAC_MSDU_Rate_2 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_2 | ||||||
|             Max_MAC_MSDU_Rate_3 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_3 |             Max_MAC_MSDU_Rate_3 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_3 | ||||||
|             Max_MAC_MSDU_Rate_4 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_4 |             Max_MAC_MSDU_Rate_4 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_4 | ||||||
|             Max_MAC_MSDU_Rate_5 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_5 |             Max_MAC_MSDU_Rate_5 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_5 | ||||||
|             Max_MAC_MSDU_Rate_6 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_6 |             Max_MAC_MSDU_Rate_6 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_6 | ||||||
|             Max_MAC_MSDU_Rate_7 = (IP_Packets_MSDU) * Max_MAC_MPDU_Rate_7 |             Max_MAC_MSDU_Rate_7 = IP_Packets_MSDU * Max_MAC_MPDU_Rate_7 | ||||||
|  |  | ||||||
|         else: |         else: | ||||||
|             Max_MAC_MSDU_Rate_1 = Max_MAC_MPDU_Rate_1 |             Max_MAC_MSDU_Rate_1 = Max_MAC_MPDU_Rate_1 | ||||||
| @@ -2162,8 +2151,10 @@ class ac11_calculator(n11_calculator): | |||||||
|                 if self.Maximum_Theoretical_R_value > 100: |                 if self.Maximum_Theoretical_R_value > 100: | ||||||
|                     self.Estimated_MOS_Score = 4.5 |                     self.Estimated_MOS_Score = 4.5 | ||||||
|                 else: |                 else: | ||||||
|                     Estimated_MOS_Score_1 = (1 + 0.035 * self.Maximum_Theoretical_R_value + self.Maximum_Theoretical_R_value * ( |                     Estimated_MOS_Score_1 = ( | ||||||
|                             self.Maximum_Theoretical_R_value - 60) * (100 - self.Maximum_Theoretical_R_value) * 7 * 0.000001) |                                 1 + 0.035 * self.Maximum_Theoretical_R_value + self.Maximum_Theoretical_R_value * ( | ||||||
|  |                                 self.Maximum_Theoretical_R_value - 60) * ( | ||||||
|  |                                             100 - self.Maximum_Theoretical_R_value) * 7 * 0.000001) | ||||||
|                     self.Estimated_MOS_Score = format(Estimated_MOS_Score_1, '.2f') |                     self.Estimated_MOS_Score = format(Estimated_MOS_Score_1, '.2f') | ||||||
|  |  | ||||||
|         # Voice_Call_Range |         # Voice_Call_Range | ||||||
| @@ -2207,7 +2198,6 @@ class ac11_calculator(n11_calculator): | |||||||
|         else: |         else: | ||||||
|             self.Maximum_Bidirectional_Voice_Calls = round(Maximum_Bidirectional, 2) |             self.Maximum_Bidirectional_Voice_Calls = round(Maximum_Bidirectional, 2) | ||||||
|  |  | ||||||
|  |  | ||||||
|     def get_result(self): |     def get_result(self): | ||||||
|  |  | ||||||
|         print("\n" + "******************Station : 11ac Calculator*****************************" + "\n") |         print("\n" + "******************Station : 11ac Calculator*****************************" + "\n") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 matthew
					matthew