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
Prev Previous commit
Next Next commit
add command line parsing to helics example
  • Loading branch information
Jeff Daily committed Oct 25, 2017
commit ee184f5de1cfefc9eb003c2cdc0965d9bdf2751d
6 changes: 4 additions & 2 deletions contrib/helics/examples/helics-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ main (int argc, char *argv[])
{
bool verbose = true;

HelicsHelper helics;

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

helics.SetupCommandLine(cmd);
cmd.Parse (argc,argv);

GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::HelicsSimulatorImpl"));

HelicsHelper helics;
helics.SetupFederate();
NS_LOG_INFO ("Simulator Impl bound, about to Run simulator");

Simulator::Run ();
Simulator::Stop (Seconds (10.0));
Simulator::Destroy ();
return 0;
}
Expand Down
31 changes: 28 additions & 3 deletions contrib/helics/helper/helics-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,40 @@

namespace ns3 {

HelicsHelper::HelicsHelper()
: broker("")
, name("ns3")
, core("zmq")
, stop(1.0)
, timedelta(1.0)
, coreinit("")
{
}

void
HelicsHelper::SetupFederate(void)
{
helics::FederateInfo fi ("ns3");
fi.coreType = helics::coreTypeFromString ("zmq");
helics::FederateInfo fi (name);
fi.coreType = helics::coreTypeFromString (core);
//fi.coreInitString = "--broker=" + "brokid" + " --broker_address=" + "addr" + " --federates 1";
fi.coreInitString = "--federates 1";
//fi.coreInitString = "--federates 1";
fi.timeDelta = timedelta;
if (!coreinit.empty()) {
fi.coreInitString = coreinit;
}
federate = std::make_shared<helics::MessageFederate> (fi);
}

void
HelicsHelper::SetupCommandLine(CommandLine &cmd)
{
cmd.AddValue ("broker", "address to connect the broker to", broker);
cmd.AddValue ("name", "name of the ns3 federate", name);
cmd.AddValue ("core", "name of the core to connect to", core);
cmd.AddValue ("stop", "the time to stop the player", stop);
cmd.AddValue ("timedelta", "the time delta of the federate", timedelta);
cmd.AddValue ("coreinit", "the core initializion string", coreinit);
}

}

12 changes: 12 additions & 0 deletions contrib/helics/helper/helics-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@
#ifndef HELICS_HELPER_H
#define HELICS_HELPER_H

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

namespace ns3 {

class HelicsHelper {
public:
HelicsHelper();
void SetupFederate(void);
void SetupCommandLine(CommandLine &cmd);

private:
std::string broker;
std::string name;
std::string type;
std::string core;
double stop;
double timedelta;
std::string coreinit;
};

}
Expand Down
1 change: 1 addition & 0 deletions contrib/helics/model/helics-simulator-impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ HelicsSimulatorImpl::Run (void)
federate->enterExecutionState ();

// Requests time of next event, or max simulation time if nothing in the queue
NS_LOG_INFO ("Requesting time");
Time grantedTime = Time::FromDouble (federate->requestTime (Next ().GetSeconds ()), Time::S);
Time nextTime = Next ();

Expand Down
8 changes: 8 additions & 0 deletions contrib/helics/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ int main()
# if they are enabled.
conf.env['MODULES_NOT_BUILT'].append('helics')

# if HELICS is enabled, we must use c++14 instead of c++11
if conf.env['HELICS']:
for index,flag in enumerate(conf.env['CXXFLAGS']):
if 'c++11' in flag:
conf.env['CXXFLAGS'][index] = '-std=c++14'
break
print(conf.env['CXXFLAGS'])

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