|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
40 #include "ns3/core-module.h"
41 #include "ns3/time-probe.h"
42 #include "ns3/gnuplot-helper.h"
79 .SetGroupName (
"Stats")
81 .AddTraceSource (
"Interval",
84 "ns3::TracedValueCallback::Time")
93 m_var = CreateObject<ExponentialRandomVariable> ();
108 TimeProbe::SetValueByPath (
"/Names/probe3",
m_interval);
117 GlobalValue::GetValueByName (
"verbose",
verbose);
120 std::cout <<
"context: " << context <<
" old " << oldVal.
As (Time::S) <<
" new " << newVal.
As (Time::S) << std::endl;
129 GlobalValue::GetValueByName (
"verbose",
verbose);
132 std::cout <<
"context: " << context <<
" old " << oldVal <<
" new " << newVal << std::endl;
137 "Whether to enable verbose output",
141 int main (
int argc,
char *argv[])
147 cmd.AddValue (
"stopTime",
"Time (seconds) to terminate simulation",
stopTime);
148 cmd.AddValue (
"verbose",
"Whether to enable verbose output",
verbose);
149 cmd.Parse (argc, argv);
160 Names::Add (
"/Names/Emitter", emitter);
185 NS_ASSERT_MSG (connected,
"Trace source not connected to probe1");
191 NS_ASSERT_MSG (connected,
"Trace source not connected to probe1 Output");
209 NS_ASSERT_MSG (connected,
"Trace source not connected to probe2 Output");
219 Names::Add (
"/Names/probe3", probe3);
225 NS_ASSERT_MSG (connected,
"Trace source not connected to probe3 Output");
230 "Emitter interarrivals vs. Time",
231 "Simulation time (Seconds)",
232 "Interarrival time (Seconds)",
239 "/Names/Emitter/Interval",
241 "Emitter Interarrival Time",
242 GnuplotAggregator::KEY_INSIDE);
250 Simulator::Destroy ();
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Hold a so-called 'global value'.
Parse command-line arguments.
void SetName(std::string name)
Set the object's name. All spaces are replaced by underscores.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
AttributeValue implementation for Boolean.
TracedValue< Time > m_interval
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ LOG_LEVEL_ALL
Print everything.
static ns3::GlobalValue g_verbose("verbose", "Whether to enable verbose output", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void PlotProbe(const std::string &typeId, const std::string &path, const std::string &probeTraceSource, const std::string &title, enum GnuplotAggregator::KeyLocation keyLocation=GnuplotAggregator::KEY_INSIDE)
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void NotifyViaProbe(std::string context, double oldVal, double newVal)
void DoInitialize(void)
Initialize() implementation.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
A base class which provides memory management and object aggregation.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Simulation virtual time values and global simulation resolution.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
std::string GetName(void) const
Get the object's name.
Helper class used to make gnuplot plots.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void ConfigurePlot(const std::string &outputFileNameWithoutExtension, const std::string &title, const std::string &xLegend, const std::string &yLegend, const std::string &terminalType="png")
Time Seconds(double value)
Construct a Time in the indicated unit.
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
Connect a TraceSource to a Callback with a context.
virtual bool ConnectByObject(std::string traceSource, Ptr< Object > obj)
connect to a trace source attribute provided by a given object
Ptr< ExponentialRandomVariable > m_var
void NotifyViaTraceSource(std::string context, Time oldVal, Time newVal)
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
static TypeId GetTypeId(void)
Register this type.
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
virtual void ConnectByPath(std::string path)
connect to a trace source provided by a config path
static TypeId GetTypeId(void)
Register this type.