Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
energy
bmon
Commits
71b96b89
Commit
71b96b89
authored
Feb 05, 2015
by
Alan Mitchell
Browse files
Erorr Trapping
parent
f730b8b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
bmsapp/scripts/add_dummy_data.py
bmsapp/scripts/add_dummy_data.py
+13
-8
No files found.
bmsapp/scripts/add_dummy_data.py
View file @
71b96b89
'''Adds dummy data to the reading database
'''
import
bmsapp.readingdb.bmsdata
import
random
import
time
import
traceback
import
bmsapp.readingdb.bmsdata
BLDG_COUNT
=
8
SENSOR_COUNT
=
20
...
...
@@ -17,13 +18,17 @@ vals = [random.random() for i in range(len(tstamps))]
def
run
():
db
=
bmsapp
.
readingdb
.
bmsdata
()
try
:
db
=
bmsapp
.
readingdb
.
bmsdata
()
for
b
in
range
(
BLDG_COUNT
):
for
s
in
range
(
SENSOR_COUNT
):
for
b
in
range
(
BLDG_COUNT
):
for
s
in
range
(
SENSOR_COUNT
):
sensor_id
=
'%03d_%03d'
%
(
b
,
s
)
ids
=
[
sensor_id
]
*
len
(
tstamps
)
db
.
insert_reading
(
tstamps
,
ids
,
vals
)
sensor_id
=
'%03d_%03d'
%
(
b
,
s
)
ids
=
[
sensor_id
]
*
len
(
tstamps
)
db
.
insert_reading
(
tstamps
,
ids
,
vals
)
db
.
close
()
db
.
close
()
except
:
traceback
.
print_exc
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment