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 test_error_value_federate_initialize():
initstring = "-f 1 --name=mainbroker"
with pt.raises(h._helics.HelicsException):
h.helicsCreateBroker("mq", "", initstring)
def create_broker():
initstring = "--federates=2 --name=mainbroker"
broker = h.helicsCreateBroker("zmq", "", initstring)
isconnected = h.helicsBrokerIsConnected(broker)
if isconnected == 1:
pass
return broker
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 #
fedinfo = h.helicsFederateInfoCreate()
# Set Federate name #
status = h.helicsFederateInfoSetFederateName(fedinfo, "TestA Federate")
# Set core type from string #
def create_broker():
initstring = "2 --name=mainbroker"
broker = h.helicsCreateBroker("zmq", "", initstring)
isconnected = h.helicsBrokerIsConnected(broker)
if isconnected == 1:
pass
return broker
def create_broker():
initstring = "2 --name=mainbroker"
broker = h.helicsCreateBroker("zmq", "", initstring)
isconnected = h.helicsBrokerIsConnected(broker)
if isconnected == 1:
pass
return broker
def create_broker():
initstring = "--federates=3 --name=mainbroker"
broker = h.helicsCreateBroker("zmq", "", initstring)
isconnected = h.helicsBrokerIsConnected(broker)
if isconnected == 1:
pass
return broker