00001 #include <list>
00002
00003 #include "SlottedAloha.h"
00004
00026 SysSAloha::SysSAloha(ParamManager* _Param, GlobalProbeManager* _Results, ProbeManager* _ProbeMgr)
00027 : DESystem(_Param,
00028 _Results,
00029 _ProbeMgr,
00030 get<IntParameter,int>(_Param, "TimeResolution", "SAloha", ""),
00031 stringToULL( get<StringParameter,string>(_Param, "SlotTime", "SAloha", ""),
00032 get<IntParameter,int>(_Param, "TimeResolution", "SAloha", "") ),
00033 1,
00034 1)
00035 {
00036
00037
00038 ap = 0;
00039 PktGen = 0;
00040 }
00041
00050 void SysSAloha::setup(ParamManager *Param, GlobalProbeManager *Results)
00051 {
00052
00053
00054 Param->addClass ("SAloha", "SAloha system");
00055
00056 Param->addParameter ("SAloha", new IntParameter("TimeResolution", "Risoluzione temporale", "-6", "(0,inf)" ));
00057 Param->addParameter ("SAloha", new StringParameter("SlotTime", "Length of a slot", "1", "(0,inf)" ));
00058 Param->addParameter ("SAloha", new DETimeParameter("RoundTripDelay", "Round trip delay", "1.1", "(0,inf)" ));
00059
00060
00061 DevPkt::setup(Param, Results);
00062 DevPktGen::setup(Param, Results);
00063 DevAP::setup(Param, Results);
00064
00065
00066 Param->setDefault("BaseFileName", "results/");
00067 Param->setDefault("TimeResolution", "-6");
00068 Param->setDefault("SimulationTime", "100000");
00069 Param->setDefault("WriteStatsInterval", "10000");
00070 Param->setDefault("DebugPrintInterval", "10000");
00071 }
00072
00073
00080 void SysSAloha::Initialize()
00081 {
00082 DESystem::Initialize();
00083
00084
00085
00086 if( ap )
00087 delete ap;
00088 ap = new DevAP(this);
00089 ap->Initialize();
00090
00091
00092
00093 if( PktGen )
00094 delete PktGen;
00095 PktGen = new DevPktGen(this, ap);
00096 PktGen->Initialize();
00097 }
00098
00102 SysSAloha::~SysSAloha()
00103 {
00104 if( ap )
00105 delete ap;
00106
00107 if( PktGen )
00108 delete PktGen;
00109 }
00110
00112
00114
00120 void DEMain()
00121 {
00122 RunSimul<SysSAloha>();
00123 }
00124