40 #include "ns3/core-module.h" 41 #include "ns3/time-probe.h" 42 #include "ns3/gnuplot-helper.h" 60 static TypeId GetTypeId (
void);
63 void DoInitialize (
void);
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.
GetSeconds () <<
" new " << newVal.
GetSeconds () << 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 ();
virtual bool ConnectByObject(std::string traceSource, Ptr< Object > obj)
connect to a trace source attribute provided by a given object
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Boolean.
static ns3::GlobalValue g_verbose("verbose", "Whether to enable verbose output", ns3::BooleanValue(false), ns3::MakeBooleanChecker())
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
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)
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Hold a so-called 'global value'.
static TypeId GetTypeId(void)
Register this type.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
TracedValue< Time > m_interval
void ConfigurePlot(const std::string &outputFileNameWithoutExtension, const std::string &title, const std::string &xLegend, const std::string &yLegend, const std::string &terminalType="png")
virtual void ConnectByPath(std::string path)
connect to a trace source provided by a config path
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Ptr< ExponentialRandomVariable > m_var
void NotifyViaProbe(std::string context, double oldVal, double newVal)
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Parse command-line arguments.
void DoInitialize(void)
Initialize() implementation.
Helper class used to make gnuplot plots.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
void SetName(std::string name)
Set the object's name. All spaces are replaced by underscores.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
double GetValue(double mean, double bound)
Get the next random value, as a double from the exponential distribution with the specified mean and ...
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
Connect a TraceSource to a Callback with a context.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
A base class which provides memory management and object aggregation.
void NotifyViaTraceSource(std::string context, Time oldVal, Time newVal)
std::string GetName(void) const
Get the object's name.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.