Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezade authored and alirezade committed Jan 10, 2024
1 parent 64b3e6f commit 9ad0137
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ics_sim/Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def add_sensor(self, tag, fault):
def read(self, tag):
if tag in self._sensors.keys():
value = self._get(tag)
# if value is None:
# print(f"The tag: {tag} recieved null value from databse. return -1!")
# return -1
if value is None: # todo: we have to comment this section
print(f"The tag: {tag} recieved null value from databse. return -1!")
return -1
value += random.uniform(value, -1 * value) * self._sensors[tag]
return value
else:
Expand Down
4 changes: 2 additions & 2 deletions src/ics_sim/connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def set(self, key, value):
return value

except sqlite3.Error as e:
error('_set in ICSSIM connection %s: ' % e.args[0])
error(f'_set in ICSSIM connection {e.args[0]} for setting tag {key}')

def get(self, key):
get_query = """SELECT {} FROM {} WHERE {} = ?""".format(
Expand All @@ -94,7 +94,7 @@ def get(self, key):
return record[0]

except sqlite3.Error as e:
error('_get in ICSSIM connection %s: ' % e.args[0])
error(f'_get in ICSSIM connection {e.args[0]} for getting tag {key}')


class MemcacheConnector(Connector):
Expand Down

0 comments on commit 9ad0137

Please sign in to comment.