crond-jaist / gridattacksim Goto Github PK
View Code? Open in Web Editor NEWGridAttackSim: Smart Grid Attack Simulation Framework
License: BSD 3-Clause "New" or "Revised" License
GridAttackSim: Smart Grid Attack Simulation Framework
License: BSD 3-Clause "New" or "Revised" License
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.
In the file "attack_broker.py" the following two lines(line 102-103) attempt to execute a subprocess and extracts its pid.
child = subprocess.Popen('pgrep xterm', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, executable='/bin/bash')
pid = int(child.communicate()[0].split('\n')[0])
However, this doesn't give the correct pid.
I am running the simulation and I am facing the following errors:
mv: cannot stat 'baseprice_clearedprice_clearedquantity.csv': No such file or directory
mv: cannot stat 'totalload.csv': No such file or directory
I've installed all the requirements for gridattacksim.
When I run python3 GridAttackSim.py It starts. I can select options and start the simulation.
I get the message that the simulation has started.
3 windows pop up (fcnc, ns-3, ?). The third window opens and closes shortly after. I think it's the subprocess to get the I'd of the running process and check it it ended.
The simulation never ends on its own. If I do end it by closing the popup Windows, it does generate csv files but they are blank. Do I have to input other data into the system? I do great blank csv files named "baseprice_clearedprice_clearedquantity.csv" and 'totalload.csv and put these in the folders in the appropriate database.
The files do show up when I press show results. Graphing them produces nothing because the files are empty.
No other errors show. How long does simulation normally take? Or are there additional inputs I should provide? Shown Below is an image of what I see after simulation has started. The output files show up when I manually end the process. The process never ends on its own.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.