HELICS
HELICS copied to clipboard
`helicsInputGetRawValue` and `helicsInputGetBytes` behave different in `v2.6.1` versus `v3.0.0.alpha.2`
If I run the same code, I get different results in v2.6.1
versus v3.0.0.alpha.2
.
This is the code I'm running:
import helics as h
print("helicsGetVersion: ", h.helicsGetVersion())
print("__version__: ", h.__version__)
broker = h.helicsCreateBroker("zmq", "", "-f 1 --name=mainbroker")
fedinfo = h.helicsCreateFederateInfo()
fedinfo.core_name = "TestFederate"
fedinfo.core_type = "zmq"
fedinfo.core_init = "-f 1 --broker=mainbroker"
mFed = h.helicsCreateCombinationFederate("TestFederate", fedinfo)
_ = mFed.register_endpoint("ep1")
_ = mFed.register_global_endpoint("ep2")
pub = mFed.register_publication("publication", h.HELICS_DATA_TYPE_STRING, "custom-units")
sub = mFed.register_subscription("TestFederate/publication", "custom-units")
sub.option["CONNECTION_REQUIRED"] = 1
mFed.property[h.HELICS_PROPERTY_TIME_DELTA] = 1.0
sub.set_default(b"hello")
sub.set_default("world")
sub.set_default(0)
sub.set_default(True)
sub.set_default(1.1)
sub.set_default(2 + 1.1j)
sub.set_default([1.0, 2.0, 3.0])
sub.info = "hello world"
mFed.publications["TestFederate/publication"].option["CONNECTION_REQUIRED"] = 1
mFed.enter_executing_mode()
data = "random-data"
mFed.endpoints["TestFederate/ep1"].default_destination = "ep2"
mFed.endpoints["TestFederate/ep1"].info = "information"
mFed.endpoints["TestFederate/ep1"].send_data(data, "ep2", 1.0)
mFed.publications["TestFederate/publication"].publish("first-time")
assert mFed.request_time(2.0) == 1.0
print("""mFed.subscriptions["TestFederate/publication"].bytes: """, mFed.subscriptions["TestFederate/publication"].bytes)
assert mFed.subscriptions["TestFederate/publication"].bytes == b"first-time"
print("Exiting...")
That looks like it is due to the binary type header that is included now.
It is a question of whether this behavior is desirable. I think there needs to be some way to get the raw bytes vs interpreted bytes.
That looks like it is due to the binary type header that is included now
I don't think follow? Also, why would calling helicsInputGetBytes
returning just one byte be desirable?
@kdheepak and @phlptp: this is moot now in v3.1, right?