Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems passing values in GridLAB-D/Fortran co-sim using FAPI #13

Open
victorayon opened this issue Apr 18, 2017 · 1 comment
Open

Comments

@victorayon
Copy link

victorayon commented Apr 18, 2017

Hi,

I've been working with the new Fortran API and I have successfully performed two co-simulations. One simulation involves passing values between two simple Fortran models. The second simulation consists of the same two Fortran models plus the C++ simB model from one of the tutorials. In this simulation all three simulators successfully passed and received values between each other.

I am currently woking on a third co-simulation composed of a simple GridLAB-D model and one of the simple Fortran models used in the previous simulations. However, I am having trouble passing values between them. I have been able to pass the value of the inverter variable "VA_Out" to Fortran but only in the first time step. Below is the output from the Fortran model named "fapi_A":

My name is 'fapi_A'
I am federate 0 out of 2 other federates
current time is 1, received 1 events
event value
fncs_inverter/inverter_1@fapi_A/VA_Out +57713.6+0j VA
current time is 2, received 0 events
event value
current time is 3, received 0 events
event value

What you see for times 2 and 3 is repeated for the rest of the simulation.
This is the GLD output:

name = fncs_inverter
time_delta = 1000000000ns
broker = tcp://localhost:5570
values
fapi_A/fncs_inverter/inverter_1@fapi_A/VA_Out
topic = fapi_A/fncs_inverter/inverter_1@fapi_A/VA_Out
default = +0+0j VA
list = false

This is are the lines in my GLD configure file:

route "commit:inverter_1.VA_Out -> fapi_A/VA_Out; 0";
subscribe "precommit:inverter_1.VA_Out <- fapi_A/fncs_inverter/inverter_1@fapi_A/VA_Out";

And the Config portion in the Fortran model:

config = "name = fapi_A"//NEW_LINE('A')//&
"time_delta = 1s"//NEW_LINE('A')//&
"broker = tcp://localhost:5570"//NEW_LINE('A')//&
"values"//NEW_LINE('A')//&
" fncs_inverter/inverter_1@fapi_A/VA_Out"//NEW_LINE('A')//&
" topic = fncs_inverter/inverter_1@fapi_A/VA_Out"//NEW_LINE('A')//&
" list = false"//NEW_LINE('A')

The fncs_msg object in the GLD model reads as follows:

object fncs_msg {
name fncs_inverter;
parent inverter_1;
option "transport:hostname localhost, port 5570";
configure solar1.txt;

The full files are attached. I created the GLD configure file and fncs_msg object using the gld-ns3 tutorial as reference but I still don't understand the format of the "route", "subscribe", and "function" parts.

Could you please point out what I am doing wrong? Also if possible, could you please explain the format of "route", "subscribe", etc.?

Best regards,

Victor Ayon

GLD-Fortran.zip

@jeffdaily
Copy link
Contributor

"route" is intended for use with a communications network simulator. The idea is you pass in the usual key and value, but also two named endpoints representing how the key/value would be transmitted as a network packet between the two endpoints. We use a customized ns-3 when we do this.

Internally, FNCS treats a 'route' message like any other subscription topic but it just has a special form of "simname/from@to/key" --> "value". Normally, a published value just looks like "simname/key" --> "value". The 'route' has the extra middle section with the two endpoints separated by @.

It sounds like you're just trying to exchange values without trying to simulate the value exchange over a communications network -- for example exchanging boundary conditions between transmission and distribution simulators. You should then not use 'route' when setting up your GridLAB-D configuration file.

For the rest of the setup I'll have to defer to @afisher1 to help get your fortran code talking to GridLAB-D. He's our FNCS + GridLAB-D expert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants