📄 savetrace.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright (c) __year__ Ericsson Telecommunicatie B.V. % All rights reserved. % % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the following conditions % are met: % 1. Redistributions of source code must retain the above copyright % notice, this list of conditions and the following disclaimer. % 2. Redistributions in binary form must reproduce the above copyright % notice, this list of conditions and the following disclaimer in the % documentation and/or other materials provided with the % distribution. % 3. Neither the name of Ericsson Telecommunicatie B.V. may be used % to endorse or promote products derived from this software without % specific prior written permission. % % % THIS SOFTWARE IS PROVIDED BY ERICSSON TELECOMMUNICATIE B.V. AND % CONTRIBUTORS "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, % INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF % MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. % IN NO EVENT SHALL ERICSSON TELECOMMUNICATIE B.V., THE AUTHOR OR HIS % CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, % EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, % PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR % PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY % OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT % (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE % OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. % % % Contact for feedback on EURANE: eurane@ti-wmc.nl % EURANE = Enhanced UMTS Radio Access Network Extensions % website: http://www.ti-wmc.nl/eurane/ %% ***************************************************************************%% UMTS-HSDPA channel generator % % Write the tracefile, which next can be used as an input file in the ns-2 % simulator EURANE.% Useful header information is included as well.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Each line contains the data needed at one moment:% Adapt it such that is included parameters that might change in the nearby future.name = ['output/',env,'-',num2str(vel_kmh),'kmh-',num2str(distanceUEBS),'m-',num2str(dur),'s-UEnr',num2str(n)];% Define the start and endindices.% The resulting length equals numTTItracesi=CQIdelayinTTI+1;ei=CQIdelayinTTI+numTTItrace;outputmatrix=[P_out(si:ei),P_1stRT(si:ei),P_2ndRT(si:ei),CQI(si:ei)]; disp('Note that the last'),HARQcycle*2disp('generated elements are not included in the output file')disp('Note that the first'),CQIdelayinTTIdisp('generated elements are not included in the output file')str1='%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%';str2='% Number of comment lines: 31';str3='% Tracefile generated at: ';str4='% in directory: ';str5='% with file name: ';str6='% by: ';str7='% containing: P, P_1stRT, P_2ndRT, CQI';str8='% i.e. P(t), MRC{P(t),P(t+H)}, MRC{P(t),P(t+H),P(t+2*H)}, CQI(.. P(t-D).. )';str9='% with MRC=Maximum Ratio Combining technique';str10='% with H=HARQcycle= ';str11='% and D=CQIdelayinTTI=';str12='% with trace length (numTTItrace): ';str13='% corresponding time interval in seconds:';str14='% (Note that this is the time between stop and finish for the event';str15='% scheduler in ns-2, which is longer than the time interval of the source)';str16='% for user #: ';str17='% velocity (km/h): ';str18='% distance (m) from BS: ';str19='% which environment (nr,name): ';str19a=char(strcat(env,{' environment'}));str20='% BS Transmission power (dBm): ';str21='% Base station antenna gain (in dBi): ';str22='% Linit (distance loss at 1 km): ';str23='% Iintra (intra cell interference): ';str24='% Iinter (inter cell interference): ';str25='% HARQ cycle period: ';str26='% Time delay (TTI) in CQI: ';str27='% Minimum CQI value: ';str28='% Maximum CQI value: ';str29='% Percentage of adapted (too low) CQI values: ';str30='% Percentage of adapted (too high) CQI values:';str31='%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'; [s,whoami]=unix('whoami'); fid=fopen(name,'w'); fprintf(fid,'%s \n',str1); fprintf(fid,'%s \n',str2); fprintf(fid,'%s %s \n',str3,datestr(now)); fprintf(fid,'%s %s \n',str4,pwd); fprintf(fid,'%s %s \n',str5,name); fprintf(fid,'%s %s \n',str6,whoami(1:end-1)); fprintf(fid,'%s \n',str7); fprintf(fid,'%s \n',str8); fprintf(fid,'%s \n',str9); fprintf(fid,'%s %6i \n',str10,HARQcycle); fprintf(fid,'%s %6i \n',str11,CQIdelayinTTI); fprintf(fid,'%s %6i \n',str12,numTTItrace); fprintf(fid,'%s %6i \n',str13,dur); fprintf(fid,'%s \n',str14); fprintf(fid,'%s \n',str15); fprintf(fid,'%s %6i \n',str16,n); fprintf(fid,'%s %12.8f \n',str17,vel_kmh); fprintf(fid,'%s %12.8f \n',str18,distanceUEBS); fprintf(fid,'%s %6i %s \n',str19,multi+5,str19a); fprintf(fid,'%s %6i \n',str20,PTx); fprintf(fid,'%s %6i \n',str21,GT); fprintf(fid,'%s %6i \n',str22,Linit); fprintf(fid,'%s %6i \n',str23,Iintra); fprintf(fid,'%s %6i \n',str24,Iinter); fprintf(fid,'%s %6i \n',str25,HARQcycle); fprintf(fid,'%s %3i \n',str26,CQIdelayinTTI); fprintf(fid,'%s %3i \n',str27,minCQI); fprintf(fid,'%s %3i \n',str28,maxCQI); fprintf(fid,'%s %3i \n',str29,perctoolow); fprintf(fid,'%s %3i \n',str30,perctoohigh); fprintf(fid,'%s \n',str31); fprintf(fid,'%12.8f %12.8f %12.8f %6i \n',outputmatrix'); fclose(fid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -