Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 03 17:30
    nightlark edited #2482
  • Dec 03 17:30
    nightlark edited #2482
  • Dec 03 17:30
    nightlark edited #2482
  • Dec 03 17:22
    nightlark edited #2482
  • Dec 03 17:22
    nightlark edited #2482
  • Dec 03 17:21
    nightlark edited #2482
  • Dec 03 17:19
    nightlark edited #2482
  • Dec 03 17:18
    nightlark edited #2482
  • Dec 03 17:18
    nightlark edited #2457
  • Dec 03 17:18
    nightlark edited #2482
  • Dec 03 17:17
    nightlark opened #2482
  • Dec 03 15:56
    phlptp synchronize #2461
  • Dec 03 15:56

    phlptp on dynamic_federation

    start adding the final stages t… make a change to the API for ha… [pre-commit.ci] auto fixes from… and 9 more (compare)

  • Dec 03 15:46

    phlptp on deprecate_subscription_methods

    (compare)

  • Dec 03 15:46

    phlptp on develop

    Deprecate all subscription meth… (compare)

  • Dec 03 15:46
    phlptp closed #2464
  • Dec 03 13:48

    phlptp on deprecate_subscription_methods

    Update src/helics/application_a… (compare)

  • Dec 03 13:48
    phlptp synchronize #2464
  • Dec 03 01:39
    pre-commit-ci[bot] synchronize #2464
  • Dec 03 01:39

    pre-commit-ci[bot] on deprecate_subscription_methods

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

Ryan Mast
@nightlark
Do the pyhelics and matHELICS interfaces will need addAlias functions added?
Philip Top
@phlptp
Yes, the clang stuff for matlab might do it automatically
Nathan Gray
@nathantgray
Has anyone encountered an issue when using HELICS+GridLAB-D where the co-simulation will sometimes get stuck at a seemingly random time? I'm having this issue. I suspect it relates to timing between GridLAB-D and other federates. I've been occasionally running into this for probably at least a year now. But switching to HELICS 3 and GLD 5 has made it unmanageable.
Philip Top
@phlptp
I have not encountered the issue can you give more details about what federates you are using and how you are configuring them?
Nathan Gray
@nathantgray
Co-simDiagram.png
Unfortunately I don't have any cases that are easy to share that have this issue.
I have several python agents communicating through an ns3 network to send and receive data from gridlabd. GridLAB-D publishes values to python device agents which send messages to the microgrid agents. microgrid agents request time from helics periodically. The device agents request the end of the simulation and get granted time whenever they receive a message or publication.
Nathan Gray
@nathantgray
I realize this is nearly impossible for someone on here to debug given this information. But I figured it was worth a shot to see if someone had encountered something similar. Is it possible that federates could get out of sync somehow and cause the whole co-simulation to stop?
Philip Top
@phlptp
What version of HELICS are your running. If it isn't the latest one I would suggest trying that, sometimes issues get fixed. Presuming that doesn't fix the issue. The best chance of tracking things down is to create an observer federate. Then if/when it happens in the observer federate run a query("root", "global_time_debugging") that will generate the entire current time status of all components. You can also do this if you run a webserver with the broker if interested as well.
11 replies
Nathan Gray
@nathantgray
It happens in 2.8.0 and 3.2.1. I'll try the observer federate thing. Thanks for the advice!
Philip Top
@phlptp
query=h.helicsQueryCreate("root","global_time_debugging")
result=h.helicsQueryExecute(query,fed)
Trevor Hardy
@trevorhardy

I’m full-time on my new ARM-based Mac and just tried building and install HELICS v3.3.1 with PyHELICS. It looks like something is not quite working right on the PyHELICS side:

>>> import helics as h
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/hard312/opt/anaconda3/envs/helics_331/lib/python3.10/site-packages/helics/__init__.py", line 2, in <module>
    from .capi import *
  File "/Users/hard312/opt/anaconda3/envs/helics_331/lib/python3.10/site-packages/helics/capi.py", line 27, in <module>
    from . import _build
  File "/Users/hard312/opt/anaconda3/envs/helics_331/lib/python3.10/site-packages/helics/_build.py", line 156, in <module>
    lib = _load_library()
  File "/Users/hard312/opt/anaconda3/envs/helics_331/lib/python3.10/site-packages/helics/_build.py", line 105, in _load_library
    lib = ffi.dlopen(os.path.join(lib_folder, file))
  File "/Users/hard312/opt/anaconda3/envs/helics_331/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/Users/hard312/opt/anaconda3/envs/helics_331/lib/python3.10/site-packages/cffi/api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "/Users/hard312/opt/anaconda3/envs/helics_331/lib/python3.10/site-packages/cffi/api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library '/Users/hard312/install/HELICS/331/lib/libhelics.3.3.1.dylib': dlopen(/Users/hard312/install/HELICS/331/lib/libhelics.3.3.1.dylib, 0x0002): tried: '/Users/hard312/install/HELICS/331/lib/libhelics.3.3.1.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64))).  Additionally, ctypes.util.find_library() did not manage to locate a library called '/Users/hard312/install/HELICS/331/lib/libhelics.3.3.1.dylib'

Any quick fix or should I file a bug on this?

Ryan Mast
@nightlark
What does running lipo -info on the .dylib file give?
Trevor Hardy
@trevorhardy
Non-fat file: /Users/hard312/install/HELICS/331/lib/libhelics.3.3.1.dylib is architecture: arm64
Syed Qaseem Ali
@sqaseemali
Hi All,
I am looking for examples of config and running a federate in real time. Would appreciate if there is help available.
Trevor Hardy
@trevorhardy

I don’t think we have an example in the User Guide right now on real-time but there is flag that can be set in the JSON config:

name”: “federate name”,
“core_type”: zmq,
…
“real_time”: true,
“rt_tolerance”: 1.5,
…

This tells the broker to grant times in real-time with a tolerance of +/- 1.5 seconds.

Give this a shot and if you’re having trouble let us know. We have at least one person on our team who has used this feature and work with him if you’re having trouble.

1 reply
Syed Qaseem Ali
@sqaseemali
Thanks @trevorhardy appreciate the quick response.
I'll try it out
Ryan Mast
@nightlark
@trevorhardy what if you run that same command on the python executable that the conda environment is using? what I find odd is that the error message says it needs x86_64 for the HELICS library, but an M1 is not x86_64 processor -- so the only thing that comes to mind is maybe the process trying to load the HELICS library is x86_64 and running under Rosetta 2
Trevor Hardy
@trevorhardy
Can you be more specific about which command to run?
Ryan Mast
@nightlark
lipo -info on the python executable that anaconda is running
Trevor Hardy
@trevorhardy
Clever man:
Non-fat file: /Users/hard312/opt/anaconda3/envs/helics_331/bin/python is architecture: x86_64
Let me see if I can get conda to install ARM-native python.
Trevor Hardy
@trevorhardy

To completely close the loop, I followed the instructions here to make sure that conda was setting up ARM environments and that is working for me. (Confirmed with lipo -info the installed Python version and by running the example.)

As best as I can read, though, it seems that conda should have created ARM-specific versions by default. Don’t know why that got messed up.

Syed Qaseem Ali
@sqaseemali
Is there an elegant way to start and stop a co-simulation in HELICS instead of hard-coding the max time?
I am thinking of having a control federate that publishes a flag that all the other federates subscribe to, and runs as long as the flag is set.
Trevor Hardy
@trevorhardy
For stopping you could use the command interface which allows asynchronous arbitrary messages to be sent and develop a protocol to determine when the federates should exit based on these messages.
I don’t know when the command messages start being able to be sent (maybe after exiting the Creation phase?) but they could certainly be used after entering Execution phase prior to any time request if you need to delay the start of the co-simulation for some reason.
Philip Top
@phlptp
if you are running a separate broker you can run a terminal using the "term" subcommand. from there you can call terminate and it will kill a broker. You can also use the web interface and send a REST api command. If you have a particular federate that you want in control just have it sendCommand("root", "terminate") that will tell the broker to terminate and all the other federates will follow.
Syed Qaseem Ali
@sqaseemali
@phlptp does it also work with Python?
Philip Top
@phlptp
I beleive helics_broker is installed when you install helics with python, the helicsXXXsendCommand API calls should be available in python
Philip Top
@phlptp
@trevorhardy are you able to review #2464
Trevor Hardy
@trevorhardy
Yes. I’ll get to it Monday.
Trevor Hardy
@trevorhardy
As part of my review on #2464, I have a growing philosophical desire to define an unnamed output (we only call these "publications", right?). I don’t have a good use case in my brain right now and I know you’ve noodled on it in the past @phlptp, but having an output that you can’t subscribe to (add as a target to an input) and can only be sent out by the owner seems like it could have a use. Plus it completes the symmetry of [name/unamed] + [input/output] for all our handles.
Philip Top
@phlptp
@trevorhardy that is already available, names are not a required field for publications, just like inputs, endpoints, filters, and translators. The name field is not required and if not supplied that particular interface is not targetable by other federates.
Trevor Hardy
@trevorhardy

Hmm, OK.

It sounds like this may come down to how we document things as much as the underlying API. Let me stew on this and we can talk about it when I have a more formal proposal for how I might want to change the documentation (under the limitations of our curent funding). It may or may not be something we can undertake now (at least fully) but having a plan in place makes it a “shovel ready” task when the money is available.

narein257
@narein257
@phlptp Hi, where you able to make any updates to FMI interface? Did you get a chance to check the core dump issue?
EPzhang
@EPzhang
Hi All. May I ask if anyone has use HELICS to connect Matpower and Synergi Gas? I'm wondering if there's an already-made interface for Synergi gas. THX.
Philip Top
@phlptp
Let me ask around on Monday, I thought I heard of someone but it was not on a project I work with regularly. Matpower is a yes.
1 reply
Michael Blonsky
@mnblonsky
Hi all, I'm running a co-simulation on HPC that is running slowly. It seems that helicsFederateRequestTime is taking 1-2 seconds at each time step. I'm running about 2000 federates and 1 controller federate that communicates via publication/subscription to each other federate. All are using ZMQ cores. Using 40 nodes on HPC. Implemented in python. Is this time lag typical, and is there something I can do to speed it up?
1 reply
narein257
@narein257
@phlptp Did you get a chance to look into helics 3 fmi interface?
Philip Top
@phlptp
I did some updates but I will also be working on it more today and tomorrow. So should have an updated version uploaded tomorrow. @narein257
Philip Top
@phlptp
@nightlark see test for the ssl error that has popped up occasionally.
Ryan Mast
@nightlark
Does resending broker reg always happen right before it? It looks like it is after some form of connection is established, so maybe it isn't a bad certificate; something making the message authentication code become invalid seems more likely; I'd lean towards it being a symptom of another bug?
Possibly something related to fully shutting down a previous connection.
Wei Trinh
@Weifarers

Is there an expected behavior when a federate subscribes to a publication that doesn't exist? I'm currently trying the example pi-exchange, and as a test, I wanted to see what happened when I changed the pireceiver.py federate to subscribe to "testC" instead of "testA". My thought is that I would be thrown an error and everything disconnects, but instead, I get the following output from the pireceiver:
[2022-12-02 14:46:28.745] [console] [warning] TestB Federate (131073)[created]::Unable to connect to publication target testC
PI RECEIVER: Entering execution mode
PI RECEIVER: Received value = -9999999999999999464902769475481793196872414789632.000000 at time 100.0 from PI SENDER
PI RECEIVER: Received value = -9999999999999999464902769475481793196872414789632.000000 at time 100.01 from PI SENDER
PI RECEIVER: Federate finalized

The warning makes sense; I haven't set a publication with the name "testC", but where is it pulling these values from and times from, then?

Philip Top
@phlptp
you can set the required flag on each interface or on the federate(so applies to all interfaces), which would turn that warning into an error if you desired. Each input can have a default value setting which would be used if no data has been received instead of the invalid value which is -1e49. Basically for inputs, which have not received any data, when requesting the data you get the given default value or the invalidValue for double based values which is -1e49, for signed integers is the min value, for unsigned is the max value, for namedpoints it is an empty string with nan.
Wei Trinh
@Weifarers

Ah, got it! That makes way more sense; this came about primarily because when I was initially doing the test, I got the following output:

PI RECEIVER: Entering execution mode
PI RECEIVER: Received value = 3.141593 at time 5.0 from PI SENDER
PI RECEIVER: Received value = 3.141593 at time 6.0 from PI SENDER
PI RECEIVER: Received value = 3.141593 at time 7.0 from PI SENDER
PI RECEIVER: Received value = 3.141593 at time 8.0 from PI SENDER
PI RECEIVER: Received value = 3.141593 at time 9.0 from PI SENDER
PI RECEIVER: Received value = 3.141593 at time 100.0 from PI SENDER
PI RECEIVER: Received value = 3.141593 at time 100.01 from PI SENDER

I was a bit confused as to why it was receiving values past time 9.0, when the sender was only set to publish values with a for loop in the range of (5,10). Would it be correct to assume then, that because the sender is no longer publishing values to the publication, the receiver just takes the last value that it received from the subscription and is just going to indicate that it received that value until it exits the while loop?

Philip Top
@phlptp
Value based interface (publications/input) are persistent meaning they remain at the same value until changed. (if you enable data buffering on an interface, new dynamic subscriptions will get the old value as well). Endpoints are packet based data the block of data flows through but is not persisted.
That is one of the primary differences between the value and packet based interfaces in HELICS.
Wei Trinh
@Weifarers
Thanks for the quick and thorough explanation! Helps a bunch with understanding what's going on when I'm running these examples.