Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7d42986
HELICS module skeleton and waf script to specify helics location
nightlark Oct 5, 2017
6ec1cda
Move HELICS module from src to contrib folder
nightlark Oct 9, 2017
b8ddc1d
ns-3 bake module config for helics
nightlark Oct 13, 2017
5d76b3a
Find boost and zmq in waf script
nightlark Oct 25, 2017
8d41ac1
HelicsSimulatorImpl using MessageFederate -- possible hanging issue w…
nightlark Oct 25, 2017
cbe067f
Fix static global federate variable
nightlark Oct 25, 2017
ee184f5
add command line parsing to helics example
Oct 25, 2017
f3eb9ed
event loop logic changed to nextTime <= grantedTime, from <.
Oct 26, 2017
d0e8932
add helics application
Oct 27, 2017
1f0c3aa
update helics example
Oct 27, 2017
55268ee
add comment to helics example
Nov 2, 2017
cd6eb2a
Change optional feature name to helics integration for failed to find…
nightlark Nov 30, 2017
80f02bb
Merge branch 'helics' of https://github.com/GMLC-TDC/ns-3-dev-git int…
nightlark Nov 30, 2017
c2e4661
move simple federate code into separate executable
Dec 7, 2017
fff9b6d
add helics examples for using messages directly
Dec 8, 2017
151dca3
Merge branch 'master' into helics
nightlark Dec 12, 2017
2fe4f69
Updated helics header includes and federate type for version 0.9
nightlark Dec 12, 2017
87b1977
Update to use HELICS 0.9 filter API
nightlark Jan 2, 2018
07dc920
Update examples with HELICS 0.9 headers
nightlark Jan 2, 2018
f7005d9
Updated HELICS lib name from helics to helics-static
nightlark Jan 5, 2018
a2a4f06
Change lib for helics conf check to helics-static
nightlark Jan 5, 2018
ddf2ce7
Search lib64 directory for helics library if not in lib directory
nightlark Jan 17, 2018
d2dd8f0
Update to build with helics 1.0 alpha
nightlark Jan 17, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
HELICS module skeleton and waf script to specify helics location
  • Loading branch information
nightlark committed Oct 5, 2017
commit 7d429861e9203eb09f05cbdbb5043055650fb235
98 changes: 98 additions & 0 deletions src/helics/doc/helics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
Example Module Documentation
----------------------------

.. include:: replace.txt
.. highlight:: cpp

.. heading hierarchy:
------------- Chapter
************* Section (#.#)
============= Subsection (#.#.#)
############# Paragraph (no number)

This is a suggested outline for adding new module documentation to |ns3|.
See ``src/click/doc/click.rst`` for an example.

The introductory paragraph is for describing what this code is trying to
model.

For consistency (italicized formatting), please use |ns3| to refer to
ns-3 in the documentation (and likewise, |ns2| for ns-2). These macros
are defined in the file ``replace.txt``.

Model Description
*****************

The source code for the new module lives in the directory ``src/helics``.

Add here a basic description of what is being modeled.

Design
======

Briefly describe the software design of the model and how it fits into
the existing ns-3 architecture.

Scope and Limitations
=====================

What can the model do? What can it not do? Please use this section to
describe the scope and limitations of the model.

References
==========

Add academic citations here, such as if you published a paper on this
model, or if readers should read a particular specification or other work.

Usage
*****

This section is principally concerned with the usage of your model, using
the public API. Focus first on most common usage patterns, then go
into more advanced topics.

Building New Module
===================

Include this subsection only if there are special build instructions or
platform limitations.

Helpers
=======

What helper API will users typically use? Describe it here.

Attributes
==========

What classes hold attributes, and what are the key ones worth mentioning?

Output
======

What kind of data does the model generate? What are the key trace
sources? What kind of logging output can be enabled?

Advanced Usage
==============

Go into further details (such as using the API outside of the helpers)
in additional sections, as needed.

Examples
========

What examples using this new code are available? Describe them here.

Troubleshooting
===============

Add any tips for avoiding pitfalls, etc.

Validation
**********

Describe how the model has been tested/validated. What tests run in the
test suite? How much API and code is covered by the tests? Again,
references to outside published work may help here.
26 changes: 26 additions & 0 deletions src/helics/examples/helics-example.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */

#include "ns3/core-module.h"
#include "ns3/helics-helper.h"

using namespace ns3;


int
main (int argc, char *argv[])
{
bool verbose = true;

CommandLine cmd;
cmd.AddValue ("verbose", "Tell application to log if true", verbose);

cmd.Parse (argc,argv);

/* ... */

Simulator::Run ();
Simulator::Destroy ();
return 0;
}


6 changes: 6 additions & 0 deletions src/helics/examples/wscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

def build(bld):
obj = bld.create_ns3_program('helics-example', ['helics'])
obj.source = 'helics-example.cc'

11 changes: 11 additions & 0 deletions src/helics/helper/helics-helper.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */

#include "helics-helper.h"

namespace ns3 {

/* ... */


}

14 changes: 14 additions & 0 deletions src/helics/helper/helics-helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#ifndef HELICS_HELPER_H
#define HELICS_HELPER_H

#include "ns3/helics.h"

namespace ns3 {

/* ... */

}

#endif /* HELICS_HELPER_H */

11 changes: 11 additions & 0 deletions src/helics/model/helics.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */

#include "helics.h"

namespace ns3 {

/* ... */


}

14 changes: 14 additions & 0 deletions src/helics/model/helics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#ifndef HELICS_H
#define HELICS_H

#include "helics/application_api/Federate.h"

namespace ns3 {

/* ... */

}

#endif /* HELICS_H */

68 changes: 68 additions & 0 deletions src/helics/test/helics-test-suite.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */

// Include a header file from your module to test.
#include "ns3/helics.h"

// An essential include is test.h
#include "ns3/test.h"

// Do not put your test classes in namespace ns3. You may find it useful
// to use the using directive to access the ns3 namespace directly
using namespace ns3;

// This is an example TestCase.
class HelicsTestCase1 : public TestCase
{
public:
HelicsTestCase1 ();
virtual ~HelicsTestCase1 ();

private:
virtual void DoRun (void);
};

// Add some help text to this case to describe what it is intended to test
HelicsTestCase1::HelicsTestCase1 ()
: TestCase ("Helics test case (does nothing)")
{
}

// This destructor does nothing but we include it as a reminder that
// the test case should clean up after itself
HelicsTestCase1::~HelicsTestCase1 ()
{
}

//
// This method is the pure virtual method from class TestCase that every
// TestCase must implement
//
void
HelicsTestCase1::DoRun (void)
{
// A wide variety of test macros are available in src/core/test.h
NS_TEST_ASSERT_MSG_EQ (true, true, "true doesn't equal true for some reason");
// Use this one for floating point comparisons
NS_TEST_ASSERT_MSG_EQ_TOL (0.01, 0.01, 0.001, "Numbers are not equal within tolerance");
}

// The TestSuite class names the TestSuite, identifies what type of TestSuite,
// and enables the TestCases to be run. Typically, only the constructor for
// this class must be defined
//
class HelicsTestSuite : public TestSuite
{
public:
HelicsTestSuite ();
};

HelicsTestSuite::HelicsTestSuite ()
: TestSuite ("helics", UNIT)
{
// TestDuration for TestCase can be QUICK, EXTENSIVE or TAKES_FOREVER
AddTestCase (new HelicsTestCase1, TestCase::QUICK);
}

// Do not forget to allocate an instance of this TestSuite
static HelicsTestSuite helicsTestSuite;

91 changes: 91 additions & 0 deletions src/helics/wscript
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

import os

from waflib import Options

def options(opt):
opt.add_option('--with-helics',
help=('Path to HELICS for federated simulator integration'),
default='', dest='with_helics')

def configure(conf):
if Options.options.with_helics:
if os.path.isdir(Options.options.with_helics):
conf.msg("Checking for HELICS location", ("%s (given)" % Options.options.with_helics))
conf.env['WITH_HELICS'] = os.path.abspath(Options.options.with_helics)
# else:
# bake.py uses ../../build, while ns-3-dev uses ../helics
if not conf.env['WITH_HELICS']:
conf.msg("Checking for HELICS location", False)
conf.report_optional_feature("helics", "NS-3 HELICS Integration", False,
"HELICS not enabled (see option --with-helics)")
# Add this module to the list of modules that won't be built
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('helics')

return

test_code = '''
int main()
{
return 0;
}

'''

conf.env.append_value('NS3_MODULE_PATH', os.path.abspath(os.path.join(conf.env['WITH_HELICS'], 'build', 'default')))
conf.env.append_value('NS3_MODULE_PATH', os.path.abspath(os.path.join(conf.env['WITH_HELICS'], 'lib')))

conf.env['INCLUDES_HELICS'] = [
os.path.abspath(os.path.join(conf.env['WITH_HELICS'], 'include'))
]
conf.env['LIBPATH_HELICS'] = [
os.path.abspath(os.path.join(conf.env['WITH_HELICS'], 'build', 'default')),
os.path.abspath(os.path.join(conf.env['WITH_HELICS'], 'lib'))
]

conf.env['DEFINES_HELICS'] = ['NS3_HELICS']

conf.env['HELICS'] = conf.check(fragment=test_code, lib='helics', libpath=conf.env['LIBPATH_HELICS'], use='HELICS')

conf.env.append_value('LIB_HELICS', 'helics')
conf.report_optional_feature("helics", "NS-3 HELICS Integration", conf.env['HELICS'], "HELICS library not found")

if conf.env['HELICS']:
conf.env['ENABLE_HELICS'] = True
else:
# Add this module to the list of modules that won't be built
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('helics')

def build(bld):
if 'helics' in bld.env['MODULES_NOT_BUILT']:
return

module = bld.create_ns3_module('helics', ['core'])
module.source = [
'model/helics.cc',
'helper/helics-helper.cc',
]

module_test = bld.create_ns3_module_test_library('helics')
module_test.source = [
'test/helics-test-suite.cc',
]

if bld.env['HELICS']:
module.use.extend(['HELICS'])

headers = bld(features='ns3header')
headers.module = 'helics'
headers.source = [
'model/helics.h',
'helper/helics-helper.h',
]

if bld.env.ENABLE_EXAMPLES:
bld.recurse('examples')

# bld.ns3_python_bindings()