gtaoidcore.cpp 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  1. //
  2. // Created by lloyd on 2020/12/2.
  3. //
  4. #include <iostream>
  5. #include <cmath>
  6. #include <cstring>
  7. #include <iomanip>
  8. #include <list>
  9. #include "gtaoidcore.h"
  10. #include "gtrunconf.h"
  11. void gtaoidcore::gtrevision::sgt_encode(dgns_gtbaseparam *_dgns_gtbaseparam) {
  12. result = "功图错误或仪器故障";
  13. if (_dgns_gtbaseparam == nullptr) {
  14. return;
  15. }
  16. pointNum = _dgns_gtbaseparam->sgtpointnum;
  17. if (pointNum % 2 != 0) pointNum--;
  18. if (pointNum <= 0 || _dgns_gtbaseparam->sgt.empty()) {
  19. return;
  20. }
  21. minLoad = _dgns_gtbaseparam->l_min;
  22. maxLoad = _dgns_gtbaseparam->l_max;
  23. minShiftPoint = _dgns_gtbaseparam->s_min_point_location;
  24. minShift = _dgns_gtbaseparam->s_min;
  25. minShiftLoad = _dgns_gtbaseparam->sgt[_dgns_gtbaseparam->s_min_point_location][1];
  26. maxShift = _dgns_gtbaseparam->s_max;
  27. maxShiftPoint = _dgns_gtbaseparam->s_max_point_location;
  28. maxShiftLoad = _dgns_gtbaseparam->sgt[_dgns_gtbaseparam->s_max_point_location][1];
  29. cha = _dgns_gtbaseparam->s;
  30. cc1 = _dgns_gtbaseparam->n;
  31. card = new double *[2];
  32. card[0] = new double[pointNum];
  33. card[1] = new double[pointNum];
  34. for (int i = 0; i < pointNum; ++i) {
  35. card[0][i] = _dgns_gtbaseparam->sgt[i][0];
  36. card[1][i] = _dgns_gtbaseparam->sgt[i][1];
  37. }
  38. cardArray = new double *[2];
  39. cardArray[0] = new double[pointNum];
  40. cardArray[1] = new double[pointNum];
  41. for (int j = 0; j < pointNum; j++) {
  42. if (minShiftPoint + j < pointNum) {
  43. cardArray[0][j] = card[0][minShiftPoint + j];
  44. cardArray[1][j] = card[1][minShiftPoint + j];
  45. } else {
  46. cardArray[0][j] = card[0][minShiftPoint + j - pointNum];
  47. cardArray[1][j] = card[1][minShiftPoint + j - pointNum];
  48. }
  49. }
  50. //功图界值的判断,可以考虑不要,前面已经判断了功图合法性
  51. /*if (maxLoad == minLoad || minLoad > 150 || maxLoad > 150 || minLoad < 0 || maxLoad < 0 || pointNum < 60 ||
  52. pointNum % 2 != 0 || cha < -8)*/
  53. if (_dgns_gtbaseparam->islegal != 1)
  54. result = "功图错误或仪器故障";
  55. else result = "";
  56. }
  57. void gtaoidcore::calbgt::cal_bgt(const gtaoidcore::gtrevision &_gtrevision, const std::string &zdjg) {
  58. double tmpDownLevel = 0.001;
  59. double tmpUpLevel = 0, downLoadingLevel = 0, upLoadingLevel = 0;
  60. int tmpANNNum = 0;
  61. if (!_gtrevision.result.empty()) return;
  62. while (tmpANNNum == 0) {
  63. for (int i = 0; i < _gtrevision.pointNum / 2; i++) {
  64. if (_gtrevision.cardArray[0][i] <= _gtrevision.cha * tmpDownLevel) {
  65. tmpANNNum++;
  66. downLoadingLevel += _gtrevision.cardArray[1][i];
  67. }
  68. }
  69. tmpDownLevel += 0.001;
  70. }
  71. downLoadingLevel = downLoadingLevel / tmpANNNum;
  72. tmpANNNum = 0;
  73. tmpUpLevel = 0.98;
  74. while (tmpANNNum == 0) {
  75. for (int i = 0; i < _gtrevision.pointNum; i++) {
  76. if (_gtrevision.cardArray[0][i] >= _gtrevision.cha * tmpUpLevel) {
  77. tmpANNNum++;
  78. upLoadingLevel = upLoadingLevel + _gtrevision.cardArray[1][i];
  79. }
  80. }
  81. tmpUpLevel = tmpUpLevel - 0.001;
  82. }
  83. upLoadingLevel /= tmpANNNum;
  84. double tmpdDMWY[_gtrevision.pointNum];
  85. double tmpdDMYeZH[_gtrevision.pointNum];
  86. // double DBU[2][_gtrevision.pointNum];
  87. std::vector<std::vector<double>> DBU;//[2][_gtrevision.pointNum];
  88. double equivalRodDiameter;
  89. for (int i = 0; i < _gtrevision.pointNum; i++) {
  90. tmpdDMWY[i] = _gtrevision.cardArray[0][i];
  91. tmpdDMYeZH[i] = _gtrevision.cardArray[1][i];
  92. tmpdDMYeZH[i] = tmpdDMYeZH[i] * 1000 - downLoadingLevel * 1000;
  93. }
  94. double pumpdepth;
  95. equivalRodDiameter = 0.035;//等效杆直径
  96. pumpdepth = (downLoadingLevel / 9.8 * 4 / MATH_PI / 7.85) / (equivalRodDiameter * equivalRodDiameter);
  97. pumpdepth = 50;//???
  98. auto p_pc = std::strcmp(zdjg.c_str(), "喷抽") >= 0;
  99. //Dbu[1][0] Dbu[0][TotalPoint + 2] Dbu[0][TotalPoint + 1] Dbu[1][TotalPoint + 1] Dbu[0][0]
  100. double dzxwyzh = 0, dzxwy = 0, dbmaxload = 0, dbminload = 0, ddZNXShC = 0;
  101. do {
  102. do {
  103. equivalRodDiameter = std::sqrt(downLoadingLevel / 9.8 * 4 / MATH_PI / 7.85 / pumpdepth);
  104. pumpdepth = pumpdepth + 20;
  105. } while (equivalRodDiameter >= 0.055);
  106. //pumpdepth = pumpdepth - 20;
  107. calnumb++;
  108. DBU = subGeJiGanGT(-pumpdepth, equivalRodDiameter, 7850, 210000000000l, tmpdDMWY, tmpdDMYeZH,
  109. _gtrevision.cc1, _gtrevision.pointNum, _gtrevision.pointNum / 2, 10, 0.022,
  110. 0.062, dzxwyzh, dzxwy, dbmaxload, dbminload, ddZNXShC);
  111. double upload = 0;
  112. double download = 0;
  113. for (int i = 0; i < _gtrevision.pointNum / 2; i++) {
  114. upload = DBU[1][i] + upload;
  115. download = DBU[1][_gtrevision.pointNum / 2 + i] + download;
  116. }
  117. if (upload < download) {//功图反转校验
  118. for (int i = 0; i < _gtrevision.pointNum / 2; i++) {
  119. auto downloadindex = _gtrevision.pointNum - i - 1;
  120. double tempstroke = DBU[0][i];
  121. double tempload = DBU[1][i];
  122. DBU[0][i] = DBU[0][downloadindex];
  123. DBU[1][i] = DBU[1][downloadindex];
  124. DBU[0][downloadindex] = tempstroke;
  125. DBU[1][downloadindex] = tempload;
  126. }
  127. }
  128. if (p_pc) { break; }
  129. if (pumpdepth < 1800) {
  130. pumpdepth += 20;
  131. } else break;
  132. } while (dzxwyzh < (dbmaxload + dbminload) * 3.5 / 8);
  133. {
  134. card = new double *[2];
  135. card[0] = new double[_gtrevision.pointNum];
  136. card[1] = new double[_gtrevision.pointNum];
  137. }
  138. bgt.clear();
  139. for (int i = 0; i < _gtrevision.pointNum; i++) {
  140. card[0][i] = DBU[0][i];
  141. card[1][i] = DBU[1][i] / 1000;
  142. if (DBU[1][i] / 1000 > maxLoad)
  143. maxLoad = DBU[1][i] / 1000;
  144. if (DBU[1][i] / 1000 < minLoad)
  145. minLoad = DBU[1][i] / 1000;
  146. if (DBU[0][i] > maxShift)
  147. maxShift = DBU[0][i];
  148. if (DBU[0][i] < minShift)
  149. minShift = DBU[0][i];
  150. //std::string weiyi = "", ZaiHe = "";
  151. std::stringstream weiyi, ZaiHe;
  152. weiyi << std::setw(3) << std::setfill('0') << std::to_string(DBU[0][i] * 100).substr(0, 3);
  153. ZaiHe << std::setw(5) << std::setfill('0') << std::to_string(DBU[1][i] / 10).substr(0, 5);
  154. bgtstr = bgtstr + weiyi.str() + ZaiHe.str();
  155. std::vector<double> p;
  156. p.push_back(DBU[0][i]);
  157. p.push_back(DBU[1][i] / 1000);//kN
  158. bgt.push_back(p);
  159. }
  160. _maxShift = std::to_string(maxShift);
  161. _minShift = std::to_string(minShift);
  162. _maxLoad = std::to_string(maxShift);
  163. _minLoad = std::to_string(minLoad);
  164. _maxShift = _maxShift.substr(0, 2) + "." + _maxShift.substr(2, 2);
  165. _minShift = _minShift.substr(0, 2) + "." + _minShift.substr(2, 2);
  166. _maxLoad = _maxLoad.substr(0, 3) + "." + _maxLoad.substr(3, 2);
  167. _maxLoad = _minLoad.substr(0, 3) + "." + _minShift.substr(3, 2);
  168. cha = std::to_string(maxShift - minShift);
  169. cha = cha.substr(0, 3) + "." + cha.substr(3, 2);
  170. }
  171. std::vector<std::vector<double>>
  172. gtaoidcore::calbgt::subGeJiGanGT(double dNowGanSh, double dGanJing, double GanMidu, double DXML_E, double *DdiMianWY,
  173. double *dYeZhong, double chongci, int TotalPoint, int UpPoint, int iNN1,
  174. double Viscosity, double Tubingsize, double &dzxwyzh, double &dzxwy, double &dbmaxload,
  175. double &dbminload, double &ddZNXShC) {
  176. int iNN = iNN1;
  177. auto dXShXiGeMa = new double[iNN]{0};
  178. auto dXShTao = new double[iNN]{0};
  179. auto dXShMiu = new double[iNN]{0};
  180. auto dXShDeErTa = new double[iNN]{0};
  181. auto dXSha = new double[iNN]{0};
  182. auto dXShB = new double[iNN]{0};
  183. auto dXShK = new double[iNN]{0};
  184. auto dXSHU = new double[iNN]{0};
  185. std::vector<std::vector<double>> Dbu;
  186. /*double **Dbu = new double *[2];
  187. Dbu[0] = new double[TotalPoint + 3];
  188. Dbu[1] = new double[TotalPoint + 3];*/
  189. auto dbengu = new double[TotalPoint]{0};
  190. double bmaxload = 0;
  191. double bminload = 0;
  192. auto dbengf = new double[TotalPoint]{0};
  193. auto dZhJZhO = new double[iNN]{0};
  194. auto dZhJZhP = new double[iNN]{0};
  195. auto dZhJZhPianO = new double[iNN]{0};
  196. auto dZhJZhPianP = new double[iNN]{0};
  197. double dZNXShC;
  198. double tmpdZuNiCup;
  199. double tmpdZuNiCdown;
  200. double MinshiftPoint = 1000;
  201. for (int i = 0; i < iNN; i++) {
  202. dXShXiGeMa[i] = dFunXShXiGeMa_n(chongci / 60 * 2 * MATH_PI, 60 / chongci / TotalPoint, i, dYeZhong,
  203. TotalPoint);
  204. dXShMiu[i] = dFunXShMiu_n(chongci / 60 * 2 * MATH_PI, 60 / chongci / TotalPoint, i, DdiMianWY, TotalPoint);
  205. dXShTao[i] = dFunXShTao_n(chongci / 60 * 2 * MATH_PI, 60 / chongci / TotalPoint, i, dYeZhong,
  206. TotalPoint);
  207. dXShDeErTa[i] = dFunXShDeErTa_n(chongci / 60 * 2 * MATH_PI, 60 / chongci / TotalPoint, i, DdiMianWY,
  208. TotalPoint);
  209. }
  210. dZNXShC = dFunZLXShC(chongci / 60 * 2 * MATH_PI, 4968, Viscosity, GanMidu, dGanJing * dGanJing * 0.25 * MATH_PI,
  211. Tubingsize,
  212. dGanJing, dNowGanSh);
  213. tmpdZuNiCup = dZNXShC;
  214. for (int i = 0; i < iNN; i++) {
  215. dXSha[i] = dFunXSha_n(chongci / 60 * 2 * MATH_PI, i, tmpdZuNiCup, 4968);
  216. //std::cout << "dXSha[i]:" << dXSha[i] << std::endl;
  217. dXShB[i] = dFunXShB_n(chongci / 60 * 2 * MATH_PI, i, tmpdZuNiCup, 4968);
  218. //std::cout << "dXShB[i]:" << dXShB[i] << std::endl;
  219. dXShK[i] = dFunXShK_n(dXSha[i], dXShB[i], dXShXiGeMa[i], dXShTao[i], DXML_E,
  220. dGanJing * dGanJing * 0.25 * MATH_PI);
  221. //std::cout << "dXShK[i]:" << dXShK[i] << std::endl;
  222. dXSHU[i] = dFunXShU_n(dXSha[i], dXShB[i], dXShXiGeMa[i], dXShTao[i], DXML_E,
  223. dGanJing * dGanJing * 0.25 * MATH_PI);
  224. //std::cout << "dXSHU[i]:" << dXSHU[i] << std::endl;
  225. }
  226. for (int i = 0; i < iNN; i++) {
  227. dZhJZhO[i] = dFunO_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i]);
  228. dZhJZhP[i] = dFunP_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i]);
  229. dZhJZhPianO[i] = dFunPianO_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i],
  230. dXShTao[i], dXShXiGeMa[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI);
  231. dZhJZhPianP[i] = dFunPianP_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i],
  232. dXShTao[i], dXShXiGeMa[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI);
  233. }
  234. std::vector<double> Dbu_1;
  235. std::vector<double> Dbu_2;
  236. Dbu.push_back(Dbu_1);
  237. Dbu.push_back(Dbu_2);
  238. for (int i = 0; i < UpPoint; i++) {
  239. dbengu[i] = dFunUxt(dNowGanSh, chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], dXShMiu[0], DXML_E,
  240. dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhO, dZhJZhP,
  241. 60 / chongci / TotalPoint * i);
  242. dbengf[i] = dFunFxt(chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI,
  243. iNN,
  244. dZhJZhPianO, dZhJZhPianP, 60 / chongci / TotalPoint * i);
  245. auto dbu0i = dFunUxt(dNowGanSh, chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], dXShMiu[0], DXML_E,
  246. dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhO, dZhJZhP,
  247. 60 / chongci / TotalPoint * i);
  248. Dbu[0].push_back(dbu0i);
  249. auto dbu1i = dFunFxt(chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI,
  250. iNN,
  251. dZhJZhPianO, dZhJZhPianP, 60 / chongci / TotalPoint * i);
  252. Dbu[1].push_back(dbu1i);
  253. if (Dbu[0][i] < MinshiftPoint) {
  254. MinshiftPoint = Dbu[0][i];
  255. dzxwyzh = Dbu[1][i] / 1000;
  256. dzxwy = MinshiftPoint;
  257. }
  258. if (Dbu[1][i] > bmaxload) {
  259. bmaxload = Dbu[1][i];
  260. dbmaxload = Dbu[1][i] / 1000;
  261. }
  262. if (Dbu[1][i] < bminload) {
  263. bminload = Dbu[1][i];
  264. dbminload = Dbu[1][i] / 1000;
  265. }
  266. }
  267. tmpdZuNiCdown = 1.2 * dZNXShC;
  268. for (int i = 0; i < iNN; i++) {
  269. dXSha[i] = dFunXSha_n(chongci / 60 * 2 * MATH_PI, i, tmpdZuNiCdown, 4968);
  270. dXShB[i] = dFunXShB_n(chongci / 60 * 2 * MATH_PI, i, tmpdZuNiCdown, 4968);
  271. dXShK[i] = dFunXShK_n(dXSha[i], dXShB[i], dXShXiGeMa[i], dXShTao[i], DXML_E,
  272. dGanJing * dGanJing * 0.25 * MATH_PI);
  273. dXSHU[i] = dFunXShU_n(dXSha[i], dXShB[i], dXShXiGeMa[i], dXShTao[i], DXML_E,
  274. dGanJing * dGanJing * 0.25 * MATH_PI);
  275. }
  276. for (int i = 0; i < iNN; i++) {
  277. dZhJZhO[i] = dFunO_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i]);
  278. dZhJZhP[i] = dFunP_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i]);
  279. dZhJZhPianO[i] = dFunPianO_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i],
  280. dXShTao[i], dXShXiGeMa[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI);
  281. dZhJZhPianP[i] = dFunPianP_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i],
  282. dXShTao[i], dXShXiGeMa[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI);
  283. }
  284. for (int i = UpPoint; i < TotalPoint; i++) {
  285. dbengu[i] = dFunUxt(dNowGanSh, chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], dXShMiu[0], DXML_E,
  286. dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhO, dZhJZhP,
  287. 60 / chongci / TotalPoint * (i - 1));
  288. dbengf[i] = dFunFxt(chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI,
  289. iNN,
  290. dZhJZhPianO, dZhJZhPianP, 60 / chongci / TotalPoint * (i - 1));
  291. auto Dbu0i = dFunUxt(dNowGanSh, chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], dXShMiu[0], DXML_E,
  292. dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhO, dZhJZhP,
  293. 60 / chongci / TotalPoint * (i - 1));
  294. Dbu[0].push_back(Dbu0i);
  295. auto Dbu1i = dFunFxt(chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI,
  296. iNN,
  297. dZhJZhPianO, dZhJZhPianP, 60 / chongci / TotalPoint * (i - 1));
  298. Dbu[1].push_back(Dbu1i);
  299. if (Dbu[0][i] < MinshiftPoint) {
  300. MinshiftPoint = Dbu[0][i];
  301. dzxwyzh = Dbu[1][i] / 1000;
  302. dzxwy = MinshiftPoint;
  303. }
  304. if (Dbu[1][i] > bmaxload) {
  305. bmaxload = Dbu[1][i];
  306. dbmaxload = Dbu[1][i] / 1000;
  307. }
  308. if (Dbu[1][i] < bminload) {
  309. bminload = Dbu[1][i];
  310. dbminload = Dbu[1][i] / 1000;
  311. }
  312. }
  313. ddZNXShC = dZNXShC;
  314. return Dbu;
  315. }
  316. double gtaoidcore::calbgt::dFunXShXiGeMa_n(double dWuMiGa, double DT, int iCShn, double *dZaiHe, int iDianShu) {
  317. double dFunXShXiGeMa = 0;
  318. for (int i = 0; i < iDianShu; i++) {
  319. dFunXShXiGeMa = dFunXShXiGeMa + dZaiHe[i] * std::cos(iCShn * dWuMiGa * i * DT) * DT;
  320. }
  321. return dFunXShXiGeMa * dWuMiGa / MATH_PI;
  322. }
  323. double gtaoidcore::calbgt::dFunXShTao_n(double dWuMiGa, double DT, int iCShn, double *dZaiHe, int iDianShu) {
  324. double dFunXShTao = 0;
  325. for (int i = 0; i < iDianShu; i++) {
  326. dFunXShTao = dFunXShTao + dZaiHe[i] * std::sin(iCShn * dWuMiGa * i * DT) * DT;
  327. }
  328. return dFunXShTao * dWuMiGa / MATH_PI;
  329. }
  330. double gtaoidcore::calbgt::dFunXShMiu_n(double dWuMiGa, double DT, int iCShn, double *dWeiYi, int iDianShu) {
  331. double dFunXShMiu_n = 0;
  332. for (int i = 0; i < iDianShu; i++) {
  333. dFunXShMiu_n = dFunXShMiu_n + dWeiYi[i] * std::cos(iCShn * dWuMiGa * i * DT) * DT;
  334. }
  335. //double temp = dFunXShMiu_n;
  336. return dFunXShMiu_n * dWuMiGa / MATH_PI;
  337. }
  338. double gtaoidcore::calbgt::dFunXShDeErTa_n(double dWuMiGa, double DT, int iCShn, double *dWeiYi, int iDianShu) {
  339. double dFunXShDeErTa_n = 0;
  340. for (int i = 0; i < iDianShu; i++) {
  341. dFunXShDeErTa_n = dFunXShDeErTa_n + dWeiYi[i] * std::sin(iCShn * dWuMiGa * i * DT) * DT;
  342. }
  343. return dFunXShDeErTa_n * dWuMiGa / MATH_PI;
  344. }
  345. double gtaoidcore::calbgt::dFunFLYZaiHe(double dWuMiGa, int iCShn, double *dXiGeMa, double *dTao, double dShiJian_t) {
  346. double dFunFLYZaiHe = dXiGeMa[0] / 2;
  347. for (int i = 1; i < iCShn; i++) {
  348. dFunFLYZaiHe = dFunFLYZaiHe + dXiGeMa[i] * std::cos(i * dWuMiGa * dShiJian_t) +
  349. dTao[i] * std::sin(i * dWuMiGa * dShiJian_t);
  350. }
  351. return dFunFLYZaiHe;
  352. }
  353. double gtaoidcore::calbgt::dFunYWeiYi(double dWuMiGa, int iCShn, double *dMiu, double *dDeErTa, double dShiJian_t) {
  354. double dFunFLYWeiYi = dMiu[0] / 2;
  355. for (int i = 1; i < iCShn; i++) {
  356. dFunFLYWeiYi = dFunFLYWeiYi + dMiu[i] * std::cos(i * dWuMiGa * dShiJian_t) +
  357. dDeErTa[i] * std::sin(i * dWuMiGa * dShiJian_t);
  358. }
  359. return dFunFLYWeiYi;
  360. }
  361. double gtaoidcore::calbgt::dFunSH(double dz) {
  362. return (std::exp(dz) - std::exp(-dz)) * 0.5;
  363. }
  364. double dFunCH(double dz) {
  365. return (std::exp(dz) + std::exp(-dz)) * 0.5;
  366. }
  367. double gtaoidcore::calbgt::dFunXSha_n(double dWuMiGa, int iCShn, double dCShC, double dCSHa) {
  368. iCShn++;
  369. double te =
  370. iCShn * dWuMiGa / dCSHa / std::sqrt(2) * std::sqrt(1 + std::sqrt(1 + std::pow(dCShC / iCShn / dWuMiGa, 2)));
  371. return te;
  372. }
  373. double gtaoidcore::calbgt::dFunXShB_n(double dWuMiGa, int iCShn, double dCShC, double dCSHa) {
  374. iCShn++;
  375. return iCShn * dWuMiGa / dCSHa / std::sqrt(2) * std::sqrt(-1 + std::sqrt(1 + std::pow(dCShC / iCShn / dWuMiGa, 2)));
  376. }
  377. double gtaoidcore::calbgt::dFunXShK_n(double dan, double dBn, double DXiGeMa, double dTaon, double dE, double dAr) {
  378. return (DXiGeMa * dan + DXiGeMa * dBn) / (dE * dAr * (std::pow(dan, 2) + std::pow(dBn, 2)));
  379. }
  380. double gtaoidcore::calbgt::dFunXShU_n(double dan, double dBn, double DXiGeMan, double dTaon, double dE, double dAr) {
  381. return (DXiGeMan * dBn - dTaon * dan) / (dE * dAr * (std::pow(dan, 2) + std::pow(dBn, 2)));
  382. }
  383. double gtaoidcore::calbgt::dFunZLXShC(double dWuMiGa, double dCSHa, double dCSh_u, double dRor, double dAr, double dDt,
  384. double dDr, double dL) {
  385. double tmpm, tmpQXSh, tmpFM;
  386. double tmpB1, tmpB2;
  387. tmpm = dDt / dDr;
  388. tmpFM = dWuMiGa * dL / (dCSHa * std::sin(dWuMiGa * dL / dCSHa)) + std::cos(dWuMiGa * dL / dCSHa);
  389. tmpFM = 2 / tmpFM;
  390. tmpB1 = (tmpm * tmpm - 1) / (2 * std::log(tmpm)) - 1;
  391. tmpB2 = std::pow(tmpm, 4) - 1 - std::pow((tmpm * tmpm - 1), 2) / std::log(tmpm);
  392. tmpQXSh = 2 * MATH_PI * dCSh_u / dRor / dAr;
  393. //double t = std::log(tmpm);
  394. double temp = tmpQXSh * (1 / std::log(tmpm) + 4 * (tmpB1 + 1) / tmpB2 * (tmpB1 + tmpFM));
  395. return temp;
  396. }
  397. double
  398. gtaoidcore::calbgt::dFunO_n(double dx, double dKn, double dBn, double dDeErTan, double dan, double dUn, double dMiun) {
  399. double t = (dKn * dFunCH(dBn * dx) + dDeErTan * dFunSH(dBn * dx)) * std::sin(dan * dx) +
  400. (dUn * dFunSH(dBn * dx) + dMiun * dFunCH(dBn * dx)) * std::cos(dan * dx);
  401. return t;
  402. }
  403. double
  404. gtaoidcore::calbgt::dFunP_n(double dx, double dKn, double dBn, double dDeErTan, double dan, double dUn, double dMiun) {
  405. double t = (dKn * dFunSH(dBn * dx) + dDeErTan * dFunCH(dBn * dx)) * std::cos(dan * dx) -
  406. (dUn * dFunCH(dBn * dx) + dMiun * dFunSH(dBn * dx)) * std::sin(dan * dx);
  407. return t;
  408. }
  409. double gtaoidcore::calbgt::dFunPianO_n(double dx, double dKn, double dBn, double dDeErTan, double dan, double dUn,
  410. double dMiun, double dTaon, double DXiGeMan, double dE, double dAr) {
  411. double t = (dTaon / (dE * dAr) * dFunSH(dBn * dx) + (dDeErTan * dBn - dan * dMiun) * dFunCH(dBn * dx)) *
  412. std::sin(dan * dx) +
  413. (DXiGeMan / (dE * dAr) * dFunCH(dBn * dx) + (dDeErTan * dan + dBn * dMiun) * dFunSH(dBn * dx)) *
  414. std::cos(dan * dx);
  415. return t;
  416. }
  417. double gtaoidcore::calbgt::dFunPianP_n(double dx, double dKn, double dBn, double dDeErTan, double dan, double dUn,
  418. double dMiun, double dTaon, double DXiGeMan, double dE, double dAr) {
  419. return (dTaon / (dE * dAr) * dFunCH(dBn * dx) + (dDeErTan * dBn - dan * dMiun) * dFunSH(dBn * dx)) *
  420. std::cos(dan * dx) -
  421. (DXiGeMan / (dE * dAr) * dFunSH(dBn * dx) + (dDeErTan * dan + dBn * dMiun) * dFunCH(dBn * dx)) *
  422. std::sin(dan * dx);
  423. }
  424. double
  425. gtaoidcore::calbgt::dFunUxt(double dx, double dWuMiGa, double dXiGeMa0, double dMiu0, double dE, double dAr, int iCShn,
  426. double *dOn, double *dPn, double dShiJian_t) {
  427. double dFunUxt = dXiGeMa0 / (2 * dE * dAr) * dx + dMiu0 / 2;
  428. for (int i = 1; i < iCShn; i++) {
  429. dFunUxt = dFunUxt + dOn[i] * std::cos(i * dWuMiGa * dShiJian_t) + dPn[i] * std::sin(i * dWuMiGa * dShiJian_t);
  430. }
  431. return dFunUxt;
  432. }
  433. double gtaoidcore::calbgt::dFunFxt(double dWuMiGa, double dXiGeMa0, double dE, double dAr, int iCShn, double *dPianOn,
  434. double *dPianPn, double dShiJian_t) {
  435. double dFunFxt = 0;
  436. for (int i = 1; i < iCShn; i++) {
  437. dFunFxt = dFunFxt + dPianOn[i] * std::cos(i * dWuMiGa * dShiJian_t) +
  438. dPianPn[i] * std::sin(i * dWuMiGa * dShiJian_t);
  439. }
  440. dFunFxt = dFunFxt + dXiGeMa0 / (2 * dE * dAr);
  441. double t = dE * dAr * dFunFxt;
  442. return t;
  443. }
  444. std::vector<double>
  445. gtaoidcore::cal_ylandon(std::vector<std::vector<double>> sgt, std::vector<std::vector<double>> bgt, double cc,
  446. double cc1, std::string zdjg,
  447. double bj, double bs, double hsl, double smd, double ymd, double qyb,
  448. double dym, double bdxs, double gradient_1, double gradient_10,
  449. double gradient_2, double gradient_3, double gradient_4, double gradient_5,
  450. double gradient_6, double gradient_7, double gradient_8, double gradient_9,
  451. double dividenum_1, double dividenum_2, double dividenum_3,
  452. double dividenum_4,
  453. double dividenum_5, double dividenum_6, double dividenum_7,
  454. double dividenum_8,
  455. double dividenum_9, double dividenum_10) {
  456. /*double Card_Load;
  457. double Card_Shift;*/
  458. /*double PumpCard_Load;
  459. double PumpCard_Shift;*/
  460. double Card_MaxShift;
  461. double Card_MinShift;
  462. double Card_MaxLoad;
  463. double Card_MinLoad;
  464. double Card_Power;
  465. double PumpCard_MaxShift;
  466. double PumpCard_MinShift;
  467. double PumpCard_MaxLoad;
  468. double PumpCard_MinLoad;
  469. double PumpCard_Power;
  470. std::vector<CardSlopeRec> CardSlope_array;
  471. int Card_Point;
  472. std::string L_cjsj;
  473. std::string L_jh;
  474. std::vector<std::vector<double>> L_bgt;
  475. std::vector<std::vector<double>> L_sgt;
  476. double L_Cycle;
  477. double L_Cc;
  478. double L_Bj;
  479. double L_Llbj;
  480. double L_Hs;
  481. double L_Bx;
  482. double L_Rcl;
  483. double L_Rcyl;
  484. double L_Rcsl;
  485. double L_RclT;
  486. double L_RcylT;
  487. double L_RcslT;
  488. double L_Rcql;
  489. double L_Ccsmd;
  490. double L_Dmyybz;
  491. double L_Qyb;
  492. double L_Dym;
  493. double L_Cmd;
  494. double L_Bs;
  495. double L_DownLoadLevel = 0;
  496. double L_UpLoadLevel = 0;
  497. double L_TheoryLoadLiquid = 0;
  498. double Productioncoefficient = 0;
  499. double L_TempDownLevel;
  500. double L_TempUpLevel;
  501. int L_TempNum;
  502. std::string L_Zdjg;
  503. std::string L_ZdjgJc;
  504. std::string L_Load;
  505. std::string L_Shift;
  506. std::string L_ShiftLoad;
  507. int L_Count;
  508. double l_StrokeRatio;
  509. int I = 1;
  510. int j = 0;
  511. int L_LeftDownPoint;
  512. int L_RightDownPoint;
  513. double L_LeftDownLoad;
  514. double L_RightDownLoad;
  515. double L_LeftDownStroke;
  516. double L_LeftDownStroke1;
  517. double L_LeftDownStroke2;
  518. double L_RightDownStroke;
  519. int L_LeftUpPoint;
  520. int L_RightUpPoint;
  521. double L_LeftUpLoad;
  522. double L_RightUpLoad;
  523. double L_LeftUpStroke;
  524. double L_RightUpStroke;
  525. double L_UpEffectiveStroke;
  526. double L_DivideLoad;
  527. std::string L_Zyq;
  528. double L_Sjcc;
  529. double L_Yxcc;
  530. double L_Zcc;
  531. double L_Ycc;
  532. double L_Ccss;
  533. double L_Llpl;
  534. double L_Lsss;
  535. double L_Gyss;
  536. double L_PumpDepth = 0;
  537. double L_DivideNum;
  538. double L_LeftDownLeak;
  539. double L_DownPointDivide;
  540. double L_Gradient = 15;
  541. double L_Gradient1 = 15;
  542. int L_UpPointDivide = 0;
  543. double L_Bdxs1;
  544. double L_Bdxs;
  545. L_sgt = sgt;
  546. L_bgt = bgt;
  547. L_Cc = cc;
  548. L_Cycle = cc1;
  549. L_Zdjg = zdjg;
  550. L_Bj = bj;
  551. L_Bs = bs;
  552. L_Hs = hsl;
  553. L_Ccsmd = smd;
  554. L_Dmyybz = ymd;
  555. L_Qyb = qyb;
  556. L_Dym = dym;
  557. L_Bdxs = bdxs;
  558. //L_zyq = zyq;
  559. L_LeftDownStroke = 0;
  560. L_LeftDownPoint = 0;
  561. L_LeftDownLoad = 0;
  562. Card_MaxShift = 0;
  563. Card_MinShift = 0;
  564. Card_MaxLoad = 0;
  565. Card_MinLoad = 0;
  566. Card_Power = 0;
  567. PumpCard_MaxShift = 0;
  568. PumpCard_MinShift = 0;
  569. PumpCard_MaxLoad = 0;
  570. PumpCard_MinLoad = 0;
  571. PumpCard_Power = 0;
  572. Card_Point = 0;
  573. Card_Point = L_sgt.size();
  574. Card_Power = 0;
  575. PumpCard_Power = 0;
  576. L_LeftDownStroke1 = 15;
  577. L_LeftDownStroke2 = -15;
  578. //Card_MaxLoad=std::atof(L_sgt.substr(3+8*(-1),5))/100;
  579. for (int i = 0; i < Card_Point; i++) {
  580. CardSlopeRec CardSlope;
  581. /* Card_Shift = L_sgt[i][0];
  582. Card_Load = L_sgt[i][1];
  583. PumpCard_Shift = L_bgt[i][0];
  584. PumpCard_Load = L_bgt[i][1];*/
  585. int previousindex = i - 1;
  586. if (i == 0) {
  587. previousindex = Card_Point - 1;
  588. Card_MaxLoad = L_sgt[i][1];
  589. Card_MinLoad = L_sgt[i][1];
  590. Card_MaxShift = L_sgt[i][0];
  591. Card_MinShift = L_sgt[i][0];
  592. PumpCard_MaxLoad = L_bgt[i][1];
  593. PumpCard_MinLoad = L_bgt[i][1];
  594. PumpCard_MaxShift = L_bgt[i][0];
  595. PumpCard_MinShift = L_bgt[i][0];
  596. L_LeftDownStroke = L_bgt[i][0];
  597. L_LeftDownLoad = L_bgt[i][1];
  598. L_LeftDownPoint = i;
  599. }
  600. if (Card_MaxLoad < L_sgt[i][1]) Card_MaxLoad = L_sgt[i][1];
  601. else if (Card_MinLoad > L_sgt[i][1]) Card_MinLoad = L_sgt[i][1];
  602. if (Card_MaxShift < L_sgt[i][0]) Card_MaxShift = L_sgt[i][0];
  603. else if (Card_MinShift > L_sgt[i][0]) Card_MinShift = L_sgt[i][0];
  604. if (PumpCard_MaxLoad < L_bgt[i][1]) PumpCard_MaxLoad = L_bgt[i][1];
  605. else if (PumpCard_MinLoad > L_bgt[i][1]) PumpCard_MinLoad = L_bgt[i][1];
  606. if (PumpCard_MaxShift < L_bgt[i][0]) PumpCard_MaxShift = L_bgt[i][0];
  607. else if (PumpCard_MinShift > L_bgt[i][0]) PumpCard_MinShift = L_bgt[i][0];
  608. if (L_bgt[i][0] >= 0 && L_bgt[previousindex][1] <= 0) {
  609. if (L_LeftDownStroke1 > (L_bgt[i][0] + L_bgt[previousindex][0]) / 2)
  610. L_LeftDownStroke1 = (L_bgt[i][0] + L_bgt[previousindex][0]) / 2;
  611. }
  612. if (L_bgt[i][0] <= 0 && L_bgt[previousindex][1] >= 0) {
  613. if (L_LeftDownStroke2 < (L_bgt[i][0] + L_bgt[previousindex][0]) / 2) {
  614. L_LeftDownStroke2 = (L_bgt[i][0] + L_bgt[i][0]) / 2;
  615. //用的I TODO:check
  616. //L_LeftDownStroke2 = (L_bgt[i][0] + L_bgt[previousindex][0]) / 2;
  617. }
  618. }
  619. int nextindex = i + 1;
  620. if (i == Card_Point - 1) {
  621. nextindex = 0;
  622. }
  623. Card_Power = Card_Power + (L_sgt[nextindex][1] + L_sgt[i][1]) * (L_sgt[nextindex][0] - L_sgt[i][0]) / 2;
  624. PumpCard_Power =
  625. PumpCard_Power + (L_bgt[nextindex][1] + L_bgt[i][1]) * (L_bgt[nextindex][0] - L_bgt[i][0]) / 2;
  626. if ((L_sgt[nextindex][0] - L_sgt[i][0]) == 0)
  627. CardSlope.Card_Slope = 100;
  628. else
  629. CardSlope.Card_Slope = std::abs((L_sgt[nextindex][1] - L_sgt[i][1]) / (L_sgt[nextindex][0] - L_sgt[i][0]));
  630. if ((L_bgt[nextindex][0] - L_bgt[i][0]) == 0)
  631. CardSlope.PumpCard_Slope = 100;
  632. else
  633. CardSlope.PumpCard_Slope = std::abs(
  634. (L_bgt[nextindex][1] - L_bgt[i][1]) / (L_bgt[nextindex][0] - L_bgt[i][0]));
  635. CardSlope.PumpCard_Shift = L_bgt[i][0];
  636. if (CardSlope.Card_Slope >= 100)
  637. CardSlope.Card_Slope = 100;
  638. if (CardSlope.Card_Slope <= -100)
  639. CardSlope.Card_Slope = 100;
  640. if (CardSlope.PumpCard_Slope >= 100)
  641. CardSlope.PumpCard_Slope = 100;
  642. if (CardSlope.PumpCard_Slope <= -100)
  643. CardSlope.PumpCard_Slope = 100;
  644. CardSlope_array.push_back(CardSlope);
  645. }
  646. Card_Power = std::abs(Card_Power) / (60 / L_Cycle);
  647. PumpCard_Power = std::abs(PumpCard_Power) / (60 / L_Cycle);
  648. L_Bx = 0;
  649. L_Rcl = 0;
  650. L_Rcyl = 0;
  651. L_Rcsl = 0;
  652. L_Rcql = 0;
  653. L_RightDownPoint = 0;
  654. L_RightDownLoad = 0;
  655. L_RightDownStroke = 0;
  656. L_LeftUpPoint = 0;
  657. L_RightUpPoint = 0;
  658. L_LeftUpLoad = 0;
  659. L_RightUpLoad = 0;
  660. L_LeftUpStroke = 0;
  661. L_RightUpStroke = 0;
  662. L_UpEffectiveStroke = 0;
  663. L_Sjcc = 0;
  664. L_Yxcc = 0;
  665. L_Ccss = 0;
  666. L_Llpl = 0;
  667. L_Lsss = 0;
  668. L_Gyss = 0;
  669. L_Cmd = 0;
  670. L_Gradient = 35;
  671. L_UpPointDivide = 0;
  672. l_StrokeRatio = 0;
  673. L_DivideNum = 3.5;
  674. L_DivideLoad = (PumpCard_MaxLoad - PumpCard_MinLoad) / L_DivideNum;
  675. for (int i = 0; i < Card_Point / 2; i++) {
  676. int lastindex = Card_Point - i - 1;
  677. if (L_bgt[lastindex][1] < (PumpCard_MinLoad + L_DivideLoad) &&
  678. CardSlope_array[lastindex].PumpCard_Slope < L_Gradient)//jkl
  679. L_RightDownLoad = L_bgt[lastindex][1];
  680. L_RightDownStroke = CardSlope_array[lastindex].PumpCard_Shift;
  681. L_RightDownPoint = lastindex;
  682. }
  683. if (L_RightDownStroke == 0)
  684. L_RightDownStroke = L_LeftDownStroke;
  685. if ((PumpCard_MaxShift - PumpCard_MinShift) != 0) {
  686. l_StrokeRatio = (L_RightDownStroke - L_LeftDownStroke) * 100 / (PumpCard_MaxShift - PumpCard_MinShift);
  687. }
  688. if (false)
  689. if (L_Bdxs <= 0) {
  690. L_Bdxs = 1;
  691. }
  692. //IF L_BDXS IS NULL OR L_BDXS<=0 THEN L_BDXS=1; END IF;
  693. bool p_gybz = std::strcmp(L_Zdjg.c_str(), "供液不足") >= 0;
  694. if ((std::strcmp(L_Zdjg.c_str(), "供液正常") >= 0 || p_gybz) && l_StrokeRatio > 80)
  695. L_Gradient = gradient_1;
  696. L_DivideNum = dividenum_1;
  697. if (p_gybz && l_StrokeRatio <= 80)
  698. L_Gradient = gradient_2;
  699. L_DivideNum = dividenum_2;
  700. if (p_gybz && l_StrokeRatio <= 45)
  701. L_Gradient = gradient_3;
  702. L_DivideNum = dividenum_3;
  703. if (p_gybz && l_StrokeRatio <= 35)
  704. L_Gradient = gradient_4;
  705. L_DivideNum = dividenum_4;
  706. if (p_gybz && l_StrokeRatio <= 25)
  707. L_Gradient = gradient_5;
  708. L_DivideNum = dividenum_5;
  709. if (p_gybz && l_StrokeRatio <= 20)
  710. L_Gradient = gradient_6;
  711. L_DivideNum = dividenum_6;
  712. if (p_gybz && l_StrokeRatio <= 15)
  713. L_Gradient = gradient_7;
  714. L_DivideNum = dividenum_7;
  715. auto p_qyx = std::strcmp(L_Zdjg.c_str(), "气影响") >= 0;
  716. if (p_qyx && l_StrokeRatio >= 35)
  717. L_Gradient = gradient_8;
  718. L_DivideNum = dividenum_8;
  719. if (p_qyx && l_StrokeRatio < 35)
  720. L_Gradient = gradient_9;
  721. L_DivideNum = dividenum_9;
  722. if (p_qyx && l_StrokeRatio < 20)
  723. L_Gradient = gradient_10;
  724. L_DivideNum = dividenum_10;
  725. L_DivideLoad = (PumpCard_MaxLoad - PumpCard_MinLoad) / L_DivideNum;
  726. L_DownPointDivide = 0;
  727. L_LeftDownLeak = 0;
  728. L_LeftUpStroke = 0;
  729. L_LeftDownLeak = 0;
  730. if (L_Bj > 57)
  731. L_Gradient1 = 5;
  732. for (int i = 0; i < Card_Point / 2; i++) {
  733. int lastindex = Card_Point - i - 1;
  734. if (L_bgt[lastindex][1] < (PumpCard_MinLoad + L_DivideLoad) &&
  735. CardSlope_array[lastindex].PumpCard_Slope < L_Gradient) {
  736. L_RightDownLoad = L_bgt[lastindex][1];
  737. L_RightDownStroke = CardSlope_array[lastindex].PumpCard_Shift;
  738. L_RightDownPoint = lastindex;
  739. if (L_DownPointDivide == 0 && std::abs(CardSlope_array[lastindex].PumpCard_Slope) < 25 &&
  740. L_bgt[lastindex][1] < (PumpCard_MinLoad + L_DivideLoad)) {
  741. L_LeftDownLeak = CardSlope_array[lastindex].PumpCard_Shift;
  742. L_DownPointDivide = 1;
  743. }
  744. }
  745. if (L_UpPointDivide == 0 && std::abs(CardSlope_array[i].PumpCard_Slope) < 5 &&
  746. L_bgt[i][1] > ((PumpCard_MaxLoad - PumpCard_MinLoad) * 0.7 + PumpCard_MinLoad)) {
  747. L_LeftUpLoad = L_bgt[i][1];
  748. L_LeftUpStroke = CardSlope_array[i].PumpCard_Shift;
  749. L_LeftUpPoint = i;
  750. L_UpPointDivide = 1;
  751. }
  752. if (L_UpPointDivide == 1 && std::abs(CardSlope_array[i].PumpCard_Slope) < 5 &&
  753. L_bgt[i][1] > ((PumpCard_MaxLoad - PumpCard_MinLoad) * 0.8 + PumpCard_MinLoad)) {
  754. L_RightUpLoad = L_bgt[i][1];
  755. L_RightUpStroke = CardSlope_array[i].PumpCard_Shift;
  756. L_RightUpPoint = i;
  757. }
  758. }
  759. if (L_RightDownStroke <= 0) {
  760. L_RightDownStroke = L_LeftDownStroke;
  761. }
  762. //if L_RightDownStroke is null then L_RightDownStroke=L_LeftDownStroke; end if;
  763. if (L_Cc <= 0) {
  764. L_Cc = Card_MaxShift;
  765. }
  766. //if L_Cc is null then L_Cc=card_maxshift; end if;
  767. L_Ycc = L_RightDownStroke;
  768. L_Zcc = L_LeftDownStroke;
  769. if (L_Bj <= 95) {
  770. L_Llpl = L_Cycle * L_Cc * 24 * 60 * L_Bj * L_Bj * MATH_PI / 4000000;
  771. }
  772. //if L_Bj<=95 then L_Llpl=L_Cycle*L_Cc*24*60*L_Bj*L_Bj*3.1415926/4000000; end if;--理论排量---------------------------------
  773. L_Sjcc = PumpCard_MaxShift - PumpCard_MinShift;//--实际冲程
  774. L_Ccss = L_Cc - L_Sjcc;//--冲程损失
  775. if (L_Ccss < 0)
  776. L_Ccss = 0;
  777. //if L_Ccss<0 then L_Ccss=0; end if;
  778. L_Lsss = 0;
  779. if (std::strcmp(L_Zdjg.c_str(), "泵工作正常") >= 0 || std::strcmp(L_Zdjg.c_str(), "碰泵") >= 0)
  780. L_Lsss = 0;
  781. if (std::strcmp(L_Zdjg.c_str(), "游动凡尔漏失") >= 0)
  782. L_Lsss = (PumpCard_MaxShift - L_RightUpStroke) * 2;
  783. if (std::strcmp(L_Zdjg.c_str(), "固定凡尔漏失") >= 0)
  784. L_Lsss = L_Lsss + (L_LeftDownLeak - PumpCard_MinShift) * 2;
  785. if (std::strcmp(L_Zdjg.c_str(), "冲次过快") >= 0)
  786. L_Lsss = (PumpCard_MaxShift - L_RightUpStroke) * 2;
  787. if (L_Lsss < 0)
  788. L_Lsss = 0;
  789. L_Yxcc = L_RightDownStroke - L_LeftDownStroke - L_Lsss;
  790. if (L_Yxcc <= 0)
  791. L_Yxcc = 0;
  792. L_Gyss = L_Sjcc - L_Yxcc;
  793. if (L_Gyss < 0)
  794. L_Gyss = 0;
  795. if (L_Gyss == 0)
  796. L_Bx = 0;
  797. else L_Bx = L_Yxcc / L_Cc * 100;
  798. if (L_Bj > 0 && L_Bj <= 95) {
  799. if (L_Bj * L_Bj * MATH_PI / 4 * 24 * 60 * L_Cycle * L_Cc * L_Bx / 100000000 >
  800. 0.0087 * std::pow(2.71828, 0.0027 * L_Bs))
  801. L_Rcl = L_Bj * L_Bj * MATH_PI / 4 * 24 * 60 * L_Cycle * L_Cc * L_Bx / 100000000 *
  802. L_Bdxs;//---0.0087*power(2.71828,0.0027*nvl(L_Bs,0));
  803. else
  804. L_Rcl = L_Bj * L_Bj * MATH_PI / 4 * 24 * 60 * L_Cycle * L_Cc * L_Bx / 100000000 * L_Bdxs;
  805. if (L_Rcl <= 0)
  806. L_Rcl = 0;
  807. if (L_Hs <= 100) {
  808. L_Rcsl = L_Rcl * L_Hs / 100;
  809. L_Rcyl = L_Rcl - L_Rcsl;
  810. if (L_Ccsmd > 1 && L_Ccsmd < 1.5) {}
  811. else
  812. L_Ccsmd = 1.05;
  813. if (L_Dmyybz > 0.6 && L_Dmyybz < 1.5) {}
  814. else
  815. L_Dmyybz = 0.83;
  816. if (L_Bs > 0)
  817. L_TheoryLoadLiquid = MATH_PI / 4 * (L_Bj * L_Bj / 1000000) * L_Bs *
  818. ((1 - L_Hs / 100) * L_Dmyybz + L_Hs / 100 * L_Ccsmd) * 9.8 *
  819. (1 + L_Cycle * Card_MaxShift / 127);
  820. else
  821. L_TheoryLoadLiquid = MATH_PI / 4 * (L_Bj * L_Bj / 1000000) * L_PumpDepth *
  822. ((1 - L_Hs / 100) * L_Dmyybz + L_Hs / 100 * L_Ccsmd) * 9.8 *
  823. (1 + L_Cycle * Card_MaxShift / 127);
  824. if (L_Qyb >= 0)
  825. L_Rcql = L_Qyb * L_Rcyl;
  826. Productioncoefficient = 1;
  827. if ((PumpCard_MaxLoad - PumpCard_MinLoad) / L_TheoryLoadLiquid < 0.8 && !std::strcmp(zdjg.c_str(), "喷抽") &&
  828. L_Bs > 1750)
  829. Productioncoefficient = (PumpCard_MaxLoad - PumpCard_MinLoad) / L_TheoryLoadLiquid;
  830. else
  831. Productioncoefficient = 1;
  832. L_Rcsl = L_Ccsmd * L_Rcsl * Productioncoefficient;
  833. L_Rcyl = L_Dmyybz * L_Rcyl * Productioncoefficient;
  834. L_Rcl = L_Rcsl + L_Rcyl;
  835. } else {
  836. L_Llbj = std::sqrt((PumpCard_MaxLoad - PumpCard_MinLoad) * 4 / (9.8 * L_PumpDepth * MATH_PI)) *
  837. 1000;//--+power(0.019,2)
  838. }
  839. }
  840. if (L_Hs < 0 || L_Dmyybz < 0 || L_Ccsmd < 0 || L_Qyb < 0 || L_Bj <= 0 || L_Bj > 95) {
  841. L_ZdjgJc = "基本数据不全";
  842. L_Zdjg += L_ZdjgJc;
  843. }
  844. L_Dym = -10;//什么情况
  845. if (L_Dym >= 0 && L_Bj <= 95)//什么情况
  846. {
  847. if (L_Bs <= 0)
  848. L_Bs = L_PumpDepth;
  849. if (L_Hs < 0 || L_Hs > 100)
  850. L_Hs = 60;
  851. if (L_Dmyybz <= 0)
  852. L_Dmyybz = 0.84;
  853. if (L_Ccsmd <= 0)
  854. L_Ccsmd = 1.05;
  855. if (L_Bj <= 0)
  856. L_Bj = 38;
  857. } else {
  858. if (L_Bs <= 0)
  859. L_Bs = L_PumpDepth;
  860. if (L_Hs < 0 || L_Hs > 100)
  861. L_Hs = 60;
  862. if (L_Dmyybz <= 0)
  863. L_Dmyybz = 0.84;
  864. if (L_Ccsmd <= 0)
  865. L_Ccsmd = 1.05;
  866. if (L_Bj <= 0 || L_Bj > 95)
  867. L_Bj = 38;
  868. if ((((1 - L_Hs / 100) * L_Dmyybz + L_Hs / 100 * L_Ccsmd) * 9.8 * 0.25 * MATH_PI * std::pow(L_Bj, 2) / 1000) == 0)
  869. L_Cmd = 0;
  870. else {
  871. L_Cmd = std::abs(PumpCard_MinLoad * L_Yxcc / L_Sjcc) * 1000 /
  872. (((1 - L_Hs / 100) * L_Dmyybz + L_Hs / 100 * L_Ccsmd) * 9.8 * 0.25 * MATH_PI * std::pow(L_Bj, 2) /
  873. 1000);
  874. L_Dym = L_Bs - L_Cmd;
  875. }
  876. }
  877. if (L_Gyss < PumpCard_MaxShift || L_Ccss < PumpCard_MaxShift || L_Lsss < PumpCard_MaxShift)
  878. PumpCard_MaxShift = L_Cc;
  879. double rcyl1 = L_Rcl;
  880. double rcyl = L_Rcyl;
  881. double rcsl = L_Rcsl;
  882. double rcql = L_Rcql;
  883. double bx = L_Bx;
  884. double llpl = L_Llpl;
  885. double sjcc = L_Sjcc;
  886. double yxcc = L_Yxcc;
  887. double zcc = L_Zcc;
  888. double ycc = L_Ycc;
  889. double ccss = L_Ccss;
  890. double lsss = L_Lsss;
  891. double gyss = L_Gyss;
  892. double pumpdepth = L_PumpDepth;
  893. /* std::string str = "";
  894. str += std::to_string(rcyl1) + ";" + std::to_string(rcyl) + ";" + std::to_string(rcsl) + ";" +
  895. std::to_string(rcql) + ";" + std::to_string(bx) + ";" + std::to_string(llpl) + ";" + std::to_string(sjcc) +
  896. ";" + std::to_string(
  897. yxcc) + ";" + std::to_string(zcc) +
  898. ";" + std::to_string(ycc) + ";" + std::to_string(ccss) + ";" + std::to_string(lsss) + ";" + std::to_string(
  899. gyss) + ";" + std::to_string(l_StrokeRatio) + ";";*/
  900. std::vector<double> res;
  901. res.push_back(rcyl1);
  902. res.push_back(rcyl);
  903. res.push_back(rcsl);
  904. res.push_back(rcql);
  905. res.push_back(bx);
  906. res.push_back(llpl);
  907. res.push_back(sjcc);
  908. res.push_back(yxcc);
  909. res.push_back(zcc);
  910. res.push_back(ycc);
  911. res.push_back(ccss);
  912. res.push_back(lsss);
  913. res.push_back(gyss);
  914. res.push_back(l_StrokeRatio);
  915. return res;
  916. }