Description
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.