Replies: 7 comments 5 replies
-
HELICS directly supports vector transfer and complex vector transfer. As far as structures go we have at various time looked at supporting it but there is no common standard for that. And when done in different application the most common way is to convert it to json and send the string, so there hasn't been a strong case to support it directly. my suggestion would be to look at something like https://www.mathworks.com/help/matlab/ref/jsonencode.html for Matlab for sending more complex structured data. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the response. Do you have any example in which you are exchanging vectors between two federates? I tried using the helicsPublicationPublishVector command, where I am hoping to send a fixed array between the battery and charger federates (in the default fundamental example). This gives an error. While using helicsPublicationPublishVector command, do we have to edit the json file as well? |
Beta Was this translation helpful? Give feedback.
-
The type of the publication you set in the JSON file is the type of data that gets transferred. HELICS does do conversion between all the supported types but generally a good idea to match up the specified type with the type of data you expect to send most of the time. What error are you getting. I know that works in C/C++ what I don't know is whether the python interface is expecting a particular kind of array since I don't work in python all that often. @kdheepak can give a better explanation and help debug what is going on in your case. |
Beta Was this translation helpful? Give feedback.
-
Hi Philip, File "C:\Users\aaa\Anaconda3\envs\env01\lib\threading.py", line 932, in _bootstrap_inner |
Beta Was this translation helpful? Give feedback.
-
If you are using Python, the simplest way is to convert the complex matrix to a complex array using reshape, and then take a "view" of it using float32 or float64. See example code below: You can then send this float64 array using There are similar functions available in MATLAB and Julia. |
Beta Was this translation helpful? Give feedback.
-
I publish using the command: h.helicsPublicationPublishVector(pubid, charging_current) Following is the error: helics-cli [error]: Process Estimator exited with return code 1 |
Beta Was this translation helpful? Give feedback.
-
FYI, the code h.helicsPublicationPublishVector(pubid, [1,2,3,4]) is not giving any error |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am using the fundamental_default example (HELICS-Examples/user_guide_examples/fundamental/fundamental_default/) in which the battery and charger federates exchange current and voltage information. I am trying to modify this example for some other application.
Herein, is it possible to exchange arrays or matrices (with complex elements) between federates. Moreover, is it possible to exchange something like structure array (https://www.mathworks.com/help/matlab/ref/struct.html) between federates.
Thank you.
Ajay
Beta Was this translation helpful? Give feedback.
All reactions