Skip to content

Commit b061241

Browse files
authored
Merge branch 'master' into dev-paper
2 parents 71a4ab8 + f9610b4 commit b061241

File tree

6 files changed

+9
-19
lines changed

6 files changed

+9
-19
lines changed

dhalsim/parser/antlr/controlsLexer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class controlsLexer(Lexer):
114114
COMMENT = 19
115115
NEWLINES = 20
116116
WS = 21
117+
#PUMP_SETTING = 22
117118

118119
channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ]
119120

dhalsim/parser/antlr/controlsParser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class controlsParser ( Parser ):
7474
COMMENT=19
7575
NEWLINES=20
7676
WS=21
77+
#PUMP_SETTING=22
7778

7879
def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
7980
super().__init__(input, output)

dhalsim/parser/grammars/controls.g4

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,16 @@ ANY_SPACE : ' '+;
99
STATE : (OPEN | CLOSED | VALUE) ;
1010
OPEN : 'OPEN';
1111
CLOSED : 'CLOSED';
12-
//PUMP_SETTING : [0-9]*'.'[0-9]*;
12+
1313

1414
/** Conditions */
1515
CONDITION : (BELOW | ABOVE) ;
1616
BELOW : 'BELOW';
1717
ABOVE : 'ABOVE';
1818

1919
/** Values */
20+
VALUE : [0-9]*'.'*[0-9]+;
2021

21-
// 5.0 : [0-9]+'.'[0-9]+
22-
// 5 : [0-9]+
23-
// .5 : '.'[0-9]+
24-
/*
25-
VALUE : (INT | FLOAT | DEC );
26-
FLOAT : [0-9]+'.'[0-9]+ ;
27-
INT : [0-9]+ ;
28-
DEC : '.'[0-9]+ ;
29-
*/
30-
31-
VALUE : [0-9]*'.'*[0-9]+; // 5 valid, but 5.0 not!
32-
33-
//VALUE : [0-9]*'.'*[0-9]+ ;
3422
ID : [a-zA-Z0-9_]+ ;
3523
CAPITALS : [A-Z].*? ;
3624

dhalsim/parser/input_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def generate_controls(self):
129129
# This is an AT NODE control
130130
dependant = str(child.getChild(10))
131131
value = float(str(child.getChild(14)))
132-
132+
133133
controls.append({
134134
"type": str(child.getChild(12)).lower(),
135135
"dependant": dependant,

dhalsim/physical_process.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def build_initial_actuator_dict(self):
290290
self.logger.error('Invalid actuator!')
291291

292292
self.actuator_list = dict(zip(actuator_names, actuator_status))
293-
293+
294294
def register_initial_results(self):
295295
self.values_list = [self.master_time, datetime.now()]
296296

@@ -338,6 +338,7 @@ def register_initial_results(self):
338338

339339
self.extend_attacks()
340340

341+
341342
def register_results(self, results=None):
342343

343344
# Results are divided into: nodes: reservoir and tanks, links: flows and status
@@ -534,7 +535,6 @@ def get_attack_flag(self, name):
534535
return flag
535536

536537
def get_actuator_status(self, actuator):
537-
#self.logger.debug('Pump value: '+ str(self.get_from_db(actuator)))
538538
if isinstance(self.get_from_db(actuator), int):
539539
# Actuator is either OPEN/CLOSED
540540
return int(self.get_from_db(actuator))
@@ -916,4 +916,4 @@ def is_valid_file(test_parser, arg):
916916
args = parser.parse_args()
917917

918918
simulation = PhysicalPlant(Path(args.intermediate_yaml))
919-
simulation.main()
919+
simulation.main()

examples/anytown_topology/anytown_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ simulator: epynet
88
demand: pdd
99
log_level: debug
1010
demand_patterns: demands_anytown_small.csv
11-
#attacks: !include anytown_concealment_mitm.yaml
11+
#attacks: !include anytown_concealment_mitm.yaml

0 commit comments

Comments
 (0)