Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def AddBroker(core_type="zmq", number_of_federates=1):
initstring = "{} --name=mainbroker".format(number_of_federates)
helicsversion = h.helicsGetVersion()
print("HELICS version = {}".format(helicsversion))
# Create broker #
broker = h.helicsCreateBroker(core_type, "", initstring)
isconnected = h.helicsBrokerIsConnected(broker)
if isconnected == 1:
pass
return broker
def mFed():
initstring = "-f 1 --name=mainbroker"
fedinitstring = "--broker=mainbroker --federates=1"
deltat = 0.01
h.helicsGetVersion()
# Create broker #
broker = h.helicsCreateBroker("zmq", "", initstring)
isconnected = h.helicsBrokerIsConnected(broker)
if isconnected == 1:
pass
# Create Federate Info object that describes the federate properties #
fedinfo = h.helicsCreateFederateInfo()
# Set Federate name #
h.helicsFederateInfoSetCoreName(fedinfo, "CoreA Federate")
# Set core type from string #
def helicsBroker():
initstring = "-f 1 --name=mainbroker"
#TODO: should add an assert here about helicsGetVersion
h.helicsGetVersion()
# Create broker #
broker = h.helicsCreateBroker("zmq", "", initstring)
isconnected = h.helicsBrokerIsConnected(broker)
if isconnected == 1:
pass
yield broker
h.helicsBrokerFree(broker)
h.helicsCloseLibrary()
def test_version():
import helics as h
print(h.helicsGetVersion())
def vFed():
initstring = "-f 1 --name=mainbroker"
fedinitstring = "--broker=mainbroker --federates=1"
deltat = 0.01
#TODO: should add an assert here about helicsGetVersion
h.helicsGetVersion()
# Create broker #
broker = h.helicsCreateBroker("zmq", "", initstring)
isconnected = h.helicsBrokerIsConnected(broker)
if isconnected == 1:
pass
# Create Federate Info object that describes the federate properties #
fedinfo = h.helicsCreateFederateInfo()
# Set Federate name #
h.helicsFederateInfoSetCoreName(fedinfo, "TestA Core")
# Set core type from string #
import time
import helics as h
from math import pi
initstring = "2 --name=mainbroker"
fedinitstring = "--broker=mainbroker --federates=1"
deltat = 0.01
helicsversion = h.helicsGetVersion()
print("PI SENDER: Helics version = {}".format(helicsversion))
# Create broker #
print("Creating Broker")
broker = h.helicsCreateBroker("zmq", "", initstring)
print("Created Broker")
print("Checking if Broker is connected")
isconnected = h.helicsBrokerIsConnected(broker)
print("Checked if Broker is connected")
if isconnected == 1:
print("Broker created and connected")
# Create Federate Info object that describes the federate properties #