crond-jaist / GridAttackSim

GridAttackSim: Smart Grid Attack Simulation Framework
BSD 3-Clause "New" or "Revised" License
21 stars 10 forks source link

Possible mistake of adding two "route" statements in `creat_rout_and_subscribe.py` file #5

Open chandrakishorSingh opened 1 year ago

chandrakishorSingh commented 1 year ago

In the file creat_rout_and_subscribe.py, which is present in every "Smart Grid Model", following two lines of code are present.

    line = line + "route \"commit:Market_1.current_price_mean_24h -> HOUSE_"+str(index)+"/avgPrice; 0\";\n";
    line = line + "route \"commit:Market_1.current_price_mean_24h -> HOUSE_"+str(index)+"/avgPrice; 0\";\n";

As we can see both of the lines are exactly same.

This file is used to generate the content for another file called fncs_msg.txt. The variable line used in above two statement is used to write the content of the required file line by line.

I am still understanding the meaning of the "route" and "subscribe" stataments(which are written in this file). So, I'm not sure why we need to have the same statements twice. Though, it looks to me that it's probably a mistake.

If we look at the body of the while loop from where above 2 statements are taken then we have the following code.

    line = line + "route \"commit:Market_1.current_market.clearing_price -> HOUSE_"+str(index)+"/clearPrice; 0\";\n";
    line = line + "route \"commit:Market_1.market_id -> HOUSE_"+str(index)+"/mktID; 0\";\n";
    line = line + "route \"commit:Market_1.current_price_mean_24h -> HOUSE_"+str(index)+"/avgPrice; 0\";\n";
    line = line + "route \"commit:Market_1.current_price_mean_24h -> HOUSE_"+str(index)+"/avgPrice; 0\";\n";
    line = line + "route \"commit:Market_1.current_price_stdev_24h -> HOUSE_"+str(index)+"/stdevPrice; 0\";\n";

    line = line + "subscribe \"function:auction/submit_bid_state <- ns3_1/fncs_msg/HOUSE_"+str(index)+"@Market_1/submit_bid_state\";\n";
    line = line + "subscribe \"precommit:HOUSE_"+str(index)+".proxy_clear_price <- ns3_1/fncs_msg/Market_1@HOUSE_"+str(index)+"/clearPrice\";\n";
    line = line + "subscribe \"precommit:HOUSE_"+str(index)+".proxy_market_id <- ns3_1/fncs_msg/Market_1@HOUSE_"+str(index)+"/mktID\";\n";
    line = line + "subscribe \"precommit:HOUSE_"+str(index)+".proxy_average <- ns3_1/fncs_msg/Market_1@HOUSE_"+str(index)+"/avgPrice\";\n";
    line = line + "subscribe \"precommit:HOUSE_"+str(index)+".proxy_standard_deviation <- ns3_1/fncs_msg/Market_1@HOUSE_"+str(index)+"/stdevPrice\";\n";

It seems like for every "route" statements there is a "subscribe" statement. For example, we have a "route" statement for "clearPrice" and one "subscribe" statement for "clearPrice" as well. The same goes for "avgPrice", "stdevPrice" and "mktID". But we don't have such a pair for "submit_bid_state"(only a "subscribe" statement but not "route" statement). And at the same time there are 2 "route" statement for "avgPrice".

So, may be(by mistake), the author have written two "route" statement for "avgPrice" and no "route" statement for "submit_bid_state".

As I said previously, I'm still understanding what these "route" and "subscribe" statement mean. I will comment about my understanding as soon as possible.

chandrakishorSingh commented 1 year ago

Also, I tried finding official docs of fncs(Framework for network co-simulation) for understanding GridAttackSim better but couldn't find one. I request authors to kindly provide any link for those official docs(if exists) or any other resource to understand fncs.

Thanks.

leduytanjaist2016 commented 1 year ago

Hello,

I'm Tan from the project team, and I want to thank you for your inquiry.

Here are some resources related to the FNCS tutorial you mentioned:

FNCS tutorial: You can access it at this link: FNCS Tutorial Official document: You may refer to this document for more information: Official Document Official website: Visit the official website of FNCS here: FNCS Official Website It's worth noting that the FNCS project concluded five years ago. Consequently, some libraries are outdated and may not function correctly. Moreover, FNCS is incompatible with Ubuntu 20. Considering this, I highly recommend transitioning to HELICS. FNCS is the predecessor to HELICS.

You can explore HELICS by visiting their website: HELICS

Please let me know if you have any further questions or need additional assistance.

Best regards, Tan