397 lines
12 KiB
C
397 lines
12 KiB
C
|
|
/////////////////////////////////////////////
|
|||
|
|
// MyLpsLib.h
|
|||
|
|
#pragma once
|
|||
|
|
#include "GeometryUtils.h"
|
|||
|
|
#include <QSettings>
|
|||
|
|
#include <QTextCodec>
|
|||
|
|
#define WLD_FILE_FLAG "WellMessage"
|
|||
|
|
#define I1D_FILE_FLAG "CurveIndex1d"
|
|||
|
|
#define D1D_FILE_FLAG "CurveData1d"
|
|||
|
|
#define I2D_FILE_FLAG "CurveIndex2d"
|
|||
|
|
#define D2D_FILE_FLAG "CurveData2d"
|
|||
|
|
#define I3D_FILE_FLAG "CurveIndex3d"
|
|||
|
|
#define D3D_FILE_FLAG "CurveData3d"
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
char flag[16];
|
|||
|
|
int length;
|
|||
|
|
char reserved[12];
|
|||
|
|
}WldFileHead;
|
|||
|
|
typedef struct {
|
|||
|
|
char name[32]; // <20><><EFBFBD><EFBFBD> 32
|
|||
|
|
char region[32]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32
|
|||
|
|
int chin_code[16]; // <20><><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><C4BA>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 64
|
|||
|
|
char type[16]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ 16
|
|||
|
|
float x_coor, y_coor; // <20><>λ<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8
|
|||
|
|
char oil_company[40]; // <20><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD> 40
|
|||
|
|
float height; // <20><><EFBFBD>IJ<EFBFBD><C4B2>ĸ߶<C4B8> 4
|
|||
|
|
float bit_program[5][2]; // <20><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD> 40
|
|||
|
|
float case_program[5][2]; // <20>ܳ<D7B9><DCB3><EFBFBD> 40
|
|||
|
|
char reserved[64]; // <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4> 64
|
|||
|
|
} WSM; // 340
|
|||
|
|
|
|||
|
|
typedef struct {
|
|||
|
|
int log_times; // <20>⾮<EFBFBD><E2BEAE><EFBFBD><EFBFBD> 4
|
|||
|
|
char log_company[40]; // <20>⾮<EFBFBD><E2BEAE>˾<EFBFBD><CBBE><EFBFBD><EFBFBD> 40
|
|||
|
|
char log_team[32]; // <20>⾮<EFBFBD><E2BEAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32
|
|||
|
|
char log_series[16]; // <20>⾮ϵ<E2BEAE>б<EFBFBD>ʶ 16
|
|||
|
|
char log_project[16]; // <20>⾮<EFBFBD><E2BEAE>Ŀ<EFBFBD><C4BF>ʶ 16
|
|||
|
|
char log_profile[16]; // <20>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ 16
|
|||
|
|
char log_date[12]; // <20>⾮<EFBFBD><E2BEAE><EFBFBD><EFBFBD> 12
|
|||
|
|
float stdep,endep; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><CEB5><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>Ⱥͽ<C8BA><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8
|
|||
|
|
float bottom_temp; // <20><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD> 4
|
|||
|
|
char mud_type[12]; // <20>ཬ<EFBFBD><E0BDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ 12
|
|||
|
|
float mud_viscosity; // <20>ཬճ<E0BDAC><D5B3> 4
|
|||
|
|
float mud_density; // <20>ཬ<EFBFBD>ܶ<EFBFBD> 4
|
|||
|
|
float mud_resistivity; // <20>ཬ<EFBFBD><E0BDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4
|
|||
|
|
char reserved[64]; // <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4> 64
|
|||
|
|
} WDM; //236
|
|||
|
|
|
|||
|
|
typedef struct {
|
|||
|
|
char name[8]; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
char alias[8]; /* <20><><EFBFBD>߱<EFBFBD><DFB1><EFBFBD> */
|
|||
|
|
char flag[16]; /* <20><><EFBFBD>߸<EFBFBD><DFB8>ӱ<EFBFBD>־ */
|
|||
|
|
float sdepth; /* <20><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> */
|
|||
|
|
float edepth; /* <20><><EFBFBD>ߵĽ<DFB5><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
float dstep; /* <20><><EFBFBD>߲<EFBFBD><DFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD> */
|
|||
|
|
char dunit[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> */
|
|||
|
|
char vunit[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> */
|
|||
|
|
char data_type[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD>*/
|
|||
|
|
int address; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD>Ĵ洢<C4B4><EFBFBD>ַ */
|
|||
|
|
} CurveIndex1d;
|
|||
|
|
|
|||
|
|
typedef struct {
|
|||
|
|
char name[8]; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
char alias[8]; /* <20><><EFBFBD>߱<EFBFBD><DFB1><EFBFBD> */
|
|||
|
|
char flag[16]; /* <20><><EFBFBD>߸<EFBFBD><DFB8>ӱ<EFBFBD>־ */
|
|||
|
|
float sdepth; /* <20>ߵ<EFBFBD><DFB5><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> */
|
|||
|
|
float edepth; /* <20><><EFBFBD>ߵĽ<DFB5><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
float dstep; /* <20><><EFBFBD>߲<EFBFBD><DFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD> */
|
|||
|
|
char dunit[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> */
|
|||
|
|
float stime; /* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|||
|
|
float etime; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|||
|
|
float tstep; /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
char tunit[8]; /* ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
char vunit[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> */
|
|||
|
|
char data_type[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD> */
|
|||
|
|
int address; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD>Ĵ洢<C4B4><EFBFBD>ַ */
|
|||
|
|
} CurveIndex2d;
|
|||
|
|
|
|||
|
|
typedef struct {
|
|||
|
|
char name[8]; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
char alias[8]; /* <20><><EFBFBD>߱<EFBFBD><DFB1><EFBFBD> */
|
|||
|
|
char flag[16]; /* <20><><EFBFBD>߸<EFBFBD><DFB8>ӱ<EFBFBD>־ */
|
|||
|
|
float sdepth; /* <20><><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> */
|
|||
|
|
float edepth; /* <20><><EFBFBD>ߵĽ<DFB5><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
float dstep; /* <20><><EFBFBD>߲<EFBFBD><DFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD> */
|
|||
|
|
char dunit[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> */
|
|||
|
|
float sangle; /* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD> */
|
|||
|
|
float eangle; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD> */
|
|||
|
|
float astep; /* <20><><EFBFBD><EFBFBD><EFBFBD>Ƕȼ<C7B6><C8BC><EFBFBD> */
|
|||
|
|
char aunit; /* <20>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
float stime; /* <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|||
|
|
float etime; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> */
|
|||
|
|
float tstep; /* <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
char tunit[8]; /* ʱ<><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|||
|
|
char vunit[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD> */
|
|||
|
|
char data_type[8]; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD> */
|
|||
|
|
int address; /* <20><><EFBFBD><EFBFBD>ֵ<EFBFBD>Ĵ洢<C4B4><EFBFBD>ַ */
|
|||
|
|
}CurveIndex3d;
|
|||
|
|
extern short ReverseShort(short num);
|
|||
|
|
extern long ReverseLong(long num);
|
|||
|
|
extern int ReverseInt(int num);
|
|||
|
|
extern float ReverseFloat(float num);
|
|||
|
|
extern double ReverseDouble(double num);
|
|||
|
|
|
|||
|
|
class MyLpsLib
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
WSM wsm;
|
|||
|
|
WDM wdm;
|
|||
|
|
Slf_FILE_MESSAGE FILE_MESSAGE;
|
|||
|
|
// WELL_DYNAMIC_INFO WellDynamicInfo;
|
|||
|
|
// WELL_STATIC_INFO WellStaticInfo;
|
|||
|
|
float minrlev,stdep,endep;
|
|||
|
|
CurveIndex1d *c1d;
|
|||
|
|
CurveIndex2d *c2d;
|
|||
|
|
CurveIndex3d *c3d;
|
|||
|
|
int num1d,num2d,ResultId,CoreId;
|
|||
|
|
QString PathName,WellName;
|
|||
|
|
QFile *dataFile;
|
|||
|
|
MyLpsLib()
|
|||
|
|
{
|
|||
|
|
num1d=0,num2d=0;
|
|||
|
|
ResultId=-1,CoreId=-1;
|
|||
|
|
};
|
|||
|
|
~MyLpsLib()
|
|||
|
|
{
|
|||
|
|
if(num1d)delete []c1d;
|
|||
|
|
if(num2d)delete []c2d;
|
|||
|
|
};
|
|||
|
|
int OpenDataFile(QString ExtName)
|
|||
|
|
{
|
|||
|
|
QString filename;
|
|||
|
|
filename=PathName+WellName+ExtName;
|
|||
|
|
dataFile=new QFile(filename);
|
|||
|
|
dataFile->open(QIODevice::WriteOnly);
|
|||
|
|
return 1;
|
|||
|
|
};
|
|||
|
|
int Rewind()
|
|||
|
|
{
|
|||
|
|
dataFile->seek(0);
|
|||
|
|
int pos=dataFile->pos();
|
|||
|
|
return 0;
|
|||
|
|
};
|
|||
|
|
int CloseDataFile()
|
|||
|
|
{
|
|||
|
|
dataFile->close();
|
|||
|
|
return 0;
|
|||
|
|
};
|
|||
|
|
int WriteDataFile(char *buf,int len)
|
|||
|
|
{
|
|||
|
|
return dataFile->write(buf, len);
|
|||
|
|
};
|
|||
|
|
void TurnData(int iType,int nCount,void *pVal)
|
|||
|
|
{
|
|||
|
|
int i;
|
|||
|
|
if ( iType == REPR_INT ) // 1 int
|
|||
|
|
{
|
|||
|
|
int *p;
|
|||
|
|
p = (int *)pVal;
|
|||
|
|
for (i=0; i<nCount; i++)
|
|||
|
|
p[i] = ReverseInt(p[i]);
|
|||
|
|
}
|
|||
|
|
if ( iType == REPR_SHORT ) // 2 short
|
|||
|
|
{
|
|||
|
|
short int *p;
|
|||
|
|
p = (short int *)pVal;
|
|||
|
|
for (i=0; i<nCount; i++)
|
|||
|
|
p[i] = ReverseShort(p[i]);
|
|||
|
|
}
|
|||
|
|
if ( iType == REPR_LONG ) // 3 long
|
|||
|
|
{
|
|||
|
|
long *p;
|
|||
|
|
p = (long *)pVal;
|
|||
|
|
for (i=0; i<nCount; i++)
|
|||
|
|
p[i] = ReverseLong(p[i]);
|
|||
|
|
}
|
|||
|
|
if ( iType == REPR_FLOAT ) // 4 float
|
|||
|
|
{
|
|||
|
|
float *p;
|
|||
|
|
p = (float *)pVal;
|
|||
|
|
for (i=0; i<nCount; i++)
|
|||
|
|
p[i] = ReverseFloat(p[i]);
|
|||
|
|
}
|
|||
|
|
if ( iType == REPR_DOUBLE ) // 5
|
|||
|
|
{
|
|||
|
|
double *p;
|
|||
|
|
p = (double *)pVal;
|
|||
|
|
for (i=0; i<nCount; i++)
|
|||
|
|
p[i] = ReverseDouble(p[i]);
|
|||
|
|
}
|
|||
|
|
if ( iType == REPR_USHORT ) // 9 unsigned short
|
|||
|
|
{
|
|||
|
|
unsigned short int *p;
|
|||
|
|
p = (unsigned short int *)pVal;
|
|||
|
|
for (i=0; i<nCount; i++)
|
|||
|
|
p[i] = ReverseShort(p[i]);
|
|||
|
|
}
|
|||
|
|
if ( iType == REPR_UINT ) // 10 unsigned int
|
|||
|
|
{
|
|||
|
|
unsigned int *p;
|
|||
|
|
p = (unsigned int *)pVal;
|
|||
|
|
for (i=0; i<nCount; i++)
|
|||
|
|
p[i] = ReverseInt(p[i]);
|
|||
|
|
}
|
|||
|
|
if ( iType == REPR_ULONG ) // 11 unsigned long
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
if ( iType == REPR_STRING ) // 6 string
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
// ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1>룬ת<EBA3AC><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|||
|
|
const char * GetDataType(int iType)
|
|||
|
|
{
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>ʼ
|
|||
|
|
const char *strDataType[]={"null","int","short","long","float","double"
|
|||
|
|
,"string","char","UCHAR","WORD"
|
|||
|
|
,"UINT","ULONG"};
|
|||
|
|
if ( iType >=0 && iType < 11 )
|
|||
|
|
return strDataType[iType];
|
|||
|
|
else
|
|||
|
|
return "unknown";
|
|||
|
|
};
|
|||
|
|
// ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1>룬ת<EBA3AC><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|||
|
|
//---- ע<>⣺-------------------------------------------
|
|||
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD>һ<EFBFBD><D2BB>Ҫͳһ<CDB3><D2BB><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD>Ȳ<EFBFBD><C8B2>ܸı<DCB8>
|
|||
|
|
//------------------------------------------------------
|
|||
|
|
int GetDataTypeCode(char *strType,int *nCodeLen)
|
|||
|
|
{
|
|||
|
|
const char *strDataType[]={"null","int","short","long","float","double"
|
|||
|
|
,"string","char","UCHAR","WORD"
|
|||
|
|
,"UINT","ULONG"};
|
|||
|
|
int nDataTypeLen[]={0,4,2,4,4,8,1,1,1,2,4,4};
|
|||
|
|
QString cs1,cs2;
|
|||
|
|
cs2 = QString(QLatin1String(strType)).toUpper();
|
|||
|
|
int iCode = 4;
|
|||
|
|
*nDataTypeLen = 4;
|
|||
|
|
for (int i=0; i<11; i++)
|
|||
|
|
{
|
|||
|
|
cs1 = QString(QLatin1String(strDataType[i])).toUpper();
|
|||
|
|
if ( cs1==cs2)
|
|||
|
|
{
|
|||
|
|
iCode = i;
|
|||
|
|
*nCodeLen = nDataTypeLen[i];
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return iCode;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
bool WriteWLD()
|
|||
|
|
{
|
|||
|
|
QString filename;
|
|||
|
|
filename=PathName+WellName+".wld";
|
|||
|
|
FILE *fp=fopen(filename.toStdString().c_str(),"w+b");
|
|||
|
|
if(!fp)
|
|||
|
|
{
|
|||
|
|
QMessageBox::information(NULL,"<EFBFBD><EFBFBD>ʾ","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"+filename+"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>");
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD><CCAC>Ϣת<CFA2><D7AA><EFBFBD><EFBFBD>wsm<73><6D>wdm
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC>Ϣ<EFBFBD><CFA2>ֵ
|
|||
|
|
strncpy(wsm.region,FILE_MESSAGE.AreaName,32);
|
|||
|
|
strncpy(wsm.oil_company,FILE_MESSAGE.OilCompanyName,32);
|
|||
|
|
strncpy(wsm.name,FILE_MESSAGE.WellName,32);
|
|||
|
|
QString temp = ::GetConfPath()+"data.ini";
|
|||
|
|
QSettings settings(temp,QSettings::IniFormat,0);
|
|||
|
|
settings.setIniCodec(QTextCodec::codecForName("UTF-8"));
|
|||
|
|
QStringList serials=settings.value("wellType",0).toStringList();
|
|||
|
|
int i=serials.indexOf(FILE_MESSAGE.WellType);
|
|||
|
|
if(i>=serials.size()) i=serials.size()-1;
|
|||
|
|
if(i<0) i=0;
|
|||
|
|
if(i<serials.size()-1) strcpy(FILE_MESSAGE.WellType,serials[i].toStdString().c_str());
|
|||
|
|
strcpy(wsm.type,FILE_MESSAGE.WellType);
|
|||
|
|
wsm.x_coor=FILE_MESSAGE.Xcoor;
|
|||
|
|
wsm.y_coor=FILE_MESSAGE.Ycoor;
|
|||
|
|
wsm.height=ConvertDataByFloat(FILE_MESSAGE.Kelly).toFloat();
|
|||
|
|
for (int i=0; i<5; i++)
|
|||
|
|
{
|
|||
|
|
sscanf(FILE_MESSAGE.Prog,"%f %f",&wsm.bit_program[i][0],&wsm.bit_program[i][1]);
|
|||
|
|
// sscanf(FILE_MESSAGE.[i],"%f %f",&wsm.case_program[i][0],&wsm.case_program[i][1]);
|
|||
|
|
}
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>̬<EFBFBD><CCAC>Ϣ<EFBFBD><CFA2>ֵ:WellDynamicInfo
|
|||
|
|
strncpy(wdm.log_company,FILE_MESSAGE.LogCompanyName,40);
|
|||
|
|
QString str=ctime((time_t *)&FILE_MESSAGE.LoggingDate);
|
|||
|
|
|
|||
|
|
strncpy(wdm.log_date,str.toStdString().c_str(),12);
|
|||
|
|
strncpy(wdm.log_series,FILE_MESSAGE.LoggingSerial,16);
|
|||
|
|
strncpy(wdm.log_team,FILE_MESSAGE.LoggingTeam,16);
|
|||
|
|
strncpy(wdm.log_project,FILE_MESSAGE.YqType,16);
|
|||
|
|
strncpy(wdm.mud_type,FILE_MESSAGE.Mud_Property,12);
|
|||
|
|
//float WaterLoss;
|
|||
|
|
wdm.mud_viscosity=FILE_MESSAGE.Mud_Viscosity[0];
|
|||
|
|
wdm.mud_density=FILE_MESSAGE.Mud_Density[0];
|
|||
|
|
wdm.mud_resistivity=FILE_MESSAGE.Mud_Resistivity[0] ;
|
|||
|
|
wdm.bottom_temp=FILE_MESSAGE.Mud_Temp;
|
|||
|
|
//pctosun
|
|||
|
|
// <20><>λ<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
wsm.x_coor = ReverseFloat(wsm.x_coor);
|
|||
|
|
wsm.y_coor = ReverseFloat(wsm.x_coor);
|
|||
|
|
// <20><><EFBFBD>IJ<EFBFBD><C4B2>ĸ߶<C4B8>
|
|||
|
|
wsm.height = ReverseFloat(wsm.height);
|
|||
|
|
for ( int i=0;i<5; i++)
|
|||
|
|
{
|
|||
|
|
// <20><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
|
|||
|
|
wsm.bit_program[i][0] = ReverseFloat(wsm.bit_program[i][0]);
|
|||
|
|
wsm.bit_program[i][1] = ReverseFloat(wsm.bit_program[i][1]);
|
|||
|
|
// <20>ܳ<D7B9><DCB3><EFBFBD>
|
|||
|
|
wsm.case_program[i][0] = ReverseFloat(wsm.case_program[i][0]);
|
|||
|
|
wsm.case_program[i][1] = ReverseFloat(wsm.case_program[i][1]);
|
|||
|
|
}
|
|||
|
|
wdm.log_times = ReverseInt(wdm.log_times); // <20>⾮<EFBFBD><E2BEAE><EFBFBD><EFBFBD>
|
|||
|
|
wdm.stdep = ReverseFloat(wdm.stdep);
|
|||
|
|
wdm.endep =ReverseFloat(wdm.endep ); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ε<EFBFBD><CEB5><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>Ⱥͽ<C8BA><CDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
wdm.bottom_temp = ReverseFloat(wdm.bottom_temp); // <20><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
|||
|
|
wdm.mud_viscosity = ReverseFloat(wdm.mud_viscosity); // <20>ཬճ<E0BDAC><D5B3>
|
|||
|
|
wdm.mud_density = ReverseFloat(wdm.mud_density); // <20>ཬ<EFBFBD>ܶ<EFBFBD>
|
|||
|
|
wdm.mud_resistivity = ReverseFloat(wdm.mud_resistivity); // <20>ཬ<EFBFBD><E0BDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
/* write head */
|
|||
|
|
int len=32+sizeof(WSM)+sizeof(WDM);
|
|||
|
|
WldFileHead wld;
|
|||
|
|
fseek(fp,0L,0);
|
|||
|
|
strcpy(wld.flag,WLD_FILE_FLAG);
|
|||
|
|
wld.length=ReverseInt(1);
|
|||
|
|
fwrite((char *)&wld, 32,1,fp );
|
|||
|
|
fseek(fp,32L,0);
|
|||
|
|
fwrite(&wsm, sizeof(wsm) ,1 , fp );
|
|||
|
|
fwrite(&wsm, sizeof(wdm) ,1 , fp );
|
|||
|
|
fclose(fp);
|
|||
|
|
return 1;
|
|||
|
|
};
|
|||
|
|
bool WriteI1D()
|
|||
|
|
{
|
|||
|
|
QString filename;
|
|||
|
|
filename=PathName+WellName+".i1d";
|
|||
|
|
FILE *fp=fopen(filename.toStdString().c_str(),"w+b");
|
|||
|
|
if(!fp)
|
|||
|
|
{
|
|||
|
|
QMessageBox::information(NULL,"<EFBFBD><EFBFBD>ʾ","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"+filename+"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>");
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
/* write head */
|
|||
|
|
//int len=32;
|
|||
|
|
WldFileHead i1d;
|
|||
|
|
fseek(fp,0L,0);
|
|||
|
|
strcpy(i1d.flag,I1D_FILE_FLAG);
|
|||
|
|
i1d.length=ReverseInt(num1d);
|
|||
|
|
fwrite(&i1d, sizeof(WldFileHead) ,1 , fp );
|
|||
|
|
fseek(fp,32L,0);
|
|||
|
|
for(int i=0;i<num1d;i++)
|
|||
|
|
{
|
|||
|
|
c1d[i].address = ReverseInt(c1d[i].address);
|
|||
|
|
c1d[i].sdepth = ReverseFloat(c1d[i].sdepth);
|
|||
|
|
c1d[i].edepth = ReverseFloat(c1d[i].edepth);
|
|||
|
|
c1d[i].dstep = ReverseFloat(c1d[i].dstep);
|
|||
|
|
fwrite(&c1d[i],sizeof(CurveIndex1d),1,fp);
|
|||
|
|
}
|
|||
|
|
fclose(fp);
|
|||
|
|
return 1;
|
|||
|
|
};
|
|||
|
|
bool WriteI2D()
|
|||
|
|
{
|
|||
|
|
QString filename;
|
|||
|
|
filename=PathName+WellName+".i2d";
|
|||
|
|
FILE *fp=fopen(filename.toStdString().c_str(),"w+b");
|
|||
|
|
if(!fp)
|
|||
|
|
{
|
|||
|
|
QMessageBox::information(NULL,"<EFBFBD><EFBFBD>ʾ","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"+filename+"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>");
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
/* write head */
|
|||
|
|
WldFileHead i2d;
|
|||
|
|
fseek(fp,0L,0);
|
|||
|
|
strcpy(i2d.flag,I2D_FILE_FLAG);
|
|||
|
|
i2d.length=ReverseInt(num2d);
|
|||
|
|
fwrite(&i2d, sizeof(WldFileHead) ,1 , fp );
|
|||
|
|
fseek(fp,32L,0);
|
|||
|
|
for(int i=0;i<num2d;i++)
|
|||
|
|
{
|
|||
|
|
c2d[i].address = ReverseInt(c2d[i].address);
|
|||
|
|
c2d[i].sdepth = ReverseFloat(c2d[i].sdepth);
|
|||
|
|
c2d[i].edepth = ReverseFloat(c2d[i].edepth);
|
|||
|
|
c2d[i].dstep = ReverseFloat(c2d[i].dstep);
|
|||
|
|
c2d[i].stime = ReverseFloat(c2d[i].stime);
|
|||
|
|
c2d[i].etime = ReverseFloat(c2d[i].etime);
|
|||
|
|
c2d[i].tstep = ReverseFloat(c2d[i].tstep);
|
|||
|
|
fwrite(&c2d[i],sizeof(CurveIndex2d),1,fp);
|
|||
|
|
}
|
|||
|
|
fclose(fp);
|
|||
|
|
return 1;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|