Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Bacheloroppgave_2022
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eilert Tunheim
Bacheloroppgave_2022
Commits
74e773e2
Commit
74e773e2
authored
3 years ago
by
Eilert Tunheim
Browse files
Options
Downloads
Patches
Plain Diff
Sorts the data incrementally
parent
a6646932
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/com/application/DB/DB.java
+12
-5
12 additions, 5 deletions
src/main/java/com/application/DB/DB.java
target/classes/com/application/DB/DB.class
+0
-0
0 additions, 0 deletions
target/classes/com/application/DB/DB.class
with
12 additions
and
5 deletions
src/main/java/com/application/DB/DB.java
+
12
−
5
View file @
74e773e2
...
...
@@ -179,7 +179,7 @@ public class DB {
"SELECT Timestamp, RealValue FROM `sf-drying-optimization.174.int_sd_swappconsensordata` " +
"WHERE TimeStamp BETWEEN " + '"'+ entry.getKey() + '"' +
" AND " + '"' + entry.getValue() + '"' +
"AND ValueID = 1
4
" +
"AND ValueID = 1
9
" +
"AND RealValue <> 0 " +
"ORDER BY TimeStamp ASC";
...
...
@@ -201,18 +201,23 @@ public class DB {
//System.out.println("baseline: "+baseline);
// kWh value
int
variantValue
=
row
.
get
(
"VariantValue"
).
getNumericValue
().
intValue
();
//-baseline
int
variantValue
=
row
.
get
(
"VariantValue"
).
getNumericValue
().
intValue
()
-
baseline
;
//-baseline
// Retrieving the wanted data
long
timeStamp
=
row
.
get
(
"TimeStamp"
).
getTimestampValue
()
/
1000
;
// Riktig format, men i string
String
formatedTimeStamp
=
getDateFormat
().
format
(
timeStamp
);
/*
// Checks for negative values and unresonable large values
if(variantValue > 0){ //&& variantValue < 5000000){
// Adding the data to a list in order to sort through later
data.put(formatedTimeStamp, variantValue);
}
*/
data
.
put
(
formatedTimeStamp
,
variantValue
);
//System.out.printf("Timestamp: \t%s\t\t\tkWh: \t%s\t\t\tBaseline: %s\n",formatedTimeStamp,variantValue,baseline);
// Checks if the data is empty
}
...
...
@@ -228,7 +233,7 @@ public class DB {
System
.
out
.
println
(
"\nFinal results size: "
+
finalResults
.
size
());
// Defining a treemap to sort th
rough the data
// Defining a treemap to sort th
e data incrementally
NavigableMap
<
Integer
,
Map
>
sortedFinalResults
=
new
TreeMap
<>(
finalResults
);
...
...
@@ -250,7 +255,7 @@ public class DB {
* A possible extention of this function could be to limit the number of dring periodes.
* This could be done with counting the number of entries in
*
* @return
A hashmap containing the correct intidtork and outtidtork dates
* @return
Returns a treemap that sorts the Start- and End time for each drying period incrementally
* @throws Exception Throws exception if an error occurs
*/
private
static
Map
<
String
,
String
>
getZeroPointDate
()
throws
Exception
{
...
...
@@ -335,7 +340,9 @@ public class DB {
//System.out.printf("%s\t\t\t%s\n",formatedInTidTork,formatedUtTidTork);
}
System
.
out
.
printf
(
"Size of dates: %s\n"
,
dates
.
size
());
return
dates
;
// Returns a treemap that sorts the dates incrementally
return
new
TreeMap
<>(
dates
);
/*
// Defining a treemap to sort through the data
...
...
This diff is collapsed.
Click to expand it.
target/classes/com/application/DB/DB.class
+
0
−
0
View file @
74e773e2
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment