Showing sensor nodes in netanim with their sensing range as a circle

258 views
Skip to first unread message

Shashank Karkare

unread,
Oct 13, 2014, 10:43:42 AM10/13/14
to ns-3-...@googlegroups.com
Hi,

I am new to ns3 and netanim, I am implementing a coverage optimization in wsn. For this I need to show the sensing range of each sensor as a circle around each node. This is not the transmission range, you can say it is just the circle around node which will move with the node.  How to do this ??

I have attached the example. It is in the MATLAB GUI
example.png

Tommaso Pecorella

unread,
Oct 13, 2014, 1:33:35 PM10/13/14
to ns-3-...@googlegroups.com

Shashank Karkare

unread,
Oct 14, 2014, 2:22:27 AM10/14/14
to ns-3-...@googlegroups.com
Hi,

Thank you for reply. I also found that by changing color of node to white result in circle however it is not showing at the coordinates that I have given.

Please look at the attached animation of my sample

Thanks,
Shashank
Animated.png

Shashank Karkare

unread,
Oct 14, 2014, 2:24:02 AM10/14/14
to ns-3-...@googlegroups.com

coordinates given are (0, 0) and (0, 3)

On Tuesday, October 14, 2014 11:52:27 AM UTC+5:30, Shashank Karkare wrote:
Hi,

Thank you for reply. I also found that by changing color of node to white result in circle however it is not showing at the coordinates that I have given.

Please look at the attached animation of my sample. coordinates given are (0, 0) and (0, 3)

Tommaso Pecorella

unread,
Oct 14, 2014, 3:53:22 AM10/14/14
to ns-3-...@googlegroups.com
Hi,

I have no idea. It may be a bug in NetAnim, in the NetAnim VERSION you are using (you didn't say the version) or in your code.
Update NetAnim (and ns-3) and try again please.

Cheers,

T.

Shashank Karkare

unread,
Oct 14, 2014, 6:47:58 AM10/14/14
to ns-3-...@googlegroups.com
Ok..

John Abraham

unread,
Oct 14, 2014, 10:08:41 AM10/14/14
to ns-3-...@googlegroups.com
well, there is no API to do this as not many users have requested it.

however, you could modify NetAnim by changing resizeableitem.cpp

download the latest NetAnim : hg clone http://code.nsnam.org/netanim

to show like this

    case ResizeableItem::CIRCLE:
    {
      painter->drawEllipse (QPointF (0, 0), m_width * 2, m_height * 2);  // sensing range circle with radius == 2X node radius

      QBrush brush;
      brush.setStyle (Qt::SolidPattern);
      brush.setColor (QColor (m_r, m_g, m_b, m_alpha));
      painter->setBrush (brush);
      painter->drawEllipse (QPointF (0, 0), m_width, m_height);

    }


gives the attached picture

AnimNode, inherits from ResizeableItem and only animnode stores the nodeid, so you need to store a mapping of nodeId to sensing range in Resizeableitem.


--
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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Screen Shot 2014-10-14 at 7.03.51 AM.png

Shashank Karkare

unread,
Oct 17, 2014, 10:07:47 AM10/17/14
to ns-3-...@googlegroups.com
Thank you very much John for adding this small enhancement on my request.

Thanks,
Shashank

Utsab Khakurel

unread,
Mar 4, 2019, 11:25:36 AM3/4/19
to ns-3-users
Hi John! I am trying to draw similar circles around the nodes. Although the radius of the outer circle could vary in my context. At this point, I updated the resizeableitem.cpp as you mentioned above but NetAnim doesn't produce the outer circle. I have also cloned the NetAnim version suggested above. Maybe I have not understood what you said at the end of the message - "AnimNode, inherits from ResizeableItem and only animnode stores the nodeid, so you need to store a mapping of nodeId to sensing range in Resizeableitem."

Hope to hear back from you!

Regards,
Utsab
Reply all
Reply to author
Forward
0 new messages