|
|
|
@ -27,6 +27,7 @@ namespace {
|
|
|
|
const char g_aPressureMagic[8] = { 'N', 'M', 'P', 'R', 'E', 'S', '3', 0 };
|
|
|
|
const char g_aPressureMagic[8] = { 'N', 'M', 'P', 'R', 'E', 'S', '3', 0 };
|
|
|
|
const char g_aCurvesMagic[8] = { 'N', 'M', 'C', 'U', 'R', 'V', '3', 0 };
|
|
|
|
const char g_aCurvesMagic[8] = { 'N', 'M', 'C', 'U', 'R', 'V', '3', 0 };
|
|
|
|
const quint32 g_nBinaryFormatVersion = 1;
|
|
|
|
const quint32 g_nBinaryFormatVersion = 1;
|
|
|
|
|
|
|
|
const int g_nSnapshotFormatVersion = 4;
|
|
|
|
const quint32 g_nEndianMarker = 0x01020304u;
|
|
|
|
const quint32 g_nEndianMarker = 0x01020304u;
|
|
|
|
const quint64 g_nMaximumCellCount = 50000000ull;
|
|
|
|
const quint64 g_nMaximumCellCount = 50000000ull;
|
|
|
|
const quint32 g_nMaximumFrameCount = 10000u;
|
|
|
|
const quint32 g_nMaximumFrameCount = 10000u;
|
|
|
|
@ -533,7 +534,8 @@ bool parseSnapshotJson(
|
|
|
|
if(!oDocument.IsObject() ||
|
|
|
|
if(!oDocument.IsObject() ||
|
|
|
|
!oDocument.HasMember("SnapshotFormatVersion") ||
|
|
|
|
!oDocument.HasMember("SnapshotFormatVersion") ||
|
|
|
|
!oDocument["SnapshotFormatVersion"].IsInt() ||
|
|
|
|
!oDocument["SnapshotFormatVersion"].IsInt() ||
|
|
|
|
oDocument["SnapshotFormatVersion"].GetInt() != 3 ||
|
|
|
|
oDocument["SnapshotFormatVersion"].GetInt() !=
|
|
|
|
|
|
|
|
g_nSnapshotFormatVersion ||
|
|
|
|
!oDocument.HasMember("ResultCellCount") ||
|
|
|
|
!oDocument.HasMember("ResultCellCount") ||
|
|
|
|
!oDocument["ResultCellCount"].IsUint64() ||
|
|
|
|
!oDocument["ResultCellCount"].IsUint64() ||
|
|
|
|
!oDocument.HasMember("PressureFrameCount") ||
|
|
|
|
!oDocument.HasMember("PressureFrameCount") ||
|
|
|
|
@ -700,8 +702,9 @@ bool nmPebiResultSnapshotSerializer::save(
|
|
|
|
oDocument.SetObject();
|
|
|
|
oDocument.SetObject();
|
|
|
|
rapidjson::Document::AllocatorType& oAllocator =
|
|
|
|
rapidjson::Document::AllocatorType& oAllocator =
|
|
|
|
oDocument.GetAllocator();
|
|
|
|
oDocument.GetAllocator();
|
|
|
|
// v3 强制保存每口结果井的 Gauge 输入签名。
|
|
|
|
// v4 在井目录中增加求解时冻结的完整流量制度,不兼容旧快照。
|
|
|
|
oDocument.AddMember("SnapshotFormatVersion", 3, oAllocator);
|
|
|
|
oDocument.AddMember("SnapshotFormatVersion",
|
|
|
|
|
|
|
|
g_nSnapshotFormatVersion, oAllocator);
|
|
|
|
oDocument.AddMember("SnapshotId",
|
|
|
|
oDocument.AddMember("SnapshotId",
|
|
|
|
toJsonString(pSnapshot->m_sSnapshotId, oAllocator), oAllocator);
|
|
|
|
toJsonString(pSnapshot->m_sSnapshotId, oAllocator), oAllocator);
|
|
|
|
oDocument.AddMember("GridInputRevision",
|
|
|
|
oDocument.AddMember("GridInputRevision",
|
|
|
|
@ -758,6 +761,21 @@ bool nmPebiResultSnapshotSerializer::save(
|
|
|
|
oJson.AddMember("WellMode", static_cast<int>(oWell.m_eWellMode), oAllocator);
|
|
|
|
oJson.AddMember("WellMode", static_cast<int>(oWell.m_eWellMode), oAllocator);
|
|
|
|
oJson.AddMember("GaugeInputSha1", toJsonString(
|
|
|
|
oJson.AddMember("GaugeInputSha1", toJsonString(
|
|
|
|
oWell.m_sGaugeInputSha1, oAllocator), oAllocator);
|
|
|
|
oWell.m_sGaugeInputSha1, oAllocator), oAllocator);
|
|
|
|
|
|
|
|
oJson.AddMember("FlowSchedulePhase", static_cast<int>(
|
|
|
|
|
|
|
|
oWell.m_eFlowSchedulePhase), oAllocator);
|
|
|
|
|
|
|
|
oJson.AddMember("FlowSectionIndex",
|
|
|
|
|
|
|
|
oWell.m_nFlowSectionIndex, oAllocator);
|
|
|
|
|
|
|
|
oJson.AddMember("UseOilRate", oWell.m_bUseOilRate, oAllocator);
|
|
|
|
|
|
|
|
oJson.AddMember("UseGasRate", oWell.m_bUseGasRate, oAllocator);
|
|
|
|
|
|
|
|
oJson.AddMember("UseWaterRate", oWell.m_bUseWaterRate, oAllocator);
|
|
|
|
|
|
|
|
addDoubleVector(oJson, "FlowDurations",
|
|
|
|
|
|
|
|
oWell.m_vecFlowDurations, oAllocator);
|
|
|
|
|
|
|
|
addDoubleVector(oJson, "OilRates",
|
|
|
|
|
|
|
|
oWell.m_vecOilRates, oAllocator);
|
|
|
|
|
|
|
|
addDoubleVector(oJson, "GasRates",
|
|
|
|
|
|
|
|
oWell.m_vecGasRates, oAllocator);
|
|
|
|
|
|
|
|
addDoubleVector(oJson, "WaterRates",
|
|
|
|
|
|
|
|
oWell.m_vecWaterRates, oAllocator);
|
|
|
|
oJson.AddMember("X", oWell.m_oLocation.x(), oAllocator);
|
|
|
|
oJson.AddMember("X", oWell.m_oLocation.x(), oAllocator);
|
|
|
|
oJson.AddMember("Y", oWell.m_oLocation.y(), oAllocator);
|
|
|
|
oJson.AddMember("Y", oWell.m_oLocation.y(), oAllocator);
|
|
|
|
oJson.AddMember("HasPerforation", oWell.m_bHasPerforation, oAllocator);
|
|
|
|
oJson.AddMember("HasPerforation", oWell.m_bHasPerforation, oAllocator);
|
|
|
|
@ -1064,6 +1082,7 @@ bool nmPebiResultSnapshotSerializer::load(
|
|
|
|
int nWellType = 0;
|
|
|
|
int nWellType = 0;
|
|
|
|
int nWellCategory = 0;
|
|
|
|
int nWellCategory = 0;
|
|
|
|
int nWellMode = 0;
|
|
|
|
int nWellMode = 0;
|
|
|
|
|
|
|
|
int nFlowSchedulePhase = 0;
|
|
|
|
if(!oJson.IsObject() ||
|
|
|
|
if(!oJson.IsObject() ||
|
|
|
|
!oJson.HasMember("WellInstanceId") ||
|
|
|
|
!oJson.HasMember("WellInstanceId") ||
|
|
|
|
!oJson["WellInstanceId"].IsString() ||
|
|
|
|
!oJson["WellInstanceId"].IsString() ||
|
|
|
|
@ -1075,6 +1094,24 @@ bool nmPebiResultSnapshotSerializer::load(
|
|
|
|
!readRequiredInt(oJson, "WellType", nWellType) ||
|
|
|
|
!readRequiredInt(oJson, "WellType", nWellType) ||
|
|
|
|
!readRequiredInt(oJson, "WellCategory", nWellCategory) ||
|
|
|
|
!readRequiredInt(oJson, "WellCategory", nWellCategory) ||
|
|
|
|
!readRequiredInt(oJson, "WellMode", nWellMode) ||
|
|
|
|
!readRequiredInt(oJson, "WellMode", nWellMode) ||
|
|
|
|
|
|
|
|
!readRequiredInt(oJson, "FlowSchedulePhase",
|
|
|
|
|
|
|
|
nFlowSchedulePhase) ||
|
|
|
|
|
|
|
|
!readRequiredInt(oJson, "FlowSectionIndex",
|
|
|
|
|
|
|
|
oWell.m_nFlowSectionIndex) ||
|
|
|
|
|
|
|
|
!readRequiredBool(oJson, "UseOilRate",
|
|
|
|
|
|
|
|
oWell.m_bUseOilRate) ||
|
|
|
|
|
|
|
|
!readRequiredBool(oJson, "UseGasRate",
|
|
|
|
|
|
|
|
oWell.m_bUseGasRate) ||
|
|
|
|
|
|
|
|
!readRequiredBool(oJson, "UseWaterRate",
|
|
|
|
|
|
|
|
oWell.m_bUseWaterRate) ||
|
|
|
|
|
|
|
|
!readDoubleVector(oJson, "FlowDurations",
|
|
|
|
|
|
|
|
oWell.m_vecFlowDurations) ||
|
|
|
|
|
|
|
|
!readDoubleVector(oJson, "OilRates",
|
|
|
|
|
|
|
|
oWell.m_vecOilRates) ||
|
|
|
|
|
|
|
|
!readDoubleVector(oJson, "GasRates",
|
|
|
|
|
|
|
|
oWell.m_vecGasRates) ||
|
|
|
|
|
|
|
|
!readDoubleVector(oJson, "WaterRates",
|
|
|
|
|
|
|
|
oWell.m_vecWaterRates) ||
|
|
|
|
!readRequiredDouble(oJson, "X", oWell.m_oLocation.rx()) ||
|
|
|
|
!readRequiredDouble(oJson, "X", oWell.m_oLocation.rx()) ||
|
|
|
|
!readRequiredDouble(oJson, "Y", oWell.m_oLocation.ry()) ||
|
|
|
|
!readRequiredDouble(oJson, "Y", oWell.m_oLocation.ry()) ||
|
|
|
|
!readRequiredBool(oJson, "HasPerforation", oWell.m_bHasPerforation) ||
|
|
|
|
!readRequiredBool(oJson, "HasPerforation", oWell.m_bHasPerforation) ||
|
|
|
|
@ -1099,6 +1136,8 @@ bool nmPebiResultSnapshotSerializer::load(
|
|
|
|
oWell.m_eWellCategory = static_cast<NM_WELL_CATEGORY>(
|
|
|
|
oWell.m_eWellCategory = static_cast<NM_WELL_CATEGORY>(
|
|
|
|
nWellCategory);
|
|
|
|
nWellCategory);
|
|
|
|
oWell.m_eWellMode = static_cast<NM_CASE_WELL_MODE>(nWellMode);
|
|
|
|
oWell.m_eWellMode = static_cast<NM_CASE_WELL_MODE>(nWellMode);
|
|
|
|
|
|
|
|
oWell.m_eFlowSchedulePhase = static_cast<NM_PHASE_TYPE>(
|
|
|
|
|
|
|
|
nFlowSchedulePhase);
|
|
|
|
if(setJsonWellIds.contains(oWell.m_sWellInstanceId) ||
|
|
|
|
if(setJsonWellIds.contains(oWell.m_sWellInstanceId) ||
|
|
|
|
!mapCurves.contains(oWell.m_sWellInstanceId))
|
|
|
|
!mapCurves.contains(oWell.m_sWellInstanceId))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|