SlideShare a Scribd company logo
1 of 12
By
Mohammed Amer Al-Batati

         2012
 cQueue is a container class that acts as a queue.
 The basic cQueue member functions:
   insert(obj), inserts an object into the queue head.
   pop(), returns and removes object from the front.
   remove(obj), removes that object from the queue.
   length(), returns the number of items in the queue.
   empty(), tells whether there is anything in the queue.
   insertBefore(obj_where, obj_what)
   insertAfter(obj_where, obj_what)
   front(), returns pointer to the object at the front.
   back() , returns pointer to the object at the back.
 cQueue Example:




 Iterators
 cArray is a container class that holds objects derived from cObject.
 cArray works as an array, but it grows automatically when it becomes
  full.
 The basic usage:
      cArray array("array"); // Creating an array
      int index = array.add( obj ); // Adding an object
      int index = array.find(obj);// Finding an object
      array.remove (obj)// Remove an object

 Iteration
  for (int i=0; i<array.size(); i++)
         {
                  if (array[i]) // is this position used?
                  {
                  }
         }
 There are two main types of outputs: vectors and
  scalars.
 output vectors are to record time series data and
  output scalars are supposed to record a single value per
  simulation run.
 Let’s record the node power after every transmission
  operation. To do that add the following:
    1.     cOutVector TxEnergy;// in Node.h
    2.     TxEnergy.setName("NodePower");// in Node.cc (initialize())
    3.     TxEnergy.record(energy);// after updating node energy
        Save, build, and run.
 A folder called “results” will be generated.



 Click one of VEC files to generate an analysis file (.anf).
 Select “result” as parent folder -> name it-> click finish.
 Click Wildcard to add all other VEC files in single ANF
 file.




 Browse data to get the following results
 You may want to record the distribution as a histogram
  (not as a time series).
   Syntax: cHistogram hData;
   hData.collect(value);// to insert a new value.
 Other functions can be used to get the statics, for
  example:
  hData.getCount(), hData.getMin(),
  hData.getMax(), hData.getMean(),
  hData.getStddev(), hData.getVariance(),
  hData.getSum(), hData.getSqrSum().
 Let’s record node life time, which is the time that a
  node takes before it dies:
  1.   At Node.h




  2.   At Node.cc
 Save, Build and run




 Play with the properties to get:
 An eventlog file contains a log of messages sent during
  the simulation and the details of events that prompted
  their sending or reception.
 The Sequence Chart displays eventlog files in a
  graphical form.
 Add: record-eventlog = true # In omnetpp.ini




 Save and run.
 ELOG files will be generated.




 Double-Click one of them to watch the sequence chart.

More Related Content

What's hot

What's hot (20)

C++ Secure Programming
C++ Secure ProgrammingC++ Secure Programming
C++ Secure Programming
 
Thread
ThreadThread
Thread
 
Python Training in Bangalore | Multi threading | Learnbay.in
Python Training in Bangalore | Multi threading | Learnbay.inPython Training in Bangalore | Multi threading | Learnbay.in
Python Training in Bangalore | Multi threading | Learnbay.in
 
GPU Computing with CUDA
GPU Computing with CUDAGPU Computing with CUDA
GPU Computing with CUDA
 
The Ring programming language version 1.5.3 book - Part 85 of 184
The Ring programming language version 1.5.3 book - Part 85 of 184The Ring programming language version 1.5.3 book - Part 85 of 184
The Ring programming language version 1.5.3 book - Part 85 of 184
 
Socket.io v.0.8.3
Socket.io v.0.8.3Socket.io v.0.8.3
Socket.io v.0.8.3
 
Mintz q207
Mintz q207Mintz q207
Mintz q207
 
Standard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented ProgrammingStandard Template Library (STL) in Object Oriented Programming
Standard Template Library (STL) in Object Oriented Programming
 
Netty: asynchronous data transfer
Netty: asynchronous data transferNetty: asynchronous data transfer
Netty: asynchronous data transfer
 
Java NIO.2
Java NIO.2Java NIO.2
Java NIO.2
 
Lockless
LocklessLockless
Lockless
 
Java nio ( new io )
Java nio ( new io )Java nio ( new io )
Java nio ( new io )
 
Task and Data Parallelism
Task and Data ParallelismTask and Data Parallelism
Task and Data Parallelism
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with netty
 
Apachecon Eu 2008 Mina
Apachecon Eu 2008 MinaApachecon Eu 2008 Mina
Apachecon Eu 2008 Mina
 
Stoop 300-block optimizationinvw
Stoop 300-block optimizationinvwStoop 300-block optimizationinvw
Stoop 300-block optimizationinvw
 
Threads in python
Threads in pythonThreads in python
Threads in python
 
Stackless Python 101
Stackless Python 101Stackless Python 101
Stackless Python 101
 
RuntimeUnitTestToolkit for Unity(English)
RuntimeUnitTestToolkit for Unity(English)RuntimeUnitTestToolkit for Unity(English)
RuntimeUnitTestToolkit for Unity(English)
 
7th lab
7th lab7th lab
7th lab
 

Similar to Tutorial 6 queues & arrays & results recording

In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docxIn Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
bradburgess22840
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdf
aromalcom
 
Using c++Im also using a the ide editor called CodeLiteThe hea.pdf
Using c++Im also using a the ide editor called CodeLiteThe hea.pdfUsing c++Im also using a the ide editor called CodeLiteThe hea.pdf
Using c++Im also using a the ide editor called CodeLiteThe hea.pdf
fashiongallery1
 
Concurrent Collections Object In Dot Net 4
Concurrent Collections Object In Dot Net 4Concurrent Collections Object In Dot Net 4
Concurrent Collections Object In Dot Net 4
Neeraj Kaushik
 

Similar to Tutorial 6 queues & arrays & results recording (20)

Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docxIn Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
In Class AssignmetzCST280W13a-1.pdfCST 280 In-Class Pract.docx
 
Writing native bindings to node.js in C++
Writing native bindings to node.js in C++Writing native bindings to node.js in C++
Writing native bindings to node.js in C++
 
LectureNotes-06-DSA
LectureNotes-06-DSALectureNotes-06-DSA
LectureNotes-06-DSA
 
srgoc
srgocsrgoc
srgoc
 
Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
 
Lec05 buffers basic_examples
Lec05 buffers basic_examplesLec05 buffers basic_examples
Lec05 buffers basic_examples
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
Python for Beginners
Python  for BeginnersPython  for Beginners
Python for Beginners
 
Multithreading Concepts
Multithreading ConceptsMultithreading Concepts
Multithreading Concepts
 
Advance Java
Advance JavaAdvance Java
Advance Java
 
Lec2
Lec2Lec2
Lec2
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Objective c
Objective cObjective c
Objective c
 
In java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdfIn java , I want you to implement a Data Structure known as a Doubly.pdf
In java , I want you to implement a Data Structure known as a Doubly.pdf
 
More topics on Java
More topics on JavaMore topics on Java
More topics on Java
 
Using c++Im also using a the ide editor called CodeLiteThe hea.pdf
Using c++Im also using a the ide editor called CodeLiteThe hea.pdfUsing c++Im also using a the ide editor called CodeLiteThe hea.pdf
Using c++Im also using a the ide editor called CodeLiteThe hea.pdf
 
Concurrent Collections Object In Dot Net 4
Concurrent Collections Object In Dot Net 4Concurrent Collections Object In Dot Net 4
Concurrent Collections Object In Dot Net 4
 
Stack Implementation
Stack ImplementationStack Implementation
Stack Implementation
 

Recently uploaded

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Recently uploaded (20)

AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 

Tutorial 6 queues & arrays & results recording

  • 2.  cQueue is a container class that acts as a queue.  The basic cQueue member functions:  insert(obj), inserts an object into the queue head.  pop(), returns and removes object from the front.  remove(obj), removes that object from the queue.  length(), returns the number of items in the queue.  empty(), tells whether there is anything in the queue.  insertBefore(obj_where, obj_what)  insertAfter(obj_where, obj_what)  front(), returns pointer to the object at the front.  back() , returns pointer to the object at the back.
  • 4.  cArray is a container class that holds objects derived from cObject.  cArray works as an array, but it grows automatically when it becomes full.  The basic usage:  cArray array("array"); // Creating an array  int index = array.add( obj ); // Adding an object  int index = array.find(obj);// Finding an object  array.remove (obj)// Remove an object  Iteration for (int i=0; i<array.size(); i++) { if (array[i]) // is this position used? { } }
  • 5.  There are two main types of outputs: vectors and scalars.  output vectors are to record time series data and output scalars are supposed to record a single value per simulation run.  Let’s record the node power after every transmission operation. To do that add the following: 1. cOutVector TxEnergy;// in Node.h 2. TxEnergy.setName("NodePower");// in Node.cc (initialize()) 3. TxEnergy.record(energy);// after updating node energy  Save, build, and run.
  • 6.  A folder called “results” will be generated.  Click one of VEC files to generate an analysis file (.anf).  Select “result” as parent folder -> name it-> click finish.
  • 7.  Click Wildcard to add all other VEC files in single ANF file.  Browse data to get the following results
  • 8.  You may want to record the distribution as a histogram (not as a time series).  Syntax: cHistogram hData;  hData.collect(value);// to insert a new value.  Other functions can be used to get the statics, for example: hData.getCount(), hData.getMin(), hData.getMax(), hData.getMean(), hData.getStddev(), hData.getVariance(), hData.getSum(), hData.getSqrSum().
  • 9.  Let’s record node life time, which is the time that a node takes before it dies: 1. At Node.h 2. At Node.cc
  • 10.  Save, Build and run  Play with the properties to get:
  • 11.  An eventlog file contains a log of messages sent during the simulation and the details of events that prompted their sending or reception.  The Sequence Chart displays eventlog files in a graphical form.  Add: record-eventlog = true # In omnetpp.ini  Save and run.
  • 12.  ELOG files will be generated.  Double-Click one of them to watch the sequence chart.