Discussion:
WGS84 positions in simulation
'Thorben Iggena' via ns-3-users
2018-07-31 15:08:00 UTC
Permalink
Hi all,

I have some questions regarding some "real world" sensors in a simulation.
I have about 100 sensors with GPS coordinates. At the moment I read in the
coordinates and transform them to Cartesian coordinates:

Vector position = geopgraphicPositions.GeographicToCartesianCoordinates(
sensor->getLatitude1(), sensor->getLongitude1(), 0, GeographicPositions::
WGS84);
Ptr<ConstantPositionMobilityModel> nodeMobility = nodes.Get(i++)->GetObject<
ConstantPositionMobilityModel>();
nodeMobility->SetPosition(position);


Is this right what I am doing? As the visualisation is not working (some
python libraries do not work under Mint 19) I wanted at least to check the
distance between some nodes with the CalculateDistance function but this
gives me some strange values.
Within the tutorials I didn't found anything on how to work with WGS84
coordinates.

So does anyone have some links to tutorials etc. on how to do this? I think
I am not the first one but I didn't found anything useful yet.

Thanks and kind regards,

tanktoo
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+***@googlegroups.com.
To post to this group, send email to ns-3-***@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
j***@gmail.com
2018-07-31 17:46:32 UTC
Permalink
Thorben,

Maybe an example of a couple points, your expected distance, and the
distance that is being calculated might help debug the problem. It looks
like you're using the method correctly. Latitude and longitude should be
in degrees. Distances computed in cartesian coords will be straight line
distances, so if you have two points that are far apart (100's km) then the
computed distance might be shorter than the distance along the surface.

Jared.
Post by 'Thorben Iggena' via ns-3-users
Hi all,
I have some questions regarding some "real world" sensors in a simulation.
I have about 100 sensors with GPS coordinates. At the moment I read in the
Vector position = geopgraphicPositions.GeographicToCartesianCoordinates(
WGS84);
Ptr<ConstantPositionMobilityModel> nodeMobility = nodes.Get(i++)->
GetObject<ConstantPositionMobilityModel>();
nodeMobility->SetPosition(position);
Is this right what I am doing? As the visualisation is not working (some
python libraries do not work under Mint 19) I wanted at least to check the
distance between some nodes with the CalculateDistance function but this
gives me some strange values.
Within the tutorials I didn't found anything on how to work with WGS84
coordinates.
So does anyone have some links to tutorials etc. on how to do this? I
think I am not the first one but I didn't found anything useful yet.
Thanks and kind regards,
tanktoo
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+***@googlegroups.com.
To post to this group, send email to ns-3-***@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
j***@gmail.com
2018-07-31 17:52:42 UTC
Permalink
One more point. The WGS84 option is used to define the spheroid
approximation for the surface of the earth from which your altitude is
measured. This is a smooth approximation to the actual earth's surface and
does not incorporate topography like mountains, hills, or the like. Your
GPS device will give you an elevation or altitude output that is your
height above the WGS spheroid.
Post by j***@gmail.com
Thorben,
Maybe an example of a couple points, your expected distance, and the
distance that is being calculated might help debug the problem. It looks
like you're using the method correctly. Latitude and longitude should be
in degrees. Distances computed in cartesian coords will be straight line
distances, so if you have two points that are far apart (100's km) then the
computed distance might be shorter than the distance along the surface.
Jared.
Post by 'Thorben Iggena' via ns-3-users
Hi all,
I have some questions regarding some "real world" sensors in a simulation.
I have about 100 sensors with GPS coordinates. At the moment I read in
Vector position = geopgraphicPositions.GeographicToCartesianCoordinates(
WGS84);
Ptr<ConstantPositionMobilityModel> nodeMobility = nodes.Get(i++)->
GetObject<ConstantPositionMobilityModel>();
nodeMobility->SetPosition(position);
Is this right what I am doing? As the visualisation is not working (some
python libraries do not work under Mint 19) I wanted at least to check the
distance between some nodes with the CalculateDistance function but this
gives me some strange values.
Within the tutorials I didn't found anything on how to work with WGS84
coordinates.
So does anyone have some links to tutorials etc. on how to do this? I
think I am not the first one but I didn't found anything useful yet.
Thanks and kind regards,
tanktoo
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+***@googlegroups.com.
To post to this group, send email to ns-3-***@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
'Thorben Iggena' via ns-3-users
2018-08-01 07:37:01 UTC
Permalink
Hi Jared thanks for your answer!
As you said that my approach is correct I did a smaller example with only
two sensors. Seems my list got mixed up and that's why the distances were
wrong. With two sensors everything is fine.

So as I understand correctly the distance is calculated in meters and this
will be used as the distance for wireless communication as well?

Thanks!
Post by j***@gmail.com
One more point. The WGS84 option is used to define the spheroid
approximation for the surface of the earth from which your altitude is
measured. This is a smooth approximation to the actual earth's surface and
does not incorporate topography like mountains, hills, or the like. Your
GPS device will give you an elevation or altitude output that is your
height above the WGS spheroid.
Post by j***@gmail.com
Thorben,
Maybe an example of a couple points, your expected distance, and the
distance that is being calculated might help debug the problem. It looks
like you're using the method correctly. Latitude and longitude should be
in degrees. Distances computed in cartesian coords will be straight line
distances, so if you have two points that are far apart (100's km) then the
computed distance might be shorter than the distance along the surface.
Jared.
Post by 'Thorben Iggena' via ns-3-users
Hi all,
I have some questions regarding some "real world" sensors in a simulation.
I have about 100 sensors with GPS coordinates. At the moment I read in
Vector position = geopgraphicPositions.GeographicToCartesianCoordinates(
sensor->getLatitude1(), sensor->getLongitude1(), 0, GeographicPositions
::WGS84);
Ptr<ConstantPositionMobilityModel> nodeMobility = nodes.Get(i++)->
GetObject<ConstantPositionMobilityModel>();
nodeMobility->SetPosition(position);
Is this right what I am doing? As the visualisation is not working (some
python libraries do not work under Mint 19) I wanted at least to check the
distance between some nodes with the CalculateDistance function but this
gives me some strange values.
Within the tutorials I didn't found anything on how to work with WGS84
coordinates.
So does anyone have some links to tutorials etc. on how to do this? I
think I am not the first one but I didn't found anything useful yet.
Thanks and kind regards,
tanktoo
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+***@googlegroups.com.
To post to this group, send email to ns-3-***@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
Loading...