How to use the helics.helicsFederateFree 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 FreeFederate(fed, fedinfo):
    h.helicsFederateFinalize(fed)
    state = h.helicsFederateGetState(fed)
    assert state == 3 # TODO: should this be 3?

    h.helicsFederateInfoFree(fedinfo)
    h.helicsFederateFree(fed)
github GMLC-TDC / HELICS / tests / python / test_value_federate.py View on Github external
h.helicsFederateInfoSetIntegerProperty(fedinfo, h.helics_property_int_log_level, 1)

    vFed = h.helicsCreateValueFederate("TestA Federate", fedinfo)

    yield vFed

    h.helicsFederateFinalize(vFed)

    state = h.helicsFederateGetState(vFed)
    assert state == 3

    while (h.helicsBrokerIsConnected(broker)):
        time.sleep(1)

    h.helicsFederateInfoFree(fedinfo)
    h.helicsFederateFree(vFed)
    h.helicsCloseLibrary()
github GMLC-TDC / HELICS / tests / python / test_value_federate.py View on Github external
counter -= 1
        time.sleep(1)

    # Broker should be connected at this point
    assert h.helicsBrokerIsConnected(helicsBroker) == 1, "Broker should still be connected"

    h.helicsFederateFinalize(vFed)

    state = h.helicsFederateGetState(vFed)
    assert state == 3

    while (h.helicsBrokerIsConnected(helicsBroker)):
        time.sleep(1)

    h.helicsFederateInfoFree(fedinfo)
    h.helicsFederateFree(vFed)
github GMLC-TDC / HELICS / tests / python / test_message_federate.py View on Github external
h.helicsFederateInfoSetIntegerProperty(fedinfo, h.helics_property_int_log_level, 1)


    mFed = h.helicsCreateMessageFederate("TestA Federate", fedinfo)

    yield mFed

    h.helicsFederateFinalize(mFed)
    state = h.helicsFederateGetState(mFed)
    assert state == 3
    while (h.helicsBrokerIsConnected(broker)):
        time.sleep(1)

    h.helicsFederateInfoFree(fedinfo)
    h.helicsFederateFree(mFed)
    h.helicsCloseLibrary()
github GMLC-TDC / HELICS / examples / user_guide_examples / Example_1a / Transmission / Transmission_simulator.py View on Github external
def destroy_federate(fed):
    h.helicsFederateFinalize(fed)

#    status, state = h.helicsFederateGetState(fed)
#    assert state == 3

    while (h.helicsBrokerIsConnected(broker)):
        time.sleep(1)

    h.helicsFederateFree(fed)
    h.helicsCloseLibrary()
github GMLC-TDC / HELICS / examples / python / timing-demo / timing-federate1.py View on Github external
def destroy_value_federate(fed, broker):
    status = h.helicsFederateFinalize(fed)
    assert status == 0
    status, state = h.helicsFederateGetState(fed)
    assert status == 0
    assert state == 3

    while (h.helicsBrokerIsConnected(broker)):
        time.sleep(1)

    h.helicsFederateFree(fed)

    h.helicsCloseLibrary()
github GMLC-TDC / HELICS / examples / python / pi-exchange / pisender.py View on Github external
val = value

    currenttime = h.helicsFederateRequestTime(vfed, t)

    status = h.helicsPublicationPublishDouble(pub, val)
    print("PI SENDER: Sending value pi = {} at time {} to PI RECEIVER".format(val, currenttime[-1]))

    time.sleep(1)

status = h.helicsFederateFinalize(vfed)
print("PI SENDER: Federate finalized")

while (h.helicsBrokerIsConnected(broker)):
    time.sleep(1)

h.helicsFederateFree(vfed)
h.helicsCloseLibrary()

print("PI SENDER: Broker disconnected")
github GMLC-TDC / HELICS / examples / user_guide_examples / Example_1c / EV_Controller / EV_Controller.py View on Github external
def destroy_federate(fed):
    h.helicsFederateFinalize(fed)
    h.helicsFederateFree(fed)
    h.helicsCloseLibrary()
github GMLC-TDC / HELICS / examples / python / timing-demo / timing-federate2.py View on Github external
def destroy_value_federate(fed):
    status = h.helicsFederateFinalize(fed)
    assert status == 0
    status, state = h.helicsFederateGetState(fed)
    assert state == 3
    assert status == 0

    h.helicsFederateFree(fed)

    h.helicsCloseLibrary()