Giter Site home page Giter Site logo

crond-jaist / gridattacksim Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 10.0 3.16 MB

GridAttackSim: Smart Grid Attack Simulation Framework

License: BSD 3-Clause "New" or "Revised" License

Shell 0.88% Python 3.73% Zimpl 86.06% C++ 8.28% MATLAB 1.05%
cyberattack-simulation smart-grid

gridattacksim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gridattacksim's Issues

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

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.

pid is not extracted correctly in "attack_broker.py" file

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.

Error

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

Simulation Runs but doesn't end. Blank output files generated when manually exiting.

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.
Screen Shot 2022-04-05 at 3 06 27 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.