├── .gitignore ├── ConfigFiles ├── Highway3GPP.cfg ├── Highway3GPP_C2C_WP.cfg ├── Highway3GPP_ECCrural.cfg ├── Highway3GPP_withRSU.cfg ├── RSUconfig.cfg ├── Urban3GPP.cfg └── test_trace.cfg ├── Copyright_notice.pdf ├── DebugFiles ├── PlotBRuse.m ├── PlotBRuse2.m ├── PlotGenAndTxDebug.m ├── PlotTxDebug.m ├── printDebugBRofMode4.m ├── printDebugBackoff11p.m ├── printDebugCBR11p.m ├── printDebugCumulativeSINR.m ├── printDebugEvents.m ├── printDebugGeneration.m ├── printDebugITSNumberofReplicas.m ├── printDebugImage.m ├── printDebugKPI.m ├── printDebugReallocation.m ├── printDebugTx.m └── printDebugTxRx.m ├── LICENSE ├── MainFiles ├── mainInit.m ├── mainPositionUpdate.m └── mainV2X.m ├── MainFilesCV2X ├── counterTX.m ├── elaborateFateRxCV2X.m ├── initLastPowerCV2X.m ├── mainCV2XtransmissionEnds.m ├── mainCV2XttiEnds.m ├── mainCV2XttiStarts.m ├── sensedPowerCV2X.m ├── updateKPICV2X.m └── updateSINRCV2X.m ├── MainFilesIEEE802.11p ├── checkVehiclesStartReceiving11p.m ├── checkVehiclesStopReceiving11p.m ├── endOfBackoff11p.m ├── endOfTransmission11p.m ├── freezeBackoff11p.m ├── newPacketIn11p.m ├── resumeBackoff11p.m ├── startNewBackoff11p.m ├── updateKPI11p.m ├── updateLastPower11p.m ├── updateSINR11p.m └── updateVehicleEndingTx11p.m ├── MatCBRcalculations ├── cbrUpdate11p.m ├── cbrUpdateCV2X.m ├── printCBRToFileCV2X.m └── printCBRToFileITSG5.m ├── MatFilesCoexistence ├── coexistence11pPreambleInLTEbefore_TEMP.m ├── coexistenceAtLTEsubframeEnd.m ├── coexistenceAtLTEsubframeStart.m ├── coexistenceImprovements.m ├── coexistenceInterferenceOfEnergySignalsBeforeSuperFrame.m ├── coexistenceInterferenceOfEnergySignalsEmptySF.m ├── coexistenceSetNAV_C.m ├── coexistenceSetNAV_F.m ├── coexistenceStartNewBackoff11pModified.m ├── initiateCoexistenceParameters.m ├── mainInitCoexistence.m └── superframeManagement.m ├── MatFilesInit ├── addNewParam.m ├── constants.m ├── getseed.m ├── initiateApplicationParameters.m ├── initiateBRAssignmentAlgorithm.m ├── initiateMainSimulationParameters.m ├── initiateOutParameters.m ├── initiateParameters.m ├── initiatePhyParameters.m ├── initiateSpecificCasesParameters.m ├── readRSUconfig.m └── searchParamInCfgFile.m ├── MatFilesOut ├── outputToFiles.m ├── printDelay.m ├── printHiddenNodeProb.m ├── printNeighborsToFile.m ├── printPRRmapToFile.m ├── printPacketReceptionRatio.m ├── printPowerControl.m ├── printSpeedToFile.m └── updateAverageNeighbors.m ├── MatFilesPosition ├── addPosDelay.m ├── addPosError.m ├── initVehiclePositions.m ├── interpolateTrace.m ├── loadObstaclesMapFile.m ├── loadTrafficTrace.m ├── updateDistanceChangeForShadowing.m ├── updatePosition.m └── updatePositionFile.m ├── MatFilesResourceAllocationCV2X ├── BRreassignment3GPPautonomous.m ├── BRreassignmentControlled.m ├── BRreassignmentControlledMaxReuse.m ├── BRreassignmentControlledMinPowerReuse.m ├── BRreassignmentOrdered.m ├── BRreassignmentRandom.m ├── CV2XsensingProcedure.m └── findRCintervalAutonomous.m ├── MatFilesSINR ├── calculateNLOSv.m ├── computeChannelGain.m ├── deriveRanges.m └── readPERtable.m ├── MatFilesUtility ├── computeAngle.m ├── computeDistance.m ├── computeHiddenNodeProb.m ├── computeMinSegmentDistance.m ├── computeNeighbors.m ├── computeSignificantNeighbors.m ├── countPowerControl.m ├── countWirelessBlindSpotProb.m ├── counterMap.m ├── createMap.m ├── generationPeriodFromSpeed.m └── printUpdateToVideo.m ├── MatFilesUtility5G ├── MCS.txt ├── RBperChannel.txt ├── RBtable_5G.m ├── calculateNB_5G.m ├── fTBS_5G.m ├── findRBsBeaconSINRmin_5G.m ├── findTBS_5G.m ├── getMCS.m └── tableNinfo1_5G.mat ├── MatFilesUtilityIEEE80211p ├── SINRmin11p.m ├── autoSINRmin11p.m └── packetDuration11p.m ├── MatFilesUtilityLTE ├── IBEcalculation.m ├── RBtable.m ├── TBL717211.txt ├── bufferOverflowLTE.m ├── calculateNB.m ├── calculateSubchannelsCombinations.m ├── computeGrid.m ├── convertToGrid.m ├── countDataAge.m ├── countDistanceDetails.m ├── countPacketDelay.m ├── countUpdateDelay.m ├── deriveBeaconResources.m ├── findITBS.m ├── findModulation.m ├── findRBsBeaconNbits.m ├── findRBsBeaconSINRmin.m ├── isValidForFFT.m └── updateBRidFile.m ├── PERcurves ├── G5-CrossingNLOS │ ├── PER_11p_MCS0_350B.txt │ ├── PER_11p_MCS2_350B.txt │ ├── PER_11p_MCS4_350B.txt │ ├── PER_LTE_MCS10_350B.txt │ ├── PER_LTE_MCS11_350B.txt │ ├── PER_LTE_MCS4_350B.txt │ ├── PER_LTE_MCS5_350B.txt │ ├── PER_LTE_MCS7_350B.txt │ └── PER_LTE_MCS9_350B.txt ├── G5-HighwayLOS │ ├── PER_11p_MCS0_190B.txt │ ├── PER_11p_MCS0_350B.txt │ ├── PER_11p_MCS0_550B.txt │ ├── PER_11p_MCS2_190B.txt │ ├── PER_11p_MCS2_350B.txt │ ├── PER_11p_MCS2_550B.txt │ ├── PER_11p_MCS4_190B.txt │ ├── PER_11p_MCS4_350B.txt │ ├── PER_11p_MCS4_550B.txt │ ├── PER_LTE_MCS10_350B.txt │ ├── PER_LTE_MCS11_350B.txt │ ├── PER_LTE_MCS11_550B.txt │ ├── PER_LTE_MCS3_190B.txt │ ├── PER_LTE_MCS4_350B.txt │ ├── PER_LTE_MCS5_190B.txt │ ├── PER_LTE_MCS5_350B.txt │ ├── PER_LTE_MCS6_550B.txt │ ├── PER_LTE_MCS7_190B.txt │ ├── PER_LTE_MCS7_350B.txt │ ├── PER_LTE_MCS8_550B.txt │ └── PER_LTE_MCS9_350B.txt ├── G5-HighwayNLOS │ ├── PER_11p_MCS0_190B.txt │ ├── PER_11p_MCS0_350B.txt │ ├── PER_11p_MCS0_550B.txt │ ├── PER_11p_MCS2_190B.txt │ ├── PER_11p_MCS2_350B.txt │ ├── PER_11p_MCS2_550B.txt │ ├── PER_11p_MCS4_190B.txt │ ├── PER_11p_MCS4_350B.txt │ ├── PER_11p_MCS4_550B.txt │ ├── PER_LTE_MCS10_350B.txt │ ├── PER_LTE_MCS11_350B.txt │ ├── PER_LTE_MCS11_550B.txt │ ├── PER_LTE_MCS3_190B.txt │ ├── PER_LTE_MCS4_350B.txt │ ├── PER_LTE_MCS5_190B.txt │ ├── PER_LTE_MCS5_350B.txt │ ├── PER_LTE_MCS6_550B.txt │ ├── PER_LTE_MCS7_350B.txt │ ├── PER_LTE_MCS8_550B.txt │ └── PER_LTE_MCS9_350B.txt ├── G5-UrbanLOS │ ├── PER_11p_MCS0_350B.txt │ ├── PER_11p_MCS2_350B.txt │ ├── PER_11p_MCS4_350B.txt │ ├── PER_LTE_MCS10_350B.txt │ ├── PER_LTE_MCS11_350B.txt │ ├── PER_LTE_MCS4_350B.txt │ ├── PER_LTE_MCS5_350B.txt │ ├── PER_LTE_MCS7_350B.txt │ └── PER_LTE_MCS9_350B.txt ├── G5-UrbanNLOS │ ├── PER_11bd_MCS1_100B.txt │ ├── PER_11bd_MCS1_1500B.txt │ ├── PER_11bd_MCS5_100B.txt │ ├── PER_11bd_MCS5_1500B.txt │ ├── PER_11bddc_MCS1_100B.txt │ ├── PER_11bddc_MCS1_1500B.txt │ ├── PER_11p_MCS2_100B.txt │ ├── PER_11p_MCS2_1500B.txt │ ├── PER_11p_MCS6_100B.txt │ ├── PER_11p_MCS6_1500B.txt │ ├── PER_LTE_MCS21_100B.txt │ ├── PER_LTE_MCS21_1500B.txt │ ├── PER_LTE_MCS6_100B.txt │ ├── PER_LTE_MCS6_1500B.txt │ ├── PER_NR_MCS21_100B.txt │ ├── PER_NR_MCS21_1500B.txt │ ├── PER_NR_MCS7_100B.txt │ └── PER_NR_MCS7_1500B.txt ├── PER_table.mat ├── PERcuvesGeneration.m └── PlotCurves.m ├── README.md ├── ReadMe_LTEV2Vsim_v5.4.txt ├── Simulations.m ├── Simulations_test_trace.m ├── WiLabV2Xsim Table of input parameters v6.1.pdf ├── WiLabV2Xsim v6.1 Tutorial_v0.pdf ├── WiLabV2Xsim.m └── codeForPaper ├── Vittorio2021Performance ├── fig11_config.cfg ├── fig11_plot.m ├── fig11_simulation.m ├── fig7_config.cfg ├── fig7_plot.m ├── fig7_simulation.m ├── fig9_config.cfg ├── fig9_plot.m ├── fig9_simulation.m └── readme.md ├── Zhuofei2023Repetition ├── fig3 │ ├── .gitignore │ ├── fig3_config.cfg │ ├── fig3_plot.m │ ├── fig3_step_1_simulation.m │ ├── fig3_step_2_readData.m │ └── fig3_step_3_plotFigure.m ├── fig4 │ ├── .gitignore │ ├── fig4_config.cfg │ ├── fig4_step_1_simulation.m │ ├── fig4_step_2_readData.m │ ├── fig4_step_3_plotFigure.m │ └── getdis.m ├── fig5 │ ├── .gitignore │ ├── fig5_config.cfg │ ├── fig5_step_1_simulation.m │ ├── fig5_step_2_readData.m │ ├── fig5_step_3_plotFigure.m │ └── getdis.m ├── fig6 │ ├── .gitignore │ ├── fig6_config.cfg │ ├── fig6_step_1_simulation.m │ └── fig6_step_2_plogFigure.m └── readme.md └── Zhuofei2023cochannel ├── .gitignore ├── plot_figs_for_paper ├── fig_1_plot_prr_max_dis.m ├── fig_1_read_prr_data.m ├── fig_2_plot_packet_delay.m ├── fig_2_read_packet_delay_data.m ├── fig_3_plot_data_age.m ├── fig_3_read_data_age.m ├── functions │ └── getdis.m ├── plot_tot_data.m └── read_tot_data.m ├── readme.md └── simulation_task ├── Simulations_1_3_lte.m ├── Simulations_2_3_lte.m ├── Simulations_balanced_tech.m ├── coch_dynamic_C.cfg ├── coch_dynamic_C_preamble.cfg ├── coch_enhanced_A.cfg ├── coch_method_B.cfg ├── coch_method_F.cfg ├── coch_no_method.cfg ├── coch_only_ITS.cfg └── coch_only_NR.cfg /.gitignore: -------------------------------------------------------------------------------- 1 | *.asv 2 | ~$* 3 | Output/ 4 | code_for_papers/Vittorio2021Performance/Output/ 5 | *fortest* 6 | -------------------------------------------------------------------------------- /ConfigFiles/Highway3GPP.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | [simulationTime] 10 3 | 4 | [rho] 35.5 5 | 6 | [beaconSizeBytes] 190 7 | [TypeOfScenario] ETSI-Highway 8 | [Nlanes] 3 9 | [roadWidth] 4 10 | [roadLength] 2000 11 | [vStDev] 0 12 | 13 | [F_dB] 6 14 | [Gt_dB] 3 15 | [Gr_dB] 3 16 | 17 | [raw] 300 18 | 19 | [MCS_LTE] 7 20 | [BRAlgorithm] 18 21 | [sizeSubchannel] 10 22 | [probResKeep] 0.4 23 | [FixedPdensity] false 24 | [BRoverlapAllowed] false 25 | 26 | [printPacketReceptionRatio] true 27 | [printUpdateDelay] true 28 | [printPacketDelay] true 29 | [printDataAge] true 30 | [printWirelessBlindSpotProb] true 31 | 32 | [printNeighbors] true 33 | [printPRRmap] true 34 | [printPowerControl] false 35 | [printHiddenNodeProb] false 36 | [printCBR] true 37 | 38 | [mode5G] 1 39 | [ifAdjacent] true 40 | [SCS_NR] 15 41 | [nDMRS_NR] 24 42 | [MCS_NR] 7 -------------------------------------------------------------------------------- /ConfigFiles/Highway3GPP_C2C_WP.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | 3 | [beaconSizeBytes] 350 4 | [TypeOfScenario] ETSI-Highway 5 | [Nlanes] 3 6 | [roadWidth] 4 7 | [roadLength] 2000 8 | [vStDev] 0 9 | 10 | [F_dB] 6 11 | [Gt_dB] 3 12 | [Gr_dB] 3 13 | 14 | [raw] 100,200,300,400 15 | 16 | [MCS_LTE] 7 17 | SINRthresholdLTE] 0.1 18 | [BRAlgorithm] 18 19 | [sizeSubchannel] 10 20 | [probResKeep] 0.5 21 | [FixedPdensity] true 22 | [BRoverlapAllowed] true 23 | 24 | [rilModel11p] true 25 | 26 | [MCS_11p] 2 27 | 28 | [printPacketReceptionRatio] true 29 | [printUpdateDelay] true 30 | [printPacketDelay] true 31 | [printDataAge] true 32 | 33 | [printWirelessBlindSpotProb] true 34 | [printNeighbors] false 35 | [printPRRmap] false 36 | [printPowerControl] false 37 | [printHiddenNodeProb] false 38 | [printCBR] true 39 | -------------------------------------------------------------------------------- /ConfigFiles/Highway3GPP_ECCrural.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | 3 | [channelModel] 3 4 | [L0_dB] 47.85 5 | (this is free space at 1 meter) 6 | [beta] 2 7 | [d_threshold1] 128 8 | [beta2] 2.8 9 | [d_threshold2] 512 10 | [beta3] 3.3 11 | 12 | [beaconSizeBytes] 350 13 | [TypeOfScenario] ETSI-Highway 14 | [Nlanes] 3 15 | [roadWidth] 4 16 | [roadLength] 2000 17 | [vStDev] 0 18 | 19 | [F_dB] 6 20 | [Gt_dB] 3 21 | [Gr_dB] 3 22 | 23 | [raw] 200 24 | 25 | [folderPERcurves] PERcurves/G5-HighwayLOS 26 | 27 | [MCS_LTE] 7 28 | [BRAlgorithm] 18 29 | [sizeSubchannel] 10 30 | [probResKeep] 0.5 31 | [FixedPdensity] true 32 | [BRoverlapAllowed] true 33 | 34 | [rilModel11p] true 35 | 36 | [MCS_11p] 2 37 | 38 | [printPacketReceptionRatio] true 39 | [printUpdateDelay] true 40 | [printPacketDelay] true 41 | [printDataAge] true 42 | [prrResolution] 10 43 | 44 | [printNeighbors] false 45 | [printPRRmap] false 46 | [printPowerControl] false 47 | [printHiddenNodeProb] false 48 | [printCBR] true -------------------------------------------------------------------------------- /ConfigFiles/Highway3GPP_withRSU.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | 3 | [beaconSizeBytes] 350 4 | [TypeOfScenario] ETSI-Highway 5 | [Nlanes] 3 6 | [roadWidth] 4 7 | [roadLength] 2000 8 | [vStDev] 0 9 | 10 | [F_dB] 6 11 | [Gt_dB] 3 12 | [Gr_dB] 3 13 | 14 | [raw] 100,200,300,400 15 | 16 | [folderPERcurves] PERcurves/G5-HighwayLOS 17 | 18 | [MCS_LTE] 7 19 | [BRAlgorithm] 18 20 | [sizeSubchannel] 10 21 | [probResKeep] 0.5 22 | [FixedPdensity] true 23 | [BRoverlapAllowed] true 24 | 25 | [MCS_11p] 2 26 | 27 | [RSUcfg] RSUconfig.cfg 28 | 29 | [printPacketReceptionRatio] true 30 | [printUpdateDelay] true 31 | [printPacketDelay] true 32 | [printDataAge] true 33 | 34 | [printNeighbors] false 35 | [printPRRmap] false 36 | [printPowerControl] false 37 | [printHiddenNodeProb] false 38 | [printCBR] false -------------------------------------------------------------------------------- /ConfigFiles/RSUconfig.cfg: -------------------------------------------------------------------------------- 1 | ESTI configuration: 2 RSUs 2 | X: 800, 805 (the road is from 0 to 2000) 3 | Y: both at 28 (in ETSI the RSU are set at 26 m, with the vehicles in the first lane at Y=2 and those in the sixth lane at Y=22; in WiLabV2Xsim, instead, the vehicles in the first lane are at Y=4 and those of the sixth lane at Y=24) 4 | 5 | [NumberOfRSUs] 2 6 | [Technology] 11p 7 | [PacketType] hpDENM 8 | 9 | [xLocation] 800,805 10 | [yLocation] 28,28 11 | -------------------------------------------------------------------------------- /ConfigFiles/Urban3GPP.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | 3 | 4 | [beaconSizeBytes] 350 5 | [TypeOfScenario] ETSI-Urban 6 | [Nblocks] 4 7 | [Nlanesblockh] 4 8 | [Nlanesblockv] 4 9 | [roadWdt] 3.5 10 | [roadLength] 2000 11 | [vStDev] 0 12 | 13 | [F_dB] 6 14 | [Gt_dB] 3 15 | [Gr_dB] 3 16 | 17 | [raw] 100,200,300,400 18 | 19 | [folderPERcurves] PERcurves/G5-UrbanLOS 20 | [folderPERcurvesNLOS] PERcurves/G5-CrossingNLOS 21 | 22 | [MCS_LTE] 7 23 | [BRAlgorithm] 18 24 | [sizeSubchannel] 10 25 | [probResKeep] 0.5 26 | [FixedPdensity] true 27 | [BRoverlapAllowed] true 28 | [MCS_11p] 2 29 | 30 | [printPacketReceptionRatio] true 31 | [printUpdateDelay] true 32 | [printPacketDelay] true 33 | [printDataAge] true 34 | [printNeighbors] false 35 | [printPRRmap] false 36 | [printPowerControl] false 37 | [printHiddenNodeProb] false 38 | [printCBR] true 39 | -------------------------------------------------------------------------------- /ConfigFiles/test_trace.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | [simulationTime] 10 3 | 4 | [rho] 35.5 5 | 6 | [beaconSizeBytes] 190 7 | [TypeOfScenario] traces 8 | [Nlanes] 3 9 | [roadWidth] 4 10 | [roadLength] 2000 11 | [vStDev] 0 12 | 13 | [F_dB] 6 14 | [Gt_dB] 3 15 | [Gr_dB] 3 16 | 17 | [raw] 300 18 | 19 | [MCS_LTE] 7 20 | [BRAlgorithm] 18 21 | [sizeSubchannel] 10 22 | [probResKeep] 0.4 23 | [FixedPdensity] false 24 | [BRoverlapAllowed] false 25 | 26 | [printPacketReceptionRatio] true 27 | [printUpdateDelay] true 28 | [printPacketDelay] true 29 | [printDataAge] true 30 | [printWirelessBlindSpotProb] true 31 | 32 | [printNeighbors] true 33 | [printPRRmap] true 34 | [printPowerControl] false 35 | [printHiddenNodeProb] false 36 | [printCBR] true 37 | 38 | [mode5G] 1 39 | [ifAdjacent] true 40 | [SCS_NR] 15 41 | [nDMRS_NR] 24 42 | [MCS_NR] 7 -------------------------------------------------------------------------------- /Copyright_notice.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/V2Xgithub/WiLabV2Xsim/c8cedf7583569f58d11bf4fe397fc007bc05e883/Copyright_notice.pdf -------------------------------------------------------------------------------- /DebugFiles/PlotBRuse.m: -------------------------------------------------------------------------------- 1 | close all 2 | clear 3 | clc 4 | 5 | % 1: with ITS-G5 6 | %data = load('Output_Debug/_DebugBRofMode4_2.xls'); 7 | % 3: without ITS-G5 8 | data = load('Output_MethodC_Debug_600s_corrected//_DebugBRofMode4_3.xls'); 9 | 10 | plot(data(:,1),data(:,3),'p'); 11 | 12 | nF = 3; 13 | nT = 100; 14 | 15 | map = zeros(nT,nF); 16 | for t = 1:nT 17 | for f=1:nF 18 | map(t,f) = sum(data(:,3)==((t-1)*nF+f)); 19 | end 20 | end 21 | 22 | % maxMap = max(map,[],'all') 23 | % figure(1) 24 | % for t = 1:nT 25 | % for f=1:nF 26 | % plot(t,f,'p','Color',[1 1 1]*(1-ceil(10*map(t,f)/maxMap)/10)); 27 | % hold on 28 | % end 29 | % end 30 | 31 | % map = sum(map'); 32 | % map = map'; 33 | % maxMap = max(map,[],'all') 34 | % figure(2) 35 | % for t = 1:nT 36 | % if map(t,1)>0 37 | % if map(t,1)>0.7*maxMap 38 | % plot(t,1,'pk'); 39 | % else 40 | % plot(t,1,'pr'); 41 | % end 42 | % end 43 | % %plot(t,1,'p','Color',[1 1 1]*(1-ceil(10*map(t,1)/maxMap)/10)); 44 | % hold on 45 | % end 46 | 47 | % 48 | nSlotLTE = 10; 49 | map = zeros(nSlotLTE,nF); 50 | for t = 1:nSlotLTE 51 | for f=1:nF 52 | map(t,f) = sum(mod(data(:,3)-1,nSlotLTE*nF)+1==((t-1)*nF+f)); 53 | end 54 | end 55 | bar(map./ sum(sum(map))) 56 | xlabel('Subframe of the LTE slot'); 57 | ylabel('Normalized number of times it is selected'); 58 | legend('subchannels 1-3','subchannels 2-4','subchannels 3-5','Location','SouthEast'); 59 | title('Distribution of allocations of the LTE station inside the LTE slot; 5:5, 245 vehicles'); 60 | 61 | figure(2) 62 | mapT = sum(map'); 63 | mapT = mapT / sum(mapT); 64 | bar(mapT) 65 | xlabel('Subframe of the LTE slot'); 66 | ylabel('Normalized number of times it is selected'); 67 | %legend('subchannels 1-3','subchannels 2-4','subchannels 3-5','Location','SouthEast'); 68 | title('Distribution of allocations of the LTE station inside the LTE slot; 5:5, 245 vehicles'); 69 | -------------------------------------------------------------------------------- /DebugFiles/PlotBRuse2.m: -------------------------------------------------------------------------------- 1 | close all 2 | clear 3 | clc 4 | 5 | for iFig=1:2 6 | 7 | figure(iFig) 8 | 9 | % 1: with ITS-G5 10 | %data = load('Output_Debug/_DebugBRofMode4_2.xls'); 11 | % 3: without ITS-G5 12 | fileName = sprintf('Output_MethodC_Debug_600s_corrected//_DebugBRofMode4_%d.xls',iFig); 13 | data = load(fileName); 14 | 15 | subframeV = ceil(data(:,3)/3); 16 | timeV = ceil(data(:,1)*10)/10; 17 | subframeUsed = zeros(1,max(data(:,2))); 18 | 19 | n1 = 0; 20 | n2 = 0; 21 | n3 = 0; 22 | 23 | indexInTimeV = 1; 24 | for t=0.1:0.1:600 25 | subframeNow = mod(t/0.1-1,100)+1; 26 | while timeV(indexInTimeV)245) = -1; 30 | tx11pDENM_X = tx11p_X; 31 | tx11pDENM_X(tx11p_ID<246) = -1; 32 | 33 | Data = load('Output_Debug_A/_DebugReallocation_1.xls'); 34 | Data = load('Output_Debug_A/_DebugReallocation_2.xls'); 35 | Data = load('Output_Debug_A/_DebugReallocation_3.xls'); 36 | 37 | %Data(Data<=0) = -1; 38 | timeGen = Data(:,1); 39 | idGen = Data(:,2); 40 | xGen = Data(:,3); 41 | ifGen = Data(:,4); 42 | brGen = Data(:,5); 43 | 44 | figure(1); 45 | %plot(time,txLTE_X,'ob'); 46 | plot(timeGen(logical(ifGen)),idGen(logical(ifGen)),'*b'); 47 | hold on 48 | plot([-1 -1],[-1 -1],'--k'); 49 | plot(time,txLTE_ID,'ob'); 50 | %plot(time,rxOkLTE_X,'.g'); 51 | %plot(time,rxErrLTE_X,'.r','MarkerSize',6); 52 | plot(timeGen(logical(~ifGen)),idGen(logical(~ifGen)),'pr'); 53 | for i=1:length(timeGen) 54 | if logical(ifGen(i)) 55 | plot([timeGen(i) timeGen(i)+0.1],[idGen(i) idGen(i)],'--k'); 56 | end 57 | end 58 | axis([2 4 0 20]); 59 | %for t=1.8:0.005:2 60 | % plot([t t],[-1 2001],'--k'); 61 | %end 62 | xlabel('Time [s]'); 63 | ylabel('Position [m]'); 64 | %legend('ITS-G5, Tx CAM','ITS-G5, Rx Ok','ITS-G5, Rx Err'); 65 | %legend('ITS-G5, Tx CAM','ITS-G5, Tx DENM','ITS-G5, Rx Ok','ITS-G5, Rx Err',... 66 | % 'LTE, Tx','LTE, Rx Ok','LTE, Rx Err'); 67 | legend('Packet generation','Time to T2','Tx','Reallocation'); 68 | 69 | -------------------------------------------------------------------------------- /DebugFiles/PlotTxDebug.m: -------------------------------------------------------------------------------- 1 | close all 2 | clear 3 | clc 4 | 5 | Data = load('Output_debug/_DebugTx_5.xls'); 6 | 7 | Data(Data<=0) = -1; 8 | 9 | time = Data(:,1); 10 | tx11p_ID = Data(:,2); 11 | rxOk11p_ID = Data(:,3); 12 | rxErr11p_ID = Data(:,4); 13 | txLTE_ID = Data(:,5); 14 | rxOkLTE_ID = Data(:,6); 15 | rxErrLTE_ID = Data(:,7); 16 | tx11p_X = Data(:,8); 17 | rxOk11p_X = Data(:,9); 18 | rxErr11p_X = Data(:,10); 19 | txLTE_X = Data(:,11); 20 | rxOkLTE_X = Data(:,12); 21 | rxErrLTE_X = Data(:,13); 22 | 23 | tx11pCAM_X = tx11p_X; 24 | tx11pCAM_X(tx11p_ID<0 | tx11p_ID>245) = -1; 25 | tx11pDENM_X = tx11p_X; 26 | tx11pDENM_X(tx11p_ID<246) = -1; 27 | 28 | figure(1); 29 | plot(time,tx11pCAM_X,'ob'); 30 | hold on 31 | %plot(time,tx11pDENM_X,'pk','MarkerSize',12,'MarkerFaceColor',[0 0 0]); 32 | %plot(time,rxOk11p_X,'.b'); 33 | %plot(time,rxErr11p_X,'xr','MarkerSize',6); 34 | plot(time,txLTE_X,'om'); 35 | %plot(time,rxOkLTE_X,'.m'); 36 | %plot(time,rxErrLTE_X,'xm','MarkerSize',6); 37 | %axis([1.8 1.84 0 2000]); 38 | axis([1.5 1.7 0 2000]); 39 | for t=0:0.01:4.2 40 | plot([t t],[-1 2001],'--k'); 41 | end 42 | for t=0.005:0.01:4.2 43 | plot([t t],[-1 2001],':r'); 44 | end 45 | xlabel('Time [s]'); 46 | ylabel('Position [m]'); 47 | %legend('ITS-G5, Tx CAM','ITS-G5, Rx Ok','ITS-G5, Rx Err'); 48 | %legend('ITS-G5, Tx CAM','ITS-G5, Tx DENM','ITS-G5, Rx Ok','ITS-G5, Rx Err',... 49 | % 'LTE, Tx','LTE, Rx Ok','LTE, Rx Err'); 50 | legend('ITS-G5, Tx','LTE, Tx'); 51 | 52 | -------------------------------------------------------------------------------- /DebugFiles/printDebugBRofMode4.m: -------------------------------------------------------------------------------- 1 | function printDebugBRofMode4(timeManagement,idvehicle,BR,outParams) 2 | 3 | %if timeManagement.timeNow<10 4 | return; 5 | %end 6 | 7 | filename = sprintf('%s/_DebugBRofMode4_%d.xls',outParams.outputFolder,outParams.simID); 8 | fid = fopen(filename,'a'); 9 | 10 | fprintf(fid,'%f\t%d\t%d\n',timeManagement.timeNow,idvehicle,BR); 11 | 12 | fclose(fid); -------------------------------------------------------------------------------- /DebugFiles/printDebugBackoff11p.m: -------------------------------------------------------------------------------- 1 | function printDebugBackoff11p(Time,StringOfEvent,idEvent,stationManagement,outParams,timeManagement) 2 | % Print of: Time, event description, then per each station: 3 | % ID, technology, state, current SINR (if LTE, first neighbor), useful power (if LTE, first neighbor), 4 | % interfering power (if LTE, first neighbor), interfering power from 5 | % the other technology (if LTE, first neighbor) 6 | 7 | return; 8 | 9 | filename = sprintf('%s/_DebugBackoff11p_%d.xls',outParams.outputFolder,outParams.simID); 10 | fid = fopen(filename,'r'); 11 | if fid==-1 12 | fid = fopen(filename,'w'); 13 | fprintf(fid,'Time\tEvent\tVehicle\tBackoffCounter\ttimeNextTxRx11p\n'); 14 | end 15 | fclose(fid); 16 | 17 | fid = fopen(filename,'a'); 18 | fprintf(fid,'%3.6f\t%s\t%d\t%d\t%d\n',Time,StringOfEvent,idEvent,stationManagement.nSlotBackoff11p(idEvent),timeManagement.timeNextTxRx11p(idEvent)); 19 | fclose(fid); 20 | 21 | -------------------------------------------------------------------------------- /DebugFiles/printDebugCBR11p.m: -------------------------------------------------------------------------------- 1 | function printDebugCBR11p(Time,StringOfEvent,idEvent,outParams) 2 | % Print of: Time, event description, then per each station: 3 | % ID, technology, state, current SINR (if LTE, first neighbor), useful power (if LTE, first neighbor), 4 | % interfering power (if LTE, first neighbor), interfering power from 5 | % the other technology (if LTE, first neighbor) 6 | 7 | 8 | filename = sprintf('%s/_DebugCBR11p_%d.xls',outParams.outputFolder,outParams.simID); 9 | fid = fopen(filename,'r'); 10 | if fid==-1 11 | fid = fopen(filename,'w'); 12 | fprintf(fid,'Time\tEvent\tVehicle\n'); 13 | end 14 | fclose(fid); 15 | if ismember(187,idEvent) 16 | index = idEvent==187; 17 | fid = fopen(filename,'a'); 18 | 19 | fprintf(fid,'%3.6f\t%s\t%d\n',Time,StringOfEvent,idEvent(index)); 20 | 21 | fclose(fid); 22 | end 23 | -------------------------------------------------------------------------------- /DebugFiles/printDebugCumulativeSINR.m: -------------------------------------------------------------------------------- 1 | function printDebugCumulativeSINR(outParams,time,idTx,pckTxOccurring,IDRxs,cumulativePreable, cumulativeSINR, state, distance,rxOk) 2 | % after each time transmission, print the cumulative SINR of all of the 3 | % receiver 4 | 5 | filename = sprintf('%s/_DebugCumulative11p_%d.xls',outParams.outputFolder,outParams.simID); 6 | fid = fopen(filename,'r'); 7 | if fid==-1 8 | fid = fopen(filename,'w'); 9 | fprintf(fid,'Time\tidTx\tpckTxOccurring\tIDRx\tcumulativePreableSINR\tcumulativeSINR\tstate\tdistance\trxOK\n'); 10 | end 11 | fclose(fid); 12 | 13 | fid = fopen(filename,'a'); 14 | 15 | for i = 1:length(IDRxs) 16 | fprintf(fid,'%3.6f\t%d\t%d\t%d\t%.2f\t%.2f\t%d\t%.2f\t%d\n',time,idTx,pckTxOccurring,IDRxs(i),cumulativePreable(IDRxs(i),idTx),cumulativeSINR(IDRxs(i), idTx),state(IDRxs(i)),distance(IDRxs(i), idTx),rxOk(i)); 17 | end 18 | fclose(fid); -------------------------------------------------------------------------------- /DebugFiles/printDebugEvents.m: -------------------------------------------------------------------------------- 1 | function printDebugEvents(Time,StringOfEvent,idEvent) 2 | % Function to be used in Debug to print the main events 3 | 4 | % return 5 | 6 | if idEvent<=0 7 | fprintf('Time=%3.6f, %s\n',Time,StringOfEvent); 8 | else 9 | fprintf('Time=%3.6f, %s, idEvent=%d\n',Time,StringOfEvent,idEvent); 10 | end 11 | 12 | -------------------------------------------------------------------------------- /DebugFiles/printDebugGeneration.m: -------------------------------------------------------------------------------- 1 | function printDebugGeneration(timeManagement,idEvent,positionManagement,outParams) 2 | 3 | %if Time<4 || Time>4.2 4 | %if Time>0.2 5 | return; 6 | %end 7 | 8 | if idEvent>0 9 | 10 | filename = sprintf('%s/_DebugGen_%d.xls',outParams.outputFolder,outParams.simID); 11 | 12 | fid = fopen(filename,'a'); 13 | 14 | fprintf(fid,'%f\t%d\t%f\t%f\n',timeManagement.timeNow,idEvent,positionManagement.XvehicleReal(idEvent),timeManagement.timeNextPacket(idEvent)); 15 | 16 | fclose(fid); 17 | 18 | end -------------------------------------------------------------------------------- /DebugFiles/printDebugITSNumberofReplicas.m: -------------------------------------------------------------------------------- 1 | function printDebugITSNumberofReplicas(outParams, time, retransType, idTx, ITSNumberOfReplicas) 2 | filename = sprintf('%s/_DebugITSNumberofReplicas_%d.xls',outParams.outputFolder,outParams.simID); 3 | fid = fopen(filename,'r'); 4 | if fid==-1 5 | fid = fopen(filename,'w'); 6 | fprintf(fid,'Time\tretransType\tidTx\tITSNumberOfReplicas\n'); 7 | end 8 | fclose(fid); 9 | 10 | fid = fopen(filename,'a'); 11 | fprintf(fid,'%3.6f\t%d\t%d\t%d\n',time,retransType,idTx,ITSNumberOfReplicas); 12 | 13 | fclose(fid); -------------------------------------------------------------------------------- /DebugFiles/printDebugKPI.m: -------------------------------------------------------------------------------- 1 | function printDebugKPI(fid,Time,StringOfEvent,distance,idEvent,pckTxOccurring,Earlier,Now) 2 | % Print of: Time, event description, then per each station: 3 | % ID, technology, state, current SINR (if LTE, first neighbor), useful power (if LTE, first neighbor), 4 | % interfering power (if LTE, first neighbor), interfering power from 5 | % the other technology (if LTE, first neighbor) 6 | 7 | % to active this function, the start and the end of "updateKPI11p.m" part 8 | % should be uncomment, and the line of calling this function should be 9 | % uncomment 10 | fprintf(fid,'%3.6f\t%s\t%d\t%d\t%d\t%d\t%d\n',Time,StringOfEvent,distance,idEvent,pckTxOccurring,Earlier,Now); 11 | -------------------------------------------------------------------------------- /DebugFiles/printDebugReallocation.m: -------------------------------------------------------------------------------- 1 | function printDebugReallocation(Time,staID,posX,strEvent,BR,outParams) 2 | % Print of: Time, event description, then per each station: 3 | % ID, technology, state, current SINR (if LTE, first neighbor), useful power (if LTE, first neighbor), 4 | % interfering power (if LTE, first neighbor), interfering power from 5 | % the other technology (if LTE, first neighbor) 6 | 7 | %if Time<1.8 8 | return; 9 | %end 10 | 11 | filename = sprintf('%s/_DebugReallocation_%d.xls',outParams.outputFolder,outParams.simID); 12 | % Time - Vehicle ID - posX - Packet generation 0/1 - Reallocation 0/BR 13 | 14 | fid = fopen(filename,'a'); 15 | if staID==-1 16 | error('Error in printDebugReallocation - E1'); 17 | else 18 | fprintf(fid,'%3.6f\t%d\t%d\t',Time,staID,posX); 19 | if strcmpi(strEvent,'gen') 20 | fprintf(fid,'1\t0\n'); 21 | elseif strcmpi(strEvent,'reall') 22 | fprintf(fid,'0\t%d\n',BR); 23 | else 24 | error('Error in printDebugReallocation - E2'); 25 | end 26 | end 27 | fclose(fid); 28 | -------------------------------------------------------------------------------- /DebugFiles/printDebugTxRx.m: -------------------------------------------------------------------------------- 1 | function printDebugTxRx(time,v_id, event, stationManagement,sinrManagement,outParams) 2 | %PRINTDEBUGTXRX Summary of this function goes here 3 | % Detailed explanation goes here 4 | filename = sprintf('%s/_DebugTxRx_%d.xls',outParams.outputFolder,outParams.simID); 5 | fid = fopen(filename, "a"); 6 | fprintf(fid,"%f,%d,%s\n",time,v_id,event); 7 | fclose(fid); 8 | 9 | end 10 | 11 | -------------------------------------------------------------------------------- /MainFilesCV2X/counterTX.m: -------------------------------------------------------------------------------- 1 | function matrix = counterTX(IDvehicleTX,indexVehicleTX,awarenessID,correctList) 2 | % Count correctly transmitted beacons among neighbors within Raw 3 | % Matrix = [#Correctly transmitted beacons, #Errors, #Neighbors] 4 | 5 | Ntx = length(indexVehicleTX); 6 | matrix = zeros(Ntx,3); 7 | for i = 1:Ntx 8 | 9 | % #Neighbors of TX vehicle IDvehicleTX(i) 10 | Nneighbors = nnz(awarenessID(indexVehicleTX(i),:)); 11 | matrix(i,3) = Nneighbors; 12 | 13 | % From v 5.4.14 14 | % % #Neighbors that do not have correctly received the beacon 15 | % Nerrors = nnz(errorMatrix(:,1)==IDvehicleTX(i)); 16 | % matrix(i,2) = Nerrors; 17 | % 18 | % % #Neighbors that have correctly received the beacon transmitted by IDvehicleTX(i) 19 | % matrix(i,1) = Nneighbors - Nerrors; 20 | 21 | % #Neighbors that have correctly received the beacon transmitted by IDvehicleTX(i) 22 | Ncorrect = nnz(correctList(:,1)==IDvehicleTX(i)); 23 | matrix(i,1) = Ncorrect; 24 | 25 | % #Neighbors that do not have correctly received the beacon 26 | matrix(i,2) = Nneighbors - Ncorrect; 27 | 28 | end 29 | 30 | -------------------------------------------------------------------------------- /MainFilesCV2X/sensedPowerCV2X.m: -------------------------------------------------------------------------------- 1 | function sensedPower_MHz = sensedPowerCV2X(stationManagement,sinrManagement,appParams,phyParams) 2 | % This function calculates the power sensed by LTE nodes in a subframe 3 | % The output does not include the interference from 11p nodes, if present 4 | 5 | NbeaconsF = appParams.NbeaconsF; 6 | sensedPower_MHz = zeros(NbeaconsF,length(stationManagement.activeIDsCV2X)); 7 | 8 | if ~isempty(stationManagement.transmittingIDsCV2X) 9 | 10 | P_RX_MHz_LTE = sinrManagement.P_RX_MHz(stationManagement.indexInActiveIDs_ofLTEnodes,stationManagement.indexInActiveIDs_ofLTEnodes); 11 | activeIDsCV2X = stationManagement.activeIDsCV2X; 12 | 13 | % Calculate the beacon resources used in the time and frequency domains 14 | % Find not assigned BRid 15 | %idNOT = (stationManagement.BRid(:,1)<=0); 16 | % Calculate BRidT = vector of BRid in the time domain 17 | %BRidT = ceil(BRid/NbeaconsF); 18 | %BRidT(idNOT) = -1; 19 | % Calculate BRidF = vector of BRid in the frequency domain 20 | %BRidF = mod(stationManagement.BRid(:,1)-1,NbeaconsF)+1; 21 | %BRidF(idNOT) = -1; 22 | 23 | % Cycle that calculates per each vehicle the sensed power 24 | for indexSensingV = 1:length(activeIDsCV2X) 25 | % Cycle per each resource (in the current subframe) 26 | % Init the vector of received power in this beacon resource 27 | rxPsums_MHz = zeros(NbeaconsF,1); 28 | 29 | % Cycle over the vehicles transmitting in the same subframe 30 | for iTx = 1:length(stationManagement.transmittingIDsCV2X) 31 | %for indexSensedV = (stationManagement.indexInActiveIDsOnlyLTE_OfTxLTE)' 32 | indexSensedV = stationManagement.indexInActiveIDsOnlyLTE_OfTxLTE(iTx); 33 | % Find which BRF is used by the interferer 34 | %BRFsensedV = BRidF(activeIDsCV2X(indexSensedV)); 35 | BRFsensedV = stationManagement.transmittingFusedLTE(iTx); 36 | 37 | % Separate all other vehicles to itself 38 | if activeIDsCV2X(indexSensedV)~=activeIDsCV2X(indexSensingV) 39 | % If not itself, add the received power 40 | rxPsums_MHz(BRFsensedV) = rxPsums_MHz(BRFsensedV) + P_RX_MHz_LTE(indexSensingV,indexSensedV); 41 | else 42 | % Including itself allows simulating full duplex devices 43 | % If itself, add the Tx power multiplied by Ksi (set to inf 44 | % if the devices are half duplex) 45 | rxPsums_MHz(BRFsensedV) = rxPsums_MHz(BRFsensedV) + phyParams.Ksi*phyParams.P_ERP_MHz_CV2X(activeIDsCV2X(indexSensingV)); 46 | end 47 | end 48 | % Find total received power using IBE 49 | % Including possible interference from 11p (note: the 50 | % interfering power is already calculated per BR) 51 | for BRFi = 1:NbeaconsF 52 | sensedPower_MHz(BRFi,indexSensingV) = phyParams.IBEmatrixData(BRFi,:)*rxPsums_MHz; 53 | end 54 | end 55 | end -------------------------------------------------------------------------------- /MainFilesIEEE802.11p/freezeBackoff11p.m: -------------------------------------------------------------------------------- 1 | function nSlotBackoff = freezeBackoff11p(timeNow,timeNextTxRx,tSlot,nSlotBackoff) 2 | % The backoff counter is freezed 3 | 4 | % a small interval of -1e-9 is added for the problems with floating point 5 | % numbers 6 | 7 | nSlotBackoff = max( min(ceil((timeNextTxRx-timeNow-1e-9)/tSlot),nSlotBackoff) ,0); 8 | -------------------------------------------------------------------------------- /MainFilesIEEE802.11p/resumeBackoff11p.m: -------------------------------------------------------------------------------- 1 | function timeNextTxRx = resumeBackoff11p(timeNow,nSlotBackoff,tAifs,tSlot) 2 | % The backoff is resumed after having been freezed 3 | 4 | timeNextTxRx = round(timeNow + tAifs + nSlotBackoff * tSlot, 10); 5 | 6 | end -------------------------------------------------------------------------------- /MainFilesIEEE802.11p/startNewBackoff11p.m: -------------------------------------------------------------------------------- 1 | function [nSlot, timeNextTxRx] = startNewBackoff11p(timeNow,CW,tAifs,tSlot) 2 | % Function that performs backoff in IEEE 802.11p 3 | 4 | nSlot = randi(CW); 5 | timeNextTxRx = round(timeNow + tAifs + nSlot * tSlot, 10); 6 | 7 | -------------------------------------------------------------------------------- /MatCBRcalculations/printCBRToFileCV2X.m: -------------------------------------------------------------------------------- 1 | function printCBRToFileCV2X(stationManagement,simParams,outParams,phyParams) 2 | % Print CBR statistics 3 | 4 | %% CBR LTE statistic 5 | % I remove the first 10 values of CBR to consider a minimum of transitory 6 | if length(stationManagement.cbrCV2Xvalues(1,:))>10 7 | stationManagement.cbrCV2Xvalues(:,1:10) = []; 8 | end 9 | 10 | for iChannel=1:phyParams.nChannels 11 | 12 | if sum(stationManagement.vehicleChannel==iChannel)==0 13 | continue; 14 | end 15 | 16 | if phyParams.nChannels==1 17 | cbrOutputFileName = sprintf('%s/CBRstatistic_%.0f_%s.xls',outParams.outputFolder,outParams.simID,simParams.stringCV2X); 18 | else 19 | cbrOutputFileName = sprintf('%s/CBRstatistic_%.0f_%s_C%d.xls',outParams.outputFolder,outParams.simID,simParams.stringCV2X,iChannel); 20 | end 21 | 22 | cbrVector = stationManagement.cbrCV2Xvalues(stationManagement.vehicleChannel==iChannel,:); 23 | cbrVector = reshape(cbrVector,[],1); 24 | values = cbrVector(cbrVector>=0); 25 | [F,X] = ecdf(values); 26 | 27 | fileID = fopen(cbrOutputFileName,'w'); 28 | for i=1:length(F) 29 | fprintf(fileID,'%f\t%f\n',X(i),F(i)); 30 | end 31 | fclose(fileID); 32 | 33 | %% CBR_LTE_only 34 | if simParams.technology ~= 1 % not only LTE 35 | if length(stationManagement.coex_cbrLteOnlyValues(1,:))>10 36 | stationManagement.coex_cbrLteOnlyValues(:,1:10) = []; 37 | end 38 | valuesCbrLteOnly = stationManagement.coex_cbrLteOnlyValues(stationManagement.coex_cbrLteOnlyValues~=-1); 39 | [F2,X2] = ecdf(valuesCbrLteOnly); 40 | cbrOutputFileName = sprintf('%s/coex_cv2xOnly_CBRstatistic_%.0f_%s.xls',outParams.outputFolder,outParams.simID,simParams.stringCV2X); 41 | fileID2 = fopen(cbrOutputFileName,'w'); 42 | for i=1:length(F2) 43 | fprintf(fileID2,'%f\t%f\n',X2(i),F2(i)); 44 | end 45 | fclose(fileID2); 46 | end 47 | end 48 | 49 | %% Generic vehicle 50 | if ~isempty(stationManagement.activeIDsCV2X) 51 | idTest = stationManagement.activeIDsCV2X(1); 52 | 53 | cbrOutputFileName = sprintf('%s/CBRofGenericVehicle_%.0f_%s.xls',outParams.outputFolder,outParams.simID,simParams.stringCV2X); 54 | values = stationManagement.cbrCV2Xvalues(idTest,:); 55 | time = (10+(1:length(values))) * simParams.cbrSensingInterval; 56 | fileID = fopen(cbrOutputFileName,'w'); 57 | for i=1:length(values) 58 | if values(i)>=0 59 | fprintf(fileID,'%f\t%f\n',time(i),values(i)); 60 | end 61 | end 62 | fclose(fileID); 63 | end 64 | 65 | -------------------------------------------------------------------------------- /MatCBRcalculations/printCBRToFileITSG5.m: -------------------------------------------------------------------------------- 1 | function printCBRToFileITSG5(stationManagement,simParams,outParams,phyParams) 2 | % Print CBR statistics 3 | 4 | % I remove the first 10 values of CBR to consider a minimum of transitory 5 | if length(stationManagement.cbr11pValues(1,:))>10 6 | stationManagement.cbr11pValues(:,1:10) = []; 7 | end 8 | 9 | for iChannel=1:phyParams.nChannels 10 | 11 | if sum(stationManagement.vehicleChannel==iChannel)==0 12 | continue; 13 | end 14 | 15 | if phyParams.nChannels==1 16 | cbrOutputFileName = sprintf('%s/CBRstatistic_%.0f_11p.xls',outParams.outputFolder,outParams.simID); 17 | else 18 | cbrOutputFileName = sprintf('%s/CBRstatistic_%.0f_11p_C%d.xls',outParams.outputFolder,outParams.simID,iChannel); 19 | end 20 | 21 | cbrVector = stationManagement.cbr11pValues(stationManagement.vehicleChannel==iChannel,:); 22 | cbrVector = reshape(cbrVector,[],1); 23 | values = cbrVector(cbrVector>=0); 24 | [F,X] = ecdf(values); 25 | fileID = fopen(cbrOutputFileName,'w'); 26 | for i=1:length(F) 27 | fprintf(fileID,'%f\t%f\n',X(i),F(i)); 28 | end 29 | fclose(fileID); 30 | end 31 | 32 | if ~isempty(stationManagement.activeIDs11p) 33 | idTest = stationManagement.activeIDs11p(1); 34 | 35 | cbrOutputFileName = sprintf('%s/CBRofGenericVehicle_%.0f_11p.xls',outParams.outputFolder,outParams.simID); 36 | values = stationManagement.cbr11pValues(idTest,:); 37 | time = (10+(1:length(values))) * simParams.cbrSensingInterval; 38 | fileID = fopen(cbrOutputFileName,'w'); 39 | for i=1:length(values) 40 | if values(i)>=0 41 | fprintf(fileID,'%f\t%f\n',time(i),values(i)); 42 | end 43 | end 44 | fclose(fileID); 45 | end 46 | -------------------------------------------------------------------------------- /MatFilesCoexistence/coexistence11pPreambleInLTEbefore_TEMP.m: -------------------------------------------------------------------------------- 1 | function interfFromAdditionalPreamble = coexistence11pPreambleInLTEbefore_TEMP(timeManagement,stationManagement,sinrManagement,phyParams,appParams,simValues) 2 | 3 | % BR adopted in the time domain (i.e., TTI) 4 | BRidT = ceil((stationManagement.BRid)/appParams.NbeaconsF); 5 | BRidT(stationManagement.BRid<=0)=-1; 6 | 7 | % Upcoming subframe 8 | upcoming_subframe = (floor(timeManagement.timeNow/phyParams.Tsf)+1)+1; 9 | 10 | % Find IDs of vehicles that are transmitting in the next subframe 11 | IDvehicleTXLTEnextSF = find(BRidT == (mod((upcoming_subframe-1),appParams.NbeaconsT)+1), 1); 12 | 13 | if ~isempty(IDvehicleTXLTEnextSF) 14 | indexVehicleTXLTEnextSF = zeros(length(IDvehicleTXLTEnextSF),1); 15 | for i=1:length(IDvehicleTXLTEnextSF) 16 | indexVehicleTXLTEnextSF(i) = find(stationManagement.activeIDs==IDvehicleTXLTEnextSF(i)); 17 | end 18 | interfFromAdditionalPreamble = phyParams.BwMHz_cv2xBR * sum((sinrManagement.P_RX_MHz(:,indexVehicleTXLTEnextSF)),2); 19 | % The value is set to infinite for LTE nodes as it should not have impact 20 | % in such case 21 | interfFromAdditionalPreamble(stationManagement.activeIDsCV2X) = inf; 22 | return; 23 | end 24 | % If no LTE node will transmit in the next subframe, it should remain zero 25 | interfFromAdditionalPreamble = zeros(simValues.maxID,1); 26 | -------------------------------------------------------------------------------- /MatFilesCoexistence/coexistenceAtLTEsubframeEnd.m: -------------------------------------------------------------------------------- 1 | function [timeManagement,stationManagement,sinrManagement,outputValues] = coexistenceAtLTEsubframeEnd(timeManagement,stationManagement,sinrManagement,simParams,simValues,phyParams,outParams,outputValues) 2 | 3 | % 1. The average SINR of 11p is updated 4 | sinrManagement = updateSINR11p(timeManagement,sinrManagement,stationManagement,phyParams); 5 | 6 | % 2. The inteference from LTE is reset 7 | sinrManagement.coex_InterfFromLTEto11p = zeros(simValues.maxID,1); 8 | 9 | % 3. 11p nodes might sense the channel as free and resume a 10 | % possibly freezed backoff 11 | [timeManagement,stationManagement,sinrManagement,outputValues] = checkVehiclesStopReceiving11p(timeManagement,stationManagement,sinrManagement,simParams,phyParams,outParams,outputValues); 12 | -------------------------------------------------------------------------------- /MatFilesCoexistence/coexistenceInterferenceOfEnergySignalsBeforeSuperFrame.m: -------------------------------------------------------------------------------- 1 | function interfFromEnergySignals = coexistenceInterferenceOfEnergySignalsBeforeSuperFrame(timeManagement,stationManagement,sinrManagement,phyParams,simParams,simValues) 2 | 3 | %% From v5.2.10 4 | % All LTE nodes sense if the channel is busy 5 | % If they sense the channel busy they do not transmit the energy signal 6 | 7 | % Threshold of -94 dBm per subchannel 8 | thresh_subchannel = 10^((-94-30)/10); % fixed in this version 9 | thresh_perBeaconResource = thresh_subchannel * phyParams.NsubchannelsBeacon; 10 | % Sensed power 11 | % Note: coex_averageSFinterfFrom11pToLTE is per beacon resource 12 | sensedPower = sinrManagement.coex_averageTTIinterfFrom11pToLTE(stationManagement.activeIDsCV2X); 13 | 14 | % Nodes that sense the channel as idle are selected 15 | sensedIdle = (sensedPower < thresh_perBeaconResource); 16 | 17 | % Index of those nodes are saved in a vector and used to calculate the 18 | % energy signal 19 | indexOfTxEnergySignals = stationManagement.indexInActiveIDs_ofLTEnodes(sensedIdle); 20 | interfFromEnergySignals = zeros(simValues.maxID,1); 21 | interfFromEnergySignals(stationManagement.activeIDs) = phyParams.BwMHz_cv2xBR * sum((sinrManagement.P_RX_MHz(:,indexOfTxEnergySignals)),2); 22 | 23 | %% Up to v5.2.9 24 | %interfFromEnergySignals = phyParams.BwMHz_cv2xBR * sum((sinrManagement.P_RX_MHz(:,stationManagement.indexInActiveIDs_ofLTEnodes)),2); 25 | -------------------------------------------------------------------------------- /MatFilesCoexistence/coexistenceInterferenceOfEnergySignalsEmptySF.m: -------------------------------------------------------------------------------- 1 | function interfFromEnergySignals = coexistenceInterferenceOfEnergySignalsEmptySF(timeManagement,stationManagement,sinrManagement,phyParams,appParams,simParams,simValues) 2 | 3 | % Same as calculated for the CBR 4 | thresh_subchannel = 10^((-94-30)/10); % fixed in this version 5 | thresh_PerRB = thresh_subchannel/phyParams.sizeSubchannel; 6 | 7 | % Current TTI 8 | current_TTI_in_superframe = floor(mod(timeManagement.timeNow+1e-7,simParams.coex_superFlength)/phyParams.TTI)+1; 9 | 10 | % Inizialization of the output 11 | interfFromEnergySignals = zeros(simValues.maxID,1); 12 | 13 | %% Find IDs of vehicles that are currently sensing the channel as idle; 14 | % Sense the channel - the following matrix is NbeaconsF x nVehicles 15 | sinrManagement.sensedPowerByLteNo11p = sensedPowerCV2X(stationManagement,sinrManagement,appParams,phyParams); 16 | sensedPower = sinrManagement.sensedPowerByLteNo11p + repmat((sinrManagement.coex_averageTTIinterfFrom11pToLTE(stationManagement.activeIDsCV2X))',appParams.NbeaconsF,1); 17 | % Check if the channel is sensed as idle 18 | sensedBusy = sum(( sensedPower > thresh_PerRB),1); 19 | 20 | % Check if in the LTE part 21 | ifInLTEpart = current_TTI_in_superframe <= sinrManagement.coex_NtotTTILTE(stationManagement.activeIDsCV2X); 22 | 23 | if sum(sensedBusy==0)>0 24 | 25 | if simParams.coexB_allToTransmitInEmptySF 26 | idTxEnergySignals = stationManagement.activeIDsCV2X((sensedBusy==0)' & ifInLTEpart); 27 | else 28 | % Only those nodes that will transmit in the remaining LTE slot 29 | BRidT = ceil((stationManagement.BRid(:,1))/appParams.NbeaconsF); 30 | BRidT(stationManagement.BRid(:,1)<=0) = 0; 31 | BRidInSuperframe = mod(BRidT-1,simParams.coex_superframeTTI)+1; 32 | idTxEnergySignals = stationManagement.activeIDsCV2X(... 33 | (sensedBusy==0)' & ifInLTEpart &... 34 | (BRidInSuperframe(stationManagement.activeIDsCV2X)>current_TTI_in_superframe)... 35 | ); 36 | end 37 | indexTxEnergySignals = zeros(length(idTxEnergySignals),1); 38 | for i=1:length(idTxEnergySignals) 39 | indexTxEnergySignals(i) = find(stationManagement.activeIDs==idTxEnergySignals(i)); 40 | end 41 | interfFromEnergySignals(stationManagement.activeIDs) = phyParams.BwMHz_cv2xBR * (sum(sinrManagement.P_RX_MHz(:,indexTxEnergySignals),2)); 42 | % the interference is not relevant for LTE nodes... 43 | % those sending the signal must consider this channel as free 44 | % if there are others, they are assumed not to sense the sent energy signal 45 | interfFromEnergySignals(stationManagement.activeIDsCV2X)=inf; 46 | end -------------------------------------------------------------------------------- /MatFilesCoexistence/coexistenceStartNewBackoff11pModified.m: -------------------------------------------------------------------------------- 1 | function [nSlot, timeNextTxRx] = coexistenceStartNewBackoff11pModified(timeNow,CW,tAifs,tSlot,subframeIndex,superframeLength) 2 | % Function that performs backoff in IEEE 802.11p 3 | 4 | CWmodified = max(1,CW*floor(10*(superframeLength-subframeIndex)/superframeLength)); 5 | nSlot = randi(CWmodified); 6 | timeNextTxRx = round(timeNow + tAifs + nSlot * tSlot, 10); 7 | 8 | end -------------------------------------------------------------------------------- /MatFilesInit/addNewParam.m: -------------------------------------------------------------------------------- 1 | function [structureChanged,varargin] = addNewParam(structureToChange,field,defaultValue,paramDescription,paramType,fileCfg,varargin) 2 | % Function to create a new parameter 3 | 4 | sourceForValue = 0; % 0: default 5 | value = defaultValue; 6 | valueInCfg = searchParamInCfgFile(fileCfg,field,paramType); 7 | if ~isnan(valueInCfg) 8 | value = valueInCfg; 9 | sourceForValue = 1; % 1: file config 10 | end 11 | for i=1:(length(varargin{1}))/2 12 | if strcmpi(varargin{1,1}{2*i-1},field) 13 | value = varargin{1,1}{2*i}; 14 | sourceForValue = 2; % 2: command line 15 | % I remove this parameter and value from varargin 16 | % This allows to check that all parameters are correctly given in 17 | % input 18 | varargin{1}(2*i-1) = []; 19 | varargin{1}(2*i-1) = []; 20 | break; 21 | end 22 | end 23 | 24 | % Print to command window 25 | fprintf('%s:\t',paramDescription); 26 | fprintf('[%s] = ',field); 27 | if strcmpi(paramType,'integer') 28 | if ~isnumeric(value) || mod(value,1)~=0 29 | error('Error: parameter %s must be an integer.',field); 30 | end 31 | fprintf('%.0f ',value); 32 | elseif strcmpi(paramType,'double') 33 | if ~isnumeric(value) 34 | error('Error: parameter %s must be a number.',field); 35 | end 36 | fprintf('%f ',value); 37 | elseif strcmpi(paramType,'string') 38 | if ~isstring(value) && ~ischar(value) 39 | error('Error: parameter %s must be a string.',field); 40 | end 41 | fprintf('%s ',value); 42 | elseif strcmpi(paramType,'bool') 43 | if ~islogical(value) 44 | error('Error: parameter %s must be a boolean.',field); 45 | end 46 | if value == true 47 | fprintf('true '); 48 | else 49 | fprintf('false '); 50 | end 51 | elseif strcmpi(paramType,'integerOrArrayString') 52 | if ischar(value) 53 | value = str2num(value); 54 | end 55 | for iValue=1:length(value) 56 | if ~isnumeric(value(iValue)) || mod(value(iValue),1)~=0 57 | error('Error: parameter %s must be an integer or a string with integers.',field); 58 | end 59 | if iValue>1 60 | fprintf(','); 61 | end 62 | fprintf('%.0f',value(iValue)); 63 | end 64 | fprintf(' '); 65 | else 66 | error('Error in addNewParam: paramType can be only integer, double, string, or bool.'); 67 | end 68 | if sourceForValue==0 69 | fprintf('(default)\n'); 70 | elseif sourceForValue==1 71 | fprintf('(file %s)\n',fileCfg); 72 | else 73 | fprintf('(command line)\n'); 74 | end 75 | structureChanged = setfield(structureToChange,field,value); 76 | 77 | 78 | -------------------------------------------------------------------------------- /MatFilesInit/getseed.m: -------------------------------------------------------------------------------- 1 | function [seed] = getseed() 2 | %GETSEED Summary of this function goes here 3 | % Detailed explanation goes here 4 | t = clock; 5 | tstring = string(t); 6 | seed = ""; 7 | for i = 1:length(tstring) 8 | seed = seed + tstring(i); 9 | end 10 | seed = mod(str2double(seed)*1e4, 2^32); 11 | seed = ceil(seed); 12 | end 13 | 14 | -------------------------------------------------------------------------------- /MatFilesInit/initiateParameters.m: -------------------------------------------------------------------------------- 1 | function [simParams,appParams,phyParams,outParams] = initiateParameters(varargin) 2 | % Function to initialize simulator parameters 3 | 4 | nArgs = length(varargin{1}); 5 | 6 | %%%%%%%%% 7 | % Check file config and read parameters 8 | if nArgs < 1 || strcmp(varargin{1}{1},'0') || strcmp(varargin{1}{1},'default') 9 | fileCfg = 'WiLabV2Xsim.cfg'; 10 | elseif mod(nArgs-1,2)~=0 11 | error('Error in the number or value of input parameters. Simulation aborted.'); 12 | elseif nArgs == 1 && strcmp(varargin{1}{1},'help') 13 | fileCfg = ''; 14 | else 15 | fileCfg = char(varargin{1}{1}); 16 | end 17 | fid = fopen(fileCfg); 18 | if fid==-1 19 | if ~strcmp(varargin{1}{1},'help') 20 | error('File config "%s" not found. Simulation stoppted.\n\n',fileCfg); 21 | end 22 | else 23 | fclose(fid); 24 | end 25 | %%%%%%%%% 26 | varargin{1}(1) = []; 27 | if mod(length(varargin{1}),2)==1 28 | error('Error in the command line: an even number of inputs is needed after the config file'); 29 | end 30 | 31 | % Initialize Simulation parameters 32 | [simParams,varargin] = initiateMainSimulationParameters(fileCfg,varargin{1}); 33 | simParams.fileCfg = fileCfg; 34 | 35 | % Initialize Application parameters 36 | [appParams,simParams,varargin] = initiateApplicationParameters(simParams,fileCfg,varargin{1}); 37 | 38 | % Initialize PHY layer parameters 39 | [phyParams,varargin] = initiatePhyParameters(simParams,appParams,fileCfg,varargin{1}); 40 | 41 | % Initialize Output parameters 42 | [outParams,varargin] = initiateOutParameters(simParams,phyParams,fileCfg,varargin{1}); 43 | 44 | % C-V2X derived parameters 45 | if simParams.technology ~= constants.TECH_ONLY_11P % not only 11p 46 | 47 | % Initialize CV2X resource assignement algorithm parameters 48 | [simParams,phyParams,varargin] = initiateBRAssignmentAlgorithm(simParams,phyParams,appParams.allocationPeriod,fileCfg,varargin{1}); 49 | 50 | % Derive CV2X resources available for beaconing (Beacon Resources) 51 | [appParams,phyParams,varargin] = deriveBeaconResources(simParams,appParams,phyParams,fileCfg,varargin{1}); 52 | end 53 | 54 | % Additional parameters (currently only RSUs with DENM) 55 | [simParams,appParams,phyParams,varargin] = initiateSpecificCasesParameters(simParams,appParams,phyParams,fileCfg,varargin{1}); 56 | 57 | if ~isempty(varargin{1}) 58 | sError = sprintf('Error in the command line: '); 59 | for i=1:length(varargin{1})/2 60 | sErrorToCat = sprintf('Parameter [%s] not accepted. ',char(varargin{1}(i*2-1))); 61 | sError = strcat(sError,sErrorToCat); 62 | end 63 | error(sError); 64 | end 65 | 66 | end 67 | -------------------------------------------------------------------------------- /MatFilesInit/initiateSpecificCasesParameters.m: -------------------------------------------------------------------------------- 1 | function [simParams,appParams,phyParams,varargin] = initiateSpecificCasesParameters(simParams,appParams,phyParams,fileCfg,varargin) 2 | % 3 | % Settings of specific cases 4 | 5 | fprintf('Additional settings\n'); 6 | 7 | % Packet types: normally only CAMs, which are Type 1 8 | appParams.nPckTypes = 1; 9 | 10 | % [RSUcfg] 11 | [appParams,varargin]= addNewParam(appParams,'RSUcfg','null','Config file for RSUs - Null if no RSUs','string',fileCfg,varargin{1}); 12 | if ~strcmpi(appParams.RSUcfg,'null') 13 | if ~exist(appParams.RSUcfg, 'file') 14 | error('File cfg of RSUs ("%s") does not exist. Set "Null" if no RSUs are to be used.',appParams.RSUcfg); 15 | end 16 | appParams = readRSUconfig(appParams.RSUcfg,appParams); 17 | else 18 | appParams.nRSUs = 0; 19 | end 20 | appParams = rmfield( appParams , 'RSUcfg' ); 21 | 22 | % [MCOcfg] 23 | [phyParams,varargin]= addNewParam(phyParams,'nChannels',1,'Number of channels','integer',fileCfg,varargin{1}); 24 | if phyParams.nChannels==-1 25 | error('Missing field in MCO config file %s: "NumberOfChannels"',fileName); 26 | end 27 | if phyParams.nChannels<1 28 | error('Number of channels must be positive'); 29 | end 30 | if phyParams.nChannels>1 31 | [appParams,phyParams,varargin] = mco_initiateParameters(fileCfg,appParams,phyParams,varargin{1}); 32 | end 33 | 34 | fprintf('\n'); 35 | % 36 | %%%%%%%%% 37 | -------------------------------------------------------------------------------- /MatFilesInit/readRSUconfig.m: -------------------------------------------------------------------------------- 1 | function [appParams] = readRSUconfig(fileName,appParams) 2 | 3 | appParams.nRSUs = searchParamInCfgFile(fileName,'NumberOfRSUs','integer'); 4 | if appParams.nRSUs==-1 5 | error('Missing field in RSU config file %s: "NumberOfRSUs"',fileName); 6 | end 7 | if appParams.nRSUs==0 8 | return; 9 | end 10 | 11 | appParams.RSU_technology = searchParamInCfgFile(fileName,'Technology','string'); 12 | if appParams.RSU_technology==-1 13 | error('Missing field in RSU config file %s: "Technology"',fileName); 14 | end 15 | if ~strcmpi(appParams.RSU_technology,'11p') && ~strcmpi(appParams.RSU_technology,'LTE') 16 | error('Technology must be "11p" or "LTE"'); 17 | end 18 | 19 | appParams.RSU_pckTypeString = searchParamInCfgFile(fileName,'PacketType','string'); 20 | if appParams.RSU_pckTypeString==-1 21 | error('Missing field in RSU config file %s: "PacketType"',fileName); 22 | end 23 | if strcmpi(appParams.RSU_pckTypeString,'CAM') 24 | % nothing to do 25 | elseif strcmpi(appParams.RSU_pckTypeString,'DENM') || strcmpi(appParams.RSU_pckTypeString,'hpDENM') 26 | if ~strcmpi(appParams.RSU_technology,'11p') 27 | error('DENM and high priority DENM implemented only in "11p"'); 28 | end 29 | appParams.nPckTypes = 2; 30 | else 31 | error('RSU packet type %s invalid: only CAM, DENM, or hpDENM',appParams.RSU_pckTypeString); 32 | end 33 | 34 | appParams.RSU_xLocation = searchParamInCfgFile(fileName,'xLocation','integerOrArrayString'); 35 | if appParams.RSU_xLocation==-1 36 | error('Missing field in RSU config file %s: "xLocation"',fileName); 37 | end 38 | if length(appParams.RSU_xLocation)~=appParams.nRSUs 39 | error('The list of x positions in the RSU config %s is not correct for %s RSUs',fileName,appParams.nRSUs); 40 | end 41 | 42 | appParams.RSU_yLocation = searchParamInCfgFile(fileName,'yLocation','integerOrArrayString'); 43 | if appParams.RSU_yLocation==-1 44 | error('Missing field in RSU config file %s: "yLocation"',fileName); 45 | end 46 | if length(appParams.RSU_yLocation)~=appParams.nRSUs 47 | error('The list of y positions in the RSU config %s is not correct for %s RSUs',fileName,appParams.nRSUs); 48 | end 49 | -------------------------------------------------------------------------------- /MatFilesInit/searchParamInCfgFile.m: -------------------------------------------------------------------------------- 1 | function value = searchParamInCfgFile(filename,paramname,paramType) 2 | % Function used to search for a given parameter in the config file 3 | 4 | value = NaN; 5 | 6 | fid = fopen(filename); 7 | if fid==-1 8 | return 9 | end 10 | [C]=textscan(fid,'%s %s','CommentStyle','%'); 11 | fclose(fid); 12 | 13 | params = C{1}; 14 | values = C{2}; 15 | for i=1:length(params) 16 | parameter = char(params(i)); 17 | if parameter(1)=='[' && parameter(end)==']' && strcmpi(parameter(2:end-1),paramname) 18 | 19 | if strcmpi(paramType,'integer') || strcmpi(paramType,'double') 20 | value = str2double(values(i)); 21 | elseif strcmpi(paramType,'string') 22 | value = values{i}; 23 | elseif strcmpi(paramType,'bool') 24 | 25 | if strcmpi(values(i),'true') 26 | value = true; 27 | elseif strcmpi(values(i),'false') 28 | value = false; 29 | else 30 | values{i} 31 | error('Error: parameter %s must be a boolean.',params(i)); 32 | end 33 | elseif strcmpi(paramType,'integerOrArrayString') 34 | %if ischar(values(i)) 35 | value = str2num(values{i}); 36 | %else 37 | % value = str2double(values(i)); 38 | %end 39 | else 40 | error('Error in searchParamInCfgFile: paramType can be only integer, double, string, or bool.'); 41 | end 42 | 43 | return 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /MatFilesOut/printHiddenNodeProb.m: -------------------------------------------------------------------------------- 1 | function printHiddenNodeProb(outputValues,outParams) 2 | % Print to file the hidden node probability 3 | % [distance(m) - Nevents - hidden node probability] 4 | 5 | filename = sprintf('%s/hiddenNodeProb_%.0f_%.0f.xls',outParams.outputFolder,outParams.simID,outParams.Pth_dBm); 6 | fileID = fopen(filename,'at'); 7 | 8 | for i = 1:length(outputValues.hiddenNodeSumProb) 9 | fprintf(fileID,'%.0f\t%.0f\t%.6f\n',i,outputValues.hiddenNodeProbEvents(i),outputValues.hiddenNodeSumProb(i)/outputValues.hiddenNodeProbEvents(i)); 10 | end 11 | 12 | fclose(fileID); 13 | 14 | end -------------------------------------------------------------------------------- /MatFilesOut/printNeighborsToFile.m: -------------------------------------------------------------------------------- 1 | function printNeighborsToFile(time,positionManagement,Nvehicles,averageNeighborsRawLTE,averageNeighborsRaw11p,outParams,phyParams) 2 | % Print number of neighbors per vehicle at each snapshot for traffic trace 3 | % analysis (CDF plot) 4 | 5 | filename8 = sprintf('%s/neighbors_%.0f.xls',outParams.outputFolder,outParams.simID); 6 | fileID = fopen(filename8,'at'); 7 | 8 | fprintf(fileID,'%f\t',time); 9 | for k = 1:length(phyParams.Raw) 10 | if k==1 11 | distanceCheck = positionManagement.distanceReal(:,:)=phyParams.Raw(k-1) & positionManagement.distanceReal(:,:)>phyParams.Raw(k)); 14 | end 15 | avNeighborsTot = sum(sum(distanceCheck))/Nvehicles; 16 | fprintf(fileID,'%d\t%d\t%d',averageNeighborsRawLTE(k),averageNeighborsRaw11p(k),avNeighborsTot); 17 | if k4 13 | speedNow = dataTrace(fileIndex,5); 14 | end 15 | 16 | % Sort IDvehicle, XvehicleReal and YvehicleReal by IDvehicle 17 | [IDvehicle,indexOrder] = sort(IDvehicle); 18 | XvehicleReal = XvehicleReal(indexOrder); 19 | YvehicleReal = YvehicleReal(indexOrder); 20 | if length(dataTrace(1,:))>4 21 | speedNow = speedNow(indexOrder); 22 | else 23 | speedNow = (((YvehicleReal - YvehiclePrevious).^2 + (XvehicleReal - XvehiclePrevious).^2).^0.5) / (time-tPrevious); 24 | end 25 | 26 | direction = complex((XvehicleReal - XvehiclePrevious),(YvehicleReal - YvehiclePrevious))'; 27 | 28 | [~,indexNewVehicles] = setdiff(IDvehicle,oldIDvehicle,'stable'); 29 | 30 | % Find IDs of vehicles that are exiting the scenario 31 | IDvehicleExit = setdiff(oldIDvehicle,IDvehicle); 32 | 33 | % Find indices of vehicles in IDvehicle that are both in IDvehicle and OldIDvehicle 34 | indexOldVehicles = find(ismember(IDvehicle,oldIDvehicle)); 35 | 36 | % Find indices of vehicles in OldIDvehicle that are both in IDvehicle and OldIDvehicle 37 | indexOldVehiclesToOld = find(ismember(oldIDvehicle,IDvehicle)); 38 | 39 | %figure(1) 40 | %plot(XvehicleReal,YvehicleReal,'p'); 41 | 42 | if length(dataTrace(1,:))==4 43 | speedNow = zeros(length(IDvehicle),1); 44 | for i=1:length(IDvehicle) 45 | iOld = find(oldIDvehicle==IDvehicle(i)); 46 | if ~isempty(iOld) 47 | speedNow(i) = sqrt((XvehicleReal(i)-XvehiclePrevious(iOld)).*(XvehicleReal(i)-XvehiclePrevious(iOld)) + ... 48 | (YvehicleReal(i)-YvehiclePrevious(iOld)).*(YvehicleReal(i)-YvehiclePrevious(iOld)))/(time-timePrevious); 49 | %else 50 | % speedNow(i) = 0; 51 | end 52 | 53 | % if IDvehicle(i)==1 54 | % figure(2) 55 | % plot(time,speedNow(i),'pr'); 56 | % hold on 57 | % end 58 | end 59 | end 60 | 61 | % Print speed (if enabled) 62 | if ~isempty(outParams) && outParams.printSpeed 63 | printSpeedToFile(time,IDvehicle,speedNow,simValues.maxID,outParams); 64 | end 65 | -------------------------------------------------------------------------------- /MatFilesResourceAllocationCV2X/BRreassignmentControlled.m: -------------------------------------------------------------------------------- 1 | function [BRid, Nreassign] = BRreassignmentControlled(IDvehicle,scheduledID,distance,BRid,Nbeacons,Rreuse) 2 | % [CONTROLLED CASE with Rreuse and scheduled vehicles] 3 | % Reassign BRs first to blocked vehicles, then to scheduledID vehicles 4 | 5 | % NOTE: this algorithm is not optimized with IBE 6 | % (it could be improved with the same approach as BR Algorithm 7) 7 | 8 | % Find blocked vehicles 9 | blockedID = find(BRid==-1); 10 | blockedIndex = find(BRid(IDvehicle)==-1); 11 | Nb = length(blockedIndex); 12 | 13 | % Assign resources to blocked vehicles 14 | if Nb~=0 15 | p1 = randperm(Nb); % Generate random permutation vector 16 | % Assign BRs to blocked vehicles 17 | for i = 1:Nb 18 | z = p1(i); 19 | ID = IDvehicle(blockedIndex(z,1)); 20 | p2 = randperm(Nbeacons); % Generate random permutation vector 21 | for j = 1:Nbeacons % Check all possible BRs 22 | BR = p2(j); 23 | found = 0; % Becomes 1 if there is a vehicle using that BR within reuse distance 24 | intIndex = find(BRid(IDvehicle)==BR); 25 | for k = 1:length(intIndex) 26 | if distance(blockedIndex(z,1),intIndex(k)) (sinrManagement.coex_NtotTTILTE(1)*appParams.NbeaconsF) 35 | BRid(idV) = 0; 36 | end 37 | end 38 | 39 | % If it is outside the interval given by T1 and T2 it is not acceptable 40 | if T1>1 || T2TTILastPacket+T2 46 | BRid(idV) = 0; 47 | end 48 | % IF Both are beyond this beacon period 49 | elseif (TTILastPacket+T1-1)>appParams.NbeaconsT 50 | if TselectedTTILastPacket+T2-appParams.NbeaconsT 51 | BRid(idV) = 0; 52 | end 53 | % IF T1 within, T2 beyond 54 | else 55 | if TselectedTTILastPacket+T2-appParams.NbeaconsT 56 | BRid(idV) = 0; 57 | end 58 | end 59 | end 60 | end 61 | end 62 | 63 | Nreassign = Nvehicles; 64 | 65 | end -------------------------------------------------------------------------------- /MatFilesResourceAllocationCV2X/findRCintervalAutonomous.m: -------------------------------------------------------------------------------- 1 | function [minRandValue,maxRandValue] = findRCintervalAutonomous(Tbeacon,simParams) 2 | % The min and max values for the random counter are set as in TS 36.321 3 | 4 | if Tbeacon>=0.1 5 | minRandValue = 5; 6 | maxRandValue = 15; 7 | elseif Tbeacon>=0.05 8 | minRandValue = 10; 9 | maxRandValue = 30; 10 | else 11 | minRandValue = 25; 12 | maxRandValue = 75; 13 | end 14 | 15 | if simParams.minRandValueMode4~=-1 16 | minRandValue = simParams.minRandValueMode4; 17 | end 18 | if simParams.maxRandValueMode4~=-1 19 | maxRandValue = simParams.maxRandValueMode4; 20 | end 21 | if maxRandValue <= minRandValue 22 | error('Error: in 3GPP Mode 4, "maxRandValue" must be larger than "minRandValue"'); 23 | end 24 | 25 | end -------------------------------------------------------------------------------- /MatFilesSINR/readPERtable.m: -------------------------------------------------------------------------------- 1 | function [sinrVectorOut,PERout,sinr_dB_fromtable,PER_fromtable,sinr_lin_fromtable_interp,PER_interp] = readPERtable(fileName,nInterp) 2 | 3 | if ~exist(fileName,'file') 4 | fprintf('Input file %s does not exist',fileName); 5 | error(''); 6 | end 7 | PERtable_ori = load(fileName); 8 | [PERtable(:,2),I]=unique(PERtable_ori(:,2),'stable'); 9 | PERtable(:,1)=PERtable_ori(I,1); 10 | 11 | sinr_dB_fromtable = PERtable(:,1); 12 | PER_fromtable = PERtable(:,2); 13 | 14 | 15 | if PER_fromtable(1)~=1 16 | PER_fromtable = [1; PER_fromtable]; 17 | sinr_dB_fromtable = [sinr_dB_fromtable(1)-0.01; sinr_dB_fromtable]; 18 | end 19 | 20 | if PER_fromtable(end)==0 21 | PER_fromtable(end) = 1e-8; 22 | elseif PER_fromtable(end)~=0 23 | PER_fromtable(end+1) = 1e-8; 24 | sinr_dB_fromtable(end+1) = sinr_dB_fromtable(end)+0.01; 25 | end 26 | 27 | % if PER_fromtable(1)~=0 || PER_fromtable(end)~=1 28 | % error('Extreme cases of PER to be defined'); 29 | % end 30 | 31 | 32 | % Interpolation, with uniform steps in BLER domain 33 | PER_step = 1/nInterp; 34 | PER_interp = PER_step:PER_step:1; 35 | %gamma_dB_fromtable_interp = interp1(PER_fromtable,gamma_dB_fromtable,PER_interp); 36 | %sinr_lin_fromtable = 10.^(sinr_dB_fromtable/10); 37 | %sinr_lin_fromtable_interp = interp1(PER_fromtable,sinr_lin_fromtable,PER_interp); 38 | 39 | sinr_dB_fromtable_interp = interp1(10*log10(PER_fromtable),sinr_dB_fromtable,10*log10(PER_interp)); 40 | sinr_lin_fromtable_interp = 10.^(sinr_dB_fromtable_interp/10); 41 | 42 | % % Interpolation in dB 43 | % %BLER_fromtable_dB = 10*log10( BLER_fromtable ); 44 | % gamma_dB_fromtable_interp_step = (gamma_dB_fromtable(end)-gamma_dB_fromtable(1))/(nInterp-1); 45 | % gamma_dB_fromtable_interp = gamma_dB_fromtable(1):gamma_dB_fromtable_interp_step:gamma_dB_fromtable(end); 46 | % PER_fromtable_interp_dB = interp1(gamma_dB_fromtable,BLER_fromtable,gamma_dB_fromtable_interp); 47 | 48 | PERout = PER_interp; 49 | %gammaOut = gamma_dB_fromtable_interp; 50 | sinrVectorOut = 10*log10(sinr_lin_fromtable_interp); 51 | 52 | % if strcmpi(type,'logGamma') 53 | % gammaOut = gamma_dB_fromtable_interp; 54 | % BLER = 10.^(BLER_fromtable_interp_dB/10); 55 | % elseif strcmpi(type,'linGamma') 56 | % % Linear conversion 57 | % gammaLin_fromtable_interp = 10.^(gamma_dB_fromtable_interp/10); 58 | % 59 | % % Values with constan delta in linear 60 | % nGamma = nInterp; 61 | % gammaLinStep = (gammaLin_fromtable_interp(end))/(nGamma); 62 | % gammaLin = 0:gammaLinStep:gammaLin_fromtable_interp(end); 63 | % BLER_dB = interp1([0 gammaLin_fromtable_interp],[1 BLER_fromtable_interp_dB],gammaLin); 64 | % gammaOut = gammaLin; 65 | % BLER = 10.^(BLER_dB/10); 66 | % BLER(BLER>1) = 1; 67 | % else 68 | % error('type of readBLERtable not allowed: %s',type); 69 | % end 70 | 71 | % % Print curve to figure for DEBUG purposes 72 | % close all 73 | % figure(1) 74 | % semilogy(10*log10(gammaLin),BLER); 75 | end 76 | -------------------------------------------------------------------------------- /MatFilesUtility/computeAngle.m: -------------------------------------------------------------------------------- 1 | function angle = computeAngle(XvehicleReal,YvehicleReal,Xold,Yold,angleOld) 2 | % Function to compute the angle of the vehicles trajectory. 3 | % The angle is determined as the angle between the vector 4 | % [oldPosition newPosition] and the x-axis. 5 | 6 | xDiff = XvehicleReal-Xold; 7 | yDiff = YvehicleReal-Yold; 8 | 9 | % Slope of line connecting old and new coordinates 10 | m = yDiff./xDiff; 11 | 12 | % Identify quarters 13 | quarter1 = (xDiff>0).*(yDiff>0); 14 | quarter2 = (xDiff<0).*(yDiff>0); 15 | quarter3 = (xDiff<0).*(yDiff<0); 16 | quarter4 = (xDiff>0).*(yDiff<0); 17 | % Special cases 18 | zeroRad = (xDiff>0).*(yDiff==0); 19 | halfPiRad = (xDiff==0).*(yDiff>0); 20 | piRad = (xDiff<0).*(yDiff==0); 21 | threeHalfPiRad = (xDiff==0).*(yDiff<0); 22 | stillVehicles = (xDiff==0).*(yDiff==0); 23 | 24 | m(isnan(m)) = 1; 25 | 26 | % Calculate angle 27 | angle = atan(m).*(quarter1) + (atan(m)+pi).*(quarter2) + (atan(m)+pi).*(quarter3) +... 28 | atan(m).*(quarter4)+ zeroRad*0 + halfPiRad*pi/2 + piRad*pi + threeHalfPiRad*3/2*pi+... 29 | stillVehicles.*angleOld(:,1); 30 | 31 | 32 | end 33 | 34 | -------------------------------------------------------------------------------- /MatFilesUtility/computeDistance.m: -------------------------------------------------------------------------------- 1 | function [positionManagement,stationManagement] = computeDistance (simParams,simValues,stationManagement,positionManagement) 2 | % Function derived dividing previous version in computeDistance and 3 | % computeNeighbors (version 5.6.0) 4 | 5 | 6 | % Compute distance matrix 7 | positionManagement.distanceReal = sqrt((positionManagement.XvehicleReal - positionManagement.XvehicleReal').^2+(positionManagement.YvehicleReal - positionManagement.YvehicleReal').^2); 8 | %if simParams.technology ~= 2 && ... % not only 11p 9 | if sum(stationManagement.vehicleState(stationManagement.activeIDs)==constants.V_STATE_LTE_TXRX)>0 && ... 10 | (simParams.posError95 || positionManagement.NgroupPosUpdate~=1) %LTE 11 | positionManagement.distanceEstimated = sqrt((simValues.XvehicleEstimated - simValues.XvehicleEstimated').^2+(simValues.YvehicleEstimated - simValues.YvehicleEstimated').^2); 12 | else 13 | positionManagement.distanceEstimated = positionManagement.distanceReal; 14 | end 15 | 16 | end -------------------------------------------------------------------------------- /MatFilesUtility/computeHiddenNodeProb.m: -------------------------------------------------------------------------------- 1 | function [hiddenNodeSumProb,hiddenNodeProbEvents] = computeHiddenNodeProb(IDvehicle,distance,RXpower,gammaMin,Pn,Pth,hiddenNodeSumProb,hiddenNodeProbEvents) 2 | % Function to update hidden node probability 3 | 4 | % Number of vehicles (set A) 5 | Aset = find(IDvehicle); 6 | 7 | % Find maximum recording distance (m) 8 | maxDist = length(hiddenNodeSumProb); 9 | 10 | % Check transmitters (A) 11 | for A = Aset' 12 | % ID of the transmitter 13 | IDtx = IDvehicle(A); 14 | % Find potential receivers (set B) 15 | Bset = find((RXpower(A,:)/Pn)>gammaMin); 16 | % Check potential receivers (B) 17 | for B = Bset 18 | % ID of the receiver 19 | IDrx = IDvehicle(B); 20 | % Distance between A and B 21 | distAB = floor(distance(A,B))+1; 22 | % Limit maximum distance 23 | if distAB>=maxDist 24 | distAB = maxDist; 25 | end 26 | if IDtx~=IDrx 27 | % Reset counters for hidden and non-hidden nodes 28 | hiddenNodes = 0; 29 | nonHiddenNodes = 0; 30 | % Find all potential interferers (Cset) 31 | Cset = find(IDvehicle~=IDtx & IDvehicle~=IDrx); 32 | for C = Cset' 33 | % Compute SINR considering interferer C 34 | SINR = RXpower(A,B)/(Pn+RXpower(C,B)); 35 | % If computed SINR is lower than the minimum threshold 36 | if SINRPth 40 | % Increment non hidden counter 41 | nonHiddenNodes = nonHiddenNodes+1; 42 | else 43 | % Increment hidden counter 44 | hiddenNodes = hiddenNodes+1; 45 | end 46 | end 47 | end 48 | if hiddenNodes~=0 && nonHiddenNodes~=0 49 | % Update array for hidden node probability computation 50 | hiddenNodeSumProb(distAB) = hiddenNodeSumProb(distAB) + hiddenNodes/(hiddenNodes+nonHiddenNodes); 51 | end 52 | % Increment number of events 53 | hiddenNodeProbEvents(distAB) = hiddenNodeProbEvents(distAB)+1; 54 | end 55 | end 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /MatFilesUtility/computeSignificantNeighbors.m: -------------------------------------------------------------------------------- 1 | function [effAwarenessID,effNeighborsID,XvehicleRealOld,YvehicleRealOld,alphaOld] = computeSignificantNeighbors(IDvehicle,XvehicleReal,YvehicleReal,XvehicleRealOld,YvehicleRealOld,neighborsID,indexNewVehicles,indexOldVehicles,indexOldVehiclesToOld,angleOld,margin,Raw,RawMax,neighborsDistance) 2 | % Function that calculates effective neighbors i.e. neighbors at 3 | % distance lower than MaxRaw and whose trajectories are signficant 4 | 5 | % Initialise matrix of effective neighbors 6 | effNeighborsID = neighborsID*0; 7 | 8 | % Adjust dimension of old coordinate arrays 9 | Xold = zeros(length(XvehicleReal),1); 10 | Xold(indexOldVehicles) = XvehicleRealOld(indexOldVehiclesToOld); 11 | 12 | Yold = zeros(length(YvehicleReal),1); 13 | Yold(indexOldVehicles) = YvehicleRealOld(indexOldVehiclesToOld); 14 | 15 | % Adjust dimension of old angle array 16 | alphaOld = zeros(length(Yold),1); 17 | alphaOld(indexNewVehicles) = pi; 18 | alphaOld(indexOldVehicles) = angleOld(indexOldVehiclesToOld); 19 | 20 | % Calculate angle of trajectory 21 | angle = computeAngle(XvehicleReal,YvehicleReal,Xold,Yold,alphaOld); 22 | 23 | % Build matrix of significant neighbors 24 | for i=1:length(neighborsID(:,1)) 25 | for j=1:nnz(neighborsID(i,:)) 26 | index = find(IDvehicle==neighborsID(i,j)); 27 | % Check whether they are relevant neighbors 28 | relevant = computeMinSegmentDistance(XvehicleReal(i),YvehicleReal(i),XvehicleReal(index),YvehicleReal(index),angle(i),angle(index),margin,RawMax); 29 | 30 | % Build matrix of effective neighbors 31 | if relevant 32 | effNeighborsID(i,j) = neighborsID(i,j); 33 | else 34 | effNeighborsID(i,j) = 0; 35 | end 36 | 37 | end 38 | end 39 | 40 | % Matrix of significant neighbors in the awareness range 41 | effAwarenessID = (neighborsDistance=maxPtx 14 | powerControlCounter(end) = powerControlCounter(end) + 1; 15 | elseif P_ERP_MHz_dBm(IDvehicleTX(i))<=1 16 | powerControlCounter(1) = powerControlCounter(1) + 1; 17 | else 18 | powerControlCounter(P_ERP_MHz_dBm(IDvehicleTX(i))) = powerControlCounter(P_ERP_MHz_dBm(IDvehicleTX(i))) + 1; 19 | end 20 | end 21 | 22 | end 23 | -------------------------------------------------------------------------------- /MatFilesUtility/countWirelessBlindSpotProb.m: -------------------------------------------------------------------------------- 1 | function wirelessBlindSpotCounter = countWirelessBlindSpotProb(updateTimeMatrix,enteredInRange,wirelessBlindSpotCounter,elapsedTime,phyParams) 2 | % Function to store delay events for wireless blind spot computation 3 | 4 | % For every time interval (multiples of Tbeacon) 5 | NupdateDelayEvents = length(wirelessBlindSpotCounter(:,1,1)); 6 | %fp = fopen('temp.xls','a'); 7 | for iRaw = 1:length(phyParams.Raw) 8 | % Build timeDiff matrix 9 | timeDiffMatrix = updateTimeMatrix(:,:,iRaw); 10 | timeDiffMatrix(timeDiffMatrix>0) = elapsedTime-timeDiffMatrix(timeDiffMatrix>0); 11 | 12 | for i = 1:NupdateDelayEvents 13 | 14 | % Count number of delay events larger or equal than time interval 15 | wirelessBlindSpotCounter(i,iRaw,2) = wirelessBlindSpotCounter(i,iRaw,2) + sum(timeDiffMatrix(:)>=wirelessBlindSpotCounter(i,iRaw,1)) + sum(sum(timeDiffMatrix()<0 & enteredInRange(:,:,iRaw)>=0 & (elapsedTime-enteredInRange(:,:,iRaw))>wirelessBlindSpotCounter(i,iRaw,1))); 16 | % Count number of delay events shorter than time interval 17 | wirelessBlindSpotCounter(i,iRaw,3) = wirelessBlindSpotCounter(i,iRaw,3) + sum(timeDiffMatrix(:)>0 & timeDiffMatrix(:)=wirelessBlindSpotCounter(i,iRaw,1)),sum(sum(timeDiffMatrix()<0 & enteredInRange(:,:,iRaw)>=0 & (elapsedTime-enteredInRange(:,:,iRaw))>wirelessBlindSpotCounter(i,iRaw,1)))); 21 | %end 22 | 23 | end 24 | %if iRaw == length(phyParams.Raw) 25 | % fprintf(fp,'\n'); 26 | %end 27 | end 28 | %fclose(fp); 29 | 30 | %% Before version 5.4.1 31 | % % Build timeDiff matrix 32 | % timeDiffMatrix = updateTimeMatrix; 33 | % timeDiffMatrix(timeDiffMatrix>0) = elapsedTime-timeDiffMatrix(timeDiffMatrix>0); 34 | % 35 | % % For every time interval (multiples of Tbeacon) 36 | % for i = 1:length(wirelessBlindSpotCounter) 37 | % % Count number of delay events larger or equal than time interval 38 | % wirelessBlindSpotCounter(i,2) = wirelessBlindSpotCounter(i,2) + sum(timeDiffMatrix(:)>=wirelessBlindSpotCounter(i,1)); 39 | % % Count number of delay events shorter than time interval 40 | % wirelessBlindSpotCounter(i,3) = wirelessBlindSpotCounter(i,3) + sum(timeDiffMatrix(:)>0 & timeDiffMatrix(:)0); 9 | for j = 1:length(awarenessIndex) 10 | % ID and index of receiving vehicle 11 | IDvehicleRX = awarenessID(indexVehicleTX(i),awarenessIndex(j)); 12 | indexVehicleRX = find(IDvehicle==IDvehicleRX); 13 | % Count correctly received beacons 14 | if isempty(find(errorMatrix(:,1)==IDvehicleTX(i) & errorMatrix(:,2)==IDvehicleRX, 1)) 15 | simValues.correctlyReceivedMapCV2X(simValues.YmapFloor(indexVehicleRX),simValues.XmapFloor(indexVehicleRX),iPhyRaw) = ... 16 | simValues.correctlyReceivedMapCV2X(simValues.YmapFloor(indexVehicleRX),simValues.XmapFloor(indexVehicleRX),iPhyRaw) + 1; 17 | end 18 | end 19 | % Count neighbors of IDVehicleTX(i) 20 | NneighborsRaw = length(awarenessIndex); 21 | simValues.neighborsMapCV2X(simValues.YmapFloor(indexVehicleTX(i)),simValues.XmapFloor(indexVehicleTX(i)),iPhyRaw) = ... 22 | simValues.neighborsMapCV2X(simValues.YmapFloor(indexVehicleTX(i)),simValues.XmapFloor(indexVehicleTX(i)),iPhyRaw) + NneighborsRaw; 23 | end 24 | 25 | end -------------------------------------------------------------------------------- /MatFilesUtility/createMap.m: -------------------------------------------------------------------------------- 1 | function createMap(backGround,fuzzyValues,imageFileName) 2 | % CREATEMAP creates and saves an image to represent the values in 3 | % 'fuzzyValues' 4 | % 5 | % --Inputs-- 6 | % backGround: a matrix describing the scenario, with 1=gray and 0=white 7 | % fuzzyValues: a matrix with the values to be used in the range 0-1, where 8 | % 1 is cyan and 0 is black (intermediate colors are shown in a legend added 9 | % on the left of the image 10 | % imageFileName: the output file; the extension of the file determines its 11 | % format (e.g., .bmp or .png) 12 | % 13 | % --Outputs-- 14 | % image: is a matrix containing the rgb output values 15 | % 16 | % --Notes-- 17 | % backGround and fuzzyValues must be matrices of the same size 18 | 19 | % Initialize 20 | nRows = size(backGround,1); 21 | nCol = size(backGround,2); 22 | image=ones(nRows,nCol+10,3); 23 | 24 | % Check that the matrices are of the smae size 25 | if size(fuzzyValues,1)~=nRows || size(fuzzyValues,2)~=nCol 26 | fprintf('Error creating a bitmap: "backGround" and "fuzzyValues" must be of the same size\n'); 27 | fprintf('"backGround" is a %d x %d matrix\n',nRows,nCol); 28 | fprintf('"fuzzyValues" is a %d x %d matrix\n',size(fuzzyValues,1),size(fuzzyValues,2)); 29 | error(''); 30 | end 31 | 32 | % Create the legend 33 | % Color the left bar 34 | A = (1:nRows)/nRows; 35 | legend = repmat(A',1,8); 36 | image(:,1:8,1) = min(max(min((legend/0.25),((0.75-legend)/0.25)),0),1); 37 | image(:,1:8,2) = min(max((legend-0.25)/0.25,0),1); 38 | image(:,1:8,3) = max((legend-0.75)/0.25,0); 39 | % Add thicks at multiples of 10% 40 | image(1:2,1:4,1) = 0; 41 | image(1:2,1:4,2) = 0; 42 | image(1:2,1:4,3) = 0; 43 | for i=1:10 44 | iRow = floor( (nRows*i/10) ); 45 | if i<5 46 | image(iRow:iRow+1,1:4,1) = 0; 47 | image(iRow:iRow+1,1:4,2) = 0; 48 | image(iRow:iRow+1,1:4,3) = 0; 49 | else 50 | image(iRow-1:iRow,1:4,1) = 0; 51 | image(iRow-1:iRow,1:4,2) = 0; 52 | image(iRow-1:iRow,1:4,3) = 0; 53 | end 54 | end 55 | 56 | % Set background 57 | streetfileScaled = 1-backGround*0.2; 58 | image(:,11:end,1) = streetfileScaled; 59 | image(:,11:end,2) = streetfileScaled; 60 | image(:,11:end,3) = streetfileScaled; 61 | 62 | % Add colors based on the input values 63 | image(:,11:end,1) = image(:,11:end,1).*(fuzzyValues<0) + min(max(min((fuzzyValues/0.25),((0.75-fuzzyValues)/0.25)),0),1); 64 | image(:,11:end,2) = image(:,11:end,2).*(fuzzyValues<0) + min(max((fuzzyValues-0.25)/0.25,0),1); 65 | image(:,11:end,3) = image(:,11:end,3).*(fuzzyValues<0) + max((fuzzyValues-0.75)/0.25,0); 66 | 67 | imwrite(image,imageFileName); 68 | 69 | end 70 | 71 | -------------------------------------------------------------------------------- /MatFilesUtility/generationPeriodFromSpeed.m: -------------------------------------------------------------------------------- 1 | function generationInterval = generationPeriodFromSpeed(speed,appParams) 2 | 3 | speedKmh = speed*3.6; 4 | N = speedKmh/10; 5 | 6 | CPeriod = (1.440)./N; 7 | 8 | switch appParams.camDiscretizationType 9 | 10 | case 'allSteps' 11 | Possible=0.1:0.1:1; 12 | case 'allocationAligned' 13 | Possible=[0.1,0.2,0.5,1]; 14 | end 15 | 16 | generationInterval=CPeriod; 17 | 18 | if ~strcmp(appParams.camDiscretizationType, 'null') 19 | Paugmented=CPeriod.*(1+appParams.camDiscretizationIncrease./100); 20 | for pp=1:length(Paugmented) 21 | [~,j]=min(abs(Paugmented(pp)-Possible)); 22 | generationInterval(pp)=Possible(j).*(Possible(j)<=Paugmented(pp))+Possible(max(j-1,1)).*(Possible(j)>Paugmented(pp)); 23 | end 24 | end 25 | 26 | generationInterval = max(min(generationInterval,1),0.1); 27 | 28 | % Survey on ITS-G5 CAM statistics 29 | % CAR 2 CAR Communication Consortium 30 | % 31 | % speedKmh beacon // period in ms 32 | % 20 720 33 | % 40 360 34 | % 35 | % 720*2:1440/2 -- 360*4: 1440/4 36 | % period is 1440/N, where speed is 10*N 37 | % 38 | % MIN is 1 Hz at 14.4 km/h 39 | % MAX is 10 Hz at 144 km/h -------------------------------------------------------------------------------- /MatFilesUtility/printUpdateToVideo.m: -------------------------------------------------------------------------------- 1 | function reverseStr = printUpdateToVideo(elapsedTime,simTime,reverseStr) 2 | % Function to print time to video and estimate end of simulation 3 | 4 | elapsedSeconds = toc; 5 | remainingSeconds = elapsedSeconds * (simTime-elapsedTime)/elapsedTime; 6 | remainingDays = floor(remainingSeconds/(60*60*24)); 7 | remainingSeconds = remainingSeconds - (remainingDays*60*60*24); 8 | remainingHours = floor(remainingSeconds/(60*60)); 9 | remainingSeconds = remainingSeconds - (remainingHours*60*60); 10 | remainingMinutes = floor(remainingSeconds/(60)); 11 | remainingSeconds = remainingSeconds - (remainingMinutes*60); 12 | msg = sprintf('%.1f / %.1fs, end estimated in',elapsedTime,simTime); 13 | if remainingDays>0 14 | sTemp = sprintf(' %d days, %d hours',remainingDays,remainingHours); 15 | msg = strcat(msg,sTemp); 16 | elseif remainingHours>0 17 | sTemp = sprintf(' %d hours, %d minutes',remainingHours,remainingMinutes); 18 | msg = strcat(msg,sTemp); 19 | elseif remainingMinutes>0 20 | sTemp = sprintf(' %d minutes, %d seconds',remainingMinutes,ceil(remainingSeconds)); 21 | msg = strcat(msg,sTemp); 22 | else 23 | sTemp = sprintf(' %d seconds',ceil(remainingSeconds)); 24 | msg = strcat(msg,sTemp); 25 | end 26 | fprintf([reverseStr, msg]); 27 | reverseStr = repmat(sprintf('\b'), 1, length(msg)); 28 | 29 | 30 | -------------------------------------------------------------------------------- /MatFilesUtility5G/MCS.txt: -------------------------------------------------------------------------------- 1 | 0 2 120 0.2344 2 | 1 2 157 0.3066 3 | 2 2 193 0.3770 4 | 3 2 251 0.4902 5 | 4 2 308 0.6016 6 | 5 2 379 0.7402 7 | 6 2 449 0.8770 8 | 7 2 526 1.0273 9 | 8 2 602 1.1758 10 | 9 2 679 1.3262 11 | 10 4 340 1.3281 12 | 11 4 378 1.4766 13 | 12 4 434 1.6953 14 | 13 4 490 1.9141 15 | 14 4 553 2.1602 16 | 15 4 616 2.4063 17 | 16 4 658 2.5703 18 | 17 6 438 2.5664 19 | 18 6 466 2.7305 20 | 19 6 517 3.0293 21 | 20 6 567 3.3223 22 | 21 6 616 3.6094 23 | 22 6 666 3.9023 24 | 23 6 719 4.2129 25 | 24 6 772 4.5234 26 | 25 6 822 4.8164 27 | 26 6 873 5.1152 28 | 27 6 910 5.3320 29 | 28 6 948 5.5547 30 | 29 2 0 0 31 | 30 4 0 0 32 | 31 6 0 0 -------------------------------------------------------------------------------- /MatFilesUtility5G/RBperChannel.txt: -------------------------------------------------------------------------------- 1 | 25 52 79 106 133 160 216 270 0 0 0 0 0 2 | 11 24 38 51 65 78 106 133 162 189 217 245 273 3 | 0 11 18 24 31 38 51 65 79 93 107 121 135 4 | -------------------------------------------------------------------------------- /MatFilesUtility5G/RBtable_5G.m: -------------------------------------------------------------------------------- 1 | function [nRB]=RBtable_5G(ChannelBandwidth,SCS) 2 | % Given SCS and ChannelBandwidth return the number of RB in the channel 3 | % If returns 0 the value selected is not determined 4 | % Values are taken as specified in table 5.3.2-1 in 3GPP 38.101-1 V16.4.0 (2020-06) 5 | 6 | 7 | Table = load('RBperChannel.txt'); 8 | 9 | scs=[15,30,60]'; % admitted values for SCS [kHz] 10 | bandwidth=[5,10,15,20,25,30,40,50,60,70,80,90,100]; %admitted values for Bandwidth [MHz] 11 | 12 | i1=find(scs==SCS); 13 | i2=find(bandwidth==ChannelBandwidth); 14 | 15 | if(isempty(i1)||isempty(i2)) 16 | error("Wrong value selection of Band/SCS\n"); 17 | end 18 | 19 | nRB=Table(i1,i2); 20 | 21 | if(nRB==0) 22 | error("The nRB value selected by Band/SCS is N/A"); 23 | end -------------------------------------------------------------------------------- /MatFilesUtility5G/calculateNB_5G.m: -------------------------------------------------------------------------------- 1 | function [appParams,phyParams] = calculateNB_5G(appParams,phyParams) 2 | % compute NbeaconsF and NbeaconsT 3 | % 5G doesn't have adjacent and non adjacent mode, since the SCI is carried along the transport block 4 | 5 | 6 | % Find number of RBs per subchannel (or multiple) 7 | phyParams.RBsBeaconSubchannel = phyParams.NsubchannelsBeacon*phyParams.sizeSubchannel; 8 | 9 | 10 | % Find number of beacons in the frequency domain (if subchannels can or cannot overlap) 11 | if phyParams.BRoverlapAllowed 12 | appParams.NbeaconsF = phyParams.NsubchannelsFrequency - phyParams.NsubchannelsBeacon + 1; 13 | else 14 | appParams.NbeaconsF = floor(appParams.RBsFrequencyV2V/(phyParams.RBsBeaconSubchannel)); 15 | end 16 | 17 | % Find number of beacons in the time domain 18 | appParams.NbeaconsT = floor(appParams.allocationPeriod/phyParams.Tslot_NR); 19 | 20 | end 21 | -------------------------------------------------------------------------------- /MatFilesUtility5G/fTBS_5G.m: -------------------------------------------------------------------------------- 1 | % This function returns the TBS in the case Ninfo<=3824 2 | % The values of TBS are taken from table 5.1.3.2-1 from 3GPP TS 38.214 V16.2.0 (2020-06) 3 | % In the case Ninfo<=3824, Given Ninfo, evaluates Ninfo', then the closest TBS that is not less than Ninfo' is returned 4 | % In the case Ninfo>3824 the TBS is determined by a formula 5 | 6 | function [TBS,Ninfo1] = fTBS_5G(Ninfo,R) 7 | 8 | if (Ninfo<=3824) 9 | 10 | n=max(3,floor(log2(Ninfo))-6); % Evaluate n 11 | Ninfo1=max(24,2^n*(floor(Ninfo/2^n))); % Evaluate Ninfo' 12 | 13 | S=load("tableNinfo1_5G.mat"); % Load Table 5.1.3.2-1 from 3GPP TS 38.214 V16.2.0 (2020-06) 14 | tableNinfo1=S.tableNinfo1(:,2); % Access the second column with the TBS values 15 | 16 | t=tableNinfo1-Ninfo1; % Subtracts Ninfo' to find the value with the smallest difference 17 | minValue = min(t(t>=0)); % finds min non negative value 18 | 19 | TBS = minValue + Ninfo1; 20 | 21 | else 22 | % Finds the TBS size for Ninfo > 3824 23 | 24 | n=floor(log2(Ninfo-24))-5; % Evaluate n 25 | Ninfo1=max(3840,2^n*(round((Ninfo-24)/2^n))); % Evaluate Ninfo' 26 | 27 | if (R<=(1/4)) 28 | 29 | C = ceil((Ninfo1+24)/3816); 30 | TBS = 8*C*ceil((Ninfo1+24)/(8*C))-24; 31 | 32 | elseif(Ninfo1>=8424) 33 | 34 | C = ceil((Ninfo1+24)/8424); 35 | TBS = 8*C*ceil((Ninfo1+24)/(8*C))-24; 36 | 37 | else 38 | 39 | TBS = 8*ceil((Ninfo1+24)/8)-24; 40 | 41 | end 42 | 43 | end 44 | end -------------------------------------------------------------------------------- /MatFilesUtility5G/getMCS.m: -------------------------------------------------------------------------------- 1 | % Takes as input the index of MCS and return Modulation order (Qm), Code Rate (Rx1024),and Spectral Efficiency 2 | % The values are taken from table Table 5.1.3.1-1: MCS index table 1 for PDSCH 3 | % As specified in 38.214 V16.2.0 (2020-06) 4 | % To update the table, change the txt file 5 | % Admitted value for the MCS index are from 0 to 28, values 29,30,31 are 6 | % reserved and not selectable 7 | 8 | function [Qm,R,SpectralEff] = getMCS(indexMCS) 9 | 10 | if(indexMCS >= 0) && (indexMCS <= 28) && (isnumeric(indexMCS)) 11 | Table = load('MCS.txt'); 12 | Qm = Table(indexMCS+1,2); 13 | R = Table(indexMCS+1,3); 14 | SpectralEff = Table(indexMCS+1,4); 15 | else 16 | error("error in indexMCS selection\n"); 17 | end 18 | 19 | end 20 | -------------------------------------------------------------------------------- /MatFilesUtility5G/tableNinfo1_5G.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/V2Xgithub/WiLabV2Xsim/c8cedf7583569f58d11bf4fe397fc007bc05e883/MatFilesUtility5G/tableNinfo1_5G.mat -------------------------------------------------------------------------------- /MatFilesUtilityIEEE80211p/SINRmin11p.m: -------------------------------------------------------------------------------- 1 | function gammaMin_dB = SINRmin11p(Mode) 2 | % IEEE 802.11p: find minimum SINR which depends on the operating Mode 3 | % Starting from version 5.0.11, the Modes are numbered from 0 to 7 4 | 5 | % OLD THRESHOLDS 6 | % Values are derived from IEEE 802.11-2007, section 17.3.10.1 7 | % if Mode==0 8 | % gammaMin_dB = 10; 9 | % elseif Mode==1 10 | % gammaMin_dB = 11; 11 | % elseif Mode==2 12 | % gammaMin_dB = 13; 13 | % elseif Mode==3 14 | % gammaMin_dB = 15; 15 | % elseif Mode==4 16 | % gammaMin_dB = 18; 17 | % elseif Mode==5 18 | % gammaMin_dB = 22; 19 | % elseif Mode==6 20 | % gammaMin_dB = 26; 21 | % elseif Mode==7 22 | % gammaMin_dB = 27; 23 | % end 24 | 25 | % NEW THRESHOLDS 26 | % FROM U-BLOX 27 | if Mode==0 28 | gammaMin_dB = 4.1; 29 | elseif Mode==1 30 | gammaMin_dB = 5.6; 31 | elseif Mode==2 32 | gammaMin_dB = 6.5; 33 | elseif Mode==3 34 | gammaMin_dB = 9.0; 35 | elseif Mode==4 36 | gammaMin_dB = 11.7; 37 | elseif Mode==5 38 | gammaMin_dB = 15.5; 39 | elseif Mode==6 40 | gammaMin_dB = 19.9; 41 | elseif Mode==7 42 | gammaMin_dB = 22.0; 43 | end 44 | 45 | 46 | end 47 | -------------------------------------------------------------------------------- /MatFilesUtilityIEEE80211p/autoSINRmin11p.m: -------------------------------------------------------------------------------- 1 | function gammaMin_dB = autoSINRmin11p(mcs_index, dataSize, BwMHz) 2 | % Find minimum SINR for IEEE 802.11p automaticly, only for 10 MHz now 3 | % related method could be found in paper: 4 | % Wu Z, Bartoletti S, Martinez V, Bazzi A. A Methodology for Abstracting 5 | % the Physical Layer of Direct V2X Communications Technologies. Sensors. 2022; 6 | % 22(23):9330. https://doi.org/10.3390/s22239330 7 | 8 | if BwMHz ~= 10 9 | error("Automaticly threshold calculatioin only for 10 MHz in this version, %d MHz is set", BwMHz); 10 | end 11 | % MCS mode 0 1 2 3 4 5 6 7 12 | bpSymbol = [24, 36, 48, 72, 96, 144, 192, 216]; % data bits per OFDM symbol 13 | n_symbol = ceil(8*dataSize / bpSymbol(mcs_index+1)); % number of symbols needed for the data of a packet 14 | 15 | t_pre = 40e-6; % sec. preamble duration 16 | t_AIFS = 110e-6; % sec. arbitrary inter-frame space 17 | t_sym = 8e-6; % sec. symbol duration 18 | 19 | % bits/s/Hz 20 | effective_throughput = 8*dataSize / (t_pre + t_AIFS + n_symbol * t_sym) / (BwMHz * 1e6); 21 | shannon_throughput = effective_throughput / constants.IMPLEMENTLOSS_11P; 22 | sinr_linear = 2^(shannon_throughput)-1; 23 | gammaMin_dB = 10*log10(sinr_linear); 24 | 25 | end 26 | -------------------------------------------------------------------------------- /MatFilesUtilityIEEE80211p/packetDuration11p.m: -------------------------------------------------------------------------------- 1 | function tPack = packetDuration11p(Nbyte,Mode,NbitsHz,BwMHz,pWithLTEPHY) 2 | % IEEE 802.11p: find packet transmission duration 3 | 4 | Nol = 22; % overhead at MAC in bits 5 | %Noh = 60; % overhead above MAC in bytes 6 | tOs = 8e-6; % OFDM symbol duration 7 | tPreamble = 40e-6; % overhead at PHY in us 8 | 9 | % If using 802.11p standard PHY 10 | % From version 5.0.11, the Modes are numbered from 0 to 7 11 | if ~pWithLTEPHY 12 | % MCS mode 0 1 2 3 4 5 6 7 13 | bpSymbol = [24, 36, 48, 72, 96, 144, 192, 216]; % data bits per OFDM symbol 14 | ns = bpSymbol(Mode+1); % ns = bits per OFDM symbol 15 | 16 | % Compute packet transmission duration (standard) 17 | tPack = tPreamble + ceil((Nbyte*8 + Nol)/ns)*tOs; 18 | else 19 | % If using 802.11p with LTE PHY 20 | 21 | % Compute throughput (bits/s) 22 | thr = NbitsHz*BwMHz*1e6; 23 | 24 | % Compute packet transmission duration (11p with LTE PHY) 25 | tPack = tPreamble + ceil((Nbyte*8 + Nol)/(thr*tOs))*tOs; 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /MatFilesUtilityLTE/RBtable.m: -------------------------------------------------------------------------------- 1 | function RBs = RBtable(Bw) 2 | % Find the number of available Resource Blocks in the frequency domain 3 | 4 | if(Bw==1.4) 5 | RBs = 6; 6 | elseif(Bw==5) 7 | RBs = 25; 8 | elseif(Bw==10) 9 | RBs = 50; 10 | elseif(Bw==20) 11 | RBs = 100; 12 | else 13 | error('Invalid Bandwidth'); 14 | end 15 | 16 | end -------------------------------------------------------------------------------- /MatFilesUtilityLTE/calculateSubchannelsCombinations.m: -------------------------------------------------------------------------------- 1 | function completeSizeSubchannel = calculateSubchannelsCombinations(supportedSizeSubchannel,RBsFrequencyV2V,ifAdjacent) 2 | % Function to calculate all combinations of subchannels 3 | 4 | % Pre-allocate vector (better code performance) 5 | % First column: RBs per subchannels or multiple 6 | % Second column: subchannel size 7 | % Third column: number of subchannels 8 | completeSizeSubchannel = zeros(length(supportedSizeSubchannel)*(supportedSizeSubchannel(end)/supportedSizeSubchannel(1)),3); 9 | 10 | % Complete vector of subchannel sizes with multiples up to the number of RBs per Tslot 11 | k = 1; 12 | for i = 1:length(supportedSizeSubchannel) 13 | n = 1; 14 | multiple = 0; 15 | while multiple0).*... 18 | % (neighborsDistance(indexVehicleTX(stationManagement.pckType(IDVehicleTX)==pckType & stationManagement.vehicleChannel(IDVehicleTX)==iChannel),:) < distance)); 19 | % 20 | % Since v 5.4.14 21 | % % #Errors within i meters 22 | % Nerrors = nnz(errorMatrix((stationManagement.pckType(errorMatrix(:,1))==pckType & stationManagement.vehicleChannel(errorMatrix(:,1))==iChannel),4) < distance); 23 | % distanceDetailsCounter(iChannel,pckType,i,3) = distanceDetailsCounter(iChannel,pckType,i,3) + Nerrors; 24 | % 25 | % % #Correctly received beacons within i meters 26 | % NrxOK = NrxNeighbors - Nerrors; 27 | % distanceDetailsCounter(iChannel,pckType,i,2) = distanceDetailsCounter(iChannel,pckType,i,2) + NrxOK; 28 | 29 | % #Correctly received beacons within i meters 30 | NrxOK = nnz(correctRxListRawMax((stationManagement.pckType(correctRxListRawMax(:,1))==pckType & stationManagement.vehicleChannel(correctRxListRawMax(:,1))==iChannel),4) < distance); 31 | distanceDetailsCounter(iChannel,pckType,i,2) = distanceDetailsCounter(iChannel,pckType,i,2) + NrxOK; 32 | 33 | % #Errors within i meters 34 | Nerrors = nnz(errorRxListRawMax((stationManagement.pckType(errorRxListRawMax(:,1))==pckType & stationManagement.vehicleChannel(errorRxListRawMax(:,1))==iChannel),4) < distance); 35 | distanceDetailsCounter(iChannel,pckType,i,3) = distanceDetailsCounter(iChannel,pckType,i,3) + Nerrors; 36 | 37 | if i>1 && distanceDetailsCounter(iChannel,pckType,i,2)0 20 | packetDelay = subframeNow - subframeLastPacket(IDvehicleTX(i)); 21 | 22 | if packetDelay<0 23 | error('Delay of a packet z 0'); 24 | elseif packetDelay>=delayMax 25 | % Increment last counter 26 | packetDelayCounter(iChannel,pckType,end,iPhyRaw) = packetDelayCounter(iChannel,pckType,end,iPhyRaw) + iNcorrect; 27 | else 28 | % Increment counter corresponding to the current delay 29 | packetDelayCounter(iChannel,pckType,ceil(packetDelay/delayResolution),iPhyRaw) = ... 30 | packetDelayCounter(iChannel,pckType,ceil(packetDelay/delayResolution),iPhyRaw) + iNcorrect; 31 | end 32 | end 33 | end 34 | 35 | end 36 | -------------------------------------------------------------------------------- /MatFilesUtilityLTE/findITBS.m: -------------------------------------------------------------------------------- 1 | function ITBS = findITBS(MCS) 2 | % This function finds the corresponding Transport Block Size Index (ITBS) 3 | % from 3GPP LTE Tables 4 | 5 | if MCS<=10 6 | ITBS = MCS; 7 | elseif MCS>10 && MCS<=20 8 | ITBS = MCS-1; 9 | elseif MCS>20 && MCS<=28 10 | ITBS = MCS-2; 11 | else 12 | error('Invalid MCS'); 13 | end 14 | 15 | end 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /MatFilesUtilityLTE/findModulation.m: -------------------------------------------------------------------------------- 1 | function Nbps = findModulation(MCS) 2 | % This function takes the modulation and coding scheme (MCS) as 3 | % the input parameter and based on table 8-6-1-1 of 3GPP TS 36.213 V14.0.0 4 | % finds the number of bits per symbol 5 | 6 | if MCS<=10 7 | Nbps = 2; 8 | elseif MCS>=11 && MCS<=20 9 | Nbps = 4; 10 | elseif MCS>=21 && MCS<=28 11 | Nbps = 6; 12 | else 13 | error('Invalid MCS'); 14 | end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /MatFilesUtilityLTE/findRBsBeaconNbits.m: -------------------------------------------------------------------------------- 1 | function [RBsBeacon,Nbits] = findRBsBeaconNbits(ITBS,BeaconSizeBits) 2 | % This function looks at Table 7-1-7-2-1-1 of 3GPP TS 36.213 V14.0.0 and, 3 | % based on ITBS (which is calculated before) and B (beacon size), finds the 4 | % corresponding number of RBs in each slot of an LTE subframe that is 5 | % needed to carry one beacon 6 | 7 | X = load('TBL717211.txt'); 8 | 9 | RBsBeacon = 0; 10 | 11 | for i = 2 : 111 12 | if X(ITBS+1,i) > BeaconSizeBits 13 | Nbits = X(ITBS+1,i); 14 | RBsBeacon = 2*(i-1); 15 | break; 16 | end 17 | end 18 | 19 | if RBsBeacon == 0 20 | error('Beacon size is too large for the selected MCS'); 21 | end 22 | 23 | end -------------------------------------------------------------------------------- /MatFilesUtilityLTE/findRBsBeaconSINRmin.m: -------------------------------------------------------------------------------- 1 | function [RBsBeacon,gammaMin_dB,NbitsHz,CR,Nbps] = findRBsBeaconSINRmin(MCS,BeaconSizeBits,TTI,BwMHz) 2 | % This function calculates RBs per beacon and minimum required SINR 3 | 4 | % Call function to find ITBS value from MCS 5 | ITBS = findITBS(MCS); 6 | 7 | % Call function to find the modulation format (number of bits per symbol) 8 | Nbps = findModulation(MCS); 9 | 10 | % Call function to find the number of RBs per beacon 11 | [RBsBeacon,Nbits] = findRBsBeaconNbits(ITBS,BeaconSizeBits); 12 | 13 | % Compute the effective code rate 14 | % CR = Nbits/((RBsBeacon/2)*9*12*Nbps); 15 | % Nsymbols is 8 since ACG is considered mandatory (Vittorio) 16 | CR = Nbits/((RBsBeacon/2)*8*12*Nbps); 17 | 18 | % Compute spectral efficiency (bits/s/Hz) 19 | NbitsHz = (12*14*Nbps*CR)/(1e-3*180e3); 20 | 21 | %% Compute the minimum required SINR 22 | % Find minimum SINR for LTE-V2X automaticly, only for 10 MHz now 23 | % related method could be found in paper: 24 | % Wu Z, Bartoletti S, Martinez V, Bazzi A. A Methodology for Abstracting 25 | % the Physical Layer of Direct V2X Communications Technologies. Sensors. 2022; 26 | % 22(23):9330. https://doi.org/10.3390/s22239330 27 | effective_throughput = BeaconSizeBits * 50 / (RBsBeacon/2) / TTI / (BwMHz * 1e6); 28 | 29 | shannon_throughput = effective_throughput / constants.IMPLEMENTLOSS_CV2X; 30 | sinr_linear = 2^(shannon_throughput)-1; 31 | gammaMin_dB = pow2db(sinr_linear); 32 | 33 | end -------------------------------------------------------------------------------- /MatFilesUtilityLTE/isValidForFFT.m: -------------------------------------------------------------------------------- 1 | function isValid = isValidForFFT(number) 2 | % number must be a multiple only of 2, 3, and/or 5 3 | 4 | while rem(number,2)==0 5 | number=number/2; 6 | end 7 | 8 | while rem(number,3)==0 9 | number=number/3; 10 | end 11 | 12 | while rem(number,5)==0 13 | number=number/5; 14 | end 15 | 16 | if number == 1 17 | isValid = true; 18 | else 19 | isValid = false; 20 | end -------------------------------------------------------------------------------- /MatFilesUtilityLTE/updateBRidFile.m: -------------------------------------------------------------------------------- 1 | function [BRid] = updateBRidFile(BRid,IDvehicle,indexNewVehicles) 2 | % Update BRid vector if using File Trace (variable number of vehicles) 3 | 4 | BRidIn = BRid(IDvehicle,:); 5 | BRidIn(indexNewVehicles,:)=-1; 6 | BRid = -2*ones(length(BRid(:,1)),length(BRid(1,:))); 7 | BRid(IDvehicle,:) = BRidIn; 8 | 9 | end -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_11p_MCS0_350B.txt: -------------------------------------------------------------------------------- 1 | -2.000000 0.987800 2 | -1.000000 0.917800 3 | 0.000000 0.720400 4 | 1.000000 0.437200 5 | 2.000000 0.194600 6 | 3.000000 0.064000 7 | 4.000000 0.017600 8 | 5.000000 0.002400 9 | 6.000000 0.000400 10 | 7.000000 0.000390 11 | 8.000000 0.000000 12 | -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_11p_MCS2_350B.txt: -------------------------------------------------------------------------------- 1 | 1.000000 0.989600 2 | 2.000000 0.933000 3 | 3.000000 0.766000 4 | 4.000000 0.501200 5 | 5.000000 0.241200 6 | 6.000000 0.087000 7 | 7.000000 0.023600 8 | 8.000000 0.006800 9 | 9.000000 0.000800 10 | 10.000000 0.000200 11 | 11.000000 0.000000 -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_11p_MCS4_350B.txt: -------------------------------------------------------------------------------- 1 | 6.000000 0.999800 2 | 7.000000 0.991000 3 | 8.000000 0.945400 4 | 9.000000 0.812600 5 | 10.000000 0.589000 6 | 11.000000 0.342400 7 | 12.000000 0.160200 8 | 13.000000 0.066000 9 | 14.000000 0.022800 10 | 15.000000 0.008000 11 | 16.000000 0.001600 12 | 17.000000 0.001200 13 | 18.000000 0.000400 14 | 19.000000 0.000200 15 | 20.000000 0.000190 16 | 21.000000 0.000000 17 | -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_LTE_MCS10_350B.txt: -------------------------------------------------------------------------------- 1 | 4.000000 1.000000 2 | 5.000000 0.999000 3 | 6.000000 0.991600 4 | 7.000000 0.958800 5 | 8.000000 0.869400 6 | 9.000000 0.690600 7 | 10.000000 0.448000 8 | 11.000000 0.235600 9 | 12.000000 0.098000 10 | 13.000000 0.032600 11 | 14.000000 0.010400 12 | 15.000000 0.002000 13 | 16.000000 0.000600 14 | 17.000000 0.000200 15 | 18.000000 0.000000 16 | -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_LTE_MCS11_350B.txt: -------------------------------------------------------------------------------- 1 | 2.000000 1.000000 2 | 3.000000 0.999800 3 | 4.000000 0.998200 4 | 5.000000 0.986400 5 | 6.000000 0.943000 6 | 7.000000 0.824400 7 | 8.000000 0.610400 8 | 9.000000 0.357200 9 | 10.000000 0.165200 10 | 11.000000 0.056800 11 | 12.000000 0.017600 12 | 13.000000 0.004400 13 | 14.000000 0.000400 14 | 15.000000 0.000390 15 | 16.000000 0.000000 16 | -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_LTE_MCS4_350B.txt: -------------------------------------------------------------------------------- 1 | -3.000000 1.000000 2 | -2.500000 0.999600 3 | -2.000000 0.998400 4 | -1.500000 0.990600 5 | -1.000000 0.973400 6 | -0.500000 0.927000 7 | 0.000000 0.845200 8 | 0.500000 0.708200 9 | 1.000000 0.558800 10 | 1.500000 0.403400 11 | 2.000000 0.261000 12 | 2.500000 0.152000 13 | 3.000000 0.077800 14 | 3.500000 0.036000 15 | 4.000000 0.013000 16 | 4.500000 0.006000 17 | 5.000000 0.002200 18 | 5.500000 0.000600 19 | 6.000000 0.000400 20 | 6.500000 0.000200 21 | 7.000000 0.000000 22 | -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_LTE_MCS5_350B.txt: -------------------------------------------------------------------------------- 1 | -3.500000 1.000000 2 | -3.000000 0.999800 3 | -2.500000 0.999790 4 | -2.000000 0.999780 5 | -1.500000 0.999400 6 | -1.000000 0.997400 7 | -0.500000 0.989600 8 | 0.000000 0.968600 9 | 0.500000 0.922000 10 | 1.000000 0.836000 11 | 1.500000 0.707400 12 | 2.000000 0.554000 13 | 2.500000 0.395600 14 | 3.000000 0.250800 15 | 3.500000 0.147600 16 | 4.000000 0.080000 17 | 4.500000 0.035600 18 | 5.000000 0.016600 19 | 5.500000 0.006600 20 | 6.000000 0.001600 21 | 6.500000 0.000000 22 | -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_LTE_MCS7_350B.txt: -------------------------------------------------------------------------------- 1 | -0.500000 1.000000 2 | 0.000000 0.999800 3 | 0.500000 0.999790 4 | 1.000000 0.999200 5 | 1.500000 0.997200 6 | 2.000000 0.990600 7 | 2.500000 0.974400 8 | 3.000000 0.940600 9 | 3.500000 0.883000 10 | 4.000000 0.790200 11 | 4.500000 0.672400 12 | 5.000000 0.534200 13 | 5.500000 0.389600 14 | 6.000000 0.255800 15 | 6.500000 0.155600 16 | 7.000000 0.082800 17 | 7.500000 0.042800 18 | 8.000000 0.020400 19 | 8.500000 0.008800 20 | 9.000000 0.003800 21 | 9.500000 0.002200 22 | 10.000000 0.000800 23 | 10.500000 0.000400 24 | 11.000000 0.000000 25 | -------------------------------------------------------------------------------- /PERcurves/G5-CrossingNLOS/PER_LTE_MCS9_350B.txt: -------------------------------------------------------------------------------- 1 | 4.000000 1.000000 2 | 5.000000 0.999800 3 | 6.000000 0.996600 4 | 7.000000 0.983200 5 | 8.000000 0.940600 6 | 9.000000 0.843200 7 | 10.000000 0.682400 8 | 11.000000 0.470000 9 | 12.000000 0.297600 10 | 13.000000 0.159000 11 | 14.000000 0.076400 12 | 15.000000 0.033000 13 | 16.000000 0.010000 14 | 17.000000 0.004000 15 | 18.000000 0.001800 16 | 19.000000 0.001000 17 | 20.000000 0.000200 18 | 21.000000 0.000000 19 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS0_190B.txt: -------------------------------------------------------------------------------- 1 | -5.000000 0.981400 2 | -4.000000 0.902600 3 | -3.000000 0.677000 4 | -2.000000 0.406000 5 | -1.000000 0.191600 6 | 0.000000 0.070400 7 | 1.000000 0.020600 8 | 2.000000 0.005400 9 | 3.000000 0.001200 10 | 4.000000 0.000400 11 | 5.000000 0.000000 12 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS0_350B.txt: -------------------------------------------------------------------------------- 1 | -5 0.992200000000000 2 | -4 0.935600000000000 3 | -3 0.767200000000000 4 | -2 0.488800000000000 5 | -1 0.238800000000000 6 | 0 0.0920000000000000 7 | 1 0.0338000000000000 8 | 2 0.00940000000000000 9 | 3 0.00340000000000000 10 | 4 0.000600000000000000 11 | 5 0.000200000000000000 12 | 6 0 -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS0_550B.txt: -------------------------------------------------------------------------------- 1 | -5.000000 0.996800 2 | -4.000000 0.956000 3 | -3.000000 0.806200 4 | -2.000000 0.548400 5 | -1.000000 0.279400 6 | 0.000000 0.121200 7 | 1.000000 0.039400 8 | 2.000000 0.010800 9 | 3.000000 0.002400 10 | 4.000000 0.000800 11 | 5.000000 0.000000 12 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS2_190B.txt: -------------------------------------------------------------------------------- 1 | -2.000000 0.983600 2 | -1.000000 0.901400 3 | 0.000000 0.702000 4 | 1.000000 0.431600 5 | 2.000000 0.212200 6 | 3.000000 0.085600 7 | 4.000000 0.026800 8 | 5.000000 0.007800 9 | 6.000000 0.002200 10 | 7.000000 0.000600 11 | 8.000000 0.000400 12 | 9.000000 0.000200 13 | 10.000000 0.000000 14 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS2_350B.txt: -------------------------------------------------------------------------------- 1 | -2 0.991600000000000 2 | -1 0.938800000000000 3 | 0 0.766200000000000 4 | 1 0.507600000000000 5 | 2 0.264000000000000 6 | 3 0.110800000000000 7 | 4 0.0404000000000000 8 | 5 0.0132000000000000 9 | 6 0.00280000000000000 10 | 7 0.00100000000000000 11 | 8 0.000200000000000000 12 | 9 0 -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS2_550B.txt: -------------------------------------------------------------------------------- 1 | -2.000000 0.995800 2 | -1.000000 0.960000 3 | 0.000000 0.817800 4 | 1.000000 0.573800 5 | 2.000000 0.303000 6 | 3.000000 0.136600 7 | 4.000000 0.048200 8 | 5.000000 0.015200 9 | 6.000000 0.005000 10 | 7.000000 0.001000 11 | 9.000000 0.000200 12 | 10.000000 0.000000 13 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS4_190B.txt: -------------------------------------------------------------------------------- 1 | 3.000000 0.997800 2 | 4.000000 0.970000 3 | 5.000000 0.860000 4 | 6.000000 0.647200 5 | 7.000000 0.396800 6 | 8.000000 0.196400 7 | 9.000000 0.081400 8 | 10.000000 0.027800 9 | 11.000000 0.011800 10 | 12.000000 0.003600 11 | 13.000000 0.000600 12 | 14.000000 0.000400 13 | 15.000000 0.000000 14 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS4_350B.txt: -------------------------------------------------------------------------------- 1 | 3 0.998600000000000 2 | 4 0.985600000000000 3 | 5 0.914200000000000 4 | 6 0.721200000000000 5 | 7 0.467400000000000 6 | 8 0.257800000000000 7 | 9 0.105400000000000 8 | 10 0.0412000000000000 9 | 11 0.0154000000000000 10 | 12 0.00440000000000000 11 | 13 0.00100000000000000 12 | 14 0.000600000000000000 13 | 15 0 -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_11p_MCS4_550B.txt: -------------------------------------------------------------------------------- 1 | 3.000000 0.999400 2 | 4.000000 0.992200 3 | 5.000000 0.939600 4 | 6.000000 0.793800 5 | 7.000000 0.540800 6 | 8.000000 0.297400 7 | 9.000000 0.140000 8 | 10.000000 0.053400 9 | 11.000000 0.018600 10 | 12.000000 0.006800 11 | 13.000000 0.001800 12 | 14.000000 0.000800 13 | 15.000000 0.000200 14 | 16.000000 0.000000 15 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS10_350B.txt: -------------------------------------------------------------------------------- 1 | 1.000000 1.000000 2 | 2.000000 0.999800 3 | 3.000000 0.995200 4 | 4.000000 0.957400 5 | 5.000000 0.825200 6 | 6.000000 0.626000 7 | 7.000000 0.390000 8 | 8.000000 0.198400 9 | 9.000000 0.087000 10 | 10.000000 0.034400 11 | 11.000000 0.013800 12 | 12.000000 0.004800 13 | 13.000000 0.001400 14 | 14.000000 0.000600 15 | 15.000000 0.000200 16 | 16.000000 0.000100 17 | 17.000000 0.000000 18 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS11_350B.txt: -------------------------------------------------------------------------------- 1 | 0 1 2 | 1 0.999400000000000 3 | 2 0.990600000000000 4 | 3 0.927200000000000 5 | 4 0.765600000000000 6 | 5 0.543000000000000 7 | 6 0.307000000000000 8 | 7 0.138000000000000 9 | 8 0.0586000000000000 10 | 9 0.0214000000000000 11 | 10 0.00860000000000000 12 | 11 0.00300000000000000 13 | 12 0.00100000000000000 14 | 13 0.000200000000000000 15 | 14 0 -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS11_550B.txt: -------------------------------------------------------------------------------- 1 | 2.000000 0.991600 2 | 2.500000 0.974000 3 | 3.000000 0.936600 4 | 3.500000 0.873200 5 | 4.000000 0.773800 6 | 4.500000 0.651600 7 | 5.000000 0.518200 8 | 5.500000 0.387000 9 | 6.000000 0.272200 10 | 6.500000 0.181800 11 | 7.000000 0.114200 12 | 7.500000 0.068400 13 | 8.000000 0.039400 14 | 8.500000 0.023800 15 | 9.000000 0.012200 16 | 9.500000 0.006400 17 | 10.000000 0.003200 18 | 10.500000 0.000800 19 | 11.000000 0.000400 20 | 11.500000 0.000200 21 | 12.000000 0.000100 22 | 12.500000 0.000000 23 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS3_190B.txt: -------------------------------------------------------------------------------- 1 | -7.000000 1.000000 2 | -6.500000 0.999600 3 | -6.000000 0.997800 4 | -5.500000 0.991800 5 | -5.000000 0.976600 6 | -4.500000 0.939600 7 | -4.000000 0.865000 8 | -3.500000 0.760000 9 | -3.000000 0.632000 10 | -2.500000 0.488600 11 | -2.000000 0.358800 12 | -1.500000 0.245400 13 | -1.000000 0.156600 14 | -0.500000 0.096200 15 | 0.000000 0.055000 16 | 0.500000 0.028600 17 | 1.000000 0.014800 18 | 1.500000 0.009000 19 | 2.000000 0.004000 20 | 2.500000 0.001800 21 | 3.000000 0.000800 22 | 3.500000 0.000400 23 | 4.000000 0.000200 24 | 4.500000 0.000100 25 | 5.000000 0.000000 26 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS4_350B.txt: -------------------------------------------------------------------------------- 1 | -5.5 1 2 | -5 0.998800000000000 3 | -4.5 0.996200000000000 4 | -4 0.981600000000000 5 | -3.5 0.947200000000000 6 | -3 0.878600000000000 7 | -2.5 0.771000000000000 8 | -2 0.626600000000000 9 | -1.5 0.459800000000000 10 | -1 0.313400000000000 11 | -0.5 0.198800000000000 12 | 0 0.115200000000000 13 | 0.5 0.0626000000000000 14 | 1 0.0326000000000000 15 | 1.5 0.0152000000000000 16 | 2 0.00780000000000000 17 | 2.5 0.00400000000000000 18 | 3 0.000800000000000000 19 | 3.5 0.000400000000000000 20 | 4.5 0.000200000000000000 21 | 5 0 -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS5_190B.txt: -------------------------------------------------------------------------------- 1 | -5.000000 0.999800 2 | -4.500000 0.999400 3 | -4.000000 0.996200 4 | -3.500000 0.987400 5 | -3.000000 0.972200 6 | -2.500000 0.933800 7 | -2.000000 0.872800 8 | -1.500000 0.781400 9 | -1.000000 0.676600 10 | -0.500000 0.537800 11 | 0.000000 0.415800 12 | 0.500000 0.303400 13 | 1.000000 0.207600 14 | 1.500000 0.138400 15 | 2.000000 0.091400 16 | 2.500000 0.052600 17 | 3.000000 0.029800 18 | 3.500000 0.016200 19 | 4.000000 0.007800 20 | 4.500000 0.003800 21 | 5.000000 0.001200 22 | 5.500000 0.000600 23 | 6.000000 0.000400 24 | 6.500000 0.000390 25 | 7.000000 0.000380 26 | 7.500000 0.000200 27 | 8.000000 0.000100 28 | 8.500000 0.000000 29 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS5_350B.txt: -------------------------------------------------------------------------------- 1 | -4 0.999000000000000 2 | -3.50000000000000 0.993400000000000 3 | -3 0.975200000000000 4 | -2.50000000000000 0.935200000000000 5 | -2 0.859800000000000 6 | -1.50000000000000 0.737200000000000 7 | -1 0.595600000000000 8 | -0.500000000000000 0.448000000000000 9 | 0 0.314400000000000 10 | 0.500000000000000 0.205600000000000 11 | 1 0.121200000000000 12 | 1.50000000000000 0.0694000000000000 13 | 2 0.0354000000000000 14 | 2.50000000000000 0.0178000000000000 15 | 3 0.00820000000000000 16 | 3.50000000000000 0.00360000000000000 17 | 4 0.00220000000000000 18 | 4.50000000000000 0.00100000000000000 19 | 5 0.000800000000000000 20 | 5.50000000000000 0.000400000000000000 21 | 6 0.000200000000000000 22 | 6.50000000000000 0 -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS6_550B.txt: -------------------------------------------------------------------------------- 1 | -4.000000 1.000000 2 | -3.500000 0.999800 3 | -3.000000 0.998600 4 | -2.500000 0.995600 5 | -2.000000 0.982000 6 | -1.500000 0.950800 7 | -1.000000 0.882600 8 | -0.500000 0.766800 9 | 0.000000 0.630800 10 | 0.500000 0.469200 11 | 1.000000 0.316800 12 | 1.500000 0.195000 13 | 2.000000 0.115400 14 | 2.500000 0.061400 15 | 3.000000 0.032400 16 | 3.500000 0.016800 17 | 4.000000 0.008800 18 | 4.500000 0.004600 19 | 5.000000 0.002400 20 | 5.500000 0.000800 21 | 6.000000 0.000400 22 | 6.500000 0.000200 23 | 7.000000 0.000100 24 | 7.500000 0.000000 25 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS7_190B.txt: -------------------------------------------------------------------------------- 1 | 0 1 2 | 2 0.9 3 | 4 0.7 4 | 6 0.4 5 | 8 0.13 6 | 10 0.045 7 | 12 0.017 8 | 14 0.007 9 | 16 0 10 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS7_350B.txt: -------------------------------------------------------------------------------- 1 | -2 0.9996 2 | -1.5 0.9980 3 | -1 0.9914 4 | -0.50 0.9792 5 | 0 0.9424 6 | 0.50 0.8758 7 | 1 0.7812 8 | 1.5 0.6504 9 | 2 0.5016 10 | 2.5 0.3760 11 | 3 0.2568 12 | 3.5 0.1776 13 | 4 0.1140 14 | 4.5 0.06340 15 | 5 0.03860 16 | 5.5 0.02280 17 | 6 0.01200 18 | 6.5 0.005600 19 | 7 0.003800 20 | 7.5 0.002200 21 | 8 0.001000 22 | 8.5 0.0008000 23 | 9 0.0006000 24 | 9.5 0.0004000 25 | 10 0.0002000 26 | 10.50 0 -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS8_550B.txt: -------------------------------------------------------------------------------- 1 | -1.500000 1.000000 2 | -1.000000 0.999800 3 | -0.500000 0.997600 4 | 0.000000 0.989600 5 | 0.500000 0.972400 6 | 1.000000 0.931800 7 | 1.500000 0.857800 8 | 2.000000 0.740800 9 | 2.500000 0.599600 10 | 3.000000 0.447000 11 | 3.500000 0.313400 12 | 4.000000 0.207400 13 | 4.500000 0.127200 14 | 5.000000 0.075000 15 | 5.500000 0.041600 16 | 6.000000 0.021800 17 | 6.500000 0.011800 18 | 7.000000 0.006200 19 | 7.500000 0.002400 20 | 8.000000 0.001200 21 | 8.500000 0.000800 22 | 9.000000 0.000600 23 | 9.500000 0.000400 24 | 10.000000 0.000000 25 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayLOS/PER_LTE_MCS9_350B.txt: -------------------------------------------------------------------------------- 1 | 1.000000 1.000000 2 | 2.000000 0.999800 3 | 3.000000 0.996200 4 | 4.000000 0.980600 5 | 5.000000 0.925000 6 | 6.000000 0.813000 7 | 7.000000 0.615200 8 | 8.000000 0.431400 9 | 9.000000 0.256600 10 | 10.000000 0.139200 11 | 11.000000 0.067200 12 | 12.000000 0.031400 13 | 13.000000 0.013800 14 | 14.000000 0.004400 15 | 15.000000 0.003200 16 | 16.000000 0.001200 17 | 17.000000 0.000600 18 | 18.000000 0.000000 -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS0_190B.txt: -------------------------------------------------------------------------------- 1 | -1.000000 0.942400 2 | 0.000000 0.810800 3 | 1.000000 0.559800 4 | 2.000000 0.289200 5 | 3.000000 0.107800 6 | 4.000000 0.029600 7 | 5.000000 0.005800 8 | 6.000000 0.001600 9 | 7.000000 0.000200 10 | 8.000000 0.000000 11 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS0_350B.txt: -------------------------------------------------------------------------------- 1 | -1.000000 0.981600 2 | 0.000000 0.895400 3 | 1.000000 0.689400 4 | 2.000000 0.387200 5 | 3.000000 0.165400 6 | 4.000000 0.046400 7 | 5.000000 0.012000 8 | 6.000000 0.001400 9 | 7.000000 0.000200 10 | 8.000000 0.000000 11 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS0_550B.txt: -------------------------------------------------------------------------------- 1 | -1.000000 0.992200 2 | 0.000000 0.948800 3 | 1.000000 0.778400 4 | 2.000000 0.496000 5 | 3.000000 0.219600 6 | 4.000000 0.072000 7 | 5.000000 0.019400 8 | 6.000000 0.004200 9 | 7.000000 0.000800 10 | 8.000000 0.000000 11 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS2_190B.txt: -------------------------------------------------------------------------------- 1 | 1.000000 0.990800 2 | 2.000000 0.945200 3 | 3.000000 0.816200 4 | 4.000000 0.588000 5 | 5.000000 0.327000 6 | 6.000000 0.136800 7 | 7.000000 0.045600 8 | 8.000000 0.012200 9 | 9.000000 0.002000 10 | 10.000000 0.000600 11 | 11.000000 0.000000 12 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS2_350B.txt: -------------------------------------------------------------------------------- 1 | 1.000000 0.996000 2 | 2.000000 0.971400 3 | 3.000000 0.892800 4 | 4.000000 0.688600 5 | 5.000000 0.432800 6 | 6.000000 0.201400 7 | 7.000000 0.071200 8 | 8.000000 0.020000 9 | 9.000000 0.002400 10 | 10.000000 0.001000 11 | 11.000000 0.000000 12 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS2_550B.txt: -------------------------------------------------------------------------------- 1 | 1.000000 0.998000 2 | 2.000000 0.988000 3 | 3.000000 0.930800 4 | 4.000000 0.775800 5 | 5.000000 0.513600 6 | 6.000000 0.247600 7 | 7.000000 0.088400 8 | 8.000000 0.026600 9 | 9.000000 0.008800 10 | 10.000000 0.001200 11 | 11.000000 0.000000 12 | 12.000000 0.000400 13 | 13.000000 0.000000 14 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS4_190B.txt: -------------------------------------------------------------------------------- 1 | 7.000000 0.985800 2 | 8.000000 0.942000 3 | 9.000000 0.839200 4 | 10.000000 0.650000 5 | 11.000000 0.413800 6 | 12.000000 0.219200 7 | 13.000000 0.094800 8 | 14.000000 0.034400 9 | 15.000000 0.012000 10 | 16.000000 0.003000 11 | 17.000000 0.000600 12 | 18.000000 0.000200 13 | 19.000000 0.000000 14 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS4_350B.txt: -------------------------------------------------------------------------------- 1 | 7.000000 0.993600 2 | 8.000000 0.972600 3 | 9.000000 0.893600 4 | 10.000000 0.730600 5 | 11.000000 0.505400 6 | 12.000000 0.290000 7 | 13.000000 0.135800 8 | 14.000000 0.051600 9 | 15.000000 0.018200 10 | 16.000000 0.006000 11 | 17.000000 0.001200 12 | 18.000000 0.000400 13 | 19.000000 0.000000 14 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_11p_MCS4_550B.txt: -------------------------------------------------------------------------------- 1 | 7.000000 0.997800 2 | 8.000000 0.980800 3 | 9.000000 0.927800 4 | 10.000000 0.794600 5 | 11.000000 0.582400 6 | 12.000000 0.347200 7 | 13.000000 0.178200 8 | 14.000000 0.075000 9 | 15.000000 0.027800 10 | 16.000000 0.010000 11 | 17.000000 0.002200 12 | 18.000000 0.001200 13 | 19.000000 0.000400 14 | 20.000000 0.000000 15 | 21.000000 0.000000 16 | 22.000000 0.000000 17 | 23.000000 0.000200 18 | 24.000000 0.000000 19 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS10_350B.txt: -------------------------------------------------------------------------------- 1 | 0.000000 1.000000 2 | 1.000000 1.000000 3 | 2.000000 1.000000 4 | 3.000000 1.000000 5 | 4.000000 1.000000 6 | 5.000000 1.000000 7 | 6.000000 0.999200 8 | 7.000000 0.991200 9 | 8.000000 0.951600 10 | 9.000000 0.834600 11 | 10.000000 0.631800 12 | 11.000000 0.389400 13 | 12.000000 0.192400 14 | 13.000000 0.073200 15 | 14.000000 0.021000 16 | 15.000000 0.005800 17 | 16.000000 0.001400 18 | 17.000000 0.000000 19 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS11_350B.txt: -------------------------------------------------------------------------------- 1 | 0.000000 1.000000 2 | 1.000000 1.000000 3 | 2.000000 1.000000 4 | 3.000000 1.000000 5 | 4.000000 1.000000 6 | 5.000000 0.998000 7 | 6.000000 0.979400 8 | 7.000000 0.915000 9 | 8.000000 0.749000 10 | 9.000000 0.506600 11 | 10.000000 0.266200 12 | 11.000000 0.102800 13 | 12.000000 0.030000 14 | 13.000000 0.006200 15 | 14.000000 0.000800 16 | 15.000000 0.000000 17 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS11_550B.txt: -------------------------------------------------------------------------------- 1 | 2.000000 1.000000 2 | 2.500000 1.000000 3 | 3.000000 1.000000 4 | 3.500000 1.000000 5 | 4.000000 1.000000 6 | 4.500000 1.000000 7 | 5.000000 0.999200 8 | 5.500000 0.996400 9 | 6.000000 0.991200 10 | 6.500000 0.975400 11 | 7.000000 0.940600 12 | 7.500000 0.885000 13 | 8.000000 0.778600 14 | 8.500000 0.649200 15 | 9.000000 0.486800 16 | 9.500000 0.346600 17 | 10.000000 0.221200 18 | 10.500000 0.124800 19 | 11.000000 0.063800 20 | 11.500000 0.028400 21 | 12.000000 0.012600 22 | 12.500000 0.004400 23 | 13.000000 0.001600 24 | 13.500000 0.000400 25 | 14.000000 0.000000 26 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS3_190B.txt: -------------------------------------------------------------------------------- 1 | -7.000000 1.000000 2 | -6.500000 1.000000 3 | -6.000000 1.000000 4 | -5.500000 1.000000 5 | -5.000000 1.000000 6 | -4.500000 1.000000 7 | -4.000000 1.000000 8 | -3.500000 1.000000 9 | -3.000000 0.999800 10 | -2.500000 0.997400 11 | -2.000000 0.991600 12 | -1.500000 0.973800 13 | -1.000000 0.939600 14 | -0.500000 0.866000 15 | 0.000000 0.744600 16 | 0.500000 0.597400 17 | 1.000000 0.426600 18 | 1.500000 0.270200 19 | 2.000000 0.152600 20 | 2.500000 0.077000 21 | 3.000000 0.038800 22 | 3.500000 0.014200 23 | 4.000000 0.005400 24 | 4.500000 0.001000 25 | 5.000000 0.000400 26 | 5.500000 0.000200 27 | 6.000000 0.000000 28 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS4_350B.txt: -------------------------------------------------------------------------------- 1 | -6.000000 1.000000 2 | -5.500000 1.000000 3 | -5.000000 1.000000 4 | -4.500000 1.000000 5 | -4.000000 1.000000 6 | -3.500000 1.000000 7 | -3.000000 1.000000 8 | -2.500000 0.999400 9 | -2.000000 0.998800 10 | -1.500000 0.997000 11 | -1.000000 0.992200 12 | -0.500000 0.976600 13 | 0.000000 0.936200 14 | 0.500000 0.857800 15 | 1.000000 0.750800 16 | 1.500000 0.594800 17 | 2.000000 0.415800 18 | 2.500000 0.261400 19 | 3.000000 0.147200 20 | 3.500000 0.071400 21 | 4.000000 0.033200 22 | 4.500000 0.013200 23 | 5.000000 0.003400 24 | 5.500000 0.001000 25 | 6.000000 0.000800 26 | 6.500000 0.000000 27 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS5_190B.txt: -------------------------------------------------------------------------------- 1 | -5.000000 1.000000 2 | -4.500000 1.000000 3 | -4.000000 1.000000 4 | -3.500000 1.000000 5 | -3.000000 1.000000 6 | -2.500000 1.000000 7 | -2.000000 1.000000 8 | -1.500000 1.000000 9 | -1.000000 0.999800 10 | -0.500000 0.997400 11 | 0.000000 0.991000 12 | 0.500000 0.976800 13 | 1.000000 0.946400 14 | 1.500000 0.890000 15 | 2.000000 0.796400 16 | 2.500000 0.673400 17 | 3.000000 0.534600 18 | 3.500000 0.393000 19 | 4.000000 0.259800 20 | 4.500000 0.166400 21 | 5.000000 0.097600 22 | 5.500000 0.048600 23 | 6.000000 0.021400 24 | 6.500000 0.009200 25 | 7.000000 0.001800 26 | 7.500000 0.000800 27 | 8.000000 0.000000 28 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS5_350B.txt: -------------------------------------------------------------------------------- 1 | -4.000000 1.000000 2 | -3.500000 1.000000 3 | -3.000000 1.000000 4 | -2.500000 1.000000 5 | -2.000000 1.000000 6 | -1.500000 0.999800 7 | -1.000000 0.999600 8 | -0.500000 0.998200 9 | 0.000000 0.989800 10 | 0.500000 0.967800 11 | 1.000000 0.927200 12 | 1.500000 0.853800 13 | 2.000000 0.731000 14 | 2.500000 0.580000 15 | 3.000000 0.417600 16 | 3.500000 0.275000 17 | 4.000000 0.156600 18 | 4.500000 0.080400 19 | 5.000000 0.038000 20 | 5.500000 0.014400 21 | 6.000000 0.005000 22 | 6.500000 0.001200 23 | 7.000000 0.000200 24 | 7.500000 0.000200 25 | 8.000000 0.000000 26 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS6_550B.txt: -------------------------------------------------------------------------------- 1 | -4.000000 1.000000 2 | -3.500000 1.000000 3 | -3.000000 1.000000 4 | -2.500000 1.000000 5 | -2.000000 1.000000 6 | -1.500000 1.000000 7 | -1.000000 1.000000 8 | -0.500000 1.000000 9 | 0.000000 0.999400 10 | 0.500000 0.998200 11 | 1.000000 0.993200 12 | 1.500000 0.980800 13 | 2.000000 0.953800 14 | 2.500000 0.885000 15 | 3.000000 0.783800 16 | 3.500000 0.632800 17 | 4.000000 0.474400 18 | 4.500000 0.317000 19 | 5.000000 0.183200 20 | 5.500000 0.093400 21 | 6.000000 0.045000 22 | 6.500000 0.017600 23 | 7.000000 0.007600 24 | 7.500000 0.004200 25 | 8.000000 0.001200 26 | 8.500000 0.000200 27 | 9.000000 0.000000 28 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS7_350B.txt: -------------------------------------------------------------------------------- 1 | -2.000000 1.000000 2 | -1.500000 1.000000 3 | -1.000000 1.000000 4 | -0.500000 1.000000 5 | 0.000000 1.000000 6 | 0.500000 1.000000 7 | 1.000000 1.000000 8 | 1.500000 0.999800 9 | 2.000000 0.998600 10 | 2.500000 0.996400 11 | 3.000000 0.987200 12 | 3.500000 0.966200 13 | 4.000000 0.921400 14 | 4.500000 0.849000 15 | 5.000000 0.724400 16 | 5.500000 0.569400 17 | 6.000000 0.399200 18 | 6.500000 0.254400 19 | 7.000000 0.142200 20 | 7.500000 0.068600 21 | 8.000000 0.030000 22 | 8.500000 0.014600 23 | 9.000000 0.006600 24 | 9.500000 0.002600 25 | 10.000000 0.001000 26 | 10.500000 0.000200 27 | 11.000000 0.000200 28 | 11.500000 0.000000 29 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS8_550B.txt: -------------------------------------------------------------------------------- 1 | -2.000000 1.000000 2 | -1.500000 1.000000 3 | -1.000000 1.000000 4 | -0.500000 1.000000 5 | 0.000000 1.000000 6 | 0.500000 1.000000 7 | 1.000000 1.000000 8 | 1.500000 1.000000 9 | 2.000000 0.999800 10 | 2.500000 0.999200 11 | 3.000000 0.998200 12 | 3.500000 0.993400 13 | 4.000000 0.982000 14 | 4.500000 0.957200 15 | 5.000000 0.900200 16 | 5.500000 0.807000 17 | 6.000000 0.672600 18 | 6.500000 0.523800 19 | 7.000000 0.362400 20 | 7.500000 0.227400 21 | 8.000000 0.131000 22 | 8.500000 0.068800 23 | 9.000000 0.030400 24 | 9.500000 0.013400 25 | 10.000000 0.006600 26 | 10.500000 0.002400 27 | 11.000000 0.000600 28 | 11.500000 0.000200 29 | 12.000000 0.000000 30 | -------------------------------------------------------------------------------- /PERcurves/G5-HighwayNLOS/PER_LTE_MCS9_350B.txt: -------------------------------------------------------------------------------- 1 | 0.000000 1.000000 2 | 1.000000 1.000000 3 | 2.000000 1.000000 4 | 3.000000 1.000000 5 | 4.000000 1.000000 6 | 5.000000 1.000000 7 | 6.000000 0.999200 8 | 7.000000 0.996800 9 | 8.000000 0.978600 10 | 9.000000 0.930400 11 | 10.000000 0.816600 12 | 11.000000 0.648200 13 | 12.000000 0.460400 14 | 13.000000 0.282600 15 | 14.000000 0.152800 16 | 15.000000 0.069200 17 | 16.000000 0.031200 18 | 17.000000 0.013400 19 | 18.000000 0.004800 20 | 19.000000 0.002200 21 | 20.000000 0.000800 22 | 21.000000 0.000400 23 | 22.000000 0.000000 24 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_11p_MCS0_350B.txt: -------------------------------------------------------------------------------- 1 | -5.000000 0.999400 2 | -4.000000 0.984600 3 | -3.000000 0.906800 4 | -2.000000 0.699600 5 | -1.000000 0.414400 6 | 0.000000 0.191600 7 | 1.000000 0.066000 8 | 2.000000 0.017200 9 | 3.000000 0.005400 10 | 4.000000 0.001200 11 | 5.000000 0.000000 12 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_11p_MCS2_350B.txt: -------------------------------------------------------------------------------- 1 | -2.000000 0.999600 2 | -1.000000 0.992000 3 | 0.000000 0.919000 4 | 1.000000 0.726200 5 | 2.000000 0.459800 6 | 3.000000 0.220000 7 | 4.000000 0.079800 8 | 5.000000 0.028600 9 | 6.000000 0.005200 10 | 7.000000 0.002200 11 | 8.000000 0.000200 12 | 9.000000 0.000000 13 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_11p_MCS4_350B.txt: -------------------------------------------------------------------------------- 1 | 4.000000 0.998600 2 | 5.000000 0.983400 3 | 6.000000 0.897400 4 | 7.000000 0.718200 5 | 8.000000 0.467800 6 | 9.000000 0.249600 7 | 10.000000 0.116000 8 | 11.000000 0.048800 9 | 12.000000 0.019400 10 | 13.000000 0.008000 11 | 14.000000 0.003000 12 | 15.000000 0.001000 13 | 16.000000 0.000400 14 | 17.000000 0.000200 15 | 18.000000 0.000000 16 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_LTE_MCS10_350B.txt: -------------------------------------------------------------------------------- 1 | 0.000000 1.000000 2 | 1.000000 1.000000 3 | 2.000000 0.999600 4 | 3.000000 0.996400 5 | 4.000000 0.974600 6 | 5.000000 0.903800 7 | 6.000000 0.746600 8 | 7.000000 0.533600 9 | 8.000000 0.337400 10 | 9.000000 0.186000 11 | 10.000000 0.095600 12 | 11.000000 0.044400 13 | 12.000000 0.021000 14 | 13.000000 0.009400 15 | 14.000000 0.003200 16 | 15.000000 0.001200 17 | 16.000000 0.000200 18 | 17.000000 0.000200 19 | 18.000000 0.000000 20 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_LTE_MCS11_350B.txt: -------------------------------------------------------------------------------- 1 | 0.000000 1.000000 2 | 1.000000 0.999600 3 | 2.000000 0.992800 4 | 3.000000 0.963400 5 | 4.000000 0.874800 6 | 5.000000 0.694200 7 | 6.000000 0.476200 8 | 7.000000 0.286600 9 | 8.000000 0.148000 10 | 9.000000 0.073200 11 | 10.000000 0.033600 12 | 11.000000 0.013800 13 | 12.000000 0.006000 14 | 13.000000 0.002000 15 | 14.000000 0.000200 16 | 15.000000 0.000000 17 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_LTE_MCS4_350B.txt: -------------------------------------------------------------------------------- 1 | -6.000000 1.000000 2 | -5.500000 1.000000 3 | -5.000000 1.000000 4 | -4.500000 1.000000 5 | -4.000000 0.998800 6 | -3.500000 0.994800 7 | -3.000000 0.973800 8 | -2.500000 0.918800 9 | -2.000000 0.827800 10 | -1.500000 0.697200 11 | -1.000000 0.537400 12 | -0.500000 0.379600 13 | 0.000000 0.243800 14 | 0.500000 0.144200 15 | 1.000000 0.078200 16 | 1.500000 0.039600 17 | 2.000000 0.015800 18 | 2.500000 0.007400 19 | 3.000000 0.002800 20 | 3.500000 0.000800 21 | 4.000000 0.000800 22 | 4.500000 0.000600 23 | 5.000000 0.000000 24 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_LTE_MCS5_350B.txt: -------------------------------------------------------------------------------- 1 | -4.000000 0.999800 2 | -3.500000 0.999400 3 | -3.000000 0.997400 4 | -2.500000 0.989200 5 | -2.000000 0.964200 6 | -1.500000 0.900600 7 | -1.000000 0.803600 8 | -0.500000 0.669200 9 | 0.000000 0.514000 10 | 0.500000 0.361000 11 | 1.000000 0.239200 12 | 1.500000 0.143600 13 | 2.000000 0.084400 14 | 2.500000 0.047000 15 | 3.000000 0.024400 16 | 3.500000 0.012400 17 | 4.000000 0.006200 18 | 4.500000 0.002400 19 | 5.000000 0.001400 20 | 5.500000 0.000400 21 | 6.000000 0.000200 22 | 6.500000 0.000000 23 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_LTE_MCS7_350B.txt: -------------------------------------------------------------------------------- 1 | -2.000000 0.999800 2 | -1.500000 0.999000 3 | -1.000000 0.998400 4 | -0.500000 0.992200 5 | 0.000000 0.981600 6 | 0.500000 0.951400 7 | 1.000000 0.894200 8 | 1.500000 0.814400 9 | 2.000000 0.710200 10 | 2.500000 0.583000 11 | 3.000000 0.453200 12 | 3.500000 0.328000 13 | 4.000000 0.223800 14 | 4.500000 0.141600 15 | 5.000000 0.088800 16 | 5.500000 0.053400 17 | 6.000000 0.029200 18 | 6.500000 0.014800 19 | 7.000000 0.008800 20 | 7.500000 0.004800 21 | 8.000000 0.002400 22 | 8.500000 0.001200 23 | 9.000000 0.000200 24 | 9.500000 0.000200 25 | 10.000000 0.000000 26 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanLOS/PER_LTE_MCS9_350B.txt: -------------------------------------------------------------------------------- 1 | 0.000000 1.000000 2 | 1.000000 1.000000 3 | 2.000000 1.000000 4 | 3.000000 0.998400 5 | 4.000000 0.987200 6 | 5.000000 0.953800 7 | 6.000000 0.868800 8 | 7.000000 0.729200 9 | 8.000000 0.548400 10 | 9.000000 0.381600 11 | 10.000000 0.227000 12 | 11.000000 0.138200 13 | 12.000000 0.068600 14 | 13.000000 0.033800 15 | 14.000000 0.016400 16 | 15.000000 0.006600 17 | 16.000000 0.002400 18 | 17.000000 0.001200 19 | 18.000000 0.000800 20 | 19.000000 0.000000 21 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11bd_MCS1_100B.txt: -------------------------------------------------------------------------------- 1 | 9.88051728847717e-001 1 2 | 3.00202725518395e+000 9.99866671678790e-001 3 | 4.97808795409221e+000 9.89837349296961e-001 4 | 6.99279037981043e+000 8.43495485330818e-001 5 | 8.97009108354676e+000 6.24943095217154e-001 6 | 1.09865466195392e+001 3.53519763374531e-001 7 | 1.30038573312750e+001 1.63751067686142e-001 8 | 1.49843649440495e+001 5.73365321170975e-002 9 | 1.70412580759132e+001 1.83491514821890e-002 10 | 1.89849625897263e+001 4.85668690509259e-003 11 | 2.10056940044362e+001 1.01134521496597e-003 12 | 22 0 13 | -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11bd_MCS1_1500B.txt: -------------------------------------------------------------------------------- 1 | 5.05319148936170e+000 1.00 2 | 7.02887537993921e+000 9.32509315953754e-001 3 | 9.00455927051672e+000 8.19020547985046e-001 4 | 1.10562310030395e+001 6.19309175523015e-001 5 | 1.30319148936170e+001 3.95203524677557e-001 6 | 1.50075987841945e+001 1.96495496486141e-001 7 | 1.69832826747720e+001 8.66684983084478e-002 8 | 1.89969604863222e+001 3.22604573670340e-002 9 | 2.10106382978723e+001 8.55226057753981e-003 10 | 2.30243161094225e+001 2.01125996139780e-003 11 | 2.43161094224924e+001 1.02016523638586e-003 12 | 25 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11bd_MCS5_100B.txt: -------------------------------------------------------------------------------- 1 | 9.88008970060542e-001 1 2 | 1.49721359309174e+001 9.99335222824006e-001 3 | 1.70622831824070e+001 9.69729175980935e-001 4 | 1.89627280203952e+001 8.77429882970291e-001 5 | 2.09396866538341e+001 7.04192256923406e-001 6 | 2.29554580492317e+001 4.67419357669255e-001 7 | 2.49725977258189e+001 2.25339690257913e-001 8 | 2.69902077490651e+001 9.73256161966745e-002 9 | 2.89705015679036e+001 3.58240876664978e-002 10 | 3.10269671118956e+001 1.26695471970997e-002 11 | 3.29701585202625e+001 3.78065356576497e-003 12 | 3.49887947544009e+001 1.28467423673240e-003 13 | 3.54458251053210e+001 1.01069677760509e-003 14 | 36 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11bd_MCS5_1500B.txt: -------------------------------------------------------------------------------- 1 | 1.10182370820669e+001 1.00 2 | 1.70212765957447e+001 9.90067352522671e-001 3 | 1.90349544072948e+001 9.51313586741978e-001 4 | 2.10106382978723e+001 8.69573624340539e-001 5 | 2.30243161094225e+001 6.64131891153920e-001 6 | 2.50000000000000e+001 4.19596995644966e-001 7 | 2.69376899696049e+001 2.44753169031848e-001 8 | 2.90273556231003e+001 1.02697694400348e-001 9 | 3.10030395136778e+001 4.44016228857172e-002 10 | 3.30167173252280e+001 1.82625195410608e-002 11 | 3.49924012158055e+001 6.86602218434960e-003 12 | 3.69680851063830e+001 2.65983986808088e-003 13 | 3.90197568389058e+001 1.33574188176528e-003 14 | 4.04255319148936e+001 1.02016523638586e-003 15 | 41 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11bddc_MCS1_100B.txt: -------------------------------------------------------------------------------- 1 | 9.50179660206913e-001 9.60773727124619e-001 2 | 2.96488208592513e+000 8.18728755617958e-001 3 | 4.98052520496119e+000 5.59984376152135e-001 4 | 6.99749384639969e+000 2.80974861076016e-001 5 | 8.97736007736653e+000 1.14292263239287e-001 6 | 1.10340821740815e+001 3.80681658822800e-002 7 | 1.30157870328969e+001 1.00759346212573e-002 8 | 1.49979194795840e+001 2.41327791226748e-003 9 | 1.59894346701929e+001 1.06340053962186e-003 10 | 17 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11bddc_MCS1_1500B.txt: -------------------------------------------------------------------------------- 1 | 1.02583586626140e+000 9.90067352522671e-001 2 | 3.00151975683891e+000 9.14076742369065e-001 3 | 5.01519756838906e+000 7.71406398774386e-001 4 | 7.02887537993921e+000 5.38534924346899e-001 5 | 9.00455927051672e+000 3.07920998483260e-001 6 | 1.09802431610942e+001 1.39943830535459e-001 7 | 1.29939209726444e+001 5.05541980433349e-002 8 | 1.50075987841945e+001 1.63633730832505e-002 9 | 1.69832826747720e+001 3.73468807772668e-003 10 | 1.88829787234043e+001 1.02016523638586e-003 11 | 19 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11p_MCS2_100B.txt: -------------------------------------------------------------------------------- 1 | 9.88008970060542e-001 1 2 | 3.00198449639678e+000 0.999 3 | 4.97808795409221e+000 9.89837349296961e-001 4 | 7.03023486057948e+000 9.60514305165429e-001 5 | 8.96880831993151e+000 8.43421458131157e-001 6 | 1.09841521274573e+001 6.18673459458278e-001 7 | 1.30003511107267e+001 3.71599861780026e-001 8 | 1.49795759598859e+001 1.75601005112148e-001 9 | 1.68830139129763e+001 7.89367463930415e-002 10 | 1.90160787699934e+001 2.42717876267515e-002 11 | 2.09973987997242e+001 7.02888443345846e-003 12 | 2.29794029700498e+001 1.73471772951520e-003 13 | 2.38937202246131e+001 1.01121549422066e-003 14 | 24 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11p_MCS2_1500B.txt: -------------------------------------------------------------------------------- 1 | 1.02583586626140e+000 0.99006 2 | 7.02887537993921e+000 0.99006 3 | 9.00455927051672e+000 9.70497050095711e-001 4 | 1.10182370820669e+001 9.04997540319887e-001 5 | 1.30319148936170e+001 7.56158288148739e-001 6 | 1.50075987841945e+001 5.71775356736032e-001 7 | 1.70212765957447e+001 4.03172897173205e-001 8 | 1.90349544072948e+001 2.65100413185063e-001 9 | 2.10106382978723e+001 1.76061638754281e-001 10 | 2.30243161094225e+001 1.30498925684569e-001 11 | 2.50000000000000e+001 9.86778442508933e-002 12 | 2.70136778115502e+001 8.24489199833505e-002 13 | 2.90273556231003e+001 6.68566341673037e-002 14 | 3.10410334346505e+001 5.69875973131890e-002 15 | 3.30167173252280e+001 4.85753775669195e-002 16 | 3.50303951367781e+001 3.93890695983161e-002 17 | 3.70060790273556e+001 3.49423895566679e-002 18 | 3.90197568389058e+001 3.16227766016838e-002 19 | 4.10714285714286e+001 2.94885337773945e-002 20 | 4.30471124620061e+001 2.77742038369129e-002 21 | 4.50227963525836e+001 2.64219774709964e-002 22 | 4.69984802431611e+001 2.56424511932973e-002 23 | 4.90121580547113e+001 2.53877537651397e-002 24 | 60 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11p_MCS6_100B.txt: -------------------------------------------------------------------------------- 1 | 9.88008970060542e-001 1 2 | 3.00202725518395e+000 9.99866671678790e-001 3 | 1.49721359309174e+001 9.99335222824006e-001 4 | 1.69481966298257e+001 9.89311231224815e-001 5 | 1.90003862951001e+001 9.50457716125622e-001 6 | 2.10150032032440e+001 8.26289063173977e-001 7 | 2.29921328718316e+001 6.37162594918752e-001 8 | 2.49700321985884e+001 4.10436558110908e-001 9 | 2.69865304933680e+001 2.29868319977679e-001 10 | 2.90034563760193e+001 1.16495946919081e-001 11 | 3.29991367611709e+001 3.11412107224550e-002 12 | 3.50152929856531e+001 1.88925112951458e-002 13 | 3.69545933443871e+001 1.39974245483649e-002 14 | 3.90455530128330e+001 1.12337501441060e-002 15 | 4.09840409546107e+001 1.00634257619100e-002 16 | 4.29983585512443e+001 9.38266097677952e-003 17 | 4.50125906303036e+001 8.92455313367078e-003 18 | 4.69887368467862e+001 8.66020048106164e-003 19 | 4.90028406494840e+001 8.48806737906520e-003 20 | 50 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_11p_MCS6_1500B.txt: -------------------------------------------------------------------------------- 1 | 2.10106382978723e+001 1.00 2 | 2.30243161094225e+001 9.80233362531250e-001 3 | 2.49620060790274e+001 9.41864524244477e-001 4 | 2.70136778115502e+001 8.87108782030274e-001 5 | 2.89893617021277e+001 8.10885505605222e-001 6 | 3.10410334346505e+001 7.26560320780782e-001 7 | 3.30167173252280e+001 6.64131891153920e-001 8 | 3.49924012158055e+001 6.25522267697272e-001 9 | 3.70060790273556e+001 5.83305341964224e-001 10 | 3.90197568389058e+001 5.60473280545866e-001 11 | 4.10334346504559e+001 5.49394608398395e-001 12 | 4.29711246200608e+001 5.38534924346899e-001 13 | 4.50227963525836e+001 5.33185846789131e-001 14 | 4.69984802431611e+001 5.22646555452182e-001 15 | 4.89741641337386e+001 5.22646555452182e-001 16 | 60 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_LTE_MCS21_100B.txt: -------------------------------------------------------------------------------- 1 | 9.50051383845388e-001 1 2 | 9.00608176555186e+000 9.99600068363322e-001 3 | 1.10201855682496e+001 9.79731676066919e-001 4 | 1.29584597160914e+001 9.22632889038301e-001 5 | 1.49732049005968e+001 7.78408766379358e-001 6 | 1.69881211202509e+001 6.30995044407196e-001 7 | 1.89652507888385e+001 4.86568753955189e-001 8 | 2.09805945963644e+001 3.56911922706796e-001 9 | 2.29958956451030e+001 2.64434450580481e-001 10 | 2.49732391076266e+001 1.93970465047306e-001 11 | 2.69504970525757e+001 1.45155487175184e-001 12 | 2.90037129287424e+001 1.09716003943577e-001 13 | 3.09807570797556e+001 8.63114728104448e-002 14 | 3.29956732994097e+001 6.99659535852850e-002 15 | 3.50105895190638e+001 5.67159208585058e-002 16 | 3.69872488409925e+001 4.88162917010621e-002 17 | 3.89639081629212e+001 4.20169557219804e-002 18 | 4.09783540359164e+001 3.80175690100738e-002 19 | 4.29926288737629e+001 3.58017832664856e-002 20 | 4.50069464703965e+001 3.33798850114256e-002 21 | 4.69830499280919e+001 3.27164702377998e-002 22 | 4.89971964895769e+001 3.17473277192414e-002 23 | 60 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_LTE_MCS21_1500B.txt: -------------------------------------------------------------------------------- 1 | 1.30319148936170e+001 1.00 2 | 1.50075987841945e+001 9.70497050095711e-001 3 | 1.70212765957447e+001 9.04997540319887e-001 4 | 1.90349544072948e+001 7.86961991155237e-001 5 | 2.10106382978723e+001 6.31797691443369e-001 6 | 2.29863221884498e+001 4.32352674955153e-001 7 | 2.50000000000000e+001 2.54723705686566e-001 8 | 2.70136778115502e+001 1.34466071454518e-001 9 | 2.89893617021277e+001 6.48841662386963e-002 10 | 3.10030395136778e+001 2.72252012186855e-002 11 | 3.30167173252280e+001 1.15382176859816e-002 12 | 3.50303951367781e+001 5.45750597244147e-003 13 | 3.70060790273556e+001 2.96854305770497e-003 14 | 3.89817629179331e+001 1.99128282521597e-003 15 | 4.09954407294833e+001 1.63090155070160e-003 16 | 4.30091185410334e+001 1.52083088943266e-003 17 | 4.49848024316109e+001 1.43241666213180e-003 18 | 4.69984802431611e+001 1.41818897238619e-003 19 | 48 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_LTE_MCS6_100B.txt: -------------------------------------------------------------------------------- 1 | 9.88051728847717e-001 1 2 | 3.00258311941723e+000 8.78052097180484e-001 3 | 5.01732830392262e+000 7.40796754487575e-001 4 | 6.99450073129743e+000 5.65558064841201e-001 5 | 8.97192971139529e+000 4.06644117509613e-001 6 | 1.10256586930080e+001 2.72627304166780e-001 7 | 1.30039000900622e+001 1.62122764727149e-001 8 | 1.50212108017981e+001 7.50955917340730e-002 9 | 1.70006922036804e+001 3.34214326876403e-002 10 | 1.89806867110088e+001 1.31933174843357e-002 11 | 2.09993229451471e+001 4.48311773991588e-003 12 | 2.29803864221548e+001 1.37849634409084e-003 13 | 2.33997157395829e+001 1.01123768211583e-003 14 | 24 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_LTE_MCS6_1500B.txt: -------------------------------------------------------------------------------- 1 | 9.87841945288754e-001 1.00 2 | 3.00151975683891e+000 9.60857445019322e-001 3 | 5.01519756838906e+000 8.87108782030274e-001 4 | 7.02887537993921e+000 7.56158288148739e-001 5 | 9.00455927051672e+000 5.43937665427229e-001 6 | 1.10182370820669e+001 3.07920998483260e-001 7 | 1.30319148936170e+001 1.38553817800123e-001 8 | 1.49696048632219e+001 4.52969921071235e-002 9 | 1.70212765957447e+001 1.23733001789698e-002 10 | 1.90349544072948e+001 2.71347616776926e-003 11 | 2.00607902735562e+001 1.14998888191713e-003 12 | 21 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_NR_MCS21_100B.txt: -------------------------------------------------------------------------------- 1 | 9.50008625058213e-001 1 2 | 4.97804519530504e+000 9.99778920966395e-001 3 | 8.96808142054953e+000 9.99601755502524e-001 4 | 1.09821424644601e+001 9.89573420188640e-001 5 | 1.29963745435194e+001 9.41257559022786e-001 6 | 1.49729911066609e+001 8.18292204012645e-001 7 | 1.69879073263150e+001 6.63325424777377e-001 8 | 1.90030373399050e+001 5.11498281190218e-001 9 | 2.09804235612157e+001 3.71468175009276e-001 10 | 2.29959811626774e+001 2.59201646750426e-001 11 | 2.49732818664137e+001 1.92041667350554e-001 12 | 2.69887111915139e+001 1.38080397741593e-001 13 | 2.89661829303990e+001 9.82944924941209e-002 14 | 3.09813129439889e+001 7.57960754754449e-002 15 | 3.49742567667613e+001 3.84096453554821e-002 16 | 3.69897716094359e+001 2.70705188946739e-002 17 | 3.90050298993874e+001 2.02578661918408e-002 18 | 4.09820312916135e+001 1.60965344444346e-002 19 | 4.29968192349060e+001 1.34453165238387e-002 20 | 4.50112223491140e+001 1.22877093362580e-002 21 | 4.69874968419581e+001 1.15715617926058e-002 22 | 4.90017716798046e+001 1.08971340919732e-002 23 | 60 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_NR_MCS21_1500B.txt: -------------------------------------------------------------------------------- 1 | 1.02583586626140e+000 1.00 2 | 1.30319148936170e+001 9.90067352522671e-001 3 | 1.50075987841945e+001 9.60857445019322e-001 4 | 1.69832826747720e+001 8.69573624340539e-001 5 | 1.89969604863222e+001 7.41211581397914e-001 6 | 2.10106382978723e+001 5.43937665427229e-001 7 | 2.30623100303951e+001 3.57658217758939e-001 8 | 2.50000000000000e+001 1.85072137314101e-001 9 | 2.70136778115502e+001 8.93032063311274e-002 10 | 2.90273556231003e+001 4.22398671245763e-002 11 | 3.10030395136778e+001 1.72008192790467e-002 12 | 3.30167173252280e+001 7.21741209211999e-003 13 | 3.50303951367781e+001 3.44803967442692e-003 14 | 3.70060790273556e+001 1.89433440667391e-003 15 | 3.90197568389058e+001 1.40410260126724e-003 16 | 4.10334346504559e+001 1.19683610495832e-003 17 | 4.30091185410334e+001 1.17317867956210e-003 18 | 4.50227963525836e+001 1.14998888191713e-003 19 | 4.69984802431611e+001 1.12725746859518e-003 20 | 4.90121580547113e+001 1.11606081754344e-003 21 | 50 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_NR_MCS7_100B.txt: -------------------------------------------------------------------------------- 1 | 9.88051728847717e-001 1 2 | 3.00224104911983e+000 9.51133322092964e-001 3 | 5.01660140454064e+000 8.77973555352916e-001 4 | 6.99330348525653e+000 7.48171384566442e-001 5 | 8.97086074171591e+000 5.22057057080334e-001 6 | 1.09874017952827e+001 2.89474902642073e-001 7 | 1.29668404383777e+001 1.30125279344509e-001 8 | 1.49856477076648e+001 4.24841809570187e-002 9 | 1.70054384290568e+001 1.10222339967144e-002 10 | 1.89882977751259e+001 2.22745664459974e-003 11 | 1.99793426190759e+001 1.09557049516001e-003 12 | 21 0 -------------------------------------------------------------------------------- /PERcurves/G5-UrbanNLOS/PER_NR_MCS7_1500B.txt: -------------------------------------------------------------------------------- 1 | 3.00151975683891e+000 1.00 2 | 5.01519756838906e+000 8.78297443224325e-001 3 | 7.02887537993921e+000 7.41211581397914e-001 4 | 9.00455927051672e+000 5.22646555452182e-001 5 | 1.10182370820669e+001 2.90019864741320e-001 6 | 1.29939209726444e+001 1.29202725859574e-001 7 | 1.50075987841945e+001 4.26636299206817e-002 8 | 1.69832826747720e+001 7.73977478684827e-003 9 | 1.89969604863222e+001 1.61470238052825e-003 10 | 1.94908814589666e+001 1.05117809094345e-003 11 | 21 0 -------------------------------------------------------------------------------- /PERcurves/PER_table.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/V2Xgithub/WiLabV2Xsim/c8cedf7583569f58d11bf4fe397fc007bc05e883/PERcurves/PER_table.mat -------------------------------------------------------------------------------- /PERcurves/PERcuvesGeneration.m: -------------------------------------------------------------------------------- 1 | PERstructure = load('PER_table.mat'); 2 | 3 | for i = 1:length(PERstructure.PER_table) 4 | x = PERstructure.PER_table(i); 5 | scenario = x{1}.scenario; 6 | folderNameOut = sprintf('%s',scenario); 7 | if ~exist(folderNameOut, 'dir') 8 | mkdir(folderNameOut) 9 | end 10 | for j=1:length(x{1}.data) 11 | name = x{1}.data{j}.config; 12 | [~, n] = size(name); 13 | for iStr=1:n 14 | if name(iStr) == ' ' 15 | name(iStr) = '_'; 16 | end 17 | end 18 | fileName = sprintf('%s//%s.txt',folderNameOut,name); 19 | fp = fopen(fileName,'w'); 20 | data = x{1}.data{j}.PER_vs_SNR; 21 | while data(end,2)==0 22 | if data(end-1,2)==0 23 | data(end,:) = []; 24 | else 25 | break; 26 | end 27 | end 28 | for iData = 1:length(data(:,1)) 29 | fprintf(fp,'%f\t%f\n',data(iData,1),data(iData,2)); 30 | end 31 | fclose(fp); 32 | end 33 | end -------------------------------------------------------------------------------- /Simulations_test_trace.m: -------------------------------------------------------------------------------- 1 | % Simplified scenario to use WilabV2Xsim 2 | % Packet size and MCS are set accordingly to utilize the whole channel 3 | % Each transmission uses all the subchannels available. 4 | % NR-V2X is considered for these simulations 5 | 6 | % WiLabV2Xsim('help') 7 | 8 | close all % Close all open figures 9 | clear % Reset variables 10 | clc % Clear the command window 11 | 12 | packetSize=1000; % 1000B packet size 13 | nTransm=1; % Number of transmission for each packet 14 | sizeSubchannel=10; % Number of Resource Blocks for each subchannel 15 | Raw = 50; % Range of Awarness for evaluation of metrics 16 | speed=70; % Average speed 17 | speedStDev=7; % Standard deviation speed 18 | SCS=15; % Subcarrier spacing [kHz] 19 | pKeep=0.4; % keep probability 20 | periodicity=0.1; % periodic generation every 100ms 21 | sensingThreshold=-126; % threshold to detect resources as busy 22 | 23 | % Configuration file 24 | configFile = 'test_trace.cfg'; 25 | 26 | 27 | %% NR-V2X PERIODIC GENERATION 28 | BandMHz = 10; 29 | MCS = 11; 30 | rho = 100; % number of vehicles/km 31 | simTime=10; % simTime=300 32 | 33 | % related path, change your related path below 34 | path_task = fileparts(mfilename("fullpath")); 35 | dirTraceFile = fullfile(fileparts(path_task), "TrafficTraces", "Bologna", "BolognaAPositions.txt"); 36 | outputFolder = fullfile(path_task, 'Output', 'test_trace'); 37 | 38 | % Launches simulation 39 | WiLabV2Xsim(configFile,... 40 | 'outputFolder',outputFolder, "filenameTrace", dirTraceFile,... 41 | 'Technology','5G-V2X', 'MCS_NR',MCS, 'SCS_NR',SCS, 'beaconSizeBytes',packetSize,... 42 | 'simulationTime',simTime, 'probResKeep',pKeep, 'BwMHz',BandMHz,... 43 | 'cv2xNumberOfReplicasMax',nTransm,... 44 | 'allocationPeriod',periodicity, 'sizeSubchannel',sizeSubchannel,... 45 | 'powerThresholdAutonomous',sensingThreshold, 'Raw',Raw,'FixedPdensity',false,... 46 | 'dcc_active',false,'cbrActive',true) 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /WiLabV2Xsim Table of input parameters v6.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/V2Xgithub/WiLabV2Xsim/c8cedf7583569f58d11bf4fe397fc007bc05e883/WiLabV2Xsim Table of input parameters v6.1.pdf -------------------------------------------------------------------------------- /WiLabV2Xsim v6.1 Tutorial_v0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/V2Xgithub/WiLabV2Xsim/c8cedf7583569f58d11bf4fe397fc007bc05e883/WiLabV2Xsim v6.1 Tutorial_v0.pdf -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig11_config.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | [simulationTime] 10 3 | [rho] 35.5 4 | 5 | [beaconSizeBytes] 190 6 | [TypeOfScenario] ETSI-Highway 7 | [Nlanes] 3 8 | [roadWidth] 4 9 | [roadLength] 2000 10 | [vStDev] 0 11 | 12 | [F_dB] 6 13 | [Gt_dB] 3 14 | [Gr_dB] 3 15 | 16 | [raw] 300 17 | 18 | % [folderPERcurves] PERcurves/G5-HighwayLOS 19 | 20 | [MCS_LTE] 7 21 | [BRAlgorithm] 18 22 | [sizeSubchannel] 10 23 | [probResKeep] 0.4 24 | [FixedPdensity] false 25 | [BRoverlapAllowed] false 26 | 27 | [printPacketReceptionRatio] true 28 | 29 | [mode5G] 1 30 | [ifAdjacent] true 31 | [SCS_NR] 15 32 | [nDMRS_NR] 24 33 | [MCS_NR] 7 34 | -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig11_plot.m: -------------------------------------------------------------------------------- 1 | close all % Close all open figures 2 | clear % Reset variables 3 | clc % Clear the command window 4 | path_task = fileparts(mfilename('fullpath')); 5 | path_data = fullfile(path_task, "Output", "data_fig_11"); 6 | 7 | colorspace = [0,0,204 8 | 0,187,255 9 | 197,19,132]./255; 10 | markers = ["o", "^", "square"]; 11 | thresholds = [-126, -110]; 12 | 13 | 14 | fig = figure(); 15 | grid on; 16 | hold on; 17 | fileName = "packet_reception_ratio_1_5G.xls"; 18 | % line 1 19 | dataFile = fullfile(path_data, "M_100_avgRSRP_0_coherentArrival_0", fileName); 20 | data = load(dataFile); 21 | plot(data(:,1), data(:,6), "displayname", "Mode 2",... 22 | "LineWidth",1.5,... 23 | "lineStyle", '-', "Marker", markers(1), "MarkerFaceColor", colorspace(1,:),... 24 | "Color", colorspace(1,:),"MarkerIndices",[1:5:length(data(:,1))]); 25 | 26 | % line 2 27 | dataFile = fullfile(path_data, "M_20_avgRSRP_0_coherentArrival_0", fileName); 28 | data = load(dataFile); 29 | plot(data(:,1), data(:,6), "displayname", "L2, M=20%",... 30 | "LineWidth",1.5,... 31 | "lineStyle", '-', "Marker", markers(2), "MarkerFaceColor", colorspace(2,:),... 32 | "Color", colorspace(2,:),"MarkerIndices",[1:5:length(data(:,1))]); 33 | 34 | % line 3 35 | dataFile = fullfile(path_data, "M_100_avgRSRP_1_coherentArrival_0", fileName); 36 | data = load(dataFile); 37 | plot(data(:,1), data(:,6), "displayname", "average RSRP",... 38 | "LineWidth",1.5,... 39 | "lineStyle", '-', "Marker", markers(3), "MarkerFaceColor", colorspace(3,:),... 40 | "Color", colorspace(3,:),"MarkerIndices",[1:5:length(data(:,1))]); 41 | 42 | % line 4 43 | dataFile = fullfile(path_data, "M_20_avgRSRP_1_coherentArrival_0", fileName); 44 | data = load(dataFile); 45 | plot(data(:,1), data(:,6), "displayname", "L2, M=20%, average RSRP",... 46 | "LineWidth",1.5,... 47 | "lineStyle", '--', "Marker", markers(3), "MarkerFaceColor", "none",... 48 | "Color", colorspace(3,:),"MarkerIndices",[1:5:length(data(:,1))]); 49 | 50 | % line 5 51 | dataFile = fullfile(path_data, "M_100_avgRSRP_0_coherentArrival_1", fileName); 52 | data = load(dataFile); 53 | plot(data(:,1), data(:,6), "displayname", "Mode 2, coherent arrivals",... 54 | "LineWidth",1.5,... 55 | "lineStyle", '--', "Marker", markers(1), "MarkerFaceColor", "none",... 56 | "Color", colorspace(1,:),"MarkerIndices",[1:5:length(data(:,1))]); 57 | 58 | legend("location","southwest"); 59 | saveas(fig, fullfile(path_data, "figure11.png")) 60 | 61 | -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig11_simulation.m: -------------------------------------------------------------------------------- 1 | close all % Close all open figures 2 | clear % Reset variables 3 | clc % Clear the command window 4 | 5 | %% init simulator and path 6 | % path of simulation task 7 | version_fit = "V6.2"; % simulator V6.2 is needed 8 | path_task = fileparts(mfilename('fullpath')); 9 | addpath(path_task); 10 | 11 | % path of simulator 12 | path_simulator = fileparts(fileparts(path_task)); 13 | addpath(genpath(path_simulator)); 14 | 15 | % path of output 16 | path_output = fullfile(path_task, 'Output', 'data_fig_11'); 17 | 18 | 19 | %% Simulation for different SCS 20 | % Configuration file 21 | configFile = 'fig11_config.cfg'; 22 | 23 | simTime = 10; % simulation time 24 | nTransm=1; % Number of transmission for each packet 25 | sizeSubchannel=10; % Number of Resource Blocks for each subchannel 26 | Raw = 150; % Range of Awarness for evaluation of metrics 27 | rho = 100; % density of vehicles 28 | speed=70; % Average speed 29 | speedStDev=7; % Standard deviation speed 30 | pKeep=0.4; % keep probability 31 | BandMHz=10; 32 | SCS = 15; 33 | nDMRS = 24; 34 | thresholds = -126; % threshold to detect resources as busy 35 | pSizes = 350; % 350B packet size 36 | MCS = 4; 37 | avgRSRPin5G = [true, false]; 38 | co_arrivals = [true, false]; 39 | 40 | generationInterval = 0.2; % periodic generation every 100 ms (default) 41 | M_values = [1, 0.2]; 42 | 43 | for M = M_values 44 | for avgRSRP = avgRSRPin5G 45 | for coarri = co_arrivals 46 | if coarri 47 | if M == 0.2 || avgRSRP % condition not considered 48 | continue; 49 | end 50 | allocationPeriod=0.2; % RRI 51 | else 52 | allocationPeriod=0.1; % RRI 53 | end 54 | outputsubfolder = sprintf("M_%d_avgRSRP_%d_coherentArrival_%d",100*M,avgRSRP,coarri); 55 | WiLabV2Xsim(configFile,'CheckVersion', version_fit,... 56 | 'simulationTime',simTime,... 57 | 'rho',rho,'vMean',speed,'vStDev',speedStDev,... 58 | 'beaconSizeBytes',pSizes,'allocationPeriod',allocationPeriod,... 59 | 'generationInterval',generationInterval,'Raw',Raw,... 60 | 'Technology','5G-V2X','MCS_NR',MCS,'SCS_NR',SCS,'nDMRS_NR',nDMRS,... 61 | 'probResKeep',pKeep,'BwMHz',BandMHz,'sizeSubchannel',sizeSubchannel,... 62 | 'cv2xNumberOfReplicasMax',nTransm,... 63 | 'powerThresholdAutonomous',thresholds,'FixedPdensity',true,... 64 | 'testMBest_5G', M,'avgRSRPin5G',avgRSRP,... 65 | 'dcc_active',false,'cbrActive',true,... 66 | 'outputFolder',fullfile(path_output,outputsubfolder),... 67 | 'Message', sprintf("Simulation: %s is running", outputsubfolder)); 68 | 69 | end 70 | end 71 | end -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig7_config.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | [simulationTime] 10 3 | [rho] 35.5 4 | 5 | [beaconSizeBytes] 190 6 | [TypeOfScenario] ETSI-Highway 7 | [Nlanes] 3 8 | [roadWidth] 4 9 | [roadLength] 2000 10 | [vStDev] 0 11 | 12 | [F_dB] 6 13 | [Gt_dB] 3 14 | [Gr_dB] 3 15 | 16 | [raw] 300 17 | 18 | % [folderPERcurves] PERcurves/G5-HighwayLOS 19 | 20 | [MCS_LTE] 7 21 | [BRAlgorithm] 18 22 | [sizeSubchannel] 10 23 | [probResKeep] 0.4 24 | [FixedPdensity] false 25 | [BRoverlapAllowed] false 26 | 27 | 28 | [printPacketReceptionRatio] true 29 | 30 | [mode5G] 1 31 | [ifAdjacent] true 32 | [SCS_NR] 15 33 | [nDMRS_NR] 24 34 | [MCS_NR] 7 35 | -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig7_plot.m: -------------------------------------------------------------------------------- 1 | close all % Close all open figures 2 | clear % Reset variables 3 | clc % Clear the command window 4 | path_task = fileparts(mfilename('fullpath')); 5 | colorspace = [0,0,204 6 | 0,187,255 7 | 197,19,132]./255; 8 | SCS_NR = [15, 30, 60]; 9 | haveIBE = ["true", "false"]; 10 | 11 | 12 | fig = figure(); 13 | grid on; 14 | hold on; 15 | markers = ["o", "^", "square"]; 16 | for i_SCS = 1:length(SCS_NR) 17 | for IBE = haveIBE 18 | if IBE == "true" 19 | lgd_ibe = "w"; 20 | ls = "-"; 21 | mfc = colorspace(i_SCS,:); 22 | if SCS_NR(i_SCS) == 60 % situation not considered 23 | continue; 24 | end 25 | else 26 | lgd_ibe = "w/o"; 27 | ls = "--"; 28 | mfc = "none"; 29 | end 30 | dataFile = fullfile(path_task, "Output", "data_fig_7", ... 31 | sprintf("SCS_%d_IBE_%s",SCS_NR(i_SCS), IBE), "packet_reception_ratio_1_5G.xls"); 32 | data = load(dataFile); 33 | legend_name = sprintf("SCS=%d kHz %s IBE", SCS_NR(i_SCS), lgd_ibe); 34 | 35 | plot(data(:,1), data(:,6), "displayname", legend_name, "LineWidth",1.5,... 36 | "lineStyle", ls, "Marker", markers(i_SCS), "MarkerFaceColor", mfc,... 37 | "Color", colorspace(i_SCS,:)); 38 | end 39 | end 40 | 41 | legend("location","southwest"); 42 | xlim([0,150]); 43 | saveas(fig, fullfile(path_task, "Output", "data_fig_7", "figure7.png")) -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig7_simulation.m: -------------------------------------------------------------------------------- 1 | close all % Close all open figures 2 | clear % Reset variables 3 | clc % Clear the command window 4 | 5 | %% init simulator and path 6 | % path of simulation task 7 | version_fit = "V6.2"; % simulator V6.2 is needed 8 | path_task = fileparts(mfilename('fullpath')); 9 | addpath(path_task); 10 | 11 | % path of simulator 12 | path_simulator = fileparts(fileparts(path_task)); 13 | addpath(genpath(path_simulator)); 14 | 15 | % path of output 16 | path_output = fullfile(path_task, 'Output', 'data_fig_7'); 17 | 18 | 19 | %% Simulation for different SCS 20 | % Configuration file 21 | configFile = 'fig7_config.cfg'; 22 | 23 | simTime = 10; % simulation time 24 | packetSize=350; % 350B packet size 25 | nTransm=1; % Number of transmission for each packet 26 | sizeSubchannel=10; % Number of Resource Blocks for each subchannel 27 | Raw = 150; % Range of Awarness for evaluation of metrics 28 | rho = 100; % density of vehicles 29 | speed=70; % Average speed 30 | speedStDev=7; % Standard deviation speed 31 | pKeep=0.4; % keep probability 32 | periodicity=0.1; % RRI 33 | % generationInterval = 0.1; % periodic generation every 100 ms (default) 34 | sensingThreshold=-126; % threshold to detect resources as busy 35 | BandMHz=10; 36 | 37 | SCS = [15, 30, 60]; 38 | nDMRS = [24, 18, 12]; 39 | 40 | haveIBE = [true, false]; 41 | IBE_name = ["true", "false"]; 42 | 43 | for i_SCS = 1:length(SCS) 44 | for i_IBE = 1:length(haveIBE) 45 | if SCS(i_SCS) == 60 && haveIBE(i_IBE) == 1 % situation not considered 46 | continue; 47 | end 48 | outputsubfolder = sprintf("SCS_%d_IBE_%s", SCS(i_SCS), IBE_name(i_IBE)); 49 | WiLabV2Xsim(configFile,'CheckVersion', version_fit,... 50 | 'simulationTime',simTime,... 51 | 'rho',rho,'vMean',speed,'vStDev',speedStDev,... 52 | 'beaconSizeBytes',packetSize,'allocationPeriod',periodicity,'Raw',Raw,... 53 | 'Technology','5G-V2X','MCS_NR',21,'SCS_NR',SCS(i_SCS),'nDMRS_NR',nDMRS(i_SCS),... 54 | 'probResKeep',pKeep,'BwMHz',BandMHz,'sizeSubchannel',sizeSubchannel,... 55 | 'cv2xNumberOfReplicasMax',nTransm,'haveIBE',haveIBE(i_IBE),... 56 | 'powerThresholdAutonomous',sensingThreshold,'FixedPdensity',true,... 57 | 'dcc_active',false,'cbrActive',true,... 58 | 'outputFolder',fullfile(path_output,outputsubfolder),... 59 | 'Message', sprintf("Simulation: %s is running", outputsubfolder)); 60 | end 61 | end -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig9_config.cfg: -------------------------------------------------------------------------------- 1 | [seed] 10 2 | [simulationTime] 10 3 | [rho] 35.5 4 | 5 | [beaconSizeBytes] 190 6 | [TypeOfScenario] ETSI-Highway 7 | [Nlanes] 3 8 | [roadWidth] 4 9 | [roadLength] 2000 10 | [vStDev] 0 11 | 12 | [F_dB] 6 13 | [Gt_dB] 3 14 | [Gr_dB] 3 15 | 16 | [raw] 300 17 | 18 | % [folderPERcurves] PERcurves/G5-HighwayLOS 19 | 20 | [MCS_LTE] 7 21 | [BRAlgorithm] 18 22 | [sizeSubchannel] 10 23 | [probResKeep] 0.4 24 | [FixedPdensity] false 25 | [BRoverlapAllowed] false 26 | 27 | [printPacketReceptionRatio] true 28 | 29 | [mode5G] 1 30 | [ifAdjacent] true 31 | [SCS_NR] 15 32 | [nDMRS_NR] 24 33 | [MCS_NR] 7 34 | -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig9_plot.m: -------------------------------------------------------------------------------- 1 | close all % Close all open figures 2 | clear % Reset variables 3 | clc % Clear the command window 4 | path_task = fileparts(mfilename('fullpath')); 5 | path_data = fullfile(path_task, "Output", "data_fig_9"); 6 | 7 | colorspace = [0,0,204 8 | 0,187,255 9 | 197,19,132]./255; 10 | markers = ["o", "^", "square"]; 11 | M_values = [1,0.5,0.2]; 12 | thresholds = [-126, -110]; 13 | 14 | for pSize = [350, 1000] 15 | fig = figure(); 16 | grid on; 17 | hold on; 18 | for i_m = 1:length(M_values) 19 | if M_values(i_m) == 1 20 | lgd_name = "Mode 2"; 21 | else 22 | lgd_name = sprintf("L2, M=%d%%",100*M_values(i_m)); 23 | end 24 | for i_thr = 1:length(thresholds) 25 | if thresholds(i_thr) == -126 26 | ls = "-"; 27 | mfc = colorspace(i_m,:); 28 | else 29 | ls = "--"; 30 | mfc = "none"; 31 | end 32 | dataFile = fullfile(path_data, ... 33 | sprintf("M_%d_thr__%d_dBm_psize_%d",100*M_values(i_m), abs(thresholds(i_thr)), pSize), "packet_reception_ratio_1_5G.xls"); 34 | data = load(dataFile); 35 | 36 | plot(data(:,1), data(:,6), "displayname", sprintf("%s, Thr. %d dBm", lgd_name, thresholds(i_thr)),... 37 | "LineWidth",1.5,... 38 | "lineStyle", ls, "Marker", markers(i_m), "MarkerFaceColor", mfc,... 39 | "Color", colorspace(i_m,:),"MarkerIndices",[1:5:length(data(:,1))]); 40 | end 41 | end 42 | 43 | legend("location","southwest"); 44 | saveas(fig, fullfile(path_data, sprintf("figure9_%d.png",pSize))) 45 | end 46 | -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/fig9_simulation.m: -------------------------------------------------------------------------------- 1 | close all % Close all open figures 2 | clear % Reset variables 3 | clc % Clear the command window 4 | 5 | %% init simulator and path 6 | % path of simulation task 7 | version_fit = "V6.2"; % simulator V6.2 is needed 8 | path_task = fileparts(mfilename('fullpath')); 9 | addpath(path_task); 10 | 11 | % path of simulator 12 | path_simulator = fileparts(fileparts(path_task)); 13 | addpath(genpath(path_simulator)); 14 | 15 | % path of output 16 | path_output = fullfile(path_task, 'Output', 'data_fig_9'); 17 | 18 | 19 | %% Simulation for different SCS 20 | % Configuration file 21 | configFile = 'fig9_config.cfg'; 22 | 23 | simTime = 10; % simulation time 24 | nTransm=1; % Number of transmission for each packet 25 | sizeSubchannel=10; % Number of Resource Blocks for each subchannel 26 | Raw = 150; % Range of Awarness for evaluation of metrics 27 | rho = 100; % density of vehicles 28 | speed=70; % Average speed 29 | speedStDev=7; % Standard deviation speed 30 | pKeep=0.4; % keep probability 31 | periodicity=0.1; % RRI 32 | % generationInterval = 0.1; % periodic generation every 100 ms (default) 33 | BandMHz=10; 34 | 35 | SCS = 15; 36 | nDMRS = 24; 37 | 38 | M_values = [1, 0.5, 0.2]; 39 | thresholds = [-126, -110]; % threshold to detect resources as busy 40 | pSizes = [350, 1000]; % 350B packet size 41 | 42 | for i_m = 1:length(M_values) 43 | for i_thr = 1:length(thresholds) 44 | for i_ps = 1:length(pSizes) 45 | if pSizes(i_ps) == 350 46 | MCS = 4; 47 | else 48 | MCS = 11; 49 | end 50 | outputsubfolder = sprintf("M_%d_thr__%d_dBm_psize_%d", ... 51 | 100*M_values(i_m), abs(thresholds(i_thr)), pSizes(i_ps)); 52 | WiLabV2Xsim(configFile,'CheckVersion', version_fit,... 53 | 'simulationTime',simTime,... 54 | 'rho',rho,'vMean',speed,'vStDev',speedStDev,... 55 | 'beaconSizeBytes',pSizes(i_ps),'allocationPeriod',periodicity,'Raw',Raw,... 56 | 'Technology','5G-V2X','MCS_NR',MCS,'SCS_NR',SCS,'nDMRS_NR',nDMRS,... 57 | 'probResKeep',pKeep,'BwMHz',BandMHz,'sizeSubchannel',sizeSubchannel,... 58 | 'cv2xNumberOfReplicasMax',nTransm,... 59 | 'powerThresholdAutonomous',thresholds(i_thr),'FixedPdensity',true,... 60 | 'testMBest_5G', M_values(i_m),... 61 | 'dcc_active',false,'cbrActive',true,... 62 | 'outputFolder',fullfile(path_output,outputsubfolder),... 63 | 'Message', sprintf("Simulation: %s is running", outputsubfolder)); 64 | end 65 | end 66 | end -------------------------------------------------------------------------------- /codeForPaper/Vittorio2021Performance/readme.md: -------------------------------------------------------------------------------- 1 | # Code Explanation 2 | This folder is organized for plot figures mentioned in the following paper: 3 | 4 | V. Todisco, S. Bartoletti, C. Campolo, A. Molinaro, A. O. Berthet and A. Bazzi, "Performance Analysis of Sidelink 5G-V2X Mode 2 Through an Open-Source Simulator," in IEEE Access, vol. 9, pp. 145648-145661, 2021, doi: 10.1109/ACCESS.2021.3121151. 5 | 6 | ## Notes 7 | 1. Simulator Version: V6.2 8 | 2. Simulation file ends with "*_simulation.m" 9 | 3. Plotting file ends with "*_plot.m" 10 | 4. All of the output including data and figures are organized in subfolder ".../Vittorio2021Performance/Output" 11 | 5. The curves in figure 11 are trying to show the effect of L2 and the averaging process, and other settings do not influence the conclusions. The code given here could plot a similar figure with the paper, and could get the same conclusions. 12 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig3/.gitignore: -------------------------------------------------------------------------------- 1 | mataData/ 2 | fig_* 3 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig3/fig3_config.cfg: -------------------------------------------------------------------------------- 1 | [simulationTime] 120 2 | [Technology] 80211p 3 | [TypeOfScenario] ETSI-Highway 4 | [roadLength] 2000 5 | [roadWidth] 4 6 | [vMean] 120 7 | [vStDev] 12 8 | [NLanes] 3 9 | [rho] 5 10 | 11 | [beaconSizeBytes] 350 12 | [averageTbeacon] 0.1 13 | [variabilityGenerationInterval] 0 14 | [retransType] 0 15 | [ITSRetransBackoffInterval] 32 % [us] length of SIFS 16 | [dcc_active] false 17 | 18 | [F_dB] 6 19 | 20 | [rilModel11p] true 21 | [channelModel] 0 22 | [MCS_11p] 2 23 | 24 | % output 25 | [printPacketReceptionRatio] true 26 | [prrResolution] 10 27 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig3/fig3_plot.m: -------------------------------------------------------------------------------- 1 | %% init 2 | close all % Close all open figures 3 | clear % Reset variables 4 | clc % Clear the command window 5 | path(pathdef); % Reset Matlab path 6 | path_task = fileparts(mfilename('fullpath')); 7 | addpath(path_task); 8 | 9 | color_space = [27,158,119; 10 | 217,95,2; 11 | 117,112,179; 12 | 231,41,138; 13 | 102,166,30; 14 | 230,171,2] ./ 255; % dark green, additional method 15 | 16 | repType = 0; 17 | ch = 0; 18 | psize = 350; 19 | repNumbers = 1:4; 20 | 21 | %% init figure 22 | fig = figure(); 23 | grid on; 24 | xlabel('Distance [m]'); 25 | ylabel('Packet reception ratio (PRR)'); 26 | hold on; 27 | ylim([0, 1.05]); 28 | 29 | 30 | %% not cumulate preamble 31 | density = 5; 32 | load(fullfile(path_task, sprintf("data_prr_dis_psize_%d_cumPre_F.mat",psize))); 33 | for repNum = repNumbers 34 | data_name = sprintf("rType_%d_replicate_%d_dens_%d_cumPre_F", repType, repNum, density); 35 | data_temp = data.(data_name); 36 | if repNum == 2 37 | legend_name = "1 repetition, w/ preamble"; 38 | else 39 | legend_name = sprintf("%d repetitions, w/ preamble", repNum-1); 40 | end 41 | 42 | plot(data_temp(:,1), mean(data_temp(:,2:end),2), 'Color', color_space(repNum,:),... 43 | 'linestyle', '-', 'LineWidth', 1.5, 'DisplayName', legend_name); 44 | end 45 | 46 | 47 | %% cumulate preamble 48 | load(fullfile(path_task, sprintf("data_prr_dis_psize_%d_cumPre_T.mat",psize))); 49 | for repNum = repNumbers 50 | data_name = sprintf("rType_%d_replicate_%d_dens_%d_cumPre_T", repType, repNum, density); 51 | data_temp = data.(data_name); 52 | if repNum == 2 53 | legend_name = "1 repetition, w/o preamble"; 54 | else 55 | legend_name = sprintf("%d repetitions, w/o preamble", repNum-1); 56 | end 57 | 58 | plot(data_temp(:,1), mean(data_temp(:,2:end),2), 'Color', color_space(repNum,:),... 59 | 'linestyle','--', 'LineWidth', 1.5, 'DisplayName', legend_name); 60 | end 61 | 62 | %% save fig 63 | figure(fig); 64 | lgnd = legend('Location','southwest'); 65 | set(lgnd.BoxFace, 'ColorType', 'truecoloralpha', 'ColorData', uint8([255;255;255;0.5*255])); 66 | saveas(fig, fullfile(path_task, sprintf("fig_distance_vs_prr_psize_%d_10Hz_compare.png",psize))); 67 | % saveas(fig, fullfile(path_figures, sprintf("fig_distance_vs_prr_psize_%d_10Hz_compare.fig",psize))); 68 | 69 | % close(fig); -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig3/fig3_step_1_simulation.m: -------------------------------------------------------------------------------- 1 | %% init 2 | close all % Close all open figures 3 | clear % Reset variables 4 | clc % Clear the command window 5 | path(pathdef); % Reset Matlab path 6 | 7 | path_task = fileparts(mfilename('fullpath')); 8 | path_sim = fileparts(fileparts(fileparts(path_task))); 9 | addpath(genpath(path_sim)); 10 | rmpath(genpath(fullfile(path_sim, "codeForPaper"))); 11 | addpath(path_task); 12 | 13 | path_PERcurves = fullfile(path_sim,"PERcurves", "G5-HighwayLOS"); 14 | path_output = fullfile(path_task, "mataData"); 15 | 16 | configFile = 'fig3_config.cfg'; 17 | 18 | 19 | %% set parameters for paralle simulation 20 | repNumbers = 1:4; 21 | times = 30; % repeat simulation 22 | sensitivity = [-100, -103, -120]; % preamble detection threshold 23 | p_repNum = []; 24 | p_sens = []; 25 | p_outfolder = []; 26 | for sens = sensitivity 27 | for t = 1:times 28 | for repNum = repNumbers 29 | p_repNum = [p_repNum, repNum]; 30 | p_sens = [p_sens, sens]; 31 | p_outfolder = [p_outfolder;... 32 | fullfile(path_output,... 33 | sprintf("replicate_%d_sensitivity__%d", repNum, abs(sens)),... 34 | sprintf("sim_%d",t))]; 35 | end 36 | end 37 | end 38 | 39 | 40 | %% simulation 41 | par_num = length(p_repNum); % total simualtion numbers 42 | parfor i = 1:par_num % if not work, use "for" instead of "parfor" 43 | % if not complete at last time, remove files and restart 44 | if exist(p_outfolder(i), "dir") 45 | if ~exist(fullfile(p_outfolder(i), "MainOut.xls"), "file") 46 | rmdir(p_outfolder(i),"s"); 47 | else 48 | continue; 49 | end 50 | end 51 | 52 | % start simulation 53 | WiLabV2Xsim(configFile, 'seed', 0,... 54 | 'ITSNumberOfReplicasMax', p_repNum(i),... 55 | 'sensitivity11p_dBm', p_sens(i),... 56 | 'folderPERcurves', path_PERcurves,... 57 | 'outputFolder', p_outfolder(i)); 58 | end 59 | 60 | 61 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig3/fig3_step_2_readData.m: -------------------------------------------------------------------------------- 1 | %% Init path 2 | path_task = fileparts(mfilename('fullpath')); 3 | path_mataData = fullfile(path_task, "mataData"); 4 | path_readData = fullfile(path_task, "readData"); 5 | if ~exist(path_readData,'dir') 6 | mkdir(path_readData); 7 | end 8 | 9 | 10 | %% read static preamble data 11 | sensitivity = [-100, -103, -120]; 12 | data = []; 13 | for sens = sensitivity 14 | for repNum = 1:4 15 | scenario = sprintf("replicate_%d_sensitivity__%d", repNum, abs(sens)); 16 | sim_list = dir(fullfile(path_mataData, scenario)); 17 | sim_list = sim_list(3:end); 18 | for i = 1:length(sim_list) 19 | fileName = fullfile(sim_list(i).folder, sim_list(i).name, "packet_reception_ratio_1_11p.xls"); 20 | if ~exist(fileName, "file") 21 | continue; 22 | end 23 | datatemp = load(fileName); 24 | if ~isfield(data, scenario) 25 | data.(scenario) = [datatemp(:,1), datatemp(:,6)]; 26 | else 27 | data.(scenario) = [data.(scenario), datatemp(:, 6)]; 28 | end 29 | end 30 | end 31 | end 32 | 33 | save(fullfile(path_readData, "data_prr_vs_distance"),"data"); 34 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig3/fig3_step_3_plotFigure.m: -------------------------------------------------------------------------------- 1 | %% init 2 | close all % Close all open figures 3 | 4 | path(pathdef); % Reset Matlab path 5 | path_task = fileparts(mfilename('fullpath')); 6 | path_readData = fullfile(path_task, 'readData'); 7 | 8 | % load data 9 | load(fullfile(path_readData, "data_prr_vs_distance.mat")); 10 | 11 | % figure settings 12 | color_space = [27,158,119; 13 | 217,95,2; 14 | 117,112,179; 15 | 231,41,138; 16 | 102,166,30; 17 | 230,171,2] ./ 255; % dark green, additional method 18 | markers = ["^", "diamond", "square", "o"]; 19 | 20 | repNumbers = 1:4; 21 | sensitivity = [-100, -103]; 22 | 23 | for sens = sensitivity 24 | % init figure 25 | fig = figure(); 26 | grid on; 27 | hold on; 28 | 29 | % Compared preamble detectioin 30 | for repNum = repNumbers 31 | data_name = sprintf("replicate_%d_sensitivity__%d", repNum, abs(sens)); 32 | data_temp = data.(data_name); 33 | 34 | legend_name = sprintf("%d rep., %d dBm", repNum-1, sens); 35 | data_prr = mean(data_temp(:,2:end),2); 36 | plot(data_temp(:,1), data_prr, 'Color', color_space(repNum,:),... 37 | 'linestyle', '-', 'LineWidth', 1.5, 'HandleVisibility','on',... 38 | 'Marker',markers(repNum),'MarkerIndices',(10:10:length(data_prr)),... 39 | 'MarkerFaceColor',color_space(repNum,:), 'DisplayName',legend_name); 40 | end 41 | 42 | % plot ideal preamble detection (with -120 dBm) 43 | for repNum = repNumbers 44 | data_name = sprintf("replicate_%d_sensitivity__%d", repNum, 120); 45 | data_temp = data.(data_name); 46 | 47 | legend_name = sprintf("%d rep., ideal", repNum-1); 48 | data_prr = mean(data_temp(:,2:end),2); 49 | plot(data_temp(:,1), data_prr, 'Color', color_space(repNum,:),... 50 | 'linestyle', '--', 'LineWidth', 1.5, 'HandleVisibility','on',... 51 | 'Marker',markers(repNum),'MarkerIndices',(5:10:length(data_prr)),... 52 | 'MarkerFaceColor','none', 'DisplayName',legend_name); 53 | end 54 | 55 | % plot arrows 56 | annotation('arrow',[0.4, 0.65],[0.6,0.7],Color=[0,0,0],LineWidth=1.5,LineStyle='--'); 57 | annotation('arrow',[0.41, 0.66],[0.59,0.69],Color=[0,0,0],LineWidth=1.5,LineStyle='-'); 58 | text(620, 0.8, "$From ~ 0 ~ to ~ 3 ~ rep.$","FontSize",12, Interpreter="latex"); 59 | 60 | xlabel('Distance [m]'); 61 | ylabel('Packet reception ratio (PRR)'); 62 | ylim([0, 1.05]); 63 | title(sprintf("Preamble detection at %d dBm", sens)); 64 | 65 | % save fig 66 | lgnd = legend('Location','southwest'); 67 | set(lgnd.BoxFace, 'ColorType', 'truecoloralpha', 'ColorData', uint8([255;255;255;0.5*255])); 68 | saveas(fig, fullfile(path_task, sprintf("fig_compare_preamble_ideal_and_%d_dbm.png",abs(sens)))); 69 | end 70 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig4/.gitignore: -------------------------------------------------------------------------------- 1 | mataData/ 2 | fig_* 3 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig4/fig4_config.cfg: -------------------------------------------------------------------------------- 1 | [simulationTime] 120 2 | [Technology] 80211p 3 | [TypeOfScenario] ETSI-Highway 4 | [roadLength] 2000 5 | [roadWidth] 4 6 | [vMean] 120 7 | [vStDev] 12 8 | [NLanes] 3 9 | 10 | [beaconSizeBytes] 350 11 | [averageTbeacon] 0.1 12 | [variabilityGenerationInterval] 0 13 | [retransType] 0 14 | [ITSRetransBackoffInterval] 32 % [us] length of SIFS 15 | [dcc_active] false 16 | 17 | [F_dB] 6 18 | 19 | [rilModel11p] true 20 | [channelModel] 0 21 | [MCS_11p] 2 22 | 23 | % output 24 | [printPacketReceptionRatio] true 25 | [prrResolution] 10 26 | [printCBR] true 27 | 28 | % parameters for ECC rural model 29 | [L0_dB] 47.85 30 | [beta] 2 31 | [d_threshold1] 128 32 | [beta2] 2.8 33 | [d_threshold2] 512 34 | [beta3] 3.3 35 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig4/fig4_step_1_simulation.m: -------------------------------------------------------------------------------- 1 | %% init 2 | close all % Close all open figures 3 | clear % Reset variables 4 | clc % Clear the command window 5 | path(pathdef); % Reset Matlab path 6 | 7 | path_task = fileparts(mfilename('fullpath')); 8 | path_sim = fileparts(fileparts(fileparts(path_task))); 9 | addpath(genpath(path_sim)); 10 | rmpath(genpath(fullfile(path_sim, "codeForPaper"))); 11 | addpath(path_task); 12 | 13 | path_PERcurves = fullfile(path_sim,"PERcurves", "G5-HighwayLOS"); 14 | path_output = fullfile(path_task, "mataData"); 15 | 16 | configFile = 'fig4_config.cfg'; 17 | 18 | 19 | %% set parameters for paralle simulation 20 | density = [1:10,12:2:30,40:20:100]; 21 | ch_model = [0, 3]; % [winner+ B1, ECC rural] 22 | repNumbers = 1:4; % statistic repetition number 23 | p_ch = []; 24 | p_roadL = []; 25 | p_dens = []; 26 | p_repNum = []; 27 | p_psize = []; 28 | p_outfolder = []; 29 | 30 | for ch = ch_model 31 | for dens_kms = density 32 | % the lower density, the more simulations need to be repeat 33 | % here for quick check, only set 1 times 34 | if dens_kms <= 10 35 | times = 1; % 450 36 | elseif dens_kms <= 30 37 | times = 1; % 250 38 | else 39 | times = 1; % 20 40 | end 41 | 42 | if ch == 0 43 | roadLength = 2000; 44 | dens = dens_kms; 45 | elseif ch == 3 46 | roadLength = 8000; 47 | dens = dens_kms./4; 48 | end 49 | 50 | for repNum = repNumbers 51 | for t = times 52 | p_ch = [p_ch, ch]; 53 | p_roadL = [p_roadL, roadLength]; 54 | p_dens = [p_dens, dens]; 55 | p_repNum = [p_repNum, repNum]; 56 | p_outfolder = [p_outfolder;... 57 | fullfile(path_output,... 58 | sprintf("ch_%d_replicate_%d_dens_%.2f",ch, repNum, dens),... 59 | sprintf("sim_%d", t))]; 60 | end 61 | end 62 | end 63 | end 64 | 65 | 66 | %% simulation 67 | par_num = length(p_ch); 68 | parfor i = 1:par_num 69 | % if not complete at last time, remove files and restart 70 | if exist(p_outfolder(i), "dir") 71 | if ~exist(fullfile(p_outfolder(i), "MainOut.xls"), "file") 72 | rmdir(p_outfolder(i),"s"); 73 | else 74 | continue; 75 | end 76 | end 77 | 78 | % start simulation 79 | WiLabV2Xsim(configFile, 'seed', 0,... 80 | 'rho', p_dens(i), 'roadLength', p_roadL(i),... 81 | 'ITSNumberOfReplicasMax', p_repNum(i),... 82 | 'folderPERcurves', path_PERcurves, 'channelModel',p_ch(i),... 83 | 'outputFolder', p_outfolder(i)); 84 | end 85 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig4/fig4_step_2_readData.m: -------------------------------------------------------------------------------- 1 | path_task = fileparts(mfilename('fullpath')); 2 | path_mataData = fullfile(path_task, 'mataData'); 3 | path_readData = fullfile(path_task, 'readData'); 4 | if ~exist(path_readData,'dir') 5 | mkdir(path_readData); 6 | end 7 | 8 | 9 | density = [1:9,10:2:30,40:20:100]; 10 | ch_model = [0,3]; 11 | repNumbers = 1:4; 12 | 13 | data = []; 14 | for ch = ch_model 15 | for repNum = repNumbers 16 | for dens_km = density 17 | if ch == 0 18 | dens = dens_km; 19 | nameCBRdata = sprintf("CBR_ch_%d_rep_%d_dens_%d", ch, repNum, dens); 20 | namePRRdata = sprintf("PRR_ch_%d_rep_%d_dens_%d", ch, repNum, dens); 21 | elseif ch == 3 22 | dens = dens_km/4; 23 | nameCBRdata = sprintf("CBR_ch_%d_rep_%d_dens_%d", ch, repNum, 100*dens); 24 | namePRRdata = sprintf("PRR_ch_%d_rep_%d_dens_%d", ch, repNum, 100*dens); 25 | end 26 | scenario = sprintf("ch_%d_replicate_%d_dens_%.2f", ch, repNum, dens); 27 | file_list = dir(fullfile(path_mataData, scenario)); 28 | file_list = file_list(3:end); 29 | for i = 1:length(file_list) 30 | cbrFileName = fullfile(file_list(i).folder, file_list(i).name,... 31 | "CBRofGenericVehicle_1_11p.xls"); 32 | prrFileName = fullfile(file_list(i).folder, file_list(i).name,... 33 | "packet_reception_ratio_1_11p.xls"); 34 | 35 | % load CBR data 36 | cbrDataTemp = load(cbrFileName); 37 | if ~isfield(data, nameCBRdata) 38 | data.(nameCBRdata) = cbrDataTemp(:,2); 39 | else 40 | data.(nameCBRdata) = [data.(nameCBRdata); cbrDataTemp(:, 2)]; 41 | end 42 | 43 | % load PRR data 44 | prrDataTemp = load(prrFileName); 45 | if ~isfield(data, namePRRdata) 46 | data.(namePRRdata) = prrDataTemp(:,[1,6]); 47 | else 48 | data(namePRRdata) = [data, prrDataTemp(:,6)]; 49 | end 50 | end 51 | end 52 | end 53 | end 54 | 55 | 56 | save(fullfile(path_readData, "two_ch_data"),"data"); 57 | 58 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig4/getdis.m: -------------------------------------------------------------------------------- 1 | function dis = getdis(d, prr, prr_thre) 2 | %GETDIS get distance with prr > threshold 3 | % 此处显示详细说明 4 | i_prr = prr>prr_thre; 5 | cross_points = []; 6 | for i=1:length(i_prr)-1 7 | if i_prr(i) && ~i_prr(i+1) 8 | cross_points = [cross_points, i]; 9 | end 10 | end 11 | 12 | switch length(cross_points) 13 | case 0 % no data larger than threshold 14 | dis = 0; 15 | case 1 % normal data 16 | dis = interp1(prr(cross_points:cross_points+1), d(cross_points:cross_points+1), prr_thre); 17 | otherwise % fluctuation data 18 | dis = sum(d(cross_points))/length(cross_points); 19 | end 20 | 21 | 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig5/.gitignore: -------------------------------------------------------------------------------- 1 | mataData/ 2 | fig_* 3 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig5/fig5_config.cfg: -------------------------------------------------------------------------------- 1 | [simulationTime] 120 2 | [Technology] 80211p 3 | [TypeOfScenario] ETSI-Highway 4 | [roadLength] 2000 5 | [roadWidth] 4 6 | [vMean] 120 7 | [vStDev] 12 8 | [NLanes] 3 9 | 10 | [beaconSizeBytes] 350 11 | [averageTbeacon] 0.1 12 | [variabilityGenerationInterval] 0 13 | [retransType] 0 14 | [ITSRetransBackoffInterval] 32 % [us] length of SIFS 15 | [dcc_active] false 16 | 17 | [F_dB] 6 18 | 19 | [rilModel11p] true 20 | [channelModel] 0 21 | [MCS_11p] 2 22 | 23 | % output 24 | [printPacketReceptionRatio] true 25 | [prrResolution] 10 26 | [printCBR] true 27 | 28 | % parameters for ECC rural model 29 | [L0_dB] 47.85 30 | [beta] 2 31 | [d_threshold1] 128 32 | [beta2] 2.8 33 | [d_threshold2] 512 34 | [beta3] 3.3 35 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig5/fig5_step_2_readData.m: -------------------------------------------------------------------------------- 1 | %% init 2 | path(pathdef); % Reset Matlab path 3 | path_task = fileparts(mfilename('fullpath')); 4 | path_mataData = fullfile(path_task, 'mataData'); 5 | path_readData = fullfile(path_task, "readData"); 6 | if ~exist(path_readData,'dir') 7 | mkdir(path_readData); 8 | end 9 | 10 | 11 | %% read dynamic data 12 | density = [1:9,10:2:30,40:20:100]; 13 | data = []; 14 | ch_model = [0, 3]; % [winner+ B1, ECC rural] 15 | repType = [0,1,2]; 16 | for ch = ch_model 17 | for rType = repType 18 | if rType == 0 19 | replicate = 1:4; 20 | else 21 | replicate = 4; 22 | end 23 | for repNum = replicate 24 | for dens_km = density 25 | if ch == 0 26 | dens = dens_km; 27 | nameData = sprintf("ch_%d_rType_%d_replicate_%d_dens_%d", ch, rType, repNum, dens); 28 | 29 | else 30 | dens = dens_km/4; 31 | nameData = sprintf("ch_%d_rType_%d_replicate_%d_dens_%d", ch, rType, repNum, 100*dens); 32 | 33 | end 34 | scenario = sprintf("ch_%d_rType_%d_replicate_%d_dens_%.2f", ch, rType, repNum, dens); 35 | 36 | fileList = dir(fullfile(path_mataData, scenario)); 37 | fileList = fileList(3:end); 38 | for i = 1:length(fileList) 39 | try 40 | datatemp = load(fullfile(fileList(i).folder, fileList(i).name, "packet_reception_ratio_1_11p.xls")); 41 | catch 42 | continue; 43 | end 44 | if ~isfield(data, nameData) 45 | data.(nameData) = [datatemp(:,1), datatemp(:,6)]; 46 | else 47 | data.(nameData) = [data.(nameData), datatemp(:, 6)]; 48 | end 49 | end 50 | end 51 | end 52 | end 53 | end 54 | 55 | save(fullfile(path_readData, "prr_data_two_ch"),"data"); -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig5/getdis.m: -------------------------------------------------------------------------------- 1 | function dis = getdis(d, prr, prr_thre) 2 | %GETDIS get distance with prr > threshold 3 | % 此处显示详细说明 4 | i_prr = prr>prr_thre; 5 | cross_points = []; 6 | for i=1:length(i_prr)-1 7 | if i_prr(i) && ~i_prr(i+1) 8 | cross_points = [cross_points, i]; 9 | end 10 | end 11 | 12 | switch length(cross_points) 13 | case 0 % no data larger than threshold 14 | dis = 0; 15 | case 1 % normal data 16 | dis = interp1(prr(cross_points:cross_points+1), d(cross_points:cross_points+1), prr_thre); 17 | otherwise % fluctuation data 18 | dis = sum(d(cross_points))/length(cross_points); 19 | end 20 | 21 | 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig6/.gitignore: -------------------------------------------------------------------------------- 1 | mataData/ 2 | fig_* 3 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig6/fig6_config.cfg: -------------------------------------------------------------------------------- 1 | [simulationTime] 25 2 | [Technology] 80211p 3 | [TypeOfScenario] ETSI-Highway 4 | [roadLength] 2000 5 | [roadWidth] 4 6 | [vMean] 120 7 | [vStDev] 12 8 | [NLanes] 3 9 | [rho] 20 10 | 11 | [beaconSizeBytes] 350 12 | [averageTbeacon] 0.1 13 | [variabilityGenerationInterval] 0 14 | [retransType] 0 15 | [ITSRetransBackoffInterval] 32 % [us] length of SIFS 16 | [dcc_active] false 17 | 18 | [F_dB] 6 19 | 20 | [rilModel11p] true 21 | [channelModel] 0 22 | [MCS_11p] 2 23 | 24 | % output 25 | [printCBR] true 26 | 27 | 28 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023Repetition/fig6/fig6_step_1_simulation.m: -------------------------------------------------------------------------------- 1 | %% init 2 | %% was running on Giammarco's computer 3 | close all % Close all open figures 4 | clear % Reset variables 5 | clc % Clear the command window 6 | path(pathdef); % Reset Matlab path 7 | 8 | path_task = fileparts(mfilename('fullpath')); 9 | path_sim = fileparts(fileparts(fileparts(path_task))); 10 | addpath(genpath(path_sim)); 11 | rmpath(genpath(fullfile(path_sim, "codeForPaper"))); 12 | addpath(path_task); 13 | 14 | path_PERcurves = fullfile(path_sim,"PERcurves", "G5-HighwayLOS"); 15 | path_output = fullfile(path_task, "mataData"); 16 | 17 | 18 | %% set parameters for paralle simulation 19 | configFile = 'fig6_config.cfg'; 20 | 21 | % NOTE: The threshold index here is inversed compared with the paper 22 | % if replicate type is 0, thresholds would be ignored 23 | thre1 = 0.03; % threshold 3 in paper 24 | thre2 = 0.05; % threshold 2 in paper 25 | thre3 = 0.09; % threshold 1 in paper 26 | 27 | 28 | %% simulation 29 | for rType = [1,2] 30 | WiLabV2Xsim(configFile, 'seed', 0,... 31 | 'retransType', rType, 'ITSNumberOfReplicasMax', 4,... 32 | 'ITSReplicasThreshold1', thre1, 'ITSReplicasThreshold2', thre2,... 33 | 'ITSReplicasThreshold3', thre3,... 34 | 'folderPERcurves', path_PERcurves,'channelModel',0,... 35 | 'outputFolder', fullfile(path_output, sprintf("rType_%d",rType))); 36 | end 37 | 38 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/.gitignore: -------------------------------------------------------------------------------- 1 | data 2 | figures 3 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/plot_figs_for_paper/functions/getdis.m: -------------------------------------------------------------------------------- 1 | function dis = getdis(d, prr, prr_thre) 2 | %GETDIS get distance with prr > threshold 3 | % 4 | i_prr = prr>prr_thre; 5 | cross_points = []; 6 | for i=1:length(i_prr)-1 7 | if i_prr(i) && ~i_prr(i+1) 8 | cross_points = [cross_points, i]; 9 | end 10 | end 11 | 12 | switch length(cross_points) 13 | case 0 % no data larger than threshold 14 | dis = 0; 15 | case 1 % normal data 16 | dis = interp1(prr(cross_points:cross_points+1), d(cross_points:cross_points+1), prr_thre); 17 | otherwise % fluctuation data 18 | dis = sum(d(cross_points))/length(cross_points); 19 | end 20 | 21 | 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/plot_figs_for_paper/plot_tot_data.m: -------------------------------------------------------------------------------- 1 | % For balanced technology 2 | data_additional_name = ""; 3 | varTs = [0, -1]; 4 | for varT = varTs 5 | fig_1_plot_prr_max_dis(varT, data_additional_name); 6 | fig_2_plot_packet_delay(varT, data_additional_name); 7 | fig_3_plot_data_age(varT, data_additional_name); 8 | end 9 | 10 | % % For unbalanced technology 11 | % data_names = ["_2_3_lte", "_1_3_lte"]; 12 | % varTs = 0; 13 | % 14 | % for data_name = data_names 15 | % fig_1_plot_prr_max_dis(varTs, data_name); 16 | % fig_2_plot_packet_delay(varTs, data_name); 17 | % fig_3_plot_data_age(varTs, data_name); 18 | % end 19 | 20 | 21 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/plot_figs_for_paper/read_tot_data.m: -------------------------------------------------------------------------------- 1 | % For balanced technology 2 | data_additional_name = ""; 3 | varTs = [0, -1]; 4 | computer_names = "felix"; 5 | data_name_output = ""; 6 | 7 | for varT = varTs 8 | fig_1_read_prr_data(computer_names,varT,data_name_output); 9 | fig_2_read_packet_delay_data(computer_names,varT,data_name_output); 10 | fig_3_read_data_age(computer_names,varT,data_name_output); 11 | end 12 | 13 | 14 | % computer_names = ["felix_2_3_lte", "felixlen_1_3_lte"]; 15 | % data_name_output = ["2_3_lte", "1_3_lte"]; 16 | % 17 | % for i=1:length(computer_names) 18 | % fig_1_read_prr_data(computer_names(i),data_name_output(i)); 19 | % fig_2_read_packet_delay_data(computer_names(i),data_name_output(i)); 20 | % fig_3_read_data_age(computer_names(i),data_name_output(i)); 21 | % end 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/readme.md: -------------------------------------------------------------------------------- 1 | # Code Explanation 2 | This folder is organized for plot figures mentioned in the following paper: 3 | 4 | Wu, Z., Bartoletti, S., Martinez, V., Todisco, V., & Bazzi, A. (2023). Analysis of Co-Channel Coexistence Mitigation Methods Applied to IEEE 802.11 p and 5G NR-V2X Sidelink. Sensors, 23(9), 4337. 5 | 6 | ## 1. Simulation 7 | Simulation code and related configeration files could be found in folder "simulation_task". In order to get smooth curves, more simulations for each scenario maybe needed. 8 | 9 | The simulation results would be saved in folder "data/[subfolders]" 10 | 11 | ## 2. Read data and plot 12 | In folder "plot_figs_for_paper", "read_tot_data.m" and "plot_tot_data.m" could be modified to use the other functions to read and plot related figures. 13 | 14 | Figures would be saved in folder "figures". 15 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/simulation_task/coch_dynamic_C.cfg: -------------------------------------------------------------------------------- 1 | %% simulation parameters 2 | [simulationTime] 120 3 | [Technology] COEX-STD-INTERF-5G 4 | [TypeOfScenario] ETSI-Highway 5 | [roadLength] 8000 6 | [roadWidth] 4 7 | [vMean] 120 8 | [vStDev] 12 9 | [NLanes] 3 10 | 11 | %% coexistence mitigation method 12 | [coexMethod] C 13 | [coex_superFlength] 0.025 14 | [coex_endOfLTE] 0.013 15 | [coex_slotManagement] dynamic 16 | 17 | 18 | %% packet generation 19 | [averageTbeacon] 0.1 20 | [dcc_active] false 21 | [variabilityGenerationInterval] 0 22 | 23 | 24 | %% PHY layer 25 | % channel model 26 | [channelModel] 3 27 | [L0_dB] 47.85 28 | [beta] 2 29 | [d_threshold1] 128 30 | [beta2] 2.8 31 | [d_threshold2] 512 32 | [beta3] 3.3 33 | 34 | [F_dB] 6 35 | [folderPERcurves] 36 | [rilModel11p] true 37 | [MCS_11p] 2 38 | [MCS_LTE] 7 39 | [MCS_NR] 8 40 | [sizeSubchannel] 12 41 | [BRoverlapAllowed] true 42 | [BRAlgorithm] 18 43 | [FixedPdensity] false 44 | 45 | [ifAdjacent] true 46 | [SCS_NR] 30 % Sets the SCS for 5G (kHz) 47 | [nDMRS_NR] 18 % Sets the number of DMRS resource element used in each slot 48 | [SCIsymbols] 3 % Sets the number of symbols dedicated to the SCI-1 between 2 and 3 49 | [nRB_SCI] 12 % Sets the number of RBs dedicated to the SCI-1 50 | [probResKeep] 0.5 51 | 52 | 53 | %% output 54 | [printPacketReceptionRatio] true 55 | [prrResolution] 50 56 | [printCBR] true 57 | 58 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/simulation_task/coch_dynamic_C_preamble.cfg: -------------------------------------------------------------------------------- 1 | %% simulation parameters 2 | [simulationTime] 120 3 | [Technology] COEX-STD-INTERF-5G 4 | [TypeOfScenario] ETSI-Highway 5 | [roadLength] 8000 6 | [roadWidth] 4 7 | [vMean] 120 8 | [vStDev] 12 9 | [NLanes] 3 10 | 11 | %% coexistence mitigation method 12 | [coexMethod] C 13 | [coex_superFlength] 0.05 14 | [coex_endOfLTE] 0.05 15 | 16 | 17 | 18 | %% packet generation 19 | [averageTbeacon] 0.1 20 | [dcc_active] false 21 | [variabilityGenerationInterval] 0 22 | 23 | 24 | %% PHY layer 25 | % channel model 26 | [channelModel] 3 27 | [L0_dB] 47.85 28 | [beta] 2 29 | [d_threshold1] 128 30 | [beta2] 2.8 31 | [d_threshold2] 512 32 | [beta3] 3.3 33 | 34 | [F_dB] 6 35 | [folderPERcurves] 36 | [rilModel11p] true 37 | [MCS_11p] 2 38 | [MCS_LTE] 7 39 | [MCS_NR] 8 40 | [sizeSubchannel] 12 41 | [BRoverlapAllowed] true 42 | [BRAlgorithm] 18 43 | [FixedPdensity] false 44 | 45 | [ifAdjacent] true 46 | [SCS_NR] 30 % Sets the SCS for 5G (kHz) 47 | [nDMRS_NR] 18 % Sets the number of DMRS resource element used in each slot 48 | [SCIsymbols] 3 % Sets the number of symbols dedicated to the SCI-1 between 2 and 3 49 | [nRB_SCI] 12 % Sets the number of RBs dedicated to the SCI-1 50 | [probResKeep] 0.5 51 | 52 | 53 | %% output 54 | [printPacketReceptionRatio] true 55 | [prrResolution] 50 56 | [printCBR] true 57 | 58 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/simulation_task/coch_enhanced_A.cfg: -------------------------------------------------------------------------------- 1 | %% simulation parameters 2 | [simulationTime] 120 3 | [Technology] COEX-STD-INTERF-5G 4 | [TypeOfScenario] ETSI-Highway 5 | [roadLength] 8000 6 | [roadWidth] 4 7 | [vMean] 120 8 | [vStDev] 12 9 | [NLanes] 3 10 | 11 | %% coexistence mitigation method 12 | [coexMethod] A 13 | [coexA_improvements] 2 14 | [coex_superFlength] 0.025 15 | [coex_endOfLTE] 0.013 16 | 17 | 18 | %% packet generation 19 | [averageTbeacon] 0.1 20 | [dcc_active] false 21 | [variabilityGenerationInterval] 0 22 | 23 | 24 | %% PHY layer 25 | % channel model 26 | [channelModel] 3 27 | [L0_dB] 47.85 28 | [beta] 2 29 | [d_threshold1] 128 30 | [beta2] 2.8 31 | [d_threshold2] 512 32 | [beta3] 3.3 33 | 34 | [F_dB] 6 35 | [folderPERcurves] 36 | [rilModel11p] true 37 | [MCS_11p] 2 38 | [MCS_LTE] 7 39 | [MCS_NR] 8 40 | [sizeSubchannel] 12 41 | [BRoverlapAllowed] true 42 | [BRAlgorithm] 18 43 | [FixedPdensity] false 44 | 45 | [ifAdjacent] true 46 | [SCS_NR] 30 % Sets the SCS for 5G (kHz) 47 | [nDMRS_NR] 18 % Sets the number of DMRS resource element used in each slot 48 | [SCIsymbols] 3 % Sets the number of symbols dedicated to the SCI-1 between 2 and 3 49 | [nRB_SCI] 12 % Sets the number of RBs dedicated to the SCI-1 50 | [probResKeep] 0.5 51 | 52 | 53 | %% output 54 | [printPacketReceptionRatio] true 55 | [prrResolution] 50 56 | [printCBR] true 57 | 58 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/simulation_task/coch_method_B.cfg: -------------------------------------------------------------------------------- 1 | %% simulation parameters 2 | [simulationTime] 120 3 | [Technology] COEX-STD-INTERF-5G 4 | [TypeOfScenario] ETSI-Highway 5 | [roadLength] 8000 6 | [roadWidth] 4 7 | [vMean] 120 8 | [vStDev] 12 9 | [NLanes] 3 10 | 11 | %% coexistence mitigation method 12 | [coexMethod] B 13 | %[coexB_allToTransmitInEmptySF] true % default true 14 | %[coexB_timeBeforeLTEstarts] 15 | [coex_superFlength] 0.025 16 | [coex_endOfLTE] 0.013 17 | 18 | 19 | %% packet generation 20 | [averageTbeacon] 0.1 21 | [dcc_active] false 22 | [variabilityGenerationInterval] 0 23 | 24 | 25 | %% PHY layer 26 | % channel model 27 | [channelModel] 3 28 | [L0_dB] 47.85 29 | [beta] 2 30 | [d_threshold1] 128 31 | [beta2] 2.8 32 | [d_threshold2] 512 33 | [beta3] 3.3 34 | 35 | [F_dB] 6 36 | [folderPERcurves] 37 | [rilModel11p] true 38 | [MCS_11p] 2 39 | [MCS_LTE] 7 40 | [MCS_NR] 8 41 | [sizeSubchannel] 12 42 | [BRoverlapAllowed] true 43 | [BRAlgorithm] 18 44 | [FixedPdensity] false 45 | 46 | [ifAdjacent] true 47 | [SCS_NR] 30 % Sets the SCS for 5G (kHz) 48 | [nDMRS_NR] 18 % Sets the number of DMRS resource element used in each slot 49 | [SCIsymbols] 3 % Sets the number of symbols dedicated to the SCI-1 between 2 and 3 50 | [nRB_SCI] 12 % Sets the number of RBs dedicated to the SCI-1 51 | [probResKeep] 0.5 52 | 53 | 54 | %% output 55 | [printPacketReceptionRatio] true 56 | [prrResolution] 50 57 | [printCBR] true 58 | 59 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/simulation_task/coch_method_F.cfg: -------------------------------------------------------------------------------- 1 | %% simulation parameters 2 | [simulationTime] 120 3 | [Technology] COEX-STD-INTERF-5G 4 | [TypeOfScenario] ETSI-Highway 5 | [roadLength] 8000 6 | [roadWidth] 4 7 | [vMean] 120 8 | [vStDev] 12 9 | [NLanes] 3 10 | 11 | %% coexistence mitigation method 12 | [coexMethod] F 13 | %[coexF_guardTime] true % default true 14 | 15 | [coex_superFlength] 0.025 16 | [coex_endOfLTE] 0.013 17 | 18 | %% packet generation 19 | [averageTbeacon] 0.1 20 | [dcc_active] false 21 | [variabilityGenerationInterval] 0 22 | 23 | 24 | %% PHY layer 25 | % channel model 26 | [channelModel] 3 27 | [L0_dB] 47.85 28 | [beta] 2 29 | [d_threshold1] 128 30 | [beta2] 2.8 31 | [d_threshold2] 512 32 | [beta3] 3.3 33 | 34 | [F_dB] 6 35 | [folderPERcurves] 36 | [rilModel11p] true 37 | [MCS_11p] 2 38 | [MCS_LTE] 7 39 | [MCS_NR] 8 40 | [sizeSubchannel] 12 41 | [BRoverlapAllowed] true 42 | [BRAlgorithm] 18 43 | [FixedPdensity] false 44 | 45 | [ifAdjacent] true 46 | [SCS_NR] 30 % Sets the SCS for 5G (kHz) 47 | [nDMRS_NR] 18 % Sets the number of DMRS resource element used in each slot 48 | [SCIsymbols] 3 % Sets the number of symbols dedicated to the SCI-1 between 2 and 3 49 | [nRB_SCI] 12 % Sets the number of RBs dedicated to the SCI-1 50 | [probResKeep] 0.5 51 | 52 | 53 | %% output 54 | [printPacketReceptionRatio] true 55 | [prrResolution] 50 56 | [printCBR] true 57 | 58 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/simulation_task/coch_no_method.cfg: -------------------------------------------------------------------------------- 1 | %% simulation parameters 2 | [simulationTime] 120 3 | [Technology] COEX-STD-INTERF-5G 4 | [TypeOfScenario] ETSI-Highway 5 | [roadLength] 8000 6 | [roadWidth] 4 7 | [vMean] 120 8 | [vStDev] 12 9 | [NLanes] 3 10 | 11 | %% coexistence mitigation method 12 | [coexMethod] 0 13 | 14 | 15 | 16 | 17 | 18 | %% packet generation 19 | [averageTbeacon] 0.1 20 | [dcc_active] false 21 | [variabilityGenerationInterval] 0 22 | 23 | 24 | %% PHY layer 25 | % channel model 26 | [channelModel] 3 27 | [L0_dB] 47.85 28 | [beta] 2 29 | [d_threshold1] 128 30 | [beta2] 2.8 31 | [d_threshold2] 512 32 | [beta3] 3.3 33 | 34 | [F_dB] 6 35 | [folderPERcurves] 36 | [rilModel11p] true 37 | [MCS_11p] 2 38 | [MCS_LTE] 7 39 | [MCS_NR] 8 40 | [sizeSubchannel] 12 41 | [BRoverlapAllowed] true 42 | [BRAlgorithm] 18 43 | [FixedPdensity] false 44 | 45 | [ifAdjacent] true 46 | [SCS_NR] 30 % Sets the SCS for 5G (kHz) 47 | [nDMRS_NR] 18 % Sets the number of DMRS resource element used in each slot 48 | [SCIsymbols] 3 % Sets the number of symbols dedicated to the SCI-1 between 2 and 3 49 | [nRB_SCI] 12 % Sets the number of RBs dedicated to the SCI-1 50 | [probResKeep] 0.5 51 | 52 | 53 | %% output 54 | [printPacketReceptionRatio] true 55 | [prrResolution] 50 56 | [printCBR] true 57 | 58 | -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/simulation_task/coch_only_ITS.cfg: -------------------------------------------------------------------------------- 1 | %% simulation parameters 2 | [simulationTime] 120 3 | [Technology] 80211p 4 | [TypeOfScenario] ETSI-Highway 5 | [roadLength] 8000 6 | [roadWidth] 4 7 | [vMean] 120 8 | [vStDev] 12 9 | [NLanes] 3 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | %% packet generation 19 | [averageTbeacon] 0.1 20 | [dcc_active] false 21 | [variabilityGenerationInterval] 0 22 | 23 | 24 | %% PHY layer 25 | % channel model 26 | [channelModel] 3 27 | [L0_dB] 47.85 28 | [beta] 2 29 | [d_threshold1] 128 30 | [beta2] 2.8 31 | [d_threshold2] 512 32 | [beta3] 3.3 33 | 34 | [F_dB] 6 35 | [folderPERcurves] 36 | [rilModel11p] true 37 | [MCS_11p] 2 38 | [MCS_LTE] 7 39 | [MCS_NR] 8 40 | [sizeSubchannel] 12 41 | [BRoverlapAllowed] true 42 | [BRAlgorithm] 18 43 | [FixedPdensity] false 44 | 45 | [ifAdjacent] true 46 | [SCS_NR] 30 % Sets the SCS for 5G (kHz) 47 | [nDMRS_NR] 18 % Sets the number of DMRS resource element used in each slot 48 | [SCIsymbols] 3 % Sets the number of symbols dedicated to the SCI-1 between 2 and 3 49 | [nRB_SCI] 12 % Sets the number of RBs dedicated to the SCI-1 50 | [probResKeep] 0.5 51 | 52 | 53 | %% output 54 | [printPacketReceptionRatio] true 55 | [prrResolution] 50 56 | [printCBR] true -------------------------------------------------------------------------------- /codeForPaper/Zhuofei2023cochannel/simulation_task/coch_only_NR.cfg: -------------------------------------------------------------------------------- 1 | %% simulation parameters 2 | [simulationTime] 120 3 | [Technology] NR-V2X 4 | [TypeOfScenario] ETSI-Highway 5 | [roadLength] 8000 6 | [roadWidth] 4 7 | [vMean] 120 8 | [vStDev] 12 9 | [NLanes] 3 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | %% packet generation 19 | [averageTbeacon] 0.1 20 | [dcc_active] false 21 | [variabilityGenerationInterval] 0 22 | 23 | 24 | %% PHY layer 25 | % channel model 26 | [channelModel] 3 27 | [L0_dB] 47.85 28 | [beta] 2 29 | [d_threshold1] 128 30 | [beta2] 2.8 31 | [d_threshold2] 512 32 | [beta3] 3.3 33 | 34 | [F_dB] 6 35 | [folderPERcurves] 36 | [rilModel11p] true 37 | [MCS_11p] 2 38 | [MCS_LTE] 7 39 | [MCS_NR] 8 40 | [sizeSubchannel] 12 41 | [BRoverlapAllowed] true 42 | [BRAlgorithm] 18 43 | [FixedPdensity] false 44 | 45 | [ifAdjacent] true 46 | [SCS_NR] 30 % Sets the SCS for 5G (kHz) 47 | [nDMRS_NR] 18 % Sets the number of DMRS resource element used in each slot 48 | [SCIsymbols] 3 % Sets the number of symbols dedicated to the SCI-1 between 2 and 3 49 | [nRB_SCI] 12 % Sets the number of RBs dedicated to the SCI-1 50 | [probResKeep] 0.5 51 | 52 | 53 | %% output 54 | [printPacketReceptionRatio] true 55 | [prrResolution] 50 56 | [printCBR] true 57 | 58 | 59 | --------------------------------------------------------------------------------