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
f730b8b1
Commit
f730b8b1
authored
Feb 05, 2015
by
Alan Mitchell
Browse files
Added runscript to add Dummy Data
parent
9a9f9ef1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
bmsapp/scripts/add_dummy_data.py
bmsapp/scripts/add_dummy_data.py
+29
-0
No files found.
bmsapp/scripts/add_dummy_data.py
0 → 100644
View file @
f730b8b1
'''Adds dummy data to the reading database
'''
import
bmsapp.readingdb.bmsdata
import
random
import
time
BLDG_COUNT
=
8
SENSOR_COUNT
=
20
YRS_OF_READINGS
=
1.5
READING_SPACING
=
10.0
# minutes
# create the timestamp array and the value array (random)
tstart
=
int
(
time
.
time
()
-
YRS_OF_READINGS
*
8766
*
3600
)
tstamps
=
range
(
tstart
,
int
(
time
.
time
()),
int
(
READING_SPACING
*
60
))
vals
=
[
random
.
random
()
for
i
in
range
(
len
(
tstamps
))]
def
run
():
db
=
bmsapp
.
readingdb
.
bmsdata
()
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
)
db
.
close
()
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