Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIxed Bug In ModifyAllocation and a bug in Node.cc #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions scratch/evaluate_spatial_sharing_udp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ uint8_t stationsTrained = 0; /* Number of BF trained stations */
bool scheduledStaticPeriods = false; /* Flag to indicate whether we scheduled Static Service Periods or not */

/*** Service Period Parameters ***/
uint16_t sp1Duration = 20000; /* The duration of the allocated service period (1) in MicroSeconds */
uint16_t sp2Duration = 12000; /* The duration of the allocated service period (2) in MicroSeconds */
uint32_t sp1StartTime; /* The start time of the allocated service period (1) in MicroSeconds */
uint32_t sp2StartTime; /* The start time of the allocated service period (2) in MicroSeconds */
uint16_t offsetDuration = 1000; /* The offset between the start of the two service period allocations in MicroSeconds */
uint16_t sp1Duration = 20000; /* The duration of the allocated service period (1) in MicroSeconds */
uint16_t sp2Duration = 12000; /* The duration of the allocated service period (2) in MicroSeconds */
uint16_t offsetDuration = 1000; /* The offset between the start of the two service period allocations in MicroSeconds */
uint32_t sp1StartTime = 10000; /* The start time of the allocated service period (1) in MicroSeconds (CBAP finishes after 10000)*/
uint32_t sp2StartTime = sp1StartTime + sp1Duration + offsetDuration; /* The start time of the allocated service period (2) in MicroSeconds */
typedef std::map<Mac48Address, bool> ReportMap;
typedef ReportMap::const_iterator ReportMapCI;
ReportMap m_reportsStatus;
Expand Down Expand Up @@ -169,15 +169,15 @@ SLSCompleted (Ptr<DmgStaWifiMac> staWifiMac, Mac48Address address,
scheduledStaticPeriods = true;
/* Schedule Allocation Periods */
uint32_t startTime = 0;
startTime = apWifiMac->AllocateCbapPeriod (true, startTime, 10000);
sp1StartTime = apWifiMac->AllocateSingleContiguousBlock (1, SERVICE_PERIOD_ALLOCATION, true,
startTime = apWifiMac->AllocateCbapPeriod (true, startTime, sp1StartTime);
startTime = apWifiMac->AllocateSingleContiguousBlock (1, SERVICE_PERIOD_ALLOCATION, true,
wifiMac1->GetAssociationID (),
wifiMac2->GetAssociationID (),
startTime,
sp1Duration);
startTime = sp1StartTime;

/* Candidate SP */
sp2StartTime = apWifiMac->AllocateSingleContiguousBlock (2, SERVICE_PERIOD_ALLOCATION, true,
startTime = apWifiMac->AllocateSingleContiguousBlock (2, SERVICE_PERIOD_ALLOCATION, true,
wifiMac3->GetAssociationID (),
wifiMac4->GetAssociationID (),
startTime + offsetDuration,
Expand Down
2 changes: 1 addition & 1 deletion src/network/model/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Node::GetTypeId (void)
MakeUintegerAccessor (&Node::m_id),
MakeUintegerChecker<uint32_t> ())
.AddAttribute ("SystemId", "The systemId of this node: a unique integer used for parallel simulations.",
TypeId::ATTR_GET || TypeId::ATTR_SET,
TypeId::ATTR_GET | TypeId::ATTR_SET,
UintegerValue (0),
MakeUintegerAccessor (&Node::m_sid),
MakeUintegerChecker<uint32_t> ())
Expand Down
9 changes: 4 additions & 5 deletions src/wifi/model/dmg-ap-wifi-mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,11 @@ DmgApWifiMac::ModifyAllocation (AllocationID id, uint8_t srcAid, uint8_t dstAid,
NS_LOG_FUNCTION (this << uint32_t (id) << uint32_t (srcAid) << uint32_t (dstAid) << newStartTime << newDuration);
for (AllocationFieldList::iterator iter = m_allocationList.begin (); iter != m_allocationList.end (); iter++)
{
AllocationField field = (*iter);
if ((field.GetAllocationID () == id) &&
(field.GetSourceAid () == srcAid) && (field.GetDestinationAid () == dstAid))
if ((iter->GetAllocationID () == id) &&
(iter->GetSourceAid () == srcAid) && (iter->GetDestinationAid () == dstAid))
{
field.SetAllocationStart (newStartTime);
field.SetAllocationBlockDuration (newDuration);
iter->SetAllocationStart (newStartTime);
iter->SetAllocationBlockDuration (newDuration);
break;
}
}
Expand Down
20 changes: 14 additions & 6 deletions src/wifi/model/dmg-sta-wifi-mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ DmgStaWifiMac::DmgStaWifiMac ()

/* Let the lower layers know that we are acting as a non-AP DMG STA in an infrastructure BSS. */
SetTypeOfStation (DMG_STA);

/* Spatial Sharing Variables */
m_recievedDirectionalChannelQualityRequest = false;
}

DmgStaWifiMac::~DmgStaWifiMac ()
Expand Down Expand Up @@ -850,6 +853,12 @@ DmgStaWifiMac::StartDataTransmissionInterval (void)
Simulator::Schedule (nextBeaconInterval, &DmgStaWifiMac::StartBeaconInterval, this);
NS_LOG_DEBUG ("Next Beacon Interval will start at " << Simulator::Now () + nextBeaconInterval);

if (m_recievedDirectionalChannelQualityRequest){
Simulator::Schedule (MicroSeconds (m_reqElem->GetMeasurementStartTime ()),
&DmgStaWifiMac::StartChannelQualityMeasurement, this, m_reqElem);
m_recievedDirectionalChannelQualityRequest = false;
}

/* Send Association Request if we are not assoicated */
if (!IsAssociated ())
{
Expand Down Expand Up @@ -1595,7 +1604,6 @@ DmgStaWifiMac::StartChannelQualityMeasurement (Ptr<DirectionalChannelQualityRequ
m_sp->DisableChannelAccess ();
m_dcfManager->DisableChannelAccess ();
}
m_reqElem = element;
StaticCast<YansWifiPhy> (m_phy)->StartMeasurement (element->GetMeasurementDuration (), element->GetNumberOfTimeBlocks ());
}

Expand All @@ -1608,6 +1616,7 @@ DmgStaWifiMac::ReportChannelQualityMeasurement (TimeBlockMeasurementList list)
reportElem->SetChannelNumber (m_reqElem->GetChannelNumber ());
reportElem->SetMeasurementDuration (m_reqElem->GetMeasurementDuration ());
reportElem->SetMeasurementMethod (m_reqElem->GetMeasurementMethod ());
reportElem->SetNumberOfTimeBlocks(m_reqElem->GetNumberOfTimeBlocks());
/* Add obtained measurement results to the report */
for (TimeBlockMeasurementListCI it = list.begin (); it != list.end (); it++)
{
Expand Down Expand Up @@ -2193,11 +2202,10 @@ DmgStaWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr)
{
RadioMeasurementRequest requestHdr;
packet->RemoveHeader (requestHdr);
Ptr<DirectionalChannelQualityRequestElement> elem =
DynamicCast<DirectionalChannelQualityRequestElement> (requestHdr.GetListOfMeasurementRequestElement ().at (0));
/* Schedule the start of the requested measurement */
Simulator::Schedule (MicroSeconds (elem->GetMeasurementStartTime ()),
&DmgStaWifiMac::StartChannelQualityMeasurement, this, elem);
/* Set Flag so when DTI starts, it will know to schdule channel quality request at the appropiate time */
m_reqElem = DynamicCast<DirectionalChannelQualityRequestElement> (requestHdr.GetListOfMeasurementRequestElement ().at (0));
m_recievedDirectionalChannelQualityRequest = true;

return;
}
default:
Expand Down
1 change: 1 addition & 0 deletions src/wifi/model/dmg-sta-wifi-mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ class DmgStaWifiMac : public DmgWifiMac
/* Spatial Sharing and Interference Mitigation */
bool m_supportSpsh; //!< Flag to indicate whether we support Spatial Sharing and Interference Mitigation.
Ptr<DirectionalChannelQualityRequestElement> m_reqElem;
bool m_recievedDirectionalChannelQualityRequest; // Flag to indicate whether a channel Quality Request has been requested.

};

Expand Down