Writing Pages¶
The pages of a Sphinx site refer to the types of the model and to its C++ classes by name, and show its files with highlighting. This page shows each, with the source that produces it.
NED and MSG types¶
omnetpp_neddoc’s roles link to the pages of the NED reference, by the
short or the full name of a type:
The :ned:`Network` network has a :ned:`Source`, whose :msg:`Job` messages
are served by a :ned:`queueing node <sample.queueing.QueueingNode>`, which
uses a :ned:`Server` like :ned:`IServer`, and connects them with
:ned:`Link` channels.
The Network network has a Source, whose Job messages are
served by a queueing node, which uses a
Server like IServer, and connects them with Link
channels.
C++ classes¶
omnetpp_doxylink’s :cppref: role links to the C++ API, by the name of a
class or of a member:
The jobs are created by :cppref:`sample::Source`, and the
:cppref:`sample::queueing::Server` asks
:cppref:`sample::queueing::FifoQueue::requestJob` for the next one when
:cppref:`isIdle <sample::queueing::Server::isIdle>`.
The jobs are created by sample::Source, and the sample::queueing::Server asks sample::queueing::FifoQueue::requestJob() for the next one when isIdle.
Code¶
ned, msg and ini code blocks are highlighted by
omnetpp_lexers. A page can show the files of the model itself:
.. literalinclude:: ../../src/sample/queueing/QueueingNode.ned
:language: ned
package sample.queueing;
//
// A queue in front of a server. The server is any module that implements ~IServer.
//
module QueueingNode
{
parameters:
string serverType = default("Server"); // the NED type of the server, a module like IServer
@display("i=block/network2");
gates:
input in;
output out;
submodules:
queue: FifoQueue;
server: <serverType> like IServer;
connections:
in --> queue.in;
queue.out --> server.in;
server.out --> out;
}
namespace sample;
//
// What a job asks of the server.
//
enum JobKind
{
JOB_SHORT = 0; // served in the base service time
JOB_LONG = 1; // takes twice as long
}
//
// A job created by ~Source, served by a ~QueueingNode, and consumed by ~Sink.
//
message Job
{
JobKind kind = JOB_SHORT;
int priority; // higher values are served first
simtime_t queueingTime; // the time the job spent waiting in queues
}
[General]
network = sample.Network
sim-time-limit = 1h
**.source.interval = exponential(1s)
**.node.server.serviceTime = exponential(0.5s)
[LongQueue]
description = "a slower server, so the queue grows"
**.node.server.serviceTime = exponential(0.9s)
**.node.queue.capacity = 20