Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 17:49
    phlptp synchronize #2365
  • 17:49

    phlptp on error_fixes

    add extra core clears Merge branch 'error_fixes' of h… (compare)

  • 17:21

    phlptp on error_fixes_debug

    add test back in (compare)

  • 16:44

    phlptp on error_fixes_debug

    add back catch change (compare)

  • 16:07

    phlptp on error_fixes_debug

    try adding back into two lines (compare)

  • 15:21

    phlptp on error_fixes_debug

    remove extra long file name tes… (compare)

  • 14:40

    phlptp on error_fixes_debug

    try reverting the error code ch… (compare)

  • 00:23
    pre-commit-ci[bot] synchronize #2365
  • 00:23

    pre-commit-ci[bot] on error_fixes

    [pre-commit.ci] auto fixes from… (compare)

  • 00:23
    phlptp synchronize #2365
  • 00:23

    phlptp on error_fixes

    update the application_api head… (compare)

  • May 25 20:33

    phlptp on error_fixes

    Apply suggestions from code rev… (compare)

  • May 25 20:33
    phlptp synchronize #2365
  • May 25 20:14

    phlptp on coverage_builds

    (compare)

  • May 25 20:14

    phlptp on develop

    Coverage builds (#2362) * try … (compare)

  • May 25 20:14
    phlptp closed #2362
  • May 25 20:14
    pre-commit-ci[bot] synchronize #2364
  • May 25 20:14

    pre-commit-ci[bot] on mac_symbols

    [pre-commit.ci] auto fixes from… (compare)

  • May 25 20:13
    phlptp synchronize #2364
  • May 25 20:13

    phlptp on mac_symbols

    update the code to clear some o… (compare)

Dheepak Krishnamurthy
@kdheepak
I made a pyhelics 3.2.0 release
Philip Top
@phlptp
They modify the object pointed to by the HelicsDataBuffer
Philip Top
@phlptp
what else should be changed for a 2.8.1 release. Is there anything else that has come up that we need to get in a final release in the 2.x series?
I have updated asio, fmt, spdlog, will update the units library before the release. What else needs to be done?
Trevor Hardy
@trevorhardy
No additions from my side.
tc-reynolds
@tc-reynolds

Hello! I'm experiencing a scoping issue with helics. Here is the following python code I'm executing and what works/doesn't work

federate = helics.helicsCreateMessageFederateFromConfig(
FEDERATE_JSON_PATH
)
helics.helicsFederateEnterExecutingMode(federate)

This works ^

helics.helicsCreateMessageFederateFromConfig(
FEDERATE_JSON_PATH
)
federate = helics.helicsGetFederateByName(FEDERATE_NAME)
helics.helicsFederateEnterExecutingMode(federate)

^This doesn't work

And even weirder:

federate = helics.helicsCreateMessageFederateFromConfig(
FEDERATE_JSON_PATH
)
federate2 = helics.helicsGetFederateByName(FEDERATE_NAME)
helics.helicsFederateEnterExecutingMode(federate)

This works ^

Our suspicion is that it's due to a memory cleanup occurring behind the scene in pyhelics. As long as we hold the federate in memory, we can reference it. We are using Helics within a flask application where we would like to independently call these init/exec state functions from flask endpoints. Our current idea is to hold the federate in memory somewhere, but ideally we wouldn't want to 'hack' around this strange memory issue.

7 replies
Laurentiu Marinovici
@laurmarinovici

For this configuration:

helics, version 0.6.1
Python HELICS version v3.2.0.post1
HELICS Library version 3.1.1-main-g9a5726ba9 (2022-04-05)

I cannot seem to get the original source of a message sent from an end point though ns-3 to another point when using the filter apps. On the Python receiver federate, when I run

message = h.helicsFederateGetMessage(fed)
messageDetails = {
              'time received': h.helicsMessageGetTime(message),
              'data': h.helicsMessageGetString(message),
              'original source': h.helicsMessageGetOriginalSource(message),
              'source': h.helicsMessageGetSource(message),
              'original destination': h.helicsMessageGetOriginalDestination(message),
              'destination': h.helicsMessageGetDestination(message)
}
logger.info(messageDetails)

I get an empty string as original source:

{'time received': 1.320067863, 'data': '+1392.12 W', 'original source': '', 'source': 'R1-12.47-1-communication/R1-12.47-1-substation/R1_12_47_1_substation', 'original destination': 'R1-12.47-1-substation/R1_12_47_1_substation', 'destination': 'R1-12.47-1-substation/R1_12_47_1_substation'}

Back in HELICS 2.8 I would get the expected string rather than an empty one.

Philip Top
@phlptp
@kdheepak is the missing original_source a helics library thing or something in python?
Dheepak Krishnamurthy
@kdheepak
The source code for the function seems to be standard, I can't imagine it being an issue with the pyhelics package:
    f = loadSym("helicsMessageGetOriginalSource")
    result = f(message.handle)
    return ffi.string(result).decode()
Philip Top
@phlptp
ok, I will double check within the library itself.
Trevor Hardy
@trevorhardy
@phlptp, can tags be associated with a federate?
Philip Top
@phlptp
yes
Trevor Hardy
@trevorhardy
Cool. @kdheepak, the current pyhelics documentation does not show an API to add a tag to a federate (just for Publications and Translators). I assume we would also support for Inputs as well.
Dheepak Krishnamurthy
@kdheepak

@trevorhardy I made a new release: https://github.com/GMLC-TDC/pyhelics/releases/tag/v3.2.0.post4

Those functions were missing in the capi. I must have forgot to add them. I added the missing tag functions in this PR: GMLC-TDC/pyhelics#52.

Trevor Hardy
@trevorhardy
👍👍
Dheepak Krishnamurthy
@kdheepak
In about 10 minutes or so you'll be able to do upgrade the helics installation using pip
Trevor Hardy
@trevorhardy
@phlptp, I’m pretty sure I’ve asked this before but the input handle and output handles have separate name spaces, right?
Philip Top
@phlptp
yes
wenbowangnrel
@wenbowangnrel
A quick question about Setting "broker" true in the runner. Why would someone would want to set is false and create their own broker? Is it working the same?
Philip Top
@phlptp
It should work the same. Some cases would be if you were running a broker server which would allow brokers to get created on demand and deconflict with multiple users or multiple simulataneous co-simulations or you had some specific things you were doing on the broker that made it useful to run outside of helics-cli. Like running the broker webserver, or broker terminal.
wenbowangnrel
@wenbowangnrel
okay, that's good to know. Thanks!
Dheepak Krishnamurthy
@kdheepak
I have a usability improvement feature request for helics_broker
I would like helics_broker to always print out the port it is trying to connect to if it is not the default port. Currently, when an old instance of helics_broker is still running, the new instance of helics_broker silently chooses a new port and it is hard for users to tell that the existing broker is going to cause issues.
Philip Top
@phlptp
I can probably make it print a message showing its connection string when it connects. Would be a litle tricky to only do that when not default though, I will look through it and see what we can do
Philip Top
@phlptp
@kdheepak how did we handle the logging from the helics library in python?
Dheepak Krishnamurthy
@kdheepak
What do you mean? I think if you pass the logging levels to the federate info object, then the helics library handles logging. Right?
Philip Top
@phlptp
not the generation. But does python control the stdout in any way to restrict it? or does it just pass it through?
Dheepak Krishnamurthy
@kdheepak
The python library doesn't mess with stdout at all
Is someone running into issues seeing the helics log?
Philip Top
@phlptp
Not right now, but going to need to do something tricky with matlab since it doesn't automatically redirect std::out to the matlab command window by default.
Dheepak Krishnamurthy
@kdheepak
Ah.
Where does it go by default?
Philip Top
@phlptp
into the void as far as I can tell, I imagine it is like running a background process
Dheepak Krishnamurthy
@kdheepak
If you start matlab from the terminal, maybe you'll see the output there.
Philip Top
@phlptp
yeah you would
if you start from the terminal it should work normally, but that isn't how many people run matlab
Philip Top
@phlptp
ugg this is going to be messy. The matlab printing mechanism isn't thread safe either, so you can't print from multiple threads, only the original thread.
BuiMCanmet
@BuiMCanmet

Is someone running into issues seeing the helics log?

Since you guys are on this topic, is there any way to force logs to a specific folder when using python? Right now, I can get the stdout file but they just keep piling up in the working directory.

Philip Top
@phlptp
there is a file logging which you can control the level of independently of the console logging. so you should be able to direct the logs to a specified file
  --logfile arg          the file to log message to
  --loglevel arg         the level which to log the higher this is set to the
                         more gets logs (-1) for no logging
  --fileloglevel arg     the level at which messages get sent to the file
  --consoleloglevel arg  the level at which message get sent to the console
BuiMCanmet
@BuiMCanmet
Alright thanks! will look into it.
Trevor Hardy
@trevorhardy
@phlptp, is it intended that, when iterating, if ANY federate requests NO_ITERATION then NOBODY iterates or only if all federates make that request does nobody iterate.
Philip Top
@phlptp
One of the core philosophies of HELICS is that no federate may dictate to others how they manage their own timing though HELICS. What that means in this case is that if a federate selects NO_ITERATION it means they will not iterate. It has no effect on any other federate in regards to iteration
Trevor Hardy
@trevorhardy
Perfect; thanks.
Trevor Hardy
@trevorhardy
@phlptp, for a stand-alone federate that just wants to observe and joins a federation late, what does it need to do differently (if anything)? After it enters executing mode, does it need to request any particular time? I was thinking it might be good practice for observers to request MAX_TIME but maybe this isn’t required?
Philip Top
@phlptp
They have to specify the "--observer" flag. After entering execution mode they will not necessarily be at timeZero so will likely need to getCurrentTime to figure out what time they are at currently. At that point everything else is pretty much the same as far as time requests go.
Trevor Hardy
@trevorhardy
And --observer is in the fedInfoString or coreInfoString?
Oh, sorry, you said it was a flag. Never mind.
Philip Top
@phlptp
federate, though you can make it in the coreInitString as well, it will get passed through