How to import XML IREDES file format with Measurement While Drilling Data from tunnel drill rigs in MATLAB to extract sample data in a matrix?
11 views (last 30 days)
Show older comments
Hi,
I want to extract sample data from an xml file. The data is in the IREDES format.
Due to the high number of files (in the range of 13 000) the process should be automated while the information on the reportId and MWDholeId is maintained for each sample. The number of samples can vary a lot from 0 samples upto 1500 samples.
I hope you can help me with finding a solution to import this file type.
Cheers Jeroen
The xml-file looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
-<DRMWD xmlns:IR="http://www.iredes.org/xml" xmlns="http://www.iredes.org/xml/DrillRig" DRMWDDownwCompat="V 1.2" DRMWDVersion="V 1.2AC" IRDownwCompat="V 1.2" IRVersion="V 1.2AC">
-<IR:GenHead>
<IR:FileCreateDate>2016-11-11T15:40:12</IR:FileCreateDate>
<IR:IRversion DownwCompat="V 1.2">V 1.2AC</IR:IRversion>
-<IR:ProjectInfo>
<IR:Signature/>
<IR:Comment/>
</IR:ProjectInfo>
-<IR:EquipmentInfo>
<IR:EqpManufact>Atlas Copco</IR:EqpManufact>
<IR:EqpType>Boomer</IR:EqpType>
<IR:EqpModel/>
<IR:EqpSerNo>8999190900</IR:EqpSerNo>
<IR:EqpSysVer>RCS 5.3.2</IR:EqpSysVer>
<IR:EqpInfo/>
<IR:EqpName/>
</IR:EquipmentInfo>
</IR:GenHead>
<IR:ReportId>227.229</IR:ReportId>
<IR:StartLogTime>2016-03-14T12:49:02</IR:StartLogTime>
<IR:EndLogTime>2016-03-14T13:08:55</IR:EndLogTime>
<MWDholeId>-1</MWDholeId>
+<PositionQuality>
<SampleDistance>2.000</SampleDistance>
-<CompactMWDdata>
-<MWDparams>
<Parameter Full="Penetration Rate" Unit="cm/min"/>
<Parameter Full="Percussion Pressure" Unit="bar"/>
<Parameter Full="Feed Pressure" Unit="bar"/>
<Parameter Full="Dampening Pressure" Unit="bar"/>
<Parameter Full="Rotation Speed" Unit="r/min"/>
<Parameter Full="Rotation Pressure" Unit="bar"/>
<Parameter Full="Water Flow" Unit="l/min"/>
<Parameter Full="Water Pressure" Unit="bar"/>
<Parameter Full="Fracturing" Unit=""/>
<Parameter Full="Hardness" Unit=""/>
</MWDparams>
-<Sample>
<Val TimeTag="2016-03-14T12:49:02" LengthTag="0.038">50.000 120.000 42.700 36.030 244.860 57.780 192.790 22.260 0.000 -1.316</Val>
</Sample>
-<Sample>
<Val TimeTag="2016-03-14T12:49:02" LengthTag="0.067">350.300 120.000 45.690 38.970 232.150 73.190 191.040 22.680 0.000 9.644</Val>
</Sample>
-<Sample>
<Val TimeTag="2016-03-14T12:49:03" LengthTag="0.097">350.300 120.000 45.260 39.390 239.080 58.640 189.280 21.830 9.352 9.646</Val>
</Sample>
</CompactMWDdata>
-<IR:GenTrailer>
<IR:FileCloseDate>2016-11-11T15:40:13</IR:FileCloseDate>
<IR:ChkSum>0</IR:ChkSum>
</IR:GenTrailer>
</DRMWD>
The desired result should be something like:
227.229 -1 0.038 50.000 120.000 42.700 36.030 244.860 57.780 192.790 22.260 0.000 -1.316
227.229 -1 0.067 350.300 120.000 45.690 38.970 232.150 73.190 191.040 22.680 0.000 9.644
227.229 -1 0.097 350.300 120.000 45.260 39.390 239.080 58.640 189.280 21.830 9.352 9.646
2 Comments
Christopher Keesee
on 18 Oct 2023
I have a very similar question regarding MWD data. This XML in the IREDES format.
I am looking for a table with: ReportId, MWDholeId, DepthTag, TimeTag, Samples
Here is the XML:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by the RCS System Epiroc Rock Drills AB -->
<DRMWD xmlns="http://www.iredes.org/xml/DrillRig" xmlns:IR="http://www.iredes.org/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.iredes.org/xml/DrillRig C:\Iredes\IR_V1.2.3\xml\DR-DrillRig_V1.2\DrillRig.xsd" IRVersion="V 1.2AC" IRDownwCompat="V 1.2AC" DRMWDDownwCompat="V 1.2AC" DRMWDVersion="V 1.2AC">
<IR:GenHead>
<IR:FileCreateDate>2023-07-25T07:37:11</IR:FileCreateDate>
<IR:IRversion DownwCompat="V 1.0">V 1.2AC</IR:IRversion>
<IR:EquipmentInfo>
<IR:EqpManufact>Epiroc</IR:EqpManufact>
<IR:EqpType>SmartROC D60</IR:EqpType>
<IR:EqpSerNo>8992013316</IR:EqpSerNo>
<IR:EqpSysVer>6.22.1</IR:EqpSysVer>
<IR:EqpInfo>DrillingMethod: DTH</IR:EqpInfo>
</IR:EquipmentInfo>
</IR:GenHead>
<IR:ReportId>MWDRI250737</IR:ReportId>
<IR:StartLogTime>2023-07-25T06:49:26</IR:StartLogTime>
<IR:EndLogTime>2023-07-25T07:26:41</IR:EndLogTime>
<IR:PlanIdRef>abba19740304</IR:PlanIdRef>
<IR:PlanNameRef>23-7-18_Lift1</IR:PlanNameRef>
<MWDholeId>452</MWDholeId>
<QualityReportIdRef>DQRI250641</QualityReportIdRef>
<SampleDistance>0.020000</SampleDistance>
<CompactMWDdata>
<MWDparams>
<Parameter Unit="m/min" Full="PenetrRate">PR</Parameter>
<Parameter Unit="Bar" Full="PercPressure">PP</Parameter>
<Parameter Unit="Bar" Full="FeedPressure">FP</Parameter>
<Parameter Unit="Bar" Full="DampPressure">DP</Parameter>
<Parameter Unit="Bar" Full="RotPressure">RP</Parameter>
<Parameter Unit="Bar" Full="FlushPressure">FLP</Parameter>
</MWDparams>
<Samples TimeTag="2023-07-25T06:49:26" DepthTag="0.021">0.655 9.410 21.869 0.000 33.392 9.410 </Samples>
<Samples TimeTag="2023-07-25T06:49:26" DepthTag="0.046">2.328 11.108 23.023 0.000 30.764 11.108 </Samples>
<Samples TimeTag="2023-07-25T06:49:27" DepthTag="0.076">2.281 12.118 23.704 0.000 32.305 12.118 </Samples>
<Samples TimeTag="2023-07-25T06:49:28" DepthTag="0.103">2.823 12.638 23.526 0.000 30.050 12.638 </Samples>
<Samples TimeTag="2023-07-25T06:49:28" DepthTag="0.125">1.660 13.265 23.807 0.000 33.189 13.265 </Samples>
<Samples TimeTag="2023-07-25T06:49:29" DepthTag="0.147">1.654 13.724 23.493 0.000 30.814 13.724 </Samples>
<Samples TimeTag="2023-07-25T06:49:30" DepthTag="0.175">2.647 13.112 23.554 0.000 28.507 13.112 </Samples>
<Samples TimeTag="2023-07-25T06:49:30" DepthTag="0.198">2.369 12.531 23.473 0.000 29.859 12.531 </Samples>
<Samples TimeTag="2023-07-25T06:49:31" DepthTag="0.225">2.593 12.592 23.781 0.000 29.537 12.592 </Samples>
<Samples TimeTag="2023-07-25T06:49:32" DepthTag="0.249">1.807 13.051 23.738 0.000 29.731 13.051 </Samples>
<Samples TimeTag="2023-07-25T06:49:33" DepthTag="0.274">1.872 13.617 23.895 0.000 28.543 13.617 </Samples>
<Samples TimeTag="2023-07-25T06:49:33" DepthTag="0.295">2.219 13.540 23.780 0.000 27.875 13.540 </Samples>
<Samples TimeTag="2023-07-25T06:49:34" DepthTag="0.319">2.281 12.592 23.562 0.000 25.939 12.592 </Samples>
<Samples TimeTag="2023-07-25T06:49:35" DepthTag="0.347">2.075 12.102 23.676 0.000 27.781 12.102 </Samples>
<Samples TimeTag="2023-07-25T06:49:35" DepthTag="0.373">1.916 12.393 23.371 0.000 30.504 12.393 </Samples>
<Samples TimeTag="2023-07-25T06:49:36" DepthTag="0.396">2.471 12.684 23.574 0.000 27.504 12.684 </Samples>
<Samples TimeTag="2023-07-25T06:49:36" DepthTag="0.418">3.310 12.959 23.309 0.000 27.037 12.959 </Samples>
<Samples TimeTag="2023-07-25T06:49:37" DepthTag="0.444">2.453 13.387 23.543 0.000 27.122 13.387 </Samples>
<Samples TimeTag="2023-07-25T06:49:38" DepthTag="0.471">1.973 12.898 23.198 0.000 30.661 12.898 </Samples>
<Samples TimeTag="2023-07-25T06:49:38" DepthTag="0.491">2.146 12.087 23.286 0.000 30.063 12.087 </Samples>
<Samples TimeTag="2023-07-25T06:49:39" DepthTag="0.511">1.535 11.949 23.229 0.000 28.340 11.949 </Samples>
<Samples TimeTag="2023-07-25T06:49:40" DepthTag="0.537">2.405 12.194 23.234 0.000 32.148 12.194 </Samples>
<Samples TimeTag="2023-07-25T06:49:40" DepthTag="0.564">2.843 12.454 23.231 0.000 31.751 12.454 </Samples>
<Samples TimeTag="2023-07-25T06:49:41" DepthTag="0.589">2.654 12.852 23.385 0.000 30.189 12.852 </Samples>
<Samples TimeTag="2023-07-25T06:49:42" DepthTag="0.617">2.666 13.250 23.180 0.000 28.864 13.250 </Samples>
<Samples TimeTag="2023-07-25T06:49:42" DepthTag="0.638">3.147 13.449 23.266 0.000 30.952 13.449 </Samples>
<Samples TimeTag="2023-07-25T06:49:43" DepthTag="0.663">2.689 13.938 23.074 0.000 42.986 13.938 </Samples>
<Samples TimeTag="2023-07-25T06:49:43" DepthTag="0.683">3.011 14.413 23.347 0.000 34.637 14.413 </Samples>
<Samples TimeTag="2023-07-25T06:49:44" DepthTag="0.712">2.631 15.025 22.604 0.000 28.646 15.025 </Samples>
<Samples TimeTag="2023-07-25T06:49:44" DepthTag="0.738">2.859 15.484 22.923 0.000 26.888 15.484 </Samples>
<Samples TimeTag="2023-07-25T06:49:54" DepthTag="0.763">3.728 16.142 43.132 0.000 45.573 16.142 </Samples>
<Samples TimeTag="2023-07-25T06:49:55" DepthTag="0.787">5.913 16.279 43.686 0.000 43.847 16.279 </Samples>
<Samples TimeTag="2023-07-25T06:49:55" DepthTag="0.807">7.640 16.356 43.247 0.000 42.237 16.356 </Samples>
<Samples TimeTag="2023-07-25T06:49:55" DepthTag="0.836">7.173 16.478 42.584 0.000 41.426 16.478 </Samples>
<Samples TimeTag="2023-07-25T06:49:55" DepthTag="0.858">3.340 16.677 44.059 0.000 46.072 16.677 </Samples>
<Samples TimeTag="2023-07-25T06:49:56" DepthTag="0.887">2.113 16.937 43.183 0.000 40.211 16.937 </Samples>
<Samples TimeTag="2023-07-25T06:49:57" DepthTag="0.912">1.864 17.075 42.561 0.000 38.584 17.075 </Samples>
<Samples TimeTag="2023-07-25T06:49:58" DepthTag="0.935">1.760 17.411 32.646 0.000 34.911 17.411 </Samples>
<Samples TimeTag="2023-07-25T06:50:09" DepthTag="0.962">1.185 13.449 34.639 0.000 36.112 13.449 </Samples>
<Samples TimeTag="2023-07-25T06:50:10" DepthTag="0.984">3.340 14.061 35.501 0.000 37.653 14.061 </Samples>
<Samples TimeTag="2023-07-25T06:50:26" DepthTag="1.009">2.612 12.990 37.095 0.000 41.828 12.990 </Samples>
<Samples TimeTag="2023-07-25T06:50:26" DepthTag="1.030">3.121 13.280 36.463 0.000 42.858 13.280 </Samples>
<Samples TimeTag="2023-07-25T06:50:27" DepthTag="1.051">3.202 13.510 36.639 0.000 50.047 13.510 </Samples>
<Samples TimeTag="2023-07-25T06:50:27" DepthTag="1.076">3.670 13.709 36.587 0.000 52.974 13.709 </Samples>
<Samples TimeTag="2023-07-25T06:50:28" DepthTag="1.097">2.245 13.265 35.597 0.000 46.626 13.265 </Samples>
<Samples TimeTag="2023-07-25T06:50:28" DepthTag="1.118">3.127 12.577 33.555 0.000 45.187 12.577 </Samples>
<Samples TimeTag="2023-07-25T06:50:28" DepthTag="1.145">4.050 12.133 33.107 0.000 41.070 12.133 </Samples>
<Samples TimeTag="2023-07-25T06:50:29" DepthTag="1.174">4.428 12.072 32.710 0.000 42.771 12.072 </Samples>
<Samples TimeTag="2023-07-25T06:50:42" DepthTag="1.201">3.420 14.260 31.864 0.000 42.831 14.260 </Samples>
<Samples TimeTag="2023-07-25T06:50:42" DepthTag="1.222">7.517 14.443 32.360 0.000 38.814 14.443 </Samples>
<Samples TimeTag="2023-07-25T06:50:42" DepthTag="1.251">7.254 14.703 32.219 0.000 36.178 14.703 </Samples>
<Samples TimeTag="2023-07-25T06:50:42" DepthTag="1.287">5.480 15.101 32.571 0.000 34.837 15.101 </Samples>
<Samples TimeTag="2023-07-25T06:50:43" DepthTag="1.315">4.089 15.377 32.448 0.000 33.569 15.377 </Samples>
<Samples TimeTag="2023-07-25T06:50:43" DepthTag="1.340">3.810 15.514 32.774 0.000 33.895 15.514 </Samples>
<Samples TimeTag="2023-07-25T06:50:44" DepthTag="1.370">4.508 15.744 33.374 0.000 33.054 15.744 </Samples>
<Samples TimeTag="2023-07-25T06:50:44" DepthTag="1.399">4.369 16.034 33.202 0.000 32.753 16.034 </Samples>
<Samples TimeTag="2023-07-25T06:51:02" DepthTag="1.451">4.779 16.692 38.941 0.000 35.181 16.692 </Samples>
<Samples TimeTag="2023-07-25T06:51:02" DepthTag="1.486">5.324 16.815 40.779 0.000 42.239 16.815 </Samples>
<Samples TimeTag="2023-07-25T06:51:03" DepthTag="1.523">5.487 17.044 39.568 0.000 44.457 17.044 </Samples>
<Samples TimeTag="2023-07-25T06:51:03" DepthTag="1.554">5.778 17.197 40.807 0.000 40.725 17.197 </Samples>
<Samples TimeTag="2023-07-25T06:51:03" DepthTag="1.575">5.277 17.320 37.969 0.000 40.460 17.320 </Samples>
<Samples TimeTag="2023-07-25T06:51:19" DepthTag="1.616">2.035 17.212 29.812 0.000 35.255 17.212 </Samples>
<Samples TimeTag="2023-07-25T06:51:19" DepthTag="1.655">5.726 17.274 30.408 0.000 40.060 17.274 </Samples>
<Samples TimeTag="2023-07-25T06:51:20" DepthTag="1.686">4.658 17.442 30.345 0.000 36.871 17.442 </Samples>
<Samples TimeTag="2023-07-25T06:51:20" DepthTag="1.708">3.353 17.656 27.691 0.000 33.512 17.656 </Samples>
<Samples TimeTag="2023-07-25T06:51:21" DepthTag="1.740">4.739 17.886 34.623 0.000 39.318 17.886 </Samples>
<Samples TimeTag="2023-07-25T06:51:21" DepthTag="1.763">3.479 18.085 34.806 0.000 39.068 18.085 </Samples>
<Samples TimeTag="2023-07-25T06:51:41" DepthTag="1.790">4.134 16.432 43.709 0.000 39.749 16.432 </Samples>
<Samples TimeTag="2023-07-25T06:51:41" DepthTag="1.822">4.718 16.708 39.978 0.000 41.395 16.708 </Samples>
<Samples TimeTag="2023-07-25T06:51:56" DepthTag="1.867">2.236 16.340 31.693 0.000 27.805 16.340
</CompactMWDdata>
<IR:GenTrailer>
<IR:FileCloseDate>2023-07-25T07:37:11</IR:FileCloseDate>
<IR:ChkSum>3222420685</IR:ChkSum>
</IR:GenTrailer>
</DRMWD>
Stephen
on 18 Dec 2023
I am having the same issue.
When i try to run the code Artur, I am receing an error. Error using cell2mat
Answers (1)
Iredes Tech
on 26 Jul 2017
Dear Jeroen
I am technical officer at Iredes and just today I have found that you have asked such a question here.
One of the simplest answers to your question would be
# IREDES+MATLAB : extracting drill rig reportid, wholeid and sample data
inp = strjoin(textread("sample1.xml", "%s"))
reportid = cell2mat(regexp(inp, 'IR:ReportId\s*>([^<]+)<', 'tokens', 'once'))
data = cell2mat(regexp(inp, '<Val TimeTag[^>]*LengthTag="([^"]+)">([^<]+)<', 'tokens'))
datav = transpose(reshape(cell2mat(data), [], 3))
for n = 1:rows(datav); disp(strjoin([reportid, wholeid, datav(1,1), datav(1,2)])); end;
and this procudes exactly what you were asking for
> for n = 1:rows(datav); disp(strjoin([reportid, wholeid, datav(1,1), datav(1,2)])); end;
227.229 -1 0.038 50.000 120.000 42.700 36.030 244.860 57.780 192.790 22.260 0.000 -1.316
227.229 -1 0.038 50.000 120.000 42.700 36.030 244.860 57.780 192.790 22.260 0.000 -1.316
227.229 -1 0.038 50.000 120.000 42.700 36.030 244.860 57.780 192.790 22.260 0.000 -1.316
Best regards
Artur
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!