diff --git a/src/buildings/doc/source/buildings-user.rst b/src/buildings/doc/source/buildings-user.rst index 9cdab1c39..823a400b9 100644 --- a/src/buildings/doc/source/buildings-user.rst +++ b/src/buildings/doc/source/buildings-user.rst @@ -134,13 +134,18 @@ It is to be noted that any other configuration (i.e., with BuildingsPropagationL #. Building and nodes interactions:: + mm->SetIndoor (building, 2, 1, 1); + +which is equivalent to the form:: + mm->SetIndoor (building); mm->SetFloorNumber (2); mm->SetRoomNumberX (1); mm->SetRoomNumberY (1); - This informs node's mobility model the fact that the node is inside the building at the second floor in the corner room of the 3 x 2 grid. - It has to be noted that the simulator does not check the consistence between the node's position and the building site, which is user's responsibility. +This informs node's mobility model the fact that the node is inside the building at the second floor in the corner room of the 3 x 2 grid. +We suggest the usage of the first form since it performs a consistency check of the node position with the building bounds. +It has to be noted that the simulator does not check the consistence between the node's position (x,y,z coordinates) and the building position and size for outdoor nodes. The responsibility of this consistency is completely left to the user. diff --git a/src/buildings/model/building.cc b/src/buildings/model/building.cc index 5cf397e40..f1a9f46d0 100644 --- a/src/buildings/model/building.cc +++ b/src/buildings/model/building.cc @@ -114,5 +114,11 @@ Building::GetNumberRoomY () return (m_roomY); } +Box +Building::GetBuildingBounds () +{ + return (m_buldingBounds); +} + } // namespace ns3 diff --git a/src/buildings/model/building.h b/src/buildings/model/building.h index 7ada6f77a..e24cd4993 100644 --- a/src/buildings/model/building.h +++ b/src/buildings/model/building.h @@ -141,6 +141,12 @@ public: * Return the number of room in y-axis */ uint8_t GetNumberRoomY (); + + /** + * \return the bounds of the building + * Return the bounds of the building as Box class + */ + Box GetBuildingBounds (); private: diff --git a/src/buildings/model/buildings-mobility-model.cc b/src/buildings/model/buildings-mobility-model.cc index 0601670be..44fa91f2a 100644 --- a/src/buildings/model/buildings-mobility-model.cc +++ b/src/buildings/model/buildings-mobility-model.cc @@ -98,6 +98,22 @@ BuildingsMobilityModel::SetIndoor (Ptr building) m_myBuilding = building; } +void +BuildingsMobilityModel::SetIndoor (Ptr building, uint8_t nfloor, uint8_t nroomx, uint8_t nroomy) +{ + m_indoor = true; + m_myBuilding = building; + m_nFloor = nfloor; + m_roomX = nroomx; + m_roomY = nroomy; + + if (!building->GetBuildingBounds ().IsInside (m_helper.GetCurrentPosition ())) + { + NS_FATAL_ERROR ("Position of the node is inconsistent with building bounds"); + } +} + + void BuildingsMobilityModel::SetOutdoor (void) { diff --git a/src/buildings/model/buildings-mobility-model.h b/src/buildings/model/buildings-mobility-model.h index cb7baaedc..e911e060a 100644 --- a/src/buildings/model/buildings-mobility-model.h +++ b/src/buildings/model/buildings-mobility-model.h @@ -56,6 +56,7 @@ public: bool IsOutdoor (void); void SetIndoor (Ptr building); + void SetIndoor (Ptr building, uint8_t nfloor, uint8_t nroomx, uint8_t nroomy); void SetOutdoor (void); void SetSurroudingBuilding (Ptr building); diff --git a/src/lte/doc/source/lte-user.rst b/src/lte/doc/source/lte-user.rst index 666b63e27..eb69a7cd4 100644 --- a/src/lte/doc/source/lte-user.rst +++ b/src/lte/doc/source/lte-user.rst @@ -403,13 +403,18 @@ It is to be noted that using other means to configure the frequency used by the #. Building and nodes interactions:: + mm->SetIndoor (building, 2, 1, 1); + + which is equivalent to the form:: + mm->SetIndoor (building); mm->SetFloorNumber (2); mm->SetRoomNumberX (1); mm->SetRoomNumberY (1); - This informs the node's mobility model that the node is located inside the building on the second floor in the corner room of the 3 x 2 grid. - It has to be noted that the simulator does not check the consistence between the node's position (x,y,z coordinates) and the building position and size. The responsibility of this consistency is completely left to the user. + This informs the node's mobility model that the node is located inside the building on the second floor in the corner room of the 3 x 2 grid. + We suggest the usage of the first form since it performs a consistency check of the node position with the building bounds. + It has to be noted that the simulator does not check the consistence between the node's position (x,y,z coordinates) and the building position and size for outdoor nodes. The responsibility of this consistency is completely left to the user.