How to use the helics.helicsCreateBroker function in helics

To help you get started, we’ve selected a few helics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GMLC-TDC / HELICS / tests / python_helics / test_message_filter.py View on Github external
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
github GMLC-TDC / HELICS / tests / python / test_value_federate.py View on Github external
def test_error_value_federate_initialize():
    initstring = "-f 1 --name=mainbroker"
    with pt.raises(h._helics.HelicsException):
        h.helicsCreateBroker("mq", "", initstring)
github GMLC-TDC / HELICS / examples / user_guide_examples / Example_1a / Transmission / Transmission_simulator.py View on Github external
def create_broker():
    initstring = "--federates=2 --name=mainbroker"
    broker = h.helicsCreateBroker("zmq", "", initstring)
    isconnected = h.helicsBrokerIsConnected(broker)

    if isconnected == 1:
        pass

    return broker
github GMLC-TDC / HELICS / examples / python / pi-exchange / pisender.py View on Github external
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 #
github GMLC-TDC / HELICS / examples / python / timing-demo / timing-federate1.py View on Github external
def create_broker():
    initstring = "2 --name=mainbroker"
    broker = h.helicsCreateBroker("zmq", "", initstring)
    isconnected = h.helicsBrokerIsConnected(broker)

    if isconnected == 1:
        pass

    return broker
github GMLC-TDC / HELICS / examples / user_guide_examples / Example_1c / EV_Controller / EV_Controller.py View on Github external
def create_broker():
    initstring = "2 --name=mainbroker"
    broker = h.helicsCreateBroker("zmq", "", initstring)
    isconnected = h.helicsBrokerIsConnected(broker)

    if isconnected == 1:
        pass

    return broker
github GMLC-TDC / HELICS / examples / user_guide_examples / Example_1b / Transmission / Transmission_simulator.py View on Github external
def create_broker():
    initstring = "--federates=3 --name=mainbroker"
    broker = h.helicsCreateBroker("zmq", "", initstring)
    isconnected = h.helicsBrokerIsConnected(broker)

    if isconnected == 1:
        pass

    return broker