第32卷第1期物探化探计算技术2010年1月基金项目:煤炭科学研究总院西安研究院自筹资金项目资助(2008XAYQN004)收稿日期:2009-07-09改回日期:2009-07-21:10011749(2010)01009405MatlabSurfer王鹏,梁爽,李文刚(煤炭科学研究总院西安研究院,陕西西安710054):使用手工操作Surfer绘制大量电法等值线图,因存在重复劳动效率低等缺点,需要开发自动成图软件替代繁重的手工劳动Surfer软件自7.0及以后版本,增加了自动化功能,支持Surfer的二次开发Matlab支持ActiveX接口编程,能作为客户端访问控制其它支持COM组件的Windows应用程序这里采用Matlab的GUI图形用户接口技术编制用户界面,在主程序里调用Surfer自动化对象作为服务器,使之受控于Matlab,实现了电法等值线图自动化,批量处理软件的开发:MATLABGUI;Surfer自动化;等值线图:TP311:A0,,,,,,,,,,GOLDENSurfer,,[1~5]SurferWindows,,,Surfer7,(Automation),surfer,2002Surfer8Surfer8,,,,,,,,,,Surfer,,,,1SurferSurfer7,(Automation),surfer,SurferScript,,SurferScripterSurfer,Surfer,VB,Surfer(~GoldenSoftware\Surfer8\Samples),Surfer,,Surfer,Surfer,SurferSurfer,,,,,Surfer8.0ActiveXAutomation,Surfer8.0Surfer8.0,Automation,Surfer,(ApplicationObject),,,Surfer,:ApplicationAexsDocumentMapFramePlotDocumentShapesWksDocumentSurfer,Application,,SurferShapesCollection,:AexsCollectionApplicationCountParentItem,,,SurferAutomation[6~12]2MatlabGUIActiveXGUIGraphicalUserInterface,MATLAB,,,,,,,,MATLABGUI,[13]ActiveXMicrosoftCOM(ComponentObjectMode,l),Windows,,,:ActiveXAutomation,(Client),(Server),,,ActiveXAutomation,,,[13]MATLABActiveX:ActiveX;!ActiveXAutomationActiveXActiveX,ActiveX()(),MATLABActiveX,ActiveX,MATLAB,Surfer,Automation,Surfer,Surfer951期王鹏等:Matlab调用Surfer自动化实现电法等值线图的批量绘制3MATLABGUIMATLABGUI,,,callback,,callback,,userdata,userdata,callbackuserdatauserdatafigureaxesline,,tag,,tag,callback,findobjtag,[1415]MATLABSurfer,SurferApplication,,Application,MATLABactxserverSurfer,:srf=actxserver(∀surfer.application#);Surfer,srfSurfer,,,,,:set(sr,f∀PageUnits#,∀srfUnitsCentimeter#);%Surfer;Surfer,Surfer,srfvisible:set(sr,f∀visible#,1);%0,;Surfer,srfwindowstate,:set(sr,f∀windowstate#,∀srfwindowstatemaximized#);srfwindowstateminimized,,srfwindowstatenormalSurfer,,,,,,,:set(sr,f∀DefaultFilePath#,FilePath);%FilePath;,,:set(sr,f∀ScreenUpdating#,0);%1,;,,,Surfer,srfGridData[1415]invoke(sr,f∀GridData#,DataFile,xCo,lyCo,lzCo,lExclusionFilter,DupMethod,xDupTo,lyDupTo,lNumCols,NumRows,xMin,xMax,yMin,yMax,Algorithm,ShowRepor,tSearchEnable,SearchNumSectors,SearchRad1,SearchRad2,SearchAngle,SearchMinData,SearchDataPerSec,tSearchMaxEmpty,FaultFileName,BreakFileName,AnisotropyRatio,AnisotropyAngle,IDPower,IDSmoothing,KrigType,KrigDriftType,KrigStdDevGrid,KrigVariogram,MCMaxResidua,lMCMaxIterations,MCInternalTension,MCBoundaryTension,MCRelaxationFactor,ShepSmoothFactor,ShepQuadraticNeighbors,ShepWeightingNeighbors,ShepRange1,ShepRange2,RegrMaxXOrder,RegrMaxYOrder,RegrMaxTotalOrder,RBBasisType,RBRSquared,OutGrid,OutFm,tSearchMaxData,KrigStdDevForma,tDataMetric,LocalPolyOrder,LocalPolyPower,TriangleFileName);invokesrfGridData;DataFile;xColyColzCol;,Surfer,[]96物探化探计算技术32卷,GridFilter,Surfer,:Invoke(sr,f∀GridFilter#,InGrid,Filter,EdgeOp,BlankOp,NumPasses,EdgeFil,lBlankFil,lNumRow,NumCo,lParam1,Param2,UserFilter,OutGrid,OutFmt);InGrid;Filter;OutGrid;OutFmt,32GRDASCIIGRDSurferGRDASCIIXYZ[.dat]OutFmt1234,,3,ASCII4,,,,:wds=invoke(sr.fdocuments,∀add#,1);SurferApplicationDocumentsadd:contourframe=invoke(wds.shapes,∀AddContourMap#,gridfile);wdsshapesAddContourMap,(gridfile),contourframe,LoadFilelvl,:invoke(contourmap.Levels,∀LoadFile#,lvlfile);contourmap.LevelscontourmapLevels,LoadFile,wds.shapesAddPosMtapAddBaseMap,,,SelectAll,OverlayMaps:wds.Shapes.SelectAl;l%postsel=wds.selection;overAxes=invoke(se,l∀OverlayMaps#);%overAxes,,,,∀AddRectangle#∀AddText#,,∀contourframe#∀xMapPerPU#∀yMapPerPU#,,Surfer,;∀SaveAs#,∀Close#;ApplicationQ'uit'Surfer,,12()1软件界面Fig.1Softwareinterface4MatlabSurfer,MATLABGUI,MATLAB,ActiveX971期王鹏等:Matlab调用Surfer自动化实现电法等值线图的批量绘制2等值线实际效果图Fig.2ThedrawingcontourmapSurfer,Surfer,Surfer,,,:[1],.Surfer[J].,2006,8(1),34.[2],,,.SURFER[J].,1999,9(3),212.[3],,,.SURFERTM[J].,2007,29(4),363.[4],.Surfer[J].,2006,30(2),172.[5],.SURFER[J].,2007,31(3),250.[6],,,.SurferAutomation[J].,2006,(7),21.[7].SURFER[J].,1997,19(2):174.[8],,,.Surfer[J].,2007,25(2),90.[9],,.ActiveXSurfer[J].,2006,3:61.[10],,.Surfer[J].,2005,27(3):212.[11],,.SurferAutomation[J].,2005,2(1):56.[12].Surfer[J].,2006,21(3):224.[13]DUANEHANSELMAN,BRUCELITTLEFIELD.Matlab7[M]..:,2006.[14],,.SURFER7.0[J].,2002,24(2):157.[15],,.Surfer8.0[J].,2007,4(1):52.:王鹏(1982-),男,湖北监利人,硕士,主要从事煤田电磁法勘探工作98物探化探计算技术32卷guage,wedeveloptheupper-computersoftwareandrealizethevisualizationofdata.Keywords:FT245BM;USB;datatransmission;multithreadAUTOMATICBATCH-PROCESSINGOFELECTRICCONTOURMAPBYUSINGMATLABPROGRAMMINGWITHCALLINGSURFERSOFTWAREWANGPeng,LIANGShuang,LIWengang(XianBranchofChinaCoalResearchInstitute,XianShanxi710054,China).COMPUTINGTECHNIQUESFORGEOPHYSICALANDGEOCHEMICALEXPLORATION,2010,32(1):94ItistimeconsumingbyusingSurfersoftwaretomanuallydrawalargenumberofsimilarcontourmaps,sotodevelopasoftwareisneededforreplacementofheavymanuallabor.Surfersoftwarefromversion7.0andlaterversionarewithautomationfunction,andsecondarydevelopmentissupported.MatlabProgramlanguagesupportforActiveXprogramminginterface,whichcanbeaccessedandtheinterfacecancontrolotherWindowsapplicationwhichsupportCOMtec