From 419f42cf17da0e796d661979ec6e97a8faecc0c7 Mon Sep 17 00:00:00 2001 From: Patrick McDonagh Date: Wed, 8 Feb 2017 17:15:04 -0600 Subject: [PATCH] control the well from a text-based cli --- .../3.1/taskArtifacts/cache.properties.lock | Bin 56 -> 17 bytes .gradle/3.1/taskArtifacts/fileHashes.bin | Bin 21347 -> 21447 bytes .gradle/3.1/taskArtifacts/fileSnapshots.bin | Bin 87500 -> 102384 bytes .gradle/3.1/taskArtifacts/taskArtifacts.bin | Bin 32263 -> 32263 bytes .idea/compiler.xml | 3 +- .idea/gradle.xml | 18 + ...oglecode_json_simple_json_simple_1_1_1.xml | 11 + .../Gradle__de_vandermeer_asciilist_0_0_3.xml | 11 + ...Gradle__de_vandermeer_asciitable_0_2_5.xml | 11 + .../libraries/Gradle__io_mraa_mraa_1_5_1.xml | 11 + .idea/libraries/Gradle__junit_junit_4_10.xml | 11 + ...__org_apache_commons_commons_lang3_3_4.xml | 11 + ...Gradle__org_hamcrest_hamcrest_core_1_1.xml | 11 + .../Gradle__org_mongodb_bson_3_4_2.xml | 11 + ...adle__org_mongodb_mongodb_driver_3_4_2.xml | 11 + ..._org_mongodb_mongodb_driver_core_3_4_2.xml | 11 + .idea/modules.xml | 4 +- .idea/modules/poc-java.iml | 12 + .idea/modules/poc-java_main.iml | 23 + .idea/modules/poc-java_test.iml | 25 + .idea/vcs.xml | 1 + .idea/workspace.xml | 904 ++++++++++++++---- build.gradle | 12 +- gradle/wrapper/gradle-wrapper.properties | 4 +- poc-java.iml | 23 - .../java/com/henrypump/poc/CLScanner.java | 103 ++ src/main/java/com/henrypump/poc/Card.java | 9 +- src/main/java/com/henrypump/poc/Database.java | 39 +- .../java/com/henrypump/poc/DigitalOut.java | 4 + .../java/com/henrypump/poc/Measurement.java | 35 +- src/main/java/com/henrypump/poc/POC.java | 52 +- src/main/java/com/henrypump/poc/Well.java | 136 +-- src/main/java/com/henrypump/poc/WellTest.java | 18 +- 33 files changed, 1176 insertions(+), 359 deletions(-) create mode 100644 .idea/gradle.xml create mode 100644 .idea/libraries/Gradle__com_googlecode_json_simple_json_simple_1_1_1.xml create mode 100644 .idea/libraries/Gradle__de_vandermeer_asciilist_0_0_3.xml create mode 100644 .idea/libraries/Gradle__de_vandermeer_asciitable_0_2_5.xml create mode 100644 .idea/libraries/Gradle__io_mraa_mraa_1_5_1.xml create mode 100644 .idea/libraries/Gradle__junit_junit_4_10.xml create mode 100644 .idea/libraries/Gradle__org_apache_commons_commons_lang3_3_4.xml create mode 100644 .idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_1.xml create mode 100644 .idea/libraries/Gradle__org_mongodb_bson_3_4_2.xml create mode 100644 .idea/libraries/Gradle__org_mongodb_mongodb_driver_3_4_2.xml create mode 100644 .idea/libraries/Gradle__org_mongodb_mongodb_driver_core_3_4_2.xml create mode 100644 .idea/modules/poc-java.iml create mode 100644 .idea/modules/poc-java_main.iml create mode 100644 .idea/modules/poc-java_test.iml delete mode 100644 poc-java.iml create mode 100644 src/main/java/com/henrypump/poc/CLScanner.java diff --git a/.gradle/3.1/taskArtifacts/cache.properties.lock b/.gradle/3.1/taskArtifacts/cache.properties.lock index 844d798cec4defbe126460c987e800c1da3bc035..149cabd2fcb5517d5d39c3bf9ca9418417fc606a 100644 GIT binary patch literal 17 VcmZSH5z6?C`_*(81~A}F1OPA61U3Kw literal 56 zcmZSH5z6?C`_*(81~6c4VrF3YAn^T^iwWN*ffxo>OCtkQBL+dA{KOQ6lEmU{g^bMN IlKi4d0JhQ)Q~&?~ diff --git a/.gradle/3.1/taskArtifacts/fileHashes.bin b/.gradle/3.1/taskArtifacts/fileHashes.bin index 659b144b307db7817c54bb381c9b3b872c559b23..d1babe83f11679ce74e25bea98235005cc27dbfd 100644 GIT binary patch delta 1179 zcmaF7jPdw##tkMCjMkG)B|HTB?YEv<_fXP_0StnZCznb*5ZDnOaDv0|`3|Vy)Xlz< z-YkqWH!A)R-)PVvwAs-^k2$FI@rrproLf#FGIS`O^L?v60|R4}yyNBv5KVR<6ZMRN zgeDLxg0R3JW{sQ4pMH9kUS4^YXU-*mu#S(LCIBUYKvr(@L2nm@kF%E^wvT0E@akkf zUHN6Z5Li)jzyYut22PvFsy-`%T9RRE$$XfcpRvwJ~G z=Gg|{wVcNehO9ZF=amK4@hIj5M2Dd4WO-kg`fp~}pFdbFWz=8j&awMRdjr!8)32u*H`{@A{5z!p(ZLOL7`j8uZ^!Ny+O<)!fxGn4l4%Qc zk#tOc{ROBx z6z*W^C<|jKp4HTUMLv$dwfUhRKa!4mplbF~Of6OS=g8!2lAow{rJjGK{W}FDEkMPb z;g~vZ&f2`(>tJmD`q-=v%@;4EQFXA1Vd@CdTm3|&_sjt?Q-P|aqJYz{U|J?~`%6j8 zjomEcdi%l8&NZ)tLLW)rfJ@r?OVvlU{^9tO_m-1!Yi3v!%WEc>B+wEd5Gn@}XbB?p z;+?C__a|T2sM7O*ZMXe%R2>5Cm^x(6u-{VKudwcl!{L)(cT6im(qRr%&9wnj%k?hT zNg+jyrlr2G-6G8l_aSKkDz3UQnKwXziM z%pzGM?U|c^5e3X||ITrM)oUbP+q^g+i>W?s=Yy4ZB-GgT9$t5AHf6Q|tNJs20az6S z=L}49Im#Q(uXNh3rl0TU-e4~#f$BzXPD~w#-uGG^u9CcBvS-_hUww@|NII;6s`)`V j9?kLH!3ILFA71WkliAeb(ZQV$(XtKX93bFv2NHS!emOo# delta 1030 zcmX@UobmB8#tkMCjFyv4B|IiimAJ9FRnnP-F>|Bh5Alr#8-zAHdgw6+aY)MSKBzT) zd)>`wQ8kG+0R{%fC^qIz1q@(dTLh%^jDdtE5G#VPKve9eSu&^NSx)ag5OiOn{T@h% zw7K;Ppd=7Tou7Qr+eP84qVk7hPQ_cYmR4;(oW%bLq=;4Fh6O|sC-Y=gpA|uSCrW+Q z-Q2G+x&4gahprimL5d`UUm8FZ@$3iEXm;DqR93z%uBB@G>4}no&oO_n-S(*s5FO&p zljVI~>c8H}(meIQ_(-1N?MD&&S|dP;q;B6-fGAp138c}CeRgib!Ywb7Jv{fHQLjEN zwiRrw%l#V=9b5}BbzJaUzbPS<%TxT`)P_PeGd3h0lOOqt*RPi3nd#S@nVv9VipKE` zJmpC8K*RKFF-`oN&SqNQ!0No+2?b zVo~o0R2^($m^!|O&NCO8!4#hP{@W&|Kr@~>FfEh0{iP&W-D9$)IJ-hTlb^&Dh6x zVltRILicnYH1=L}Uaq+=E%QBR0Fn+?plU9j$qPM%(r8pn(pQVUPr3G$&rM>nzwKVSDg`+WSp2RXle>%zAtPq?|z` zplS2sfGno4-4)Zq4Dy#8jVkzDqpR@=7!$zAwEF_hFzj|fwP@x}vNpV;TOV8W>Ql=8 PoSec-sBUC;2k8I+$CVhk diff --git a/.gradle/3.1/taskArtifacts/fileSnapshots.bin b/.gradle/3.1/taskArtifacts/fileSnapshots.bin index 33fb08eabfc01ecd3c03c99a1a795241cdbc55f6..0db1def0ea94b0fe37a42701af06cce5e869f55c 100644 GIT binary patch delta 5789 zcmX@Jn)Sncwh1D-d<d)VObEVBnL4uq|gH*s>W2cF{c`yA!Bp@5YG{;*%vM zWCR*>Peeo+kmfk3j(<=Kom!CPo68K7`}~TFWJ+zVqnCfd z;*3n8lU=1P6il2w&*a$UBtR60Z-*)Ny#MF_rtKnkCU2E?JN>n(+KHG9V3;56Xy7J|N>QmD387hS3ZREFT#d za#}a5%8HtbCR|wbKWLH4QRn0SeJ6hYc*F?Qe0=*xPR1bC$)>C2Ht!EVCo);_z`D)W zxla577aL|>`Dj+RM55)^a?dv1rtNitj8@D7-&Ran#~RVQKjy>kyYt2WH%)isV>~3h z_?t=8>RGRUainj#|%E&f((^-YdS#yP_tBWy8 za`7%?U|{b8;mPxE+c64lR-9nLD9{%y((*m=>jr!8)32u*H``7AxGPG){C4bapGCd&LIPFy=g8!2lAow{rJjGK{X2!}jxLN*0yk%EUhZ`; zHh+C=R)^+`7t)g(_QnbX>8*a!d**RO=s(KY4FC8MkJJMX|hQ0(#bea{NYafzXS0t~TGFd|{(X&jYsI_Rm2M zNfeMd!+uL`zrwmJ4u?;E-7&3Xvf{L8f$LqalR}CZO-p@WyG5EA?wefLF=~a4pEX*7RqZw)4TtI}&Q_dJnI=HJdV9 zFuMbTgC##%KRh)j2bN&)2k5L5>9>uqHRhx{Yuw83YcfO*&`Ye7<30&a?!C=E`Dfo| z0ekUNj#EAhaGqHtYotAMQ#~kfr|UB@>Td3v_fnX3H0jee=@%(PXY2oVjN3g?`>|eh znLk=gu^jj_`Cs39kq_Ku2b#n6%D97m$GhD01FC|QiP@~1`6Bw*Chs|G#KlH_cIXZ^ z5PJRaa%Y>&rWTJ5?))K_9ZYX8{%pkTS@QJl%l(_XZZ1SAUnVbqB*F+QPvFU)o00&V zdAWJVq?k2R87?cRNQUUM4W!*7Achvi7*;!34qEMw_$$8;A6fAsd_^>LpPWdvxL?(2 zw$ol+$h9OSKC)OwV}aJqbi%Q~%)C7(gfW3p05}H0*8s#7Ak4%lw|$~EV-m+`zlo~- nCRHr`CcajB1^tMwAqF<+M|5SNilrE$U#cJ312tHBt9-2hemZeG delta 1491 zcmew`pY6&%nUD3c_ymfwLK9GZ+~7B!S|+8xKZ^PrP6-SyDnqprzybTSG3MTM+eU zpHFs`un?H{r$4Pn>A4z2@W7ABr4kknD{}8UUlptangRkA>ui$ zF!6O?V{e@L&~p&d4tb6X$&Ws%h=EbMGM*RB259E2S{mS6V_qE_BnPKSkTu zLL}mjPwthru&^`_+^{Rdrxjwl`(~Ia)|cM@{lZee7oxb)0w(U|eB$bl$?w%CKb3Zz zY$u~H5O3o1eBx#n0f@r>tCLe@6hg`Z>m8!MmMnt^&hvulE?;Xt%eFC(5h8xz2~50l zVtd-`g~`!iaYm+4xcEoid&UJ1%0S|i56Xy7J|N>g`LK*A<3}J*Y_qv6v#G!pyUv0= z61E2~sJ-7bQ^j-V=6wglStpyWmfO5P{G7<-e|_sVTjx6QPnKMswf%-5;{zrE(KbHC z9Ti*V^9n|+%(hOOGTo7n@sPmRJ6W2i{udv~GravMVqa^-yL(dOUF9@qbgM-nx`SktStrMR5}e$7n|<=nzRd#qg=zX}Zf%b& z{S?2x^JR|)89QB{iBWfR-@KQ?I1QImXG~;4GnVDRpUH{`e6}CtXI#s;`R5@kmhGkd zj6WHX0?&4)vhrnf64uSZO8?Po{(By>R z44Tb$FW1X&{!`q@f#mo#^DgV;E=??270eRxYmV$&0*)sT^KzS8svuz_Ad;Ru+ob)@ zynlO+raXS}vu1lDH{%5+fqsX*)0LUuOO?dDUSNAM{W^K}O}7hWtlSL#e&&~2NOBom#7<&?nk~1>PQUel8GA=y0ll6<|>$XD&PyOR? z{P%rxLDD5Ajn9pLZ}iCRwMAE5^f7#2m%GD~K)(J>tM~WoLsT;{4L071CHk?N9J^jzL7`}S%!o&J>6;*!j~#FEVXJfN`knIe0^0H1}ld(FDW^+S8R6xbU>&0dMI}(qF&z(b*%{vkVt9L4@UxM0v x_RFygSN{e};;>nAO6F7d*uO4lHZRRf6#wgLTd?<6a8fMi)p8PQUel8GOn%OpXu#&l~Lu5Z!n|& zl=GVlk}ff6^xkZAxTN>E2VFJeRKCxyt87=Fv3qal;rU}OMD@#K;+@BQ-x;B+?%xvZ ztTt!I?#f%LmDzte_X1U)WSXp-Ef>0S8}}ohyYFVT7w4B2C8uWG61!3|>uD9x0H(<) zsRgNdDXDqMmClLD8L2LrMSU_Wgv6q@@9j@XEiTE-ODxIE&jSjtTJWgM!DHEai-hyW z&g^$=HZRClW!!w;cMnS<15;OWPGWI!0nmra<pM!f2W+Qp@md6?to!T=n0xfLwF z&8aE43(c;VM}91Q)XiLQW2toFcFm^|IPCJNGg-w^koN>?m* - + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..05e5219 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__com_googlecode_json_simple_json_simple_1_1_1.xml b/.idea/libraries/Gradle__com_googlecode_json_simple_json_simple_1_1_1.xml new file mode 100644 index 0000000..1e91ade --- /dev/null +++ b/.idea/libraries/Gradle__com_googlecode_json_simple_json_simple_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__de_vandermeer_asciilist_0_0_3.xml b/.idea/libraries/Gradle__de_vandermeer_asciilist_0_0_3.xml new file mode 100644 index 0000000..ba9abcc --- /dev/null +++ b/.idea/libraries/Gradle__de_vandermeer_asciilist_0_0_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__de_vandermeer_asciitable_0_2_5.xml b/.idea/libraries/Gradle__de_vandermeer_asciitable_0_2_5.xml new file mode 100644 index 0000000..d707e29 --- /dev/null +++ b/.idea/libraries/Gradle__de_vandermeer_asciitable_0_2_5.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__io_mraa_mraa_1_5_1.xml b/.idea/libraries/Gradle__io_mraa_mraa_1_5_1.xml new file mode 100644 index 0000000..aa3d3e1 --- /dev/null +++ b/.idea/libraries/Gradle__io_mraa_mraa_1_5_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__junit_junit_4_10.xml b/.idea/libraries/Gradle__junit_junit_4_10.xml new file mode 100644 index 0000000..1b0c3a2 --- /dev/null +++ b/.idea/libraries/Gradle__junit_junit_4_10.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_apache_commons_commons_lang3_3_4.xml b/.idea/libraries/Gradle__org_apache_commons_commons_lang3_3_4.xml new file mode 100644 index 0000000..f99c825 --- /dev/null +++ b/.idea/libraries/Gradle__org_apache_commons_commons_lang3_3_4.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_1.xml b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_1.xml new file mode 100644 index 0000000..932a17a --- /dev/null +++ b/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_mongodb_bson_3_4_2.xml b/.idea/libraries/Gradle__org_mongodb_bson_3_4_2.xml new file mode 100644 index 0000000..f0d651c --- /dev/null +++ b/.idea/libraries/Gradle__org_mongodb_bson_3_4_2.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_mongodb_mongodb_driver_3_4_2.xml b/.idea/libraries/Gradle__org_mongodb_mongodb_driver_3_4_2.xml new file mode 100644 index 0000000..2568589 --- /dev/null +++ b/.idea/libraries/Gradle__org_mongodb_mongodb_driver_3_4_2.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Gradle__org_mongodb_mongodb_driver_core_3_4_2.xml b/.idea/libraries/Gradle__org_mongodb_mongodb_driver_core_3_4_2.xml new file mode 100644 index 0000000..9374231 --- /dev/null +++ b/.idea/libraries/Gradle__org_mongodb_mongodb_driver_core_3_4_2.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 6ef8c4d..8a9882b 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,9 @@ - + + + \ No newline at end of file diff --git a/.idea/modules/poc-java.iml b/.idea/modules/poc-java.iml new file mode 100644 index 0000000..7a7be7f --- /dev/null +++ b/.idea/modules/poc-java.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/poc-java_main.iml b/.idea/modules/poc-java_main.iml new file mode 100644 index 0000000..3dfc202 --- /dev/null +++ b/.idea/modules/poc-java_main.iml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/poc-java_test.iml b/.idea/modules/poc-java_test.iml new file mode 100644 index 0000000..04909b9 --- /dev/null +++ b/.idea/modules/poc-java_test.iml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..fce7f71 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,5 +2,6 @@ + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 337a3e4..46bc685 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,14 +2,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + @@ -35,23 +142,14 @@ - - + + - - + + - - - - - - - - - - - + + @@ -60,30 +158,10 @@ - - + + - - - - - - - - - - - - - - - - - - - - @@ -92,9 +170,11 @@ - - - + + + + + @@ -102,9 +182,11 @@ - - - + + + + + @@ -112,10 +194,32 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -141,6 +245,379 @@ + + + + + + @@ -151,21 +628,22 @@ @@ -180,7 +658,7 @@ - - - + + + @@ -516,37 +995,38 @@ - + - + - - + - - - + + + - + - - + + - + - + - - + + + + @@ -564,6 +1044,18 @@ + + + + + + + + + + + + @@ -573,22 +1065,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - @@ -598,13 +1130,7 @@ - - - - - - - + @@ -633,6 +1159,8 @@ + + @@ -643,6 +1171,8 @@ + + @@ -661,14 +1191,7 @@ - - - - - - - - + @@ -717,14 +1240,7 @@ - - - - - - - - + @@ -735,16 +1251,6 @@ - - - - - - - - - - @@ -757,7 +1263,6 @@ - @@ -765,7 +1270,6 @@ - @@ -783,19 +1287,32 @@ - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + @@ -807,58 +1324,51 @@ - + - - - + + + + + + + - + - - - + + + + + + - + - - - + + + + + - - - - - - - - - - + + - - - - - - - - - - + + @@ -867,60 +1377,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.gradle b/build.gradle index 4fc34d0..28b73bd 100644 --- a/build.gradle +++ b/build.gradle @@ -8,8 +8,8 @@ version = '1.0-SNAPSHOT' description = """poc-java""" -sourceCompatibility = 1.5 -targetCompatibility = 1.5 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 repositories { maven { url "http://repo.maven.apache.org/maven2" } @@ -64,7 +64,13 @@ task deploy << { task runRemote << { ssh.run { session(remotes.edison) { - execute 'java -cp .:/usr/lib/java/*:poc-java-all-1.0-SNAPSHOT.jar com.henrypump.poc.POC kiesha7265Well.json kiesha7265_card_147_surface.csv' + execute 'java -cp .:/usr/lib/java/*:poc-java-all-1.0-SNAPSHOT.jar com.henrypump.poc.POC kiesha7265Well.json kiesha7265_card_147_surface.csv true' } } +} + +task runLocal(type: JavaExec) { + classpath sourceSets.main.runtimeClasspath + main = "com.henrypump.poc.POC" + args 'kiesha7265Well.json', 'kiesha7265_card_147_surface.csv', 'false' } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 230ef75..db5552d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Feb 06 18:19:31 CST 2017 +#Wed Feb 08 13:46:23 CST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip diff --git a/poc-java.iml b/poc-java.iml deleted file mode 100644 index 35d2624..0000000 --- a/poc-java.iml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/henrypump/poc/CLScanner.java b/src/main/java/com/henrypump/poc/CLScanner.java new file mode 100644 index 0000000..f88525d --- /dev/null +++ b/src/main/java/com/henrypump/poc/CLScanner.java @@ -0,0 +1,103 @@ +package com.henrypump.poc; + +import javax.sound.midi.Soundbank; +import java.time.ZonedDateTime; +import java.util.Scanner; + +/** + * Created by patrickjmcd on 2/8/17. + */ +class CLScanner implements Runnable { + + private final POC poc; + CLScanner(POC poc){ + this.poc = poc; + } + + private void startWell(){ + poc.thisWell.start("commandline"); + } + + private void stopWell(){ + poc.thisWell.stop("commandline"); + } + + private void exitPOC(){ + System.exit(99); + } + + private void runStatus(){ + System.out.println("Run Status: " + poc.thisWell.getRunStatusString()); + } + + private void showTapers(){ + poc.thisWell.printTapers(); + } + + private void showTotals(){ + poc.thisWell.printTotals(); + } + + private void help(){ + System.out.println(""); + System.out.println("== HELP MENU =="); + System.out.println(""); + System.out.println("POSSIBLE COMMANDS"); + System.out.println("start -- Issues the start command"); + System.out.println("stop -- Issues the stop command"); + System.out.println("status -- Gets the current run status"); + System.out.println("showtapers -- Gets the current taper and well parameters"); + System.out.println("showtotals -- Gets the current totals and averages"); + System.out.println("exit -- Quits the program"); + System.out.println(""); + } + + + + public void run() { + Scanner sc = new Scanner(System.in); + String input = ""; + while (sc.hasNextLine()) { + input = sc.nextLine(); + switch(input){ + case "start": + startWell(); + break; + case "stop": + stopWell(); + break; + case "exit": + exitPOC(); + break; + case "status": + runStatus(); + break; + case "showtotals": + showTotals(); + break; + case "showtapers": + showTapers(); + break; + case "help": + help(); + break; + default: + if (input.startsWith("welltest")){ + String[] testParams = input.split(" "); + ZonedDateTime timestamp = ZonedDateTime.parse(testParams[1]); + poc.thisWell.wellTest = new WellTest(timestamp, + Double.parseDouble(testParams[2]), Double.parseDouble(testParams[3]), + Double.parseDouble(testParams[4]), Double.parseDouble(testParams[5]), + Double.parseDouble(testParams[6]), poc.thisWell.db.getPreviousDailyTotal(timestamp) + ); + poc.thisWell.db.newWellTest(poc.thisWell.wellTest); + poc.thisWell.wellTest.print(); + } else { + help(); + } + } + } + } + + +} diff --git a/src/main/java/com/henrypump/poc/Card.java b/src/main/java/com/henrypump/poc/Card.java index fa05786..fb6e5c3 100644 --- a/src/main/java/com/henrypump/poc/Card.java +++ b/src/main/java/com/henrypump/poc/Card.java @@ -53,6 +53,7 @@ public class Card { private double polishedRodHorsepower; private double pumpHorsepower; private double fluidBBLMoved; + private double fluidBBLMovedAdjusted; private double waterBBLMoved; private double oilBBLMoved; private double gasMCFMoved; @@ -184,6 +185,11 @@ public class Card { return fluidBBLMoved; } + + public double getFluidBBLMovedAdjusted() { + return fluidBBLMovedAdjusted; + } + public double getWaterBBLMoved() { return waterBBLMoved; } @@ -350,7 +356,8 @@ public class Card { downholeNetStrokeLength = bottomCorner.getPosition() - downholePositionMin.getPosition(); fillageCalculated = (downholeNetStrokeLength / downholeAdjustedGrossStrokeLength) * 100.0; fillageEstimated =(downholeNetStrokeLength / downholeGrossStrokeLength) * 100.0; - fluidBBLMoved = downholeNetStrokeLength * pumpArea * 0.00010307 * kFactor; + fluidBBLMoved = downholeNetStrokeLength * pumpArea * 0.00010307; + fluidBBLMovedAdjusted = fluidBBLMoved * kFactor; oilBBLMoved = fluidBBLMoved * oilBBLRatio; waterBBLMoved = fluidBBLMoved * waterBBLRatio; gasMCFMoved = fluidBBLMoved * gasMCFRatio; diff --git a/src/main/java/com/henrypump/poc/Database.java b/src/main/java/com/henrypump/poc/Database.java index c5d39d5..577bb88 100644 --- a/src/main/java/com/henrypump/poc/Database.java +++ b/src/main/java/com/henrypump/poc/Database.java @@ -12,18 +12,12 @@ import com.mongodb.client.MongoCollection; import com.mongodb.client.model.Sorts; import org.bson.Document; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.time.Instant; -import java.util.Arrays; +import java.time.ZonedDateTime; import com.mongodb.client.MongoCursor; - -import static com.mongodb.client.model.Aggregates.limit; import static com.mongodb.client.model.Filters.*; -import com.mongodb.client.result.DeleteResult; -import static com.mongodb.client.model.Updates.*; -import com.mongodb.client.result.UpdateResult; + +import javax.print.Doc; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -76,6 +70,7 @@ public class Database { .append("downhole_position", d_p) .append("downhole_load", d_l); collection.insertOne(doc); + System.out.println("Stored stroke number " + inpCard.getStrokeNumber() + " as " + doc.getObjectId("_id")); return collection.count(); } public void close(){ @@ -83,7 +78,7 @@ public class Database { } public long newMeasurement(Measurement inpMeasurement){ - String df = Date.from(Instant.now()).toString(); + String df = ZonedDateTime.now().toString(); MongoCollection collection = database.getCollection("wellData"); Document doc = new Document("tagname", inpMeasurement.getTagName()) .append("currentValue", inpMeasurement.getCurrentValue()) @@ -91,13 +86,29 @@ public class Database { .append("minDailyValue", inpMeasurement.getDailyMin()) .append("dailyAverage", inpMeasurement.getAverage()) .append("dailyTotal", inpMeasurement.getTotal()) + .append("numMeasurements", inpMeasurement.getNumMeasurements()) .append("timestamp", df); collection.insertOne(doc); + System.out.println("Stored " + inpMeasurement.getCurrentValue() + " for " + inpMeasurement.getTagName()); return collection.count(); } + public Document getLastStoredMeasurement(String tagName){ + MongoCollection collection = database.getCollection("wellData"); + MongoCursor cursor = collection.find(eq("tagname", tagName)).sort(Sorts.descending("timestamp")).limit(1).iterator(); + Document lastStoredDoc = new Document(); + try { + while (cursor.hasNext()) { + lastStoredDoc = cursor.next(); + } + } finally { + cursor.close(); + } + return lastStoredDoc; + } + public long newDailyTotal(Measurement inpMeasurement){ - String df = Date.from(Instant.now()).toString(); + String df = ZonedDateTime.now().toString(); MongoCollection collection = database.getCollection("gaugeOffData"); Document doc = new Document("tagname", inpMeasurement.getTagName()) .append("currentValue", inpMeasurement.getCurrentValue()) @@ -111,7 +122,7 @@ public class Database { } - public double getPreviousDailyTotal(Date inpDateTime){ + public double getPreviousDailyTotal(ZonedDateTime inpDateTime){ String isoInpDateTime = inpDateTime.toString(); MongoCollection wellTestCollection = database.getCollection("gaugeOffData"); MongoCursor cursor = wellTestCollection.find(and(eq("tagname", "Fluid Produced"), lte("timestamp", isoInpDateTime))) @@ -128,7 +139,7 @@ public class Database { }; public long newWellTest(WellTest inp){ - String df = Date.from(Instant.now()).toString(); + String df = ZonedDateTime.now().toString(); MongoCollection collection = database.getCollection("wellTestData"); Document doc = new Document("testStartTime", df) .append("testHours", inp.getTestHours()) @@ -144,7 +155,7 @@ public class Database { return collection.count(); } - public Document getPreviousWellTest(Date inpDateTime){ + public Document getPreviousWellTest(ZonedDateTime inpDateTime){ String isoInpDateTime = inpDateTime.toString(); MongoCollection wellTestCollection = database.getCollection("wellTestData"); MongoCursor cursor = wellTestCollection.find(lte("testStartTime", isoInpDateTime)) diff --git a/src/main/java/com/henrypump/poc/DigitalOut.java b/src/main/java/com/henrypump/poc/DigitalOut.java index 75f58eb..00bf032 100644 --- a/src/main/java/com/henrypump/poc/DigitalOut.java +++ b/src/main/java/com/henrypump/poc/DigitalOut.java @@ -49,6 +49,10 @@ public class DigitalOut { } } + public int getValue() { + return value; + } + public static void main(String[] args){ try { DigitalOut testOut2 = new DigitalOut(2, 0); diff --git a/src/main/java/com/henrypump/poc/Measurement.java b/src/main/java/com/henrypump/poc/Measurement.java index b72e5fb..07230a3 100644 --- a/src/main/java/com/henrypump/poc/Measurement.java +++ b/src/main/java/com/henrypump/poc/Measurement.java @@ -1,5 +1,9 @@ package com.henrypump.poc; +import org.bson.Document; + +import java.time.ZonedDateTime; + import static java.lang.Math.abs; /** @@ -37,6 +41,26 @@ public class Measurement { this.sendDelta = sendDelta; this.lastSentValue = 0.0; this.sendTimeDelta = sendTimeDelta; + + Document lastStored = this.db.getLastStoredMeasurement(this.tagName); + try { + ZonedDateTime timestamp = ZonedDateTime.parse((CharSequence) lastStored.get("timestamp")); + 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.numMeasurements = lastStored.getLong("numMeasurements"); + System.out.println("Using stored value from " + timestamp.toString() + " for " + this.tagName); + } else { + System.out.println("Cannot use stored value from " + timestamp.toString() + " for " + this.tagName); + } + } catch (NullPointerException e){ + System.out.println("There was no previous measurement in the database for " + this.tagName); + } + } Measurement(String tagName, boolean storeInDatabase){ @@ -83,9 +107,17 @@ public class Measurement { return dailyMin; } + public static boolean isToday(ZonedDateTime inpZDT){ + ZonedDateTime now = ZonedDateTime.now(); + if (now.toLocalDate().equals(inpZDT.toLocalDate())){ + return true; + } + return false; + }; + public void update(double value) { - long currentTimestamp = System.currentTimeMillis(); + long currentTimestamp = ZonedDateTime.now().toEpochSecond(); lastValue = currentValue; currentValue = value; @@ -101,6 +133,7 @@ public class Measurement { currentTimestamp - lastSentTimestamp > (sendTimeDelta * 1000)){ long l = db.newMeasurement(this); lastSentValue = currentValue; + lastSentTimestamp = currentTimestamp; } } } diff --git a/src/main/java/com/henrypump/poc/POC.java b/src/main/java/com/henrypump/poc/POC.java index 8dc4e2d..8dc8a10 100644 --- a/src/main/java/com/henrypump/poc/POC.java +++ b/src/main/java/com/henrypump/poc/POC.java @@ -1,14 +1,12 @@ package com.henrypump.poc; +import java.time.ZonedDateTime; + /** * Created by patrickjmcd on 2/1/17. * POC Class * */ -import java.awt.*; -import java.awt.event.*; -import java.time.Instant; -import java.util.Date; public class POC implements Runnable{ protected Well thisWell; @@ -19,16 +17,12 @@ public class POC implements Runnable{ private DigitalOut runIndicator; private boolean ioEnabled; - private boolean guiEnabled; - - POC(String wellName, String wellSetupJsonFile, int simLoops){ ioEnabled = true; - guiEnabled = false; thisWell = new Well(wellName, 99, 99, 7); thisWell.parseJSONFile(wellSetupJsonFile); - thisWell.printTapers(); +// thisWell.printTapers(); this.simLoops = simLoops; // IO @@ -40,16 +34,11 @@ public class POC implements Runnable{ led5 = new DigitalOut(5, 0); runIndicator = new DigitalOut(6,0); - - String headlessProp = !guiEnabled ? "true" : "false"; - System.setProperty("java.awt.headless", headlessProp); - System.out.println(java.awt.GraphicsEnvironment.isHeadless()); } POC(String wellName, String wellSetupJsonFile, String simFileName, boolean ioEnabled, int simLoops){ this.ioEnabled = ioEnabled; if (this.ioEnabled) { - guiEnabled = false; thisWell = new Well(wellName, simFileName,99, 99, 7); // IO @@ -63,7 +52,6 @@ public class POC implements Runnable{ } else { thisWell = new Well(wellName, simFileName,99, 99, 99); - guiEnabled = true; // IO startBtn = new DigitalIn(99); stopBtn = new DigitalIn(99); @@ -74,12 +62,8 @@ public class POC implements Runnable{ runIndicator = new DigitalOut(99,0); } - String headlessProp = !guiEnabled ? "true" : "false"; - System.setProperty("java.awt.headless", headlessProp); - System.out.println(java.awt.GraphicsEnvironment.isHeadless()); - thisWell.parseJSONFile(wellSetupJsonFile); - thisWell.printTapers(); +// thisWell.printTapers(); this.simLoops = simLoops; } @@ -91,14 +75,14 @@ public class POC implements Runnable{ } public void run(){ - int loopCounter = 0, loopLimit = simLoops, led2out, led3out, led4out,led5out; + new Thread(new CLScanner(this)).start(); + int led2out, led3out, led4out,led5out; double pos; - boolean newWellTest = true; long sleepMilliseconds = (long) (thisWell.getDt() * 1000); thisWell.setupFluidRatio(0.50, 0.50, 1.12); thisWell.checkSafeties(); while (true) { - while (loopCounter < loopLimit && (thisWell.getRunStatus() == Well.RUNSTATUS_RUNNING || thisWell.getRunStatus() == Well.RUNSTATUS_STARTING)) { + while (thisWell.getRunStatus() == Well.RUNSTATUS_RUNNING || thisWell.getRunStatus() == Well.RUNSTATUS_STARTING) { for (int i = 0; i <= thisWell.sim.getLastFilledIndex(); i++) { if (startBtn.read() == 1) thisWell.start("startbutton"); if (stopBtn.read() == 1) thisWell.stop("stopbutton"); @@ -123,22 +107,6 @@ public class POC implements Runnable{ e.printStackTrace(); } } - loopCounter++; - } - - if (newWellTest){ - System.out.println("Previous kFactor = " + thisWell.db.getLatestKFactor()); - Date nowDate = Date.from(Instant.now()); - double lastProductionMeasured = thisWell.db.getPreviousDailyTotal(nowDate); - thisWell.wellTest = new WellTest(nowDate, 24.0, .35, .20, .15, 1.25, lastProductionMeasured); - thisWell.db.newWellTest(thisWell.wellTest); - System.out.println("Well Test @ " + nowDate.toString()); - System.out.println("kFactor: " + thisWell.wellTest.getkFactor()); - System.out.println("oilRatio: " + thisWell.wellTest.getOilRatio()); - System.out.println("waterRatio: " + thisWell.wellTest.getWaterRatio()); - System.out.println("gasRatio: " + thisWell.wellTest.getGasMCFRatio()); - newWellTest = false; - System.out.println("Last kFactor = " + thisWell.db.getLatestKFactor()); } @@ -165,11 +133,11 @@ public class POC implements Runnable{ public static void main(String[] args) { - final POC thisPOC = new POC("Barney", args[0], args[1], true, 100); + final POC thisPOC = new POC("Barney", args[0], args[1], args[2].equals("true"), 100); thisPOC.start(); - - } } + + diff --git a/src/main/java/com/henrypump/poc/Well.java b/src/main/java/com/henrypump/poc/Well.java index 4dc4dea..5ea0d42 100644 --- a/src/main/java/com/henrypump/poc/Well.java +++ b/src/main/java/com/henrypump/poc/Well.java @@ -19,6 +19,7 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.time.LocalDate; +import java.time.ZonedDateTime; /** * Created by patrickjmcd on 1/31/17. @@ -96,7 +97,7 @@ public class Well { private double tubingCrossSectionalArea; // Statuses - private int runStatus; + private volatile int runStatus; public static final int RUNSTATUS_STOPPED = 0; public static final int RUNSTATUS_STARTING = 1; public static final int RUNSTATUS_RUNNING = 2; @@ -119,7 +120,7 @@ public class Well { private int lastDirection = DIRECTION_UNKNOWN; // Modes - private int runMode; + private volatile int runMode; public static final int RUNMODE_POC = 0; public static final int RUNMODE_MANUAL = 1; public static final int RUNMODE_TIMER = 2; @@ -142,12 +143,13 @@ public class Well { private double kFactor = 1.0; // DATE & TIME PARAMETERS - private LocalDate lastCheckedDate = null; + private ZonedDateTime now = ZonedDateTime.now(); private boolean isNewDay(){ - LocalDate today = LocalDate.now(); - boolean ret = lastCheckedDate == null || today.isAfter(lastCheckedDate); - lastCheckedDate = today; + + ZonedDateTime today = ZonedDateTime.now(); + boolean ret = !(today.toLocalDate().equals(now.toLocalDate())); + now = today; return ret; } @@ -164,6 +166,7 @@ public class Well { private Measurement polishedRodHP; private Measurement pumpHP; private Measurement fluidProduced; + private Measurement fluidProducedAdjusted; private Measurement oilProduced; private Measurement waterProduced; private Measurement gasProduced; @@ -192,6 +195,7 @@ public class Well { polishedRodHP = new Measurement("Polished Rod HP", true, db, 0.25, 600); pumpHP = new Measurement("Pump HP", true, db, 0.25, 600); fluidProduced = new Measurement("Fluid Produced", true, db, 1.0, 600); + fluidProducedAdjusted = new Measurement("Fluid Produced (adjusted)", true, db, 1.0, 600); oilProduced = new Measurement("Oil Produced", true, db, 1.0, 600); waterProduced = new Measurement("Water Produced", true, db, 1.0, 600); gasProduced = new Measurement("Gas Produced", true, db, 1.0, 600); @@ -222,6 +226,7 @@ public class Well { polishedRodHP = new Measurement("Polished Rod HP", true, db, 0.25, 600); pumpHP = new Measurement("Pump HP", true, db, 0.25, 600); fluidProduced = new Measurement("Fluid Produced", true, db, 1.0, 600); + fluidProducedAdjusted = new Measurement("Fluid Produced (adjusted)", true, db, 1.0, 600); oilProduced = new Measurement("Oil Produced", true, db, 1.0, 600); waterProduced = new Measurement("Water Produced", true, db, 1.0, 600); gasProduced = new Measurement("Gas Produced", true, db, 1.0, 600); @@ -377,6 +382,25 @@ public class Well { return runStatus; } + public String getRunStatusString(){ + switch(runStatus){ + case RUNSTATUS_STOPPED: + return "Stopped"; + case RUNSTATUS_STARTING: + return "Starting"; + case RUNSTATUS_RUNNING: + return "Running"; + case RUNSTATUS_PUMPEDOFF: + return "Pumped-Off"; + case RUNSTATUS_FAULTED: + return "Faulted"; + case RUNSTATUS_LOCKEDOUT: + return "Locked Out"; + default: + return "Unknown"; + } + } + public int getRunMode() { return runMode; } @@ -902,7 +926,7 @@ public class Well { cardStorage[j + 1] = cardStorage[j]; } cardStorage[0] = currentCard; - currentCard.printCard("csv", true); + currentCard.printCard("none", true); strokesSinceStart++; strokesToday++; strokesLifetime++; @@ -917,6 +941,7 @@ public class Well { polishedRodHP.update(currentCard.getPolishedRodHorsepower()); pumpHP.update(currentCard.getPumpHorsepower()); fluidProduced.update(currentCard.getFluidBBLMoved()); + fluidProducedAdjusted.update(currentCard.getFluidBBLMovedAdjusted()); oilProduced.update(currentCard.getOilBBLMoved()); waterProduced.update(currentCard.getWaterBBLMoved()); gasProduced.update(currentCard.getGasMCFMoved()); @@ -924,31 +949,12 @@ public class Well { surfaceStrokeLength.update(currentCard.getSurfaceStrokeLength()); tubingMovement.update(currentCard.getTubingMovement()); + db.newCard(currentCard); currentCard = new Card(strokesLifetime); pointCounter = -1; if (strokesSinceStart > startupStrokes){ runStatus = RUNSTATUS_RUNNING; } - if(isNewDay()){ - strokeSpeed.endOfDay(); - downholeGrossStroke.endOfDay(); - downholeNetStroke.endOfDay(); - fluidLevel.endOfDay(); - fluidLoad.endOfDay(); - inflowRate.endOfDay(); - peakPolishedRodLoad.endOfDay(); - minPolishedRodLoad.endOfDay(); - percentRun.endOfDay(); - polishedRodHP.endOfDay(); - pumpHP.endOfDay(); - fluidProduced.endOfDay(); - oilProduced.endOfDay(); - waterProduced.endOfDay(); - gasProduced.endOfDay(); - pumpIntakePressure.endOfDay(); - surfaceStrokeLength.endOfDay(); - tubingMovement.endOfDay(); - } } @@ -957,12 +963,16 @@ public class Well { currentSurfacePosition = inclinometer.readScaled(); currentSurfaceLoad = loadCell.readScaled(); LPStatus lastPoint = calc(currentSurfacePosition, currentSurfaceLoad); + if (lastPoint.getStatus() == GOOD_STATUS){ + currentDownholePosition = lastPoint.getPosition(); + currentDownholeLoad = lastPoint.getLoad(); + } if(runStatus == RUNSTATUS_STARTING || runStatus == RUNSTATUS_RUNNING) { if (lastPoint.getStatus() == GOOD_STATUS) { currentCard.setSurfacePosition(pointCounter, currentSurfacePosition); currentCard.setSurfaceLoad(pointCounter, currentSurfaceLoad); - currentCard.setDownholePosition(pointCounter, lastPoint.getPosition()); - currentCard.setDownholeLoad(pointCounter, lastPoint.getLoad()); + currentCard.setDownholePosition(pointCounter, currentDownholePosition); + currentCard.setDownholeLoad(pointCounter, currentDownholeLoad); } if (inclinometer.getHistory(0) > inclinometer.getHistory(1)) @@ -971,47 +981,18 @@ public class Well { direction = DIRECTION_DOWN; if (direction == DIRECTION_UP && lastDirection == DIRECTION_DOWN && pointCounter > 0) { - currentCard.setNumPointsUsed(pointCounter + 1); - currentCard.calcStrokeData(150, fluidGradient, - rodDepthTotal, tubingAnchorDepth, - tubingCrossSectionalArea, pumpArea, - frictionEstimate, structuralRating, fluidWaterRatio, fluidOilRatio, fluidGasRatio); - for (int j = 98; j >= 0; j--) { - cardStorage[j + 1] = cardStorage[j]; - } - cardStorage[0] = currentCard; - currentCard.printCard("none", true); - System.out.println("Cards in DB: " + db.newCard(currentCard)); - strokesSinceStart++; - strokesToday++; - strokesLifetime++; - - strokeSpeed.update(currentCard.getStrokeSpeed()); - downholeGrossStroke.update(currentCard.getDownholeGrossStrokeLength()); - downholeNetStroke.update(currentCard.getDownholeNetStrokeLength()); - fluidLevel.update(currentCard.getFluidLevel()); - fluidLoad.update(currentCard.getFluidLoad()); - peakPolishedRodLoad.update(currentCard.getSurfaceLoadMax().getLoad()); - minPolishedRodLoad.update(currentCard.getSurfaceLoadMin().getLoad()); - polishedRodHP.update(currentCard.getPolishedRodHorsepower()); - pumpHP.update(currentCard.getPumpHorsepower()); - fluidProduced.update(currentCard.getFluidBBLMoved()); - oilProduced.update(currentCard.getOilBBLMoved()); - waterProduced.update(currentCard.getWaterBBLMoved()); - gasProduced.update(currentCard.getGasMCFMoved()); - pumpIntakePressure.update(currentCard.getPumpIntakePressure()); - surfaceStrokeLength.update(currentCard.getSurfaceStrokeLength()); - tubingMovement.update(currentCard.getTubingMovement()); - - currentCard = new Card(strokesLifetime); - pointCounter = -1; - if (strokesSinceStart > startupStrokes) { - runStatus = RUNSTATUS_RUNNING; - } + endOfStroke(); } lastDirection = direction; pointCounter++; } + + if (runStatus == RUNSTATUS_RUNNING || runStatus == RUNSTATUS_STARTING){ + runCommand.write(1); + } else { + runCommand.write(0); + } + if(isNewDay()){ strokeSpeed.endOfDay(); downholeGrossStroke.endOfDay(); @@ -1025,6 +1006,7 @@ public class Well { polishedRodHP.endOfDay(); pumpHP.endOfDay(); fluidProduced.endOfDay(); + fluidProducedAdjusted.endOfDay(); oilProduced.endOfDay(); waterProduced.endOfDay(); gasProduced.endOfDay(); @@ -1071,6 +1053,28 @@ public class Well { } else { runCommand.write(0); } + + if(isNewDay()){ + strokeSpeed.endOfDay(); + downholeGrossStroke.endOfDay(); + downholeNetStroke.endOfDay(); + fluidLevel.endOfDay(); + fluidLoad.endOfDay(); + inflowRate.endOfDay(); + peakPolishedRodLoad.endOfDay(); + minPolishedRodLoad.endOfDay(); + percentRun.endOfDay(); + polishedRodHP.endOfDay(); + pumpHP.endOfDay(); + fluidProduced.endOfDay(); + fluidProducedAdjusted.endOfDay(); + oilProduced.endOfDay(); + waterProduced.endOfDay(); + gasProduced.endOfDay(); + pumpIntakePressure.endOfDay(); + surfaceStrokeLength.endOfDay(); + tubingMovement.endOfDay(); + } } public void printTotals(){ diff --git a/src/main/java/com/henrypump/poc/WellTest.java b/src/main/java/com/henrypump/poc/WellTest.java index 7126eac..95e2372 100644 --- a/src/main/java/com/henrypump/poc/WellTest.java +++ b/src/main/java/com/henrypump/poc/WellTest.java @@ -1,6 +1,8 @@ package com.henrypump.poc; import org.bson.Document; + +import java.time.ZonedDateTime; import java.util.Date; /** @@ -8,13 +10,13 @@ import java.util.Date; */ public class WellTest { private double testHours; - private Date testStart; + private ZonedDateTime testStart; private double totalFluidBBL, testOilBBL, testWaterBBL, testGasMCF; private double kFactor, oilRatio, waterRatio, gasMCFRatio; - public WellTest(Date testStart, double testHours, double totalFluidBBL, double testOilBBL, double testWaterBBL, double testGasMCF, double prevDailyTotal) { + public WellTest(ZonedDateTime testStart, double testHours, double totalFluidBBL, double testOilBBL, double testWaterBBL, double testGasMCF, double prevDailyTotal) { this.testStart = testStart; this.testHours = testHours; this.totalFluidBBL = totalFluidBBL; @@ -39,7 +41,7 @@ public class WellTest { return testHours; } - public Date getTestStart() { + public ZonedDateTime getTestStart() { return testStart; } @@ -75,4 +77,14 @@ public class WellTest { return gasMCFRatio; } + public void print(){ + System.out.println("Well Test started at " + testStart.toString() + " lasting " + testHours + " hours"); + System.out.println("Fluid BBL: " + totalFluidBBL); + System.out.println("Oil BBL: " + testOilBBL); + System.out.println("Water BBL: " + testWaterBBL); + System.out.println("Gas MCF: " + testGasMCF); + System.out.printf("New Ratio Oil/Water/Gas: %.2f/%.2f/%.2f\n", oilRatio, waterRatio, gasMCFRatio); + System.out.println("New Correction Factor: " + kFactor); + } + }