// // Created by lloyd on 2020/12/2. // #include #include #include #include #include #include "gtaoidcore.h" #include "gtrunconf.h" void gtaoidcore::gtrevision::sgt_encode(dgns_gtbaseparam *_dgns_gtbaseparam) { result = "功图错误或仪器故障"; if (_dgns_gtbaseparam == nullptr) { return; } pointNum = _dgns_gtbaseparam->sgtpointnum; if (pointNum % 2 != 0) pointNum--; if (pointNum <= 0 || _dgns_gtbaseparam->sgt.empty()) { return; } minLoad = _dgns_gtbaseparam->l_min; maxLoad = _dgns_gtbaseparam->l_max; minShiftPoint = _dgns_gtbaseparam->s_min_point_location; minShift = _dgns_gtbaseparam->s_min; minShiftLoad = _dgns_gtbaseparam->sgt[_dgns_gtbaseparam->s_min_point_location][1]; maxShift = _dgns_gtbaseparam->s_max; maxShiftPoint = _dgns_gtbaseparam->s_max_point_location; maxShiftLoad = _dgns_gtbaseparam->sgt[_dgns_gtbaseparam->s_max_point_location][1]; cha = _dgns_gtbaseparam->s; cc1 = _dgns_gtbaseparam->n; card = new double *[2]; card[0] = new double[pointNum]; card[1] = new double[pointNum]; for (int i = 0; i < pointNum; ++i) { card[0][i] = _dgns_gtbaseparam->sgt[i][0]; card[1][i] = _dgns_gtbaseparam->sgt[i][1]; } cardArray = new double *[2]; cardArray[0] = new double[pointNum]; cardArray[1] = new double[pointNum]; for (int j = 0; j < pointNum; j++) { if (minShiftPoint + j < pointNum) { cardArray[0][j] = card[0][minShiftPoint + j]; cardArray[1][j] = card[1][minShiftPoint + j]; } else { cardArray[0][j] = card[0][minShiftPoint + j - pointNum]; cardArray[1][j] = card[1][minShiftPoint + j - pointNum]; } } //功图界值的判断,可以考虑不要,前面已经判断了功图合法性 /*if (maxLoad == minLoad || minLoad > 150 || maxLoad > 150 || minLoad < 0 || maxLoad < 0 || pointNum < 60 || pointNum % 2 != 0 || cha < -8)*/ if (_dgns_gtbaseparam->islegal != 1) result = "功图错误或仪器故障"; else result = ""; } void gtaoidcore::calbgt::cal_bgt(const gtaoidcore::gtrevision &_gtrevision, const std::string &zdjg) { double tmpDownLevel = 0.001; double tmpUpLevel = 0, downLoadingLevel = 0, upLoadingLevel = 0; int tmpANNNum = 0; if (!_gtrevision.result.empty()) return; while (tmpANNNum == 0) { for (int i = 0; i < _gtrevision.pointNum / 2; i++) { if (_gtrevision.cardArray[0][i] <= _gtrevision.cha * tmpDownLevel) { tmpANNNum++; downLoadingLevel += _gtrevision.cardArray[1][i]; } } tmpDownLevel += 0.001; } downLoadingLevel = downLoadingLevel / tmpANNNum; tmpANNNum = 0; tmpUpLevel = 0.98; while (tmpANNNum == 0) { for (int i = 0; i < _gtrevision.pointNum; i++) { if (_gtrevision.cardArray[0][i] >= _gtrevision.cha * tmpUpLevel) { tmpANNNum++; upLoadingLevel = upLoadingLevel + _gtrevision.cardArray[1][i]; } } tmpUpLevel = tmpUpLevel - 0.001; } upLoadingLevel /= tmpANNNum; double tmpdDMWY[_gtrevision.pointNum]; double tmpdDMYeZH[_gtrevision.pointNum]; // double DBU[2][_gtrevision.pointNum]; std::vector> DBU;//[2][_gtrevision.pointNum]; double equivalRodDiameter; for (int i = 0; i < _gtrevision.pointNum; i++) { tmpdDMWY[i] = _gtrevision.cardArray[0][i]; tmpdDMYeZH[i] = _gtrevision.cardArray[1][i]; tmpdDMYeZH[i] = tmpdDMYeZH[i] * 1000 - downLoadingLevel * 1000; } double pumpdepth; equivalRodDiameter = 0.035;//等效杆直径 pumpdepth = (downLoadingLevel / 9.8 * 4 / MATH_PI / 7.85) / (equivalRodDiameter * equivalRodDiameter); pumpdepth = 50;//??? auto p_pc = std::strcmp(zdjg.c_str(), "喷抽") >= 0; //Dbu[1][0] Dbu[0][TotalPoint + 2] Dbu[0][TotalPoint + 1] Dbu[1][TotalPoint + 1] Dbu[0][0] double dzxwyzh = 0, dzxwy = 0, dbmaxload = 0, dbminload = 0, ddZNXShC = 0; do { do { equivalRodDiameter = std::sqrt(downLoadingLevel / 9.8 * 4 / MATH_PI / 7.85 / pumpdepth); pumpdepth = pumpdepth + 20; } while (equivalRodDiameter >= 0.055); //pumpdepth = pumpdepth - 20; calnumb++; DBU = subGeJiGanGT(-pumpdepth, equivalRodDiameter, 7850, 210000000000l, tmpdDMWY, tmpdDMYeZH, _gtrevision.cc1, _gtrevision.pointNum, _gtrevision.pointNum / 2, 10, 0.022, 0.062, dzxwyzh, dzxwy, dbmaxload, dbminload, ddZNXShC); double upload = 0; double download = 0; for (int i = 0; i < _gtrevision.pointNum / 2; i++) { upload = DBU[1][i] + upload; download = DBU[1][_gtrevision.pointNum / 2 + i] + download; } if (upload < download) {//功图反转校验 for (int i = 0; i < _gtrevision.pointNum / 2; i++) { auto downloadindex = _gtrevision.pointNum - i - 1; double tempstroke = DBU[0][i]; double tempload = DBU[1][i]; DBU[0][i] = DBU[0][downloadindex]; DBU[1][i] = DBU[1][downloadindex]; DBU[0][downloadindex] = tempstroke; DBU[1][downloadindex] = tempload; } } if (p_pc) { break; } if (pumpdepth < 1800) { pumpdepth += 20; } else break; } while (dzxwyzh < (dbmaxload + dbminload) * 3.5 / 8); { card = new double *[2]; card[0] = new double[_gtrevision.pointNum]; card[1] = new double[_gtrevision.pointNum]; } bgt.clear(); for (int i = 0; i < _gtrevision.pointNum; i++) { card[0][i] = DBU[0][i]; card[1][i] = DBU[1][i] / 1000; if (DBU[1][i] / 1000 > maxLoad) maxLoad = DBU[1][i] / 1000; if (DBU[1][i] / 1000 < minLoad) minLoad = DBU[1][i] / 1000; if (DBU[0][i] > maxShift) maxShift = DBU[0][i]; if (DBU[0][i] < minShift) minShift = DBU[0][i]; //std::string weiyi = "", ZaiHe = ""; std::stringstream weiyi, ZaiHe; weiyi << std::setw(3) << std::setfill('0') << std::to_string(DBU[0][i] * 100).substr(0, 3); ZaiHe << std::setw(5) << std::setfill('0') << std::to_string(DBU[1][i] / 10).substr(0, 5); bgtstr = bgtstr + weiyi.str() + ZaiHe.str(); std::vector p; p.push_back(DBU[0][i]); p.push_back(DBU[1][i] / 1000);//kN bgt.push_back(p); } _maxShift = std::to_string(maxShift); _minShift = std::to_string(minShift); _maxLoad = std::to_string(maxShift); _minLoad = std::to_string(minLoad); _maxShift = _maxShift.substr(0, 2) + "." + _maxShift.substr(2, 2); _minShift = _minShift.substr(0, 2) + "." + _minShift.substr(2, 2); _maxLoad = _maxLoad.substr(0, 3) + "." + _maxLoad.substr(3, 2); _maxLoad = _minLoad.substr(0, 3) + "." + _minShift.substr(3, 2); cha = std::to_string(maxShift - minShift); cha = cha.substr(0, 3) + "." + cha.substr(3, 2); } std::vector> gtaoidcore::calbgt::subGeJiGanGT(double dNowGanSh, double dGanJing, double GanMidu, double DXML_E, double *DdiMianWY, double *dYeZhong, double chongci, int TotalPoint, int UpPoint, int iNN1, double Viscosity, double Tubingsize, double &dzxwyzh, double &dzxwy, double &dbmaxload, double &dbminload, double &ddZNXShC) { int iNN = iNN1; auto dXShXiGeMa = new double[iNN]{0}; auto dXShTao = new double[iNN]{0}; auto dXShMiu = new double[iNN]{0}; auto dXShDeErTa = new double[iNN]{0}; auto dXSha = new double[iNN]{0}; auto dXShB = new double[iNN]{0}; auto dXShK = new double[iNN]{0}; auto dXSHU = new double[iNN]{0}; std::vector> Dbu; /*double **Dbu = new double *[2]; Dbu[0] = new double[TotalPoint + 3]; Dbu[1] = new double[TotalPoint + 3];*/ auto dbengu = new double[TotalPoint]{0}; double bmaxload = 0; double bminload = 0; auto dbengf = new double[TotalPoint]{0}; auto dZhJZhO = new double[iNN]{0}; auto dZhJZhP = new double[iNN]{0}; auto dZhJZhPianO = new double[iNN]{0}; auto dZhJZhPianP = new double[iNN]{0}; double dZNXShC; double tmpdZuNiCup; double tmpdZuNiCdown; double MinshiftPoint = 1000; for (int i = 0; i < iNN; i++) { dXShXiGeMa[i] = dFunXShXiGeMa_n(chongci / 60 * 2 * MATH_PI, 60 / chongci / TotalPoint, i, dYeZhong, TotalPoint); dXShMiu[i] = dFunXShMiu_n(chongci / 60 * 2 * MATH_PI, 60 / chongci / TotalPoint, i, DdiMianWY, TotalPoint); dXShTao[i] = dFunXShTao_n(chongci / 60 * 2 * MATH_PI, 60 / chongci / TotalPoint, i, dYeZhong, TotalPoint); dXShDeErTa[i] = dFunXShDeErTa_n(chongci / 60 * 2 * MATH_PI, 60 / chongci / TotalPoint, i, DdiMianWY, TotalPoint); } dZNXShC = dFunZLXShC(chongci / 60 * 2 * MATH_PI, 4968, Viscosity, GanMidu, dGanJing * dGanJing * 0.25 * MATH_PI, Tubingsize, dGanJing, dNowGanSh); tmpdZuNiCup = dZNXShC; for (int i = 0; i < iNN; i++) { dXSha[i] = dFunXSha_n(chongci / 60 * 2 * MATH_PI, i, tmpdZuNiCup, 4968); //std::cout << "dXSha[i]:" << dXSha[i] << std::endl; dXShB[i] = dFunXShB_n(chongci / 60 * 2 * MATH_PI, i, tmpdZuNiCup, 4968); //std::cout << "dXShB[i]:" << dXShB[i] << std::endl; dXShK[i] = dFunXShK_n(dXSha[i], dXShB[i], dXShXiGeMa[i], dXShTao[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI); //std::cout << "dXShK[i]:" << dXShK[i] << std::endl; dXSHU[i] = dFunXShU_n(dXSha[i], dXShB[i], dXShXiGeMa[i], dXShTao[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI); //std::cout << "dXSHU[i]:" << dXSHU[i] << std::endl; } for (int i = 0; i < iNN; i++) { dZhJZhO[i] = dFunO_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i]); dZhJZhP[i] = dFunP_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i]); dZhJZhPianO[i] = dFunPianO_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i], dXShTao[i], dXShXiGeMa[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI); dZhJZhPianP[i] = dFunPianP_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i], dXShTao[i], dXShXiGeMa[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI); } std::vector Dbu_1; std::vector Dbu_2; Dbu.push_back(Dbu_1); Dbu.push_back(Dbu_2); for (int i = 0; i < UpPoint; i++) { dbengu[i] = dFunUxt(dNowGanSh, chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], dXShMiu[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhO, dZhJZhP, 60 / chongci / TotalPoint * i); dbengf[i] = dFunFxt(chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhPianO, dZhJZhPianP, 60 / chongci / TotalPoint * i); auto dbu0i = dFunUxt(dNowGanSh, chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], dXShMiu[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhO, dZhJZhP, 60 / chongci / TotalPoint * i); Dbu[0].push_back(dbu0i); auto dbu1i = dFunFxt(chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhPianO, dZhJZhPianP, 60 / chongci / TotalPoint * i); Dbu[1].push_back(dbu1i); if (Dbu[0][i] < MinshiftPoint) { MinshiftPoint = Dbu[0][i]; dzxwyzh = Dbu[1][i] / 1000; dzxwy = MinshiftPoint; } if (Dbu[1][i] > bmaxload) { bmaxload = Dbu[1][i]; dbmaxload = Dbu[1][i] / 1000; } if (Dbu[1][i] < bminload) { bminload = Dbu[1][i]; dbminload = Dbu[1][i] / 1000; } } tmpdZuNiCdown = 1.2 * dZNXShC; for (int i = 0; i < iNN; i++) { dXSha[i] = dFunXSha_n(chongci / 60 * 2 * MATH_PI, i, tmpdZuNiCdown, 4968); dXShB[i] = dFunXShB_n(chongci / 60 * 2 * MATH_PI, i, tmpdZuNiCdown, 4968); dXShK[i] = dFunXShK_n(dXSha[i], dXShB[i], dXShXiGeMa[i], dXShTao[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI); dXSHU[i] = dFunXShU_n(dXSha[i], dXShB[i], dXShXiGeMa[i], dXShTao[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI); } for (int i = 0; i < iNN; i++) { dZhJZhO[i] = dFunO_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i]); dZhJZhP[i] = dFunP_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i]); dZhJZhPianO[i] = dFunPianO_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i], dXShTao[i], dXShXiGeMa[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI); dZhJZhPianP[i] = dFunPianP_n(dNowGanSh, dXShK[i], dXShB[i], dXShDeErTa[i], dXSha[i], dXSHU[i], dXShMiu[i], dXShTao[i], dXShXiGeMa[i], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI); } for (int i = UpPoint; i < TotalPoint; i++) { dbengu[i] = dFunUxt(dNowGanSh, chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], dXShMiu[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhO, dZhJZhP, 60 / chongci / TotalPoint * (i - 1)); dbengf[i] = dFunFxt(chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhPianO, dZhJZhPianP, 60 / chongci / TotalPoint * (i - 1)); auto Dbu0i = dFunUxt(dNowGanSh, chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], dXShMiu[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhO, dZhJZhP, 60 / chongci / TotalPoint * (i - 1)); Dbu[0].push_back(Dbu0i); auto Dbu1i = dFunFxt(chongci / 60 * 2 * MATH_PI, dXShXiGeMa[0], DXML_E, dGanJing * dGanJing * 0.25 * MATH_PI, iNN, dZhJZhPianO, dZhJZhPianP, 60 / chongci / TotalPoint * (i - 1)); Dbu[1].push_back(Dbu1i); if (Dbu[0][i] < MinshiftPoint) { MinshiftPoint = Dbu[0][i]; dzxwyzh = Dbu[1][i] / 1000; dzxwy = MinshiftPoint; } if (Dbu[1][i] > bmaxload) { bmaxload = Dbu[1][i]; dbmaxload = Dbu[1][i] / 1000; } if (Dbu[1][i] < bminload) { bminload = Dbu[1][i]; dbminload = Dbu[1][i] / 1000; } } ddZNXShC = dZNXShC; return Dbu; } double gtaoidcore::calbgt::dFunXShXiGeMa_n(double dWuMiGa, double DT, int iCShn, double *dZaiHe, int iDianShu) { double dFunXShXiGeMa = 0; for (int i = 0; i < iDianShu; i++) { dFunXShXiGeMa = dFunXShXiGeMa + dZaiHe[i] * std::cos(iCShn * dWuMiGa * i * DT) * DT; } return dFunXShXiGeMa * dWuMiGa / MATH_PI; } double gtaoidcore::calbgt::dFunXShTao_n(double dWuMiGa, double DT, int iCShn, double *dZaiHe, int iDianShu) { double dFunXShTao = 0; for (int i = 0; i < iDianShu; i++) { dFunXShTao = dFunXShTao + dZaiHe[i] * std::sin(iCShn * dWuMiGa * i * DT) * DT; } return dFunXShTao * dWuMiGa / MATH_PI; } double gtaoidcore::calbgt::dFunXShMiu_n(double dWuMiGa, double DT, int iCShn, double *dWeiYi, int iDianShu) { double dFunXShMiu_n = 0; for (int i = 0; i < iDianShu; i++) { dFunXShMiu_n = dFunXShMiu_n + dWeiYi[i] * std::cos(iCShn * dWuMiGa * i * DT) * DT; } //double temp = dFunXShMiu_n; return dFunXShMiu_n * dWuMiGa / MATH_PI; } double gtaoidcore::calbgt::dFunXShDeErTa_n(double dWuMiGa, double DT, int iCShn, double *dWeiYi, int iDianShu) { double dFunXShDeErTa_n = 0; for (int i = 0; i < iDianShu; i++) { dFunXShDeErTa_n = dFunXShDeErTa_n + dWeiYi[i] * std::sin(iCShn * dWuMiGa * i * DT) * DT; } return dFunXShDeErTa_n * dWuMiGa / MATH_PI; } double gtaoidcore::calbgt::dFunFLYZaiHe(double dWuMiGa, int iCShn, double *dXiGeMa, double *dTao, double dShiJian_t) { double dFunFLYZaiHe = dXiGeMa[0] / 2; for (int i = 1; i < iCShn; i++) { dFunFLYZaiHe = dFunFLYZaiHe + dXiGeMa[i] * std::cos(i * dWuMiGa * dShiJian_t) + dTao[i] * std::sin(i * dWuMiGa * dShiJian_t); } return dFunFLYZaiHe; } double gtaoidcore::calbgt::dFunYWeiYi(double dWuMiGa, int iCShn, double *dMiu, double *dDeErTa, double dShiJian_t) { double dFunFLYWeiYi = dMiu[0] / 2; for (int i = 1; i < iCShn; i++) { dFunFLYWeiYi = dFunFLYWeiYi + dMiu[i] * std::cos(i * dWuMiGa * dShiJian_t) + dDeErTa[i] * std::sin(i * dWuMiGa * dShiJian_t); } return dFunFLYWeiYi; } double gtaoidcore::calbgt::dFunSH(double dz) { return (std::exp(dz) - std::exp(-dz)) * 0.5; } double dFunCH(double dz) { return (std::exp(dz) + std::exp(-dz)) * 0.5; } double gtaoidcore::calbgt::dFunXSha_n(double dWuMiGa, int iCShn, double dCShC, double dCSHa) { iCShn++; double te = iCShn * dWuMiGa / dCSHa / std::sqrt(2) * std::sqrt(1 + std::sqrt(1 + std::pow(dCShC / iCShn / dWuMiGa, 2))); return te; } double gtaoidcore::calbgt::dFunXShB_n(double dWuMiGa, int iCShn, double dCShC, double dCSHa) { iCShn++; return iCShn * dWuMiGa / dCSHa / std::sqrt(2) * std::sqrt(-1 + std::sqrt(1 + std::pow(dCShC / iCShn / dWuMiGa, 2))); } double gtaoidcore::calbgt::dFunXShK_n(double dan, double dBn, double DXiGeMa, double dTaon, double dE, double dAr) { return (DXiGeMa * dan + DXiGeMa * dBn) / (dE * dAr * (std::pow(dan, 2) + std::pow(dBn, 2))); } double gtaoidcore::calbgt::dFunXShU_n(double dan, double dBn, double DXiGeMan, double dTaon, double dE, double dAr) { return (DXiGeMan * dBn - dTaon * dan) / (dE * dAr * (std::pow(dan, 2) + std::pow(dBn, 2))); } double gtaoidcore::calbgt::dFunZLXShC(double dWuMiGa, double dCSHa, double dCSh_u, double dRor, double dAr, double dDt, double dDr, double dL) { double tmpm, tmpQXSh, tmpFM; double tmpB1, tmpB2; tmpm = dDt / dDr; tmpFM = dWuMiGa * dL / (dCSHa * std::sin(dWuMiGa * dL / dCSHa)) + std::cos(dWuMiGa * dL / dCSHa); tmpFM = 2 / tmpFM; tmpB1 = (tmpm * tmpm - 1) / (2 * std::log(tmpm)) - 1; tmpB2 = std::pow(tmpm, 4) - 1 - std::pow((tmpm * tmpm - 1), 2) / std::log(tmpm); tmpQXSh = 2 * MATH_PI * dCSh_u / dRor / dAr; //double t = std::log(tmpm); double temp = tmpQXSh * (1 / std::log(tmpm) + 4 * (tmpB1 + 1) / tmpB2 * (tmpB1 + tmpFM)); return temp; } double gtaoidcore::calbgt::dFunO_n(double dx, double dKn, double dBn, double dDeErTan, double dan, double dUn, double dMiun) { double t = (dKn * dFunCH(dBn * dx) + dDeErTan * dFunSH(dBn * dx)) * std::sin(dan * dx) + (dUn * dFunSH(dBn * dx) + dMiun * dFunCH(dBn * dx)) * std::cos(dan * dx); return t; } double gtaoidcore::calbgt::dFunP_n(double dx, double dKn, double dBn, double dDeErTan, double dan, double dUn, double dMiun) { double t = (dKn * dFunSH(dBn * dx) + dDeErTan * dFunCH(dBn * dx)) * std::cos(dan * dx) - (dUn * dFunCH(dBn * dx) + dMiun * dFunSH(dBn * dx)) * std::sin(dan * dx); return t; } double gtaoidcore::calbgt::dFunPianO_n(double dx, double dKn, double dBn, double dDeErTan, double dan, double dUn, double dMiun, double dTaon, double DXiGeMan, double dE, double dAr) { double t = (dTaon / (dE * dAr) * dFunSH(dBn * dx) + (dDeErTan * dBn - dan * dMiun) * dFunCH(dBn * dx)) * std::sin(dan * dx) + (DXiGeMan / (dE * dAr) * dFunCH(dBn * dx) + (dDeErTan * dan + dBn * dMiun) * dFunSH(dBn * dx)) * std::cos(dan * dx); return t; } double gtaoidcore::calbgt::dFunPianP_n(double dx, double dKn, double dBn, double dDeErTan, double dan, double dUn, double dMiun, double dTaon, double DXiGeMan, double dE, double dAr) { return (dTaon / (dE * dAr) * dFunCH(dBn * dx) + (dDeErTan * dBn - dan * dMiun) * dFunSH(dBn * dx)) * std::cos(dan * dx) - (DXiGeMan / (dE * dAr) * dFunSH(dBn * dx) + (dDeErTan * dan + dBn * dMiun) * dFunCH(dBn * dx)) * std::sin(dan * dx); } double gtaoidcore::calbgt::dFunUxt(double dx, double dWuMiGa, double dXiGeMa0, double dMiu0, double dE, double dAr, int iCShn, double *dOn, double *dPn, double dShiJian_t) { double dFunUxt = dXiGeMa0 / (2 * dE * dAr) * dx + dMiu0 / 2; for (int i = 1; i < iCShn; i++) { dFunUxt = dFunUxt + dOn[i] * std::cos(i * dWuMiGa * dShiJian_t) + dPn[i] * std::sin(i * dWuMiGa * dShiJian_t); } return dFunUxt; } double gtaoidcore::calbgt::dFunFxt(double dWuMiGa, double dXiGeMa0, double dE, double dAr, int iCShn, double *dPianOn, double *dPianPn, double dShiJian_t) { double dFunFxt = 0; for (int i = 1; i < iCShn; i++) { dFunFxt = dFunFxt + dPianOn[i] * std::cos(i * dWuMiGa * dShiJian_t) + dPianPn[i] * std::sin(i * dWuMiGa * dShiJian_t); } dFunFxt = dFunFxt + dXiGeMa0 / (2 * dE * dAr); double t = dE * dAr * dFunFxt; return t; } std::vector gtaoidcore::cal_ylandon(std::vector> sgt, std::vector> bgt, double cc, double cc1, std::string zdjg, double bj, double bs, double hsl, double smd, double ymd, double qyb, double dym, double bdxs, double gradient_1, double gradient_10, double gradient_2, double gradient_3, double gradient_4, double gradient_5, double gradient_6, double gradient_7, double gradient_8, double gradient_9, double dividenum_1, double dividenum_2, double dividenum_3, double dividenum_4, double dividenum_5, double dividenum_6, double dividenum_7, double dividenum_8, double dividenum_9, double dividenum_10) { /*double Card_Load; double Card_Shift;*/ /*double PumpCard_Load; double PumpCard_Shift;*/ double Card_MaxShift; double Card_MinShift; double Card_MaxLoad; double Card_MinLoad; double Card_Power; double PumpCard_MaxShift; double PumpCard_MinShift; double PumpCard_MaxLoad; double PumpCard_MinLoad; double PumpCard_Power; std::vector CardSlope_array; int Card_Point; std::string L_cjsj; std::string L_jh; std::vector> L_bgt; std::vector> L_sgt; double L_Cycle; double L_Cc; double L_Bj; double L_Llbj; double L_Hs; double L_Bx; double L_Rcl; double L_Rcyl; double L_Rcsl; double L_RclT; double L_RcylT; double L_RcslT; double L_Rcql; double L_Ccsmd; double L_Dmyybz; double L_Qyb; double L_Dym; double L_Cmd; double L_Bs; double L_DownLoadLevel = 0; double L_UpLoadLevel = 0; double L_TheoryLoadLiquid = 0; double Productioncoefficient = 0; double L_TempDownLevel; double L_TempUpLevel; int L_TempNum; std::string L_Zdjg; std::string L_ZdjgJc; std::string L_Load; std::string L_Shift; std::string L_ShiftLoad; int L_Count; double l_StrokeRatio; int I = 1; int j = 0; int L_LeftDownPoint; int L_RightDownPoint; double L_LeftDownLoad; double L_RightDownLoad; double L_LeftDownStroke; double L_LeftDownStroke1; double L_LeftDownStroke2; double L_RightDownStroke; int L_LeftUpPoint; int L_RightUpPoint; double L_LeftUpLoad; double L_RightUpLoad; double L_LeftUpStroke; double L_RightUpStroke; double L_UpEffectiveStroke; double L_DivideLoad; std::string L_Zyq; double L_Sjcc; double L_Yxcc; double L_Zcc; double L_Ycc; double L_Ccss; double L_Llpl; double L_Lsss; double L_Gyss; double L_PumpDepth = 0; double L_DivideNum; double L_LeftDownLeak; double L_DownPointDivide; double L_Gradient = 15; double L_Gradient1 = 15; int L_UpPointDivide = 0; double L_Bdxs1; double L_Bdxs; L_sgt = sgt; L_bgt = bgt; L_Cc = cc; L_Cycle = cc1; L_Zdjg = zdjg; L_Bj = bj; L_Bs = bs; L_Hs = hsl; L_Ccsmd = smd; L_Dmyybz = ymd; L_Qyb = qyb; L_Dym = dym; L_Bdxs = bdxs; //L_zyq = zyq; L_LeftDownStroke = 0; L_LeftDownPoint = 0; L_LeftDownLoad = 0; Card_MaxShift = 0; Card_MinShift = 0; Card_MaxLoad = 0; Card_MinLoad = 0; Card_Power = 0; PumpCard_MaxShift = 0; PumpCard_MinShift = 0; PumpCard_MaxLoad = 0; PumpCard_MinLoad = 0; PumpCard_Power = 0; Card_Point = 0; Card_Point = L_sgt.size(); Card_Power = 0; PumpCard_Power = 0; L_LeftDownStroke1 = 15; L_LeftDownStroke2 = -15; //Card_MaxLoad=std::atof(L_sgt.substr(3+8*(-1),5))/100; for (int i = 0; i < Card_Point; i++) { CardSlopeRec CardSlope; /* Card_Shift = L_sgt[i][0]; Card_Load = L_sgt[i][1]; PumpCard_Shift = L_bgt[i][0]; PumpCard_Load = L_bgt[i][1];*/ int previousindex = i - 1; if (i == 0) { previousindex = Card_Point - 1; Card_MaxLoad = L_sgt[i][1]; Card_MinLoad = L_sgt[i][1]; Card_MaxShift = L_sgt[i][0]; Card_MinShift = L_sgt[i][0]; PumpCard_MaxLoad = L_bgt[i][1]; PumpCard_MinLoad = L_bgt[i][1]; PumpCard_MaxShift = L_bgt[i][0]; PumpCard_MinShift = L_bgt[i][0]; L_LeftDownStroke = L_bgt[i][0]; L_LeftDownLoad = L_bgt[i][1]; L_LeftDownPoint = i; } if (Card_MaxLoad < L_sgt[i][1]) Card_MaxLoad = L_sgt[i][1]; else if (Card_MinLoad > L_sgt[i][1]) Card_MinLoad = L_sgt[i][1]; if (Card_MaxShift < L_sgt[i][0]) Card_MaxShift = L_sgt[i][0]; else if (Card_MinShift > L_sgt[i][0]) Card_MinShift = L_sgt[i][0]; if (PumpCard_MaxLoad < L_bgt[i][1]) PumpCard_MaxLoad = L_bgt[i][1]; else if (PumpCard_MinLoad > L_bgt[i][1]) PumpCard_MinLoad = L_bgt[i][1]; if (PumpCard_MaxShift < L_bgt[i][0]) PumpCard_MaxShift = L_bgt[i][0]; else if (PumpCard_MinShift > L_bgt[i][0]) PumpCard_MinShift = L_bgt[i][0]; if (L_bgt[i][0] >= 0 && L_bgt[previousindex][1] <= 0) { if (L_LeftDownStroke1 > (L_bgt[i][0] + L_bgt[previousindex][0]) / 2) L_LeftDownStroke1 = (L_bgt[i][0] + L_bgt[previousindex][0]) / 2; } if (L_bgt[i][0] <= 0 && L_bgt[previousindex][1] >= 0) { if (L_LeftDownStroke2 < (L_bgt[i][0] + L_bgt[previousindex][0]) / 2) { L_LeftDownStroke2 = (L_bgt[i][0] + L_bgt[i][0]) / 2; //用的I TODO:check //L_LeftDownStroke2 = (L_bgt[i][0] + L_bgt[previousindex][0]) / 2; } } int nextindex = i + 1; if (i == Card_Point - 1) { nextindex = 0; } Card_Power = Card_Power + (L_sgt[nextindex][1] + L_sgt[i][1]) * (L_sgt[nextindex][0] - L_sgt[i][0]) / 2; PumpCard_Power = PumpCard_Power + (L_bgt[nextindex][1] + L_bgt[i][1]) * (L_bgt[nextindex][0] - L_bgt[i][0]) / 2; if ((L_sgt[nextindex][0] - L_sgt[i][0]) == 0) CardSlope.Card_Slope = 100; else CardSlope.Card_Slope = std::abs((L_sgt[nextindex][1] - L_sgt[i][1]) / (L_sgt[nextindex][0] - L_sgt[i][0])); if ((L_bgt[nextindex][0] - L_bgt[i][0]) == 0) CardSlope.PumpCard_Slope = 100; else CardSlope.PumpCard_Slope = std::abs( (L_bgt[nextindex][1] - L_bgt[i][1]) / (L_bgt[nextindex][0] - L_bgt[i][0])); CardSlope.PumpCard_Shift = L_bgt[i][0]; if (CardSlope.Card_Slope >= 100) CardSlope.Card_Slope = 100; if (CardSlope.Card_Slope <= -100) CardSlope.Card_Slope = 100; if (CardSlope.PumpCard_Slope >= 100) CardSlope.PumpCard_Slope = 100; if (CardSlope.PumpCard_Slope <= -100) CardSlope.PumpCard_Slope = 100; CardSlope_array.push_back(CardSlope); } Card_Power = std::abs(Card_Power) / (60 / L_Cycle); PumpCard_Power = std::abs(PumpCard_Power) / (60 / L_Cycle); L_Bx = 0; L_Rcl = 0; L_Rcyl = 0; L_Rcsl = 0; L_Rcql = 0; L_RightDownPoint = 0; L_RightDownLoad = 0; L_RightDownStroke = 0; L_LeftUpPoint = 0; L_RightUpPoint = 0; L_LeftUpLoad = 0; L_RightUpLoad = 0; L_LeftUpStroke = 0; L_RightUpStroke = 0; L_UpEffectiveStroke = 0; L_Sjcc = 0; L_Yxcc = 0; L_Ccss = 0; L_Llpl = 0; L_Lsss = 0; L_Gyss = 0; L_Cmd = 0; L_Gradient = 35; L_UpPointDivide = 0; l_StrokeRatio = 0; L_DivideNum = 3.5; L_DivideLoad = (PumpCard_MaxLoad - PumpCard_MinLoad) / L_DivideNum; for (int i = 0; i < Card_Point / 2; i++) { int lastindex = Card_Point - i - 1; if (L_bgt[lastindex][1] < (PumpCard_MinLoad + L_DivideLoad) && CardSlope_array[lastindex].PumpCard_Slope < L_Gradient)//jkl L_RightDownLoad = L_bgt[lastindex][1]; L_RightDownStroke = CardSlope_array[lastindex].PumpCard_Shift; L_RightDownPoint = lastindex; } if (L_RightDownStroke == 0) L_RightDownStroke = L_LeftDownStroke; if ((PumpCard_MaxShift - PumpCard_MinShift) != 0) { l_StrokeRatio = (L_RightDownStroke - L_LeftDownStroke) * 100 / (PumpCard_MaxShift - PumpCard_MinShift); } if (false) if (L_Bdxs <= 0) { L_Bdxs = 1; } //IF L_BDXS IS NULL OR L_BDXS<=0 THEN L_BDXS=1; END IF; bool p_gybz = std::strcmp(L_Zdjg.c_str(), "供液不足") >= 0; if ((std::strcmp(L_Zdjg.c_str(), "供液正常") >= 0 || p_gybz) && l_StrokeRatio > 80) L_Gradient = gradient_1; L_DivideNum = dividenum_1; if (p_gybz && l_StrokeRatio <= 80) L_Gradient = gradient_2; L_DivideNum = dividenum_2; if (p_gybz && l_StrokeRatio <= 45) L_Gradient = gradient_3; L_DivideNum = dividenum_3; if (p_gybz && l_StrokeRatio <= 35) L_Gradient = gradient_4; L_DivideNum = dividenum_4; if (p_gybz && l_StrokeRatio <= 25) L_Gradient = gradient_5; L_DivideNum = dividenum_5; if (p_gybz && l_StrokeRatio <= 20) L_Gradient = gradient_6; L_DivideNum = dividenum_6; if (p_gybz && l_StrokeRatio <= 15) L_Gradient = gradient_7; L_DivideNum = dividenum_7; auto p_qyx = std::strcmp(L_Zdjg.c_str(), "气影响") >= 0; if (p_qyx && l_StrokeRatio >= 35) L_Gradient = gradient_8; L_DivideNum = dividenum_8; if (p_qyx && l_StrokeRatio < 35) L_Gradient = gradient_9; L_DivideNum = dividenum_9; if (p_qyx && l_StrokeRatio < 20) L_Gradient = gradient_10; L_DivideNum = dividenum_10; L_DivideLoad = (PumpCard_MaxLoad - PumpCard_MinLoad) / L_DivideNum; L_DownPointDivide = 0; L_LeftDownLeak = 0; L_LeftUpStroke = 0; L_LeftDownLeak = 0; if (L_Bj > 57) L_Gradient1 = 5; for (int i = 0; i < Card_Point / 2; i++) { int lastindex = Card_Point - i - 1; if (L_bgt[lastindex][1] < (PumpCard_MinLoad + L_DivideLoad) && CardSlope_array[lastindex].PumpCard_Slope < L_Gradient) { L_RightDownLoad = L_bgt[lastindex][1]; L_RightDownStroke = CardSlope_array[lastindex].PumpCard_Shift; L_RightDownPoint = lastindex; if (L_DownPointDivide == 0 && std::abs(CardSlope_array[lastindex].PumpCard_Slope) < 25 && L_bgt[lastindex][1] < (PumpCard_MinLoad + L_DivideLoad)) { L_LeftDownLeak = CardSlope_array[lastindex].PumpCard_Shift; L_DownPointDivide = 1; } } if (L_UpPointDivide == 0 && std::abs(CardSlope_array[i].PumpCard_Slope) < 5 && L_bgt[i][1] > ((PumpCard_MaxLoad - PumpCard_MinLoad) * 0.7 + PumpCard_MinLoad)) { L_LeftUpLoad = L_bgt[i][1]; L_LeftUpStroke = CardSlope_array[i].PumpCard_Shift; L_LeftUpPoint = i; L_UpPointDivide = 1; } if (L_UpPointDivide == 1 && std::abs(CardSlope_array[i].PumpCard_Slope) < 5 && L_bgt[i][1] > ((PumpCard_MaxLoad - PumpCard_MinLoad) * 0.8 + PumpCard_MinLoad)) { L_RightUpLoad = L_bgt[i][1]; L_RightUpStroke = CardSlope_array[i].PumpCard_Shift; L_RightUpPoint = i; } } if (L_RightDownStroke <= 0) { L_RightDownStroke = L_LeftDownStroke; } //if L_RightDownStroke is null then L_RightDownStroke=L_LeftDownStroke; end if; if (L_Cc <= 0) { L_Cc = Card_MaxShift; } //if L_Cc is null then L_Cc=card_maxshift; end if; L_Ycc = L_RightDownStroke; L_Zcc = L_LeftDownStroke; if (L_Bj <= 95) { L_Llpl = L_Cycle * L_Cc * 24 * 60 * L_Bj * L_Bj * MATH_PI / 4000000; } //if L_Bj<=95 then L_Llpl=L_Cycle*L_Cc*24*60*L_Bj*L_Bj*3.1415926/4000000; end if;--理论排量--------------------------------- L_Sjcc = PumpCard_MaxShift - PumpCard_MinShift;//--实际冲程 L_Ccss = L_Cc - L_Sjcc;//--冲程损失 if (L_Ccss < 0) L_Ccss = 0; //if L_Ccss<0 then L_Ccss=0; end if; L_Lsss = 0; if (std::strcmp(L_Zdjg.c_str(), "泵工作正常") >= 0 || std::strcmp(L_Zdjg.c_str(), "碰泵") >= 0) L_Lsss = 0; if (std::strcmp(L_Zdjg.c_str(), "游动凡尔漏失") >= 0) L_Lsss = (PumpCard_MaxShift - L_RightUpStroke) * 2; if (std::strcmp(L_Zdjg.c_str(), "固定凡尔漏失") >= 0) L_Lsss = L_Lsss + (L_LeftDownLeak - PumpCard_MinShift) * 2; if (std::strcmp(L_Zdjg.c_str(), "冲次过快") >= 0) L_Lsss = (PumpCard_MaxShift - L_RightUpStroke) * 2; if (L_Lsss < 0) L_Lsss = 0; L_Yxcc = L_RightDownStroke - L_LeftDownStroke - L_Lsss; if (L_Yxcc <= 0) L_Yxcc = 0; L_Gyss = L_Sjcc - L_Yxcc; if (L_Gyss < 0) L_Gyss = 0; if (L_Gyss == 0) L_Bx = 0; else L_Bx = L_Yxcc / L_Cc * 100; if (L_Bj > 0 && L_Bj <= 95) { if (L_Bj * L_Bj * MATH_PI / 4 * 24 * 60 * L_Cycle * L_Cc * L_Bx / 100000000 > 0.0087 * std::pow(2.71828, 0.0027 * L_Bs)) L_Rcl = L_Bj * L_Bj * MATH_PI / 4 * 24 * 60 * L_Cycle * L_Cc * L_Bx / 100000000 * L_Bdxs;//---0.0087*power(2.71828,0.0027*nvl(L_Bs,0)); else L_Rcl = L_Bj * L_Bj * MATH_PI / 4 * 24 * 60 * L_Cycle * L_Cc * L_Bx / 100000000 * L_Bdxs; if (L_Rcl <= 0) L_Rcl = 0; if (L_Hs <= 100) { L_Rcsl = L_Rcl * L_Hs / 100; L_Rcyl = L_Rcl - L_Rcsl; if (L_Ccsmd > 1 && L_Ccsmd < 1.5) {} else L_Ccsmd = 1.05; if (L_Dmyybz > 0.6 && L_Dmyybz < 1.5) {} else L_Dmyybz = 0.83; if (L_Bs > 0) L_TheoryLoadLiquid = MATH_PI / 4 * (L_Bj * L_Bj / 1000000) * L_Bs * ((1 - L_Hs / 100) * L_Dmyybz + L_Hs / 100 * L_Ccsmd) * 9.8 * (1 + L_Cycle * Card_MaxShift / 127); else L_TheoryLoadLiquid = MATH_PI / 4 * (L_Bj * L_Bj / 1000000) * L_PumpDepth * ((1 - L_Hs / 100) * L_Dmyybz + L_Hs / 100 * L_Ccsmd) * 9.8 * (1 + L_Cycle * Card_MaxShift / 127); if (L_Qyb >= 0) L_Rcql = L_Qyb * L_Rcyl; Productioncoefficient = 1; if ((PumpCard_MaxLoad - PumpCard_MinLoad) / L_TheoryLoadLiquid < 0.8 && !std::strcmp(zdjg.c_str(), "喷抽") && L_Bs > 1750) Productioncoefficient = (PumpCard_MaxLoad - PumpCard_MinLoad) / L_TheoryLoadLiquid; else Productioncoefficient = 1; L_Rcsl = L_Ccsmd * L_Rcsl * Productioncoefficient; L_Rcyl = L_Dmyybz * L_Rcyl * Productioncoefficient; L_Rcl = L_Rcsl + L_Rcyl; } else { L_Llbj = std::sqrt((PumpCard_MaxLoad - PumpCard_MinLoad) * 4 / (9.8 * L_PumpDepth * MATH_PI)) * 1000;//--+power(0.019,2) } } if (L_Hs < 0 || L_Dmyybz < 0 || L_Ccsmd < 0 || L_Qyb < 0 || L_Bj <= 0 || L_Bj > 95) { L_ZdjgJc = "基本数据不全"; L_Zdjg += L_ZdjgJc; } L_Dym = -10;//什么情况 if (L_Dym >= 0 && L_Bj <= 95)//什么情况 { if (L_Bs <= 0) L_Bs = L_PumpDepth; if (L_Hs < 0 || L_Hs > 100) L_Hs = 60; if (L_Dmyybz <= 0) L_Dmyybz = 0.84; if (L_Ccsmd <= 0) L_Ccsmd = 1.05; if (L_Bj <= 0) L_Bj = 38; } else { if (L_Bs <= 0) L_Bs = L_PumpDepth; if (L_Hs < 0 || L_Hs > 100) L_Hs = 60; if (L_Dmyybz <= 0) L_Dmyybz = 0.84; if (L_Ccsmd <= 0) L_Ccsmd = 1.05; if (L_Bj <= 0 || L_Bj > 95) L_Bj = 38; 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) L_Cmd = 0; else { L_Cmd = std::abs(PumpCard_MinLoad * L_Yxcc / L_Sjcc) * 1000 / (((1 - L_Hs / 100) * L_Dmyybz + L_Hs / 100 * L_Ccsmd) * 9.8 * 0.25 * MATH_PI * std::pow(L_Bj, 2) / 1000); L_Dym = L_Bs - L_Cmd; } } if (L_Gyss < PumpCard_MaxShift || L_Ccss < PumpCard_MaxShift || L_Lsss < PumpCard_MaxShift) PumpCard_MaxShift = L_Cc; double rcyl1 = L_Rcl; double rcyl = L_Rcyl; double rcsl = L_Rcsl; double rcql = L_Rcql; double bx = L_Bx; double llpl = L_Llpl; double sjcc = L_Sjcc; double yxcc = L_Yxcc; double zcc = L_Zcc; double ycc = L_Ycc; double ccss = L_Ccss; double lsss = L_Lsss; double gyss = L_Gyss; double pumpdepth = L_PumpDepth; /* std::string str = ""; str += std::to_string(rcyl1) + ";" + std::to_string(rcyl) + ";" + std::to_string(rcsl) + ";" + std::to_string(rcql) + ";" + std::to_string(bx) + ";" + std::to_string(llpl) + ";" + std::to_string(sjcc) + ";" + std::to_string( yxcc) + ";" + std::to_string(zcc) + ";" + std::to_string(ycc) + ";" + std::to_string(ccss) + ";" + std::to_string(lsss) + ";" + std::to_string( gyss) + ";" + std::to_string(l_StrokeRatio) + ";";*/ std::vector res; res.push_back(rcyl1); res.push_back(rcyl); res.push_back(rcsl); res.push_back(rcql); res.push_back(bx); res.push_back(llpl); res.push_back(sjcc); res.push_back(yxcc); res.push_back(zcc); res.push_back(ycc); res.push_back(ccss); res.push_back(lsss); res.push_back(gyss); res.push_back(l_StrokeRatio); return res; }