|
694 |
@end verbatim |
694 |
@end verbatim |
695 |
|
695 |
|
696 |
@c ======================================================================== |
696 |
@c ======================================================================== |
|
|
697 |
@c Models, Attributes and Reality |
698 |
@c ======================================================================== |
699 |
@node Models, Attributes and Reality |
700 |
@section Models, Attributes and Reality |
701 |
|
702 |
This is a convenient place to make a small excursion and make an important |
703 |
point. It may or may not be obvious to you, but whenever one is using a |
704 |
simulation, it is important to understand exactly what is being modeled and |
705 |
what is not. It is tempting, for example, to think of the CSMA devices |
706 |
and channels used in the previous section as if they were real Ethernet |
707 |
devices; and to expect a simulation result to directly reflect what will |
708 |
happen in a real Ethernet. This is not the case. |
709 |
|
710 |
A model is, by definition, an abstraction of reality. It is ultimately the |
711 |
responsibility of the simulation script author to determine the so-called |
712 |
``range of accuracy'' and ``domain of applicability'' of the simulation as |
713 |
a whole, and therefore its consitiuent parts. |
714 |
|
715 |
In some cases, like @code{Csma}, it can be fairly easy to determine what is |
716 |
@emph{not} modeled. By reading the model description (@code{csma.h}) you |
717 |
can find that there is no collision detection in the CSMA model and decide |
718 |
on how applicable its use will be in your simulation or what caveats you |
719 |
may want to include with your results. In other cases, it can be quite easy |
720 |
to configure behaviors that might not agree with any reality you can go out |
721 |
and buy. It will prove worthwhile to spend some time investigating a few |
722 |
such instances, and how easily you can swerve outside the bounds of reality |
723 |
in your simulations. |
724 |
|
725 |
As you have seen, @command{ns-3} provides @code{Attributes} which a user |
726 |
can easily set to change model behavior. Consider two of the @code{Attributes} |
727 |
of the @code{CsmaNetDevice}: @code{Mtu} and @code{EncapsulationMode}. |
728 |
The @code{Mtu} attribute indicates the Maximum Transmission Unit to the |
729 |
device. This is the size of the largest Protocol Data Unit (PDU) that the |
730 |
device can send. |
731 |
|
732 |
The MTU defaults to 1500 bytes in the @code{CsmaNetDevice}. This default |
733 |
corresponds to a number found in RFC 894, ``A Standard for the Transmission |
734 |
of IP Datagrams over Ethernet Networks.'' The number is actually derived |
735 |
from the maximum packet size for 10Base5 (full-spec Ethernet) networks -- |
736 |
1518 bytes. If you subtract the DIX encapsulation overhead for Ethernet |
737 |
packets (18 bytes) you will end up with a maximum possible data size (MTU) |
738 |
of 1500 bytes. One can also find that the @code{MTU} for IEEE 802.3 networks |
739 |
is 1492 bytes. This is because LLC/SNAP encapsulation adds an extra eight |
740 |
bytes of overhead to the packet. In both cases, the underlying hardware can |
741 |
only send 1518 bytes, but the data size is different. |
742 |
|
743 |
In order to set the encapsulation mode, the @code{CsmaNetDevice} provides |
744 |
an @code{Attribute} called @code{EncapsulationMode} which can take on the |
745 |
values @code{Dix} or @code{Llc}. These correspond to Ethernet and LLC/SNAP |
746 |
framing respectively. |
747 |
|
748 |
If one leaves the @code{Mtu} at 1500 bytes and changes the encapsulation mode |
749 |
to @code{Llc}, the result will be a network that encapsulates 1500 byte PDUs |
750 |
with LLC/SNAP framing resulting in packets of 1526 bytes, which would be |
751 |
illegal in many networks, since they can transmit a maximum of 1518 bytes per |
752 |
packet. This would most likely result in a simulation that quite subtly does |
753 |
not reflect the reality you might be expecting. |
754 |
|
755 |
Just to complicate the picture, there exist jumbo frames (1500 < MTU <= 9000 bytes) |
756 |
and super-jumbo (MTU > 9000 bytes) frames that are not officially sanctioned |
757 |
by IEEE but are avialable in some high-speed (Gigabit) networks and NICs. One |
758 |
could leave the encapsulation mode set to @code{Dix}, and set the @code{Mtu} |
759 |
@code{Attribute} on a @code{CsmaNetDevice} to 64000 bytes -- even though an |
760 |
associated @code{CsmaChannel DataRate} was set at 10 megabits per second. |
761 |
This would essentially model an Ethernet switch made out of vampire-tapped |
762 |
1980s-style 10Base5 networks that support super-jumbo datagrams. This is |
763 |
certainly not something that was ever made, nor is likely to ever be made, |
764 |
but it is quite easy for you to configure. |
765 |
|
766 |
In the previous example, you used the command line to create a simulation that |
767 |
had 100 @code{Csma} nodes. You could have just as easily created a simulation |
768 |
with 500 nodes. If you were actually modeling that 10Base5 vampire-tap network, |
769 |
the maximum length of a full-spec Ethernet cable is 500 meters, with a minimum |
770 |
tap spacing of 2.5 meters. That means there could only be 200 taps on a |
771 |
real network. You could have quite easily built an illegal network in that |
772 |
way as well. This may or may not result in a meaningful simulation depending |
773 |
on what you are trying to model. |
774 |
|
775 |
Similar situations can occur in many places in @command{ns-3} and in any |
776 |
simulator. For example, you may be able to position nodes in such a way that |
777 |
they occupy the same space at the same time, or you may be able to configure |
778 |
amplifiers or noise levels that violate the basic laws of physics. |
779 |
|
780 |
@command{ns-3} generally favors flexibility, and many models will allow freely |
781 |
setting @code{Attributes} without trying to enforce any arbitrary consistency |
782 |
or particular underlying spec. |
783 |
|
784 |
The thing to take home from this is that @command{ns-3} is going to provide a |
785 |
super-flexible base for you to experiment with. It is up to you to understand |
786 |
what you are asking the system to do and to make sure that the simulations you |
787 |
create have some meaning and some connection with a reality defined by you. |
788 |
|
789 |
@c ======================================================================== |
697 |
@c Building a Wireless Network Topology |
790 |
@c Building a Wireless Network Topology |
698 |
@c ======================================================================== |
791 |
@c ======================================================================== |
699 |
@node Building a Wireless Network Topology |
792 |
@node Building a Wireless Network Topology |