Merge pull request #2 from Henry-Pump/optimize-time-series-data

Optimize time series data
This commit is contained in:
Patrick McDonagh
2017-05-02 09:38:27 -05:00
committed by GitHub
4 changed files with 373 additions and 159 deletions

211
.idea/workspace.xml generated
View File

@@ -2,8 +2,7 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="28cc251f-c94f-44ee-a66d-77aaab6e3483" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Card.java" afterPath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Card.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java" afterPath="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java" />
</list>
<ignored path="$PROJECT_DIR$/target/" />
<ignored path="$PROJECT_DIR$/.gradle/" />
@@ -109,8 +108,8 @@
<file leaf-file-name="POC.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/POC.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="13" column="30" lean-forward="false" selection-start-line="13" selection-start-column="30" selection-end-line="13" selection-end-column="30" />
<state relative-caret-position="676">
<caret line="93" column="0" lean-forward="false" selection-start-line="93" selection-start-column="0" selection-end-line="93" selection-end-column="0" />
<folding />
</state>
</provider>
@@ -119,8 +118,8 @@
<file leaf-file-name="Well.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-16507">
<caret line="93" column="39" lean-forward="true" selection-start-line="93" selection-start-column="39" selection-end-line="93" selection-end-column="39" />
<state relative-caret-position="175">
<caret line="407" column="38" lean-forward="false" selection-start-line="407" selection-start-column="38" selection-end-line="407" selection-end-column="38" />
<folding />
</state>
</provider>
@@ -156,11 +155,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="Card.java" pinned="false" current-in-tab="true">
<file leaf-file-name="Card.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Card.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="584">
<caret line="375" column="36" lean-forward="false" selection-start-line="375" selection-start-column="36" selection-end-line="375" selection-end-column="36" />
<state relative-caret-position="374">
<caret line="361" column="54" lean-forward="false" selection-start-line="361" selection-start-column="54" selection-end-line="361" selection-end-column="54" />
<folding />
</state>
</provider>
@@ -198,56 +197,49 @@
</provider>
</entry>
</file>
<file leaf-file-name="Database.java" pinned="false" current-in-tab="false">
<file leaf-file-name="Database.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4515">
<caret line="325" column="42" lean-forward="false" selection-start-line="325" selection-start-column="42" selection-end-line="325" selection-end-column="42" />
<state relative-caret-position="542">
<caret line="153" column="68" lean-forward="true" selection-start-line="153" selection-start-column="68" selection-end-line="153" selection-end-column="68" />
<folding>
<element signature="imports" expanded="false" />
<element signature="e#2539#2540#0" expanded="false" />
<element signature="e#2574#2575#0" expanded="false" />
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="build.gradle" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/build.gradle">
<file leaf-file-name="Measurement.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="18" column="59" lean-forward="false" selection-start-line="18" selection-start-column="30" selection-end-line="18" selection-end-column="59" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="AnalogIn.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/AnalogIn.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1395">
<caret line="103" column="0" lean-forward="false" selection-start-line="103" selection-start-column="0" selection-end-line="103" selection-end-column="0" />
<state relative-caret-position="552">
<caret line="64" column="69" lean-forward="false" selection-start-line="64" selection-start-column="69" selection-end-line="64" selection-end-column="69" />
<folding>
<element signature="imports" expanded="false" />
<element signature="e#1122#1123#0" expanded="false" />
<element signature="e#1164#1165#0" expanded="false" />
<element signature="e#1193#1194#0" expanded="false" />
<element signature="e#1230#1231#0" expanded="false" />
<element signature="e#3896#3897#0" expanded="true" />
<element signature="e#3928#3929#0" expanded="true" />
<element signature="e#3978#3979#0" expanded="true" />
<element signature="e#4020#4021#0" expanded="true" />
<element signature="e#4058#4059#0" expanded="true" />
<element signature="e#4094#4095#0" expanded="true" />
<element signature="e#4150#4151#0" expanded="true" />
<element signature="e#4200#4201#0" expanded="true" />
<element signature="e#4232#4233#0" expanded="true" />
<element signature="e#4260#4261#0" expanded="true" />
<element signature="e#4302#4303#0" expanded="true" />
<element signature="e#4336#4337#0" expanded="true" />
<element signature="e#4371#4372#0" expanded="true" />
<element signature="e#4402#4403#0" expanded="true" />
<element signature="e#4451#4452#0" expanded="true" />
<element signature="e#4491#4492#0" expanded="true" />
<element signature="e#4528#4529#0" expanded="true" />
<element signature="e#4561#4562#0" expanded="true" />
<element signature="e#4614#4615#0" expanded="true" />
<element signature="e#4658#4659#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="startup.sh" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/startup.sh">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@@ -272,6 +264,7 @@
<find>fluidGasRatio</find>
<find>setupFluidRatio</find>
<find>startupStrokes</find>
<find>updat</find>
</findStrings>
</component>
<component name="Git.Settings">
@@ -746,16 +739,16 @@
<option value="$PROJECT_DIR$/viceroyWell.json" />
<option value="$PROJECT_DIR$/build.gradle" />
<option value="$PROJECT_DIR$/poc.service.txt" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/CLScanner.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/IOControl.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/WebServer.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/POC.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/AnalogIn.java" />
<option value="$PROJECT_DIR$/startup.sh" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Card.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java" />
<option value="$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java" />
</list>
</option>
</component>
@@ -770,9 +763,8 @@
<treeState />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-1920" />
<option name="width" value="1920" />
<option name="height" value="1012" />
<option name="width" value="1680" />
<option name="height" value="1050" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
@@ -792,12 +784,11 @@
<panes>
<pane id="PackagesPane" />
<pane id="Scratches" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="poc-java" />
<option name="myItemId" value="POC-Java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
@@ -807,7 +798,7 @@
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="poc-java" />
<option name="myItemId" value="POC-Java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
@@ -821,7 +812,7 @@
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="poc-java" />
<option name="myItemId" value="POC-Java" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
@@ -847,6 +838,7 @@
</PATH>
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -856,6 +848,7 @@
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="reference.settings.project.maven.repository.indices" />
<property name="SearchEverywhereHistoryKey" value="&#9;FILE&#9;file:///Users/patrickjmcd/Henry_Pump/POC-Java/src/main/java/com/henrypump/poc/Well.java" />
<property name="FullScreen" value="true" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
@@ -1142,7 +1135,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-1920" y="0" width="1920" height="1012" extended-state="6" />
<frame x="0" y="0" width="1680" height="1050" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
@@ -1153,20 +1146,20 @@
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.11205847" sideWeight="0.5" order="8" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32985258" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32921347" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32960895" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32921347" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.1674093" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1916972" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32967034" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24973376" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
@@ -1256,9 +1249,7 @@
<state relative-caret-position="1575">
<caret line="129" column="42" lean-forward="true" selection-start-line="129" selection-start-column="42" selection-end-line="129" selection-end-column="42" />
<folding>
<element signature="imports" expanded="false" />
<element signature="e#2539#2540#0" expanded="false" />
<element signature="e#2574#2575#0" expanded="false" />
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
@@ -1299,9 +1290,7 @@
<state relative-caret-position="810">
<caret line="72" column="28" lean-forward="false" selection-start-line="72" selection-start-column="28" selection-end-line="72" selection-end-column="28" />
<folding>
<element signature="imports" expanded="false" />
<element signature="e#2539#2540#0" expanded="false" />
<element signature="e#2574#2575#0" expanded="false" />
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
@@ -1470,13 +1459,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1665">
<caret line="133" column="45" lean-forward="false" selection-start-line="133" selection-start-column="45" selection-end-line="133" selection-end-column="45" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/barneyWell.json.bak" />
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/IOControl.java">
<provider selected="true" editor-type-id="text-editor">
@@ -1508,6 +1490,16 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/WebServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1530">
<caret line="110" column="58" lean-forward="false" selection-start-line="110" selection-start-column="58" selection-end-line="110" selection-end-column="58" />
<folding>
<element signature="imports" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/WellTest.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="570">
@@ -1538,18 +1530,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="4515">
<caret line="325" column="42" lean-forward="false" selection-start-line="325" selection-start-column="42" selection-end-line="325" selection-end-column="42" />
<folding>
<element signature="imports" expanded="false" />
<element signature="e#2539#2540#0" expanded="false" />
<element signature="e#2574#2575#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
@@ -1572,16 +1552,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/WebServer.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1530">
<caret line="110" column="58" lean-forward="false" selection-start-line="110" selection-start-column="58" selection-end-line="110" selection-end-column="58" />
<folding>
<element signature="imports" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/startup.sh">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
@@ -1590,27 +1560,66 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Card.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="374">
<caret line="361" column="54" lean-forward="false" selection-start-line="361" selection-start-column="54" selection-end-line="361" selection-end-column="54" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/POC.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="13" column="30" lean-forward="false" selection-start-line="13" selection-start-column="30" selection-end-line="13" selection-end-column="30" />
<state relative-caret-position="676">
<caret line="93" column="0" lean-forward="false" selection-start-line="93" selection-start-column="0" selection-end-line="93" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Measurement.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="552">
<caret line="64" column="69" lean-forward="false" selection-start-line="64" selection-start-column="69" selection-end-line="64" selection-end-column="69" />
<folding>
<element signature="e#3896#3897#0" expanded="true" />
<element signature="e#3928#3929#0" expanded="true" />
<element signature="e#3978#3979#0" expanded="true" />
<element signature="e#4020#4021#0" expanded="true" />
<element signature="e#4058#4059#0" expanded="true" />
<element signature="e#4094#4095#0" expanded="true" />
<element signature="e#4150#4151#0" expanded="true" />
<element signature="e#4200#4201#0" expanded="true" />
<element signature="e#4232#4233#0" expanded="true" />
<element signature="e#4260#4261#0" expanded="true" />
<element signature="e#4302#4303#0" expanded="true" />
<element signature="e#4336#4337#0" expanded="true" />
<element signature="e#4371#4372#0" expanded="true" />
<element signature="e#4402#4403#0" expanded="true" />
<element signature="e#4451#4452#0" expanded="true" />
<element signature="e#4491#4492#0" expanded="true" />
<element signature="e#4528#4529#0" expanded="true" />
<element signature="e#4561#4562#0" expanded="true" />
<element signature="e#4614#4615#0" expanded="true" />
<element signature="e#4658#4659#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Well.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-16507">
<caret line="93" column="39" lean-forward="true" selection-start-line="93" selection-start-column="39" selection-end-line="93" selection-end-column="39" />
<state relative-caret-position="175">
<caret line="407" column="38" lean-forward="false" selection-start-line="407" selection-start-column="38" selection-end-line="407" selection-end-column="38" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Card.java">
<entry file="file://$PROJECT_DIR$/src/main/java/com/henrypump/poc/Database.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="584">
<caret line="375" column="36" lean-forward="false" selection-start-line="375" selection-start-column="36" selection-end-line="375" selection-end-column="36" />
<folding />
<state relative-caret-position="542">
<caret line="153" column="68" lean-forward="true" selection-start-line="153" selection-start-column="68" selection-end-line="153" selection-end-column="68" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>

View File

@@ -17,20 +17,20 @@ import org.bson.Document;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import com.mongodb.client.MongoCursor;
import static com.mongodb.client.model.Filters.*;
import javax.print.Doc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
public class Database {
private String pocDatabase = "poc";
private MongoClient mongoClient;
private MongoDatabase database;
private MongoCredential credential = MongoCredential.createCredential("poc_java", pocDatabase, "HenryPump@1903".toCharArray());
private MongoCollection<Document> cardCollection, wellDataCollection, gaugeOffCollection, wellTestCollection,
fluidShotsCollection, runStatusCollection, wellConfigCollection, setpointCollection;
@@ -38,8 +38,8 @@ public class Database {
cardCollection = database.getCollection("cards");
cardCollection.createIndex(Indexes.ascending("timestamp", "strokeNumber"));
wellDataCollection = database.getCollection("wellData");
wellDataCollection.createIndex(Indexes.ascending("timestamp", "tagName"));
wellDataCollection = database.getCollection("measurements");
wellDataCollection.createIndex(Indexes.ascending("dateStored", "tagName"));
gaugeOffCollection = database.getCollection("gaugeOff");
gaugeOffCollection.createIndex(Indexes.ascending("timestamp", "tagName"));
@@ -63,7 +63,9 @@ public class Database {
Database(){
mongoClient = new MongoClient();
ServerAddress server = new ServerAddress("localhost", 27017);
List<MongoCredential> credentials = Arrays.asList(credential);
mongoClient = new MongoClient(server, credentials);
database = mongoClient.getDatabase(pocDatabase);
initCollections();
@@ -72,7 +74,9 @@ public class Database {
}
Database(String dbHostname){
mongoClient = new MongoClient(dbHostname);
ServerAddress server = new ServerAddress(dbHostname, 27017);
List<MongoCredential> credentials = Arrays.asList(credential);
mongoClient = new MongoClient(server, credentials);
database = mongoClient.getDatabase(pocDatabase);
initCollections();
@@ -136,21 +140,32 @@ public class Database {
public long newMeasurement(Measurement inpMeasurement){
Document doc = new Document("tagname", inpMeasurement.getTagName())
ZonedDateTime nowDate = ZonedDateTime.now(ZoneId.of("UTC"));
ZonedDateTime todayDate = ZonedDateTime.of(nowDate.getYear(), nowDate.getMonthValue(), nowDate.getDayOfMonth(), 0, 0, 0, 0, ZoneId.of("UTC"));
Date storeDate = Date.from(todayDate.toInstant());
Document nowMeasurement = new Document("values." + nowDate.getHour() + "." + nowDate.getMinute(), inpMeasurement.getCurrentValue())
.append("currentValue", inpMeasurement.getCurrentValue())
.append("maxDailyValue", inpMeasurement.getDailyMax())
.append("minDailyValue", inpMeasurement.getDailyMin())
.append("dailyAverage", inpMeasurement.getAverage())
.append("dailyTotal", inpMeasurement.getTotal())
.append("maxValue", inpMeasurement.getDailyMax())
.append("minValue", inpMeasurement.getDailyMin())
.append("averageValue", inpMeasurement.getAverage())
.append("totalValue", inpMeasurement.getTotal())
.append("numMeasurements", inpMeasurement.getNumMeasurements())
.append("timestamp", Date.from(ZonedDateTime.now().toInstant()));
wellDataCollection.insertOne(doc);
.append("units", inpMeasurement.getUnits())
.append("storeDelta", inpMeasurement.getSendDelta())
.append("storeTime", inpMeasurement.getSendTimeDelta())
.append("useTotal", inpMeasurement.isUseTotal())
.append("useAverage", inpMeasurement.isUseAverage())
.append("dateStored", storeDate);
wellDataCollection.updateOne(and(eq("tagname", inpMeasurement.getTagName()), eq("dateStored", storeDate)), new Document("$set", nowMeasurement), (new UpdateOptions()).upsert(true));
// wellDataCollection.updateOne(and(eq("tagname", inpMeasurement.getTagName()), eq("dateStored", todayDate)), new Document("$set", aggregateData), (new UpdateOptions()).upsert(true));
System.out.println("Stored " + inpMeasurement.getCurrentValue() + " for " + inpMeasurement.getTagName());
return wellDataCollection.count();
}
public Document getLastStoredMeasurement(String tagName){
MongoCursor<Document> cursor = wellDataCollection.find(eq("tagname", tagName)).sort(Sorts.descending("timestamp")).limit(1).iterator();
MongoCursor<Document> cursor = wellDataCollection.find(eq("tagname", tagName)).sort(Sorts.descending("dateStored")).limit(1).iterator();
Document lastStoredDoc = new Document();
try {
while (cursor.hasNext()) {

View File

@@ -5,6 +5,7 @@ import org.bson.Document;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;
import java.util.Set;
import static java.lang.Math.abs;
@@ -27,8 +28,11 @@ public class Measurement {
private Database db;
private long lastSentTimestamp;
private long sendTimeDelta;
private String units = null;
private boolean useTotal;
private boolean useAverage;
Measurement(String tagName, Database db, double sendDelta, long sendTimeDelta){
Measurement(String tagName, Database db){
this.tagName = tagName;
average = 0;
total = 0;
@@ -38,24 +42,36 @@ public class Measurement {
// Database code
this.db = db;
this.sendDelta = sendDelta;
this.lastSentValue = 0.0;
this.sendTimeDelta = sendTimeDelta;
Document lastStored = this.db.getLastStoredMeasurement(this.tagName);
try {
Date lastStoredTimestamp = (Date) lastStored.get("timestamp");
Date lastStoredTimestamp = (Date) lastStored.get("dateStored");
ZonedDateTime timestamp = ZonedDateTime.ofInstant(lastStoredTimestamp.toInstant(),
ZoneId.systemDefault());
if (isToday(timestamp)){
this.average = lastStored.getDouble("dailyAverage");
this.total = lastStored.getDouble("dailyTotal");
this.lastSentValue = lastStored.getDouble("currentValue");
this.dailyMax = lastStored.getDouble("maxDailyValue");
this.dailyMin = lastStored.getDouble("minDailyValue");
this.lastSentTimestamp = timestamp.toEpochSecond();
this.average = lastStored.getDouble("averageValue");
this.total = lastStored.getDouble("totalValue");
// this.lastSentValue = lastStored.getDouble("currentValue");
this.dailyMax = lastStored.getDouble("maxValue");
this.dailyMin = lastStored.getDouble("minValue");
this.sendDelta = lastStored.getDouble("storeDelta");
this.sendTimeDelta = lastStored.getLong("storeTime");
this.units = lastStored.getString("units");
// this.lastSentTimestamp = timestamp.toEpochSecond();
Document values = (Document) lastStored.get("values");
Object[] hours = values.keySet().toArray();
String maxHour = (String) hours[hours.length - 1];
Document maxHourDoc = (Document) values.get(maxHour);
Object[] minutes = maxHourDoc.keySet().toArray();
String maxMinute = (String) minutes[minutes.length - 1];
this.lastSentValue = maxHourDoc.getDouble(maxMinute);
this.numMeasurements = lastStored.getLong("numMeasurements");
System.out.println("Using stored value from " + timestamp.toString() + " for " + this.tagName);
System.out.println("Using stored value from " + ZonedDateTime.of(timestamp.getYear(),
timestamp.getMonthValue(), timestamp.getDayOfMonth(), Integer.parseInt(maxHour),
Integer.parseInt(maxMinute), 0, 0, timestamp.getZone()).toString() + " for " + this.tagName);
} else {
System.out.println("Cannot use stored value from " + timestamp.toString() + " for " + this.tagName);
}
@@ -65,17 +81,6 @@ public class Measurement {
}
// Measurement(String tagName, boolean storeInDatabase){
// this.tagName = tagName;
// average = 0;
// total = 0;
// numMeasurements = 0;
// dailyMax = Double.MIN_VALUE;
// dailyMin = Double.MAX_VALUE;
//
// // Database code
// this.storeInDatabase = storeInDatabase;
// }
public double getCurrentValue() {
return currentValue;
@@ -109,6 +114,50 @@ public class Measurement {
return dailyMin;
}
public double getSendDelta() {
return sendDelta;
}
public void setSendDelta(double sendDelta) {
this.sendDelta = sendDelta;
}
public long getSendTimeDelta() {
return sendTimeDelta;
}
public void setSendTimeDelta(long sendTimeDelta) {
this.sendTimeDelta = sendTimeDelta;
}
public String getUnits() {
return units;
}
public void setUnits(String units) {
this.units = units;
}
public boolean isUseTotal() {
return useTotal;
}
public void setUseTotal(boolean useTotal) {
this.useTotal = useTotal;
}
public boolean isUseAverage() {
return useAverage;
}
public void setUseAverage(boolean useAverage) {
this.useAverage = useAverage;
}
private static boolean isToday(ZonedDateTime inpZDT){
ZonedDateTime now = ZonedDateTime.now();
if (now.toLocalDate().equals(inpZDT.toLocalDate())){

View File

@@ -318,26 +318,167 @@ public class Well {
}
private void initializeMeasurements(){
strokeSpeed = new Measurement("Stroke Speed", db, 0.5, 600);
downholeGrossStroke = new Measurement("Downhole Gross Stroke", db, 0.5, 600);
downholeNetStroke = new Measurement("Downhole Net Stroke", db, 0.5, 600);
fluidLevel = new Measurement("Fluid Level", db, 10, 600);
fluidLoad = new Measurement("Fluid Load", db, 20, 600);
inflowRate = new Measurement("Inflow Rate", db, 0.5, 600);
peakPolishedRodLoad = new Measurement("Peak PRL", db, 50, 600);
minPolishedRodLoad = new Measurement("Min PRL", db, 50, 600);
percentRun = new Measurement("Percent Run", db, 1.0, 600);
polishedRodHP = new Measurement("Polished Rod HP", db, 0.25, 600);
pumpHP = new Measurement("Pump HP", db, 0.25, 600);
fluidProduced = new Measurement("Fluid Produced", db, 1.0, 600);
fluidProducedAdjusted = new Measurement("Fluid Produced (adjusted)", db, 1.0, 600);
oilProduced = new Measurement("Oil Produced", db, 1.0, 600);
waterProduced = new Measurement("Water Produced", db, 1.0, 600);
gasProduced = new Measurement("Gas Produced", db, 1.0, 600);
pumpIntakePressure = new Measurement("Pump Intake Pressure", db, 5.0, 600);
surfaceStrokeLength = new Measurement("Surface Stroke", db, 0.5, 1800);
tubingMovement = new Measurement("Tubing Movement", db, 0.5, 600);
pumpFillPercent = new Measurement("Pump Fill Percent", db, 0.5, 600);
strokeSpeed = new Measurement("Stroke Speed", db);
if (strokeSpeed.getUnits() == null) {
strokeSpeed.setUnits("SPM");
strokeSpeed.setSendDelta(0.5);
strokeSpeed.setSendTimeDelta(600);
strokeSpeed.setUseAverage(true);
strokeSpeed.setUseTotal(false);
}
downholeGrossStroke = new Measurement("Downhole Gross Stroke", db);
if (downholeGrossStroke.getUnits() == null) {
downholeGrossStroke.setUnits("in.");
downholeGrossStroke.setSendDelta(0.5);
downholeGrossStroke.setSendTimeDelta(600);
downholeGrossStroke.setUseAverage(true);
downholeGrossStroke.setUseTotal(false);
}
downholeNetStroke = new Measurement("Downhole Net Stroke", db);
if (downholeNetStroke.getUnits() == null) {
downholeNetStroke.setUnits("in.");
downholeNetStroke.setSendDelta(0.5);
downholeNetStroke.setSendTimeDelta(600);
downholeNetStroke.setUseAverage(true);
downholeNetStroke.setUseTotal(false);
}
fluidLevel = new Measurement("Fluid Level", db);
if (fluidLevel.getUnits() == null) {
fluidLevel.setUnits("ft.");
fluidLevel.setSendDelta(10.0);
fluidLevel.setSendTimeDelta(600);
fluidLevel.setUseAverage(true);
fluidLevel.setUseTotal(false);
}
fluidLoad = new Measurement("Fluid Load", db);
if (fluidLoad.getUnits() == null) {
fluidLoad.setUnits("lbs.");
fluidLoad.setSendDelta(20.0);
fluidLoad.setSendTimeDelta(600);
fluidLoad.setUseAverage(true);
fluidLoad.setUseTotal(false);
}
inflowRate = new Measurement("Inflow Rate", db);
if (inflowRate.getUnits() == null) {
inflowRate.setUnits("BBL/day");
inflowRate.setSendDelta(0.5);
inflowRate.setSendTimeDelta(600);
inflowRate.setUseAverage(true);
inflowRate.setUseTotal(false);
}
peakPolishedRodLoad = new Measurement("Peak PRL", db);
if (peakPolishedRodLoad.getUnits() == null) {
peakPolishedRodLoad.setUnits("lbs.");
peakPolishedRodLoad.setSendDelta(50);
peakPolishedRodLoad.setSendTimeDelta(600);
peakPolishedRodLoad.setUseAverage(true);
peakPolishedRodLoad.setUseTotal(false);
}
minPolishedRodLoad = new Measurement("Min PRL", db);
if (minPolishedRodLoad.getUnits() == null) {
minPolishedRodLoad.setUnits("lbs.");
minPolishedRodLoad.setSendDelta(50.0);
minPolishedRodLoad.setSendTimeDelta(600);
minPolishedRodLoad.setUseAverage(true);
minPolishedRodLoad.setUseTotal(false);
}
percentRun = new Measurement("Percent Run", db);
if (percentRun.getUnits() == null) {
percentRun.setUnits("%");
percentRun.setSendDelta(0.5);
percentRun.setSendTimeDelta(600);
percentRun.setUseAverage(false);
percentRun.setUseTotal(false);
}
polishedRodHP = new Measurement("Polished Rod HP", db);
if (polishedRodHP.getUnits() == null) {
polishedRodHP.setUnits("HP");
polishedRodHP.setSendDelta(0.25);
polishedRodHP.setSendTimeDelta(600);
polishedRodHP.setUseAverage(true);
polishedRodHP.setUseTotal(false);
}
pumpHP = new Measurement("Pump HP", db);
if (pumpHP.getUnits() == null) {
pumpHP.setUnits("HP");
pumpHP.setSendDelta(0.25);
pumpHP.setSendTimeDelta(600);
pumpHP.setUseAverage(true);
pumpHP.setUseTotal(false);
}
fluidProduced = new Measurement("Fluid Produced", db);
if (fluidProduced.getUnits() == null) {
fluidProduced.setUnits("BBL");
fluidProduced.setSendDelta(1.0);
fluidProduced.setSendTimeDelta(600);
fluidProduced.setUseAverage(true);
fluidProduced.setUseTotal(true);
}
fluidProducedAdjusted = new Measurement("Fluid Produced (adjusted)", db);
if (fluidProducedAdjusted.getUnits() == null) {
fluidProducedAdjusted.setUnits("BBL");
fluidProducedAdjusted.setSendDelta(1.0);
fluidProducedAdjusted.setSendTimeDelta(600);
fluidProducedAdjusted.setUseAverage(true);
fluidProducedAdjusted.setUseTotal(true);
}
oilProduced = new Measurement("Oil Produced", db);
if (oilProduced.getUnits() == null) {
oilProduced.setUnits("BBL");
oilProduced.setSendDelta(0.5);
oilProduced.setSendTimeDelta(600);
oilProduced.setUseAverage(true);
oilProduced.setUseTotal(true);
}
waterProduced = new Measurement("Water Produced", db);
if (waterProduced.getUnits() == null) {
waterProduced.setUnits("BBL");
waterProduced.setSendDelta(1.0);
waterProduced.setSendTimeDelta(600);
waterProduced.setUseAverage(true);
waterProduced.setUseTotal(true);
}
gasProduced = new Measurement("Gas Produced", db);
if (gasProduced.getUnits() == null) {
gasProduced.setUnits("MCF");
gasProduced.setSendDelta(1.0);
gasProduced.setSendTimeDelta(600);
gasProduced.setUseAverage(true);
gasProduced.setUseTotal(true);
}
pumpIntakePressure = new Measurement("Pump Intake Pressure", db);
if (pumpIntakePressure.getUnits() == null) {
pumpIntakePressure.setUnits("PSI");
pumpIntakePressure.setSendDelta(5.0);
pumpIntakePressure.setSendTimeDelta(600);
pumpIntakePressure.setUseAverage(true);
pumpIntakePressure.setUseTotal(false);
}
surfaceStrokeLength = new Measurement("Surface Stroke", db);
if (surfaceStrokeLength.getUnits() == null) {
surfaceStrokeLength.setUnits("in.");
surfaceStrokeLength.setSendDelta(0.5);
surfaceStrokeLength.setSendTimeDelta(600);
surfaceStrokeLength.setUseAverage(true);
surfaceStrokeLength.setUseTotal(false);
}
tubingMovement = new Measurement("Tubing Movement", db);
if (tubingMovement.getUnits() == null) {
tubingMovement.setUnits("in.");
tubingMovement.setSendDelta(0.5);
tubingMovement.setSendTimeDelta(600);
tubingMovement.setUseAverage(true);
tubingMovement.setUseTotal(false);
}
pumpFillPercent = new Measurement("Pump Fill Percent", db);
if (pumpFillPercent.getUnits() == null) {
pumpFillPercent.setUnits("%");
pumpFillPercent.setSendDelta(1.0);
pumpFillPercent.setSendTimeDelta(600);
pumpFillPercent.setUseAverage(true);
pumpFillPercent.setUseTotal(false);
}
}
public double getDt() {