tester23
Goto Top

Csv in Xml umwandeln

Hallo,

nach langer Zeit habe ich wieder eine Frage.
Ich bekomme eine csv-Datei, und um die weiter verarbeiten zu können, muss diese Datei mit einem Xslt-Transformer in das XML-Format umgewandelt werden.

Die csv-Datei sieht wie folgt aus:
Date "Time" "Service Point" Meter Number Channel Reading Unit
07.09.2015 00:15 48001006278 12345 Aggregate Active Export 1 kW
07.09.2015 00:30 48001006278 12345 Aggregate Active Export 2 kW
07.09.2015 00:45 48001006278 12345 Aggregate Active Export 3 kW
07.09.2015 01:00 48001006278 12345 Aggregate Active Export 4 kW
07.09.2015 01:15 48001006278 12345 Aggregate Active Export 5 kW
07.09.2015 01:30 48001006278 12345 Aggregate Active Export 6 kW
07.09.2015 01:45 48001006278 12345 Aggregate Active Export 7 kW
07.09.2015 02:00 48001006278 12345 Aggregate Active Export 8 kW
07.09.2015 00:15 48001006278 12345 Aggregate Active Import 1 kW
07.09.2015 00:30 48001006278 12345 Aggregate Active Import 2 kW
07.09.2015 00:45 48001006278 12345 Aggregate Active Import 3 kW
07.09.2015 01:00 48001006278 12345 Aggregate Active Import 4 kW
07.09.2015 01:15 48001006278 12345 Aggregate Active Import 5 kW
07.09.2015 01:30 48001006278 12345 Aggregate Active Import 6 kW
07.09.2015 01:45 48001006278 12345 Aggregate Active Import 7 kW
07.09.2015 02:00 48001006278 12345 Aggregate Active Import 8 kW
07.09.2015 00:15 12345678901 987654 Aggregate Active Export 1 kW
07.09.2015 00:30 12345678901 987654 Aggregate Active Export 2 kW
07.09.2015 00:45 12345678901 987654 Aggregate Active Export 3 kW
07.09.2015 01:00 12345678901 987654 Aggregate Active Export 4 kW
07.09.2015 01:15 12345678901 987654 Aggregate Active Export 5 kW
07.09.2015 01:30 12345678901 987654 Aggregate Active Export 6 kW
07.09.2015 01:45 12345678901 987654 Aggregate Active Export 7 kW
07.09.2015 02:00 12345678901 987654 Aggregate Active Export 8 kW
07.09.2015 00:15 12345678901 987654 Aggregate Active Import 1 kW
07.09.2015 00:30 12345678901 987654 Aggregate Active Import 2 kW
07.09.2015 00:45 12345678901 987654 Aggregate Active Import 3 kW
07.09.2015 01:00 12345678901 987654 Aggregate Active Import 4 kW
07.09.2015 01:15 12345678901 987654 Aggregate Active Import 5 kW
07.09.2015 01:30 12345678901 987654 Aggregate Active Import 6 kW
07.09.2015 01:45 12345678901 987654 Aggregate Active Import 7 kW
07.09.2015 02:00 12345678901 987654 Aggregate Active Import 8 kW

Die Xml-Datei soll folgendes Format haben:

<?xml version="1.0" encoding="UTF-8"?>  
<smart:measuringdata>
<smart meterreading smart:unit="KWh" smart:obis="1-1.29.0" smart:id="48001006278">  
<smart:value smart:date="2015-09-07T00:15:00+01:00">0.25</smart:value>  
<smart:value smart:date="2015-09-07T00:30:00+01:00">0.5</smart:value>  
<smart:value smart:date="2015-09-07T00:45:00+01:00">0.75</smart:value>  
<smart:value smart:date="2015-09-07T01:00:00+01:00">1</smart:value>  
<smart:value smart:date="2015-09-07T01:15:00+01:00">1.25</smart:value>  
<smart:value smart:date="2015-09-07T01:30:00+01:00">1.5</smart:value>  
<smart:value smart:date="2015-09-07T01:45:00+01:00">1.75</smart:value>  
<smart:value smart:date="2015-09-07T02:00:00+01:00">2</smart:value>  
</smart:meterreading>
<smart meterreading smart:unit="KWh" smart:obis="1-2.29.0" smart:id="48001006278">  
<smart:value smart:date="2015-09-07T00:15:00+01:00">0.25</smart:value>  
<smart:value smart:date="2015-09-07T00:30:00+01:00">0.5</smart:value>  
<smart:value smart:date="2015-09-07T00:45:00+01:00">0.75</smart:value>  
<smart:value smart:date="2015-09-07T01:00:00+01:00">1</smart:value>  
<smart:value smart:date="2015-09-07T01:15:00+01:00">1.25</smart:value>  
<smart:value smart:date="2015-09-07T01:30:00+01:00">1.5</smart:value>  
<smart:value smart:date="2015-09-07T01:45:00+01:00">1.75</smart:value>  
<smart:value smart:date="2015-09-07T02:00:00+01:00">2</smart:value>  
</smart:meterreading>
<smart meterreading smart:unit="KWh" smart:obis="1-1.29.0" smart:id="12345678901">  
<smart:value smart:date="2015-09-07T00:15:00+01:00">0.25</smart:value>  
<smart:value smart:date="2015-09-07T00:30:00+01:00">0.5</smart:value>  
<smart:value smart:date="2015-09-07T00:45:00+01:00">0.75</smart:value>  
<smart:value smart:date="2015-09-07T01:00:00+01:00">1</smart:value>  
<smart:value smart:date="2015-09-07T01:15:00+01:00">1.25</smart:value>  
<smart:value smart:date="2015-09-07T01:30:00+01:00">1.5</smart:value>  
<smart:value smart:date="2015-09-07T01:45:00+01:00">1.75</smart:value>  
<smart:value smart:date="2015-09-07T02:00:00+01:00">2</smart:value>  
</smart:meterreading>
<smart meterreading smart:unit="KWh" smart:obis="1-2.29.0" smart:id="12345678901">  
<smart:value smart:date="2015-09-07T00:15:00+01:00">0.25</smart:value>  
<smart:value smart:date="2015-09-07T00:30:00+01:00">0.5</smart:value>  
<smart:value smart:date="2015-09-07T00:45:00+01:00">0.75</smart:value>  
<smart:value smart:date="2015-09-07T01:00:00+01:00">1</smart:value>  
<smart:value smart:date="2015-09-07T01:15:00+01:00">1.25</smart:value>  
<smart:value smart:date="2015-09-07T01:30:00+01:00">1.5</smart:value>  
<smart:value smart:date="2015-09-07T01:45:00+01:00">1.75</smart:value>  
<smart:value smart:date="2015-09-07T02:00:00+01:00">2</smart:value>  
</smart:meterreading>
<smart:measuringdata>

Also, vereinfacht erklärt:
Ich bekomme eine csv-Datei (die Werte befinden sich in Zeilen und Spalten, das ist hier irgendwie nicht ersichtlich) mit Lastprofilwerten von mehreren Stromzählern untereinander in KW, und muss daraus (mit eine Xslt-Transformer) eine XML-Datei erstellen und die KW-Werte in KWh umwandeln (also durch 0.25 teilen).

Bitte entschuldigt wenn es irgendwo Formattierungsfehler gibt.
Ich hoffe dass jemand mir helfen kann?

Vielen Dank im Voraus

Content-Key: 282288

Url: https://administrator.de/contentid/282288

Printed on: April 18, 2024 at 14:04 o'clock

Mitglied: 122990
122990 Sep 08, 2015 updated at 14:05:03 (UTC)
Goto Top
CSV to XML Konverter

KW-Werte in KWh umwandeln (also durch 0.25 teilen).
hä? Da stimmt aber dann watt nich ....
https://de.m.wikipedia.org/wiki/Wattstunde

Gruß grexit
Mitglied: 122990
122990 Sep 08, 2015 updated at 16:16:38 (UTC)
Goto Top
btw. stimmt da zusätzlich was nicht in deinen Demo-Daten.
So wie das aussieht hast du mehrere Zähler pro Standort, aber die Zählernummer "Meter Number" ändert sich in deinem Beispiel garnicht obwohl deine Ausgabe eine Separierung vorsieht ?? Zusätzlich hat deine XML-Datei keine Prefix-Deklaration für den Prefix smart was ebenfalls zu einer nicht konformen XML-Datei führt.

Und nur mit einem XSLT-Template wirst du hier nicht hin kommen, denn normalweise hat man eine XML als Quelle für eine XSLT Transformation. Also musst du schon eine Programmier-/Skriptsprache mit ins Spiel bringen...z.B. mit Powershell schnell realisierbar.

Bitte nutze Code-Tags für deinen Quellcode: <code> Quellcode </code>, dann sieht man auch wie deine Daten richtig formatiert sind. Was hier essentiell ist.

Gruß grexit
Member: tester23
tester23 Sep 09, 2015 updated at 08:23:33 (UTC)
Goto Top
Hallo Grexit,

danke für die schnelle Antwort.
Du hast Recht, da fehlt noch etwas, es sind mehrere Zähler untereinander die dann jeweils "Aggregate Active Export" und "Aggregate Active Import" haben.
Die XML habe ich manuell geschrieben als Beispiel wie es aussehen soll.

Ich habe die Möglichkeit einen Text-to-Xml-Parser davor zu schalten und der macht mir aus der csv-Datei dann eine XML die wie folgt aussieht:


<?xml version="1.0" encoding="UTF-8"?> 
<flatfile>
    <line cnt="1"> 
        <part cnt="1"><![CDATA[Date]]></part> 
        <part cnt="2"><![CDATA[" ""Time"""]]></part> 
        <part cnt="3"><![CDATA[" ""Service Point"""]]></part> 
        <part cnt="4"><![CDATA[Meter Number]]></part> 
        <part cnt="5"><![CDATA[Channel]]></part> 
        <part cnt="6"><![CDATA[Reading]]></part> 
        <part cnt="7"><![CDATA[Unit]]></part> 
    </line>
    <line cnt="2"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:15]]></part> 
        <part cnt="3"><![CDATA[48001006278]]></part> 
        <part cnt="4"><![CDATA[12345]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Export]]></part> 
        <part cnt="6"><![CDATA[1]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="3"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:30]]></part> 
        <part cnt="3"><![CDATA[48001006278]]></part> 
        <part cnt="4"><![CDATA[12345]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Export]]></part> 
        <part cnt="6"><![CDATA[2]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="4"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:45]]></part> 
        <part cnt="3"><![CDATA[48001006278]]></part> 
        <part cnt="4"><![CDATA[12345]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Export]]></part> 
        <part cnt="6"><![CDATA[3]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="5"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[01:00]]></part> 
        <part cnt="3"><![CDATA[48001006278]]></part> 
        <part cnt="4"><![CDATA[12345]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[4]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="6"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:15]]></part> 
        <part cnt="3"><![CDATA[48001006278]]></part> 
        <part cnt="4"><![CDATA[12345]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[1]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="7"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:30]]></part> 
        <part cnt="3"><![CDATA[48001006278]]></part> 
        <part cnt="4"><![CDATA[12345]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[2]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="8"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:45]]></part> 
        <part cnt="3"><![CDATA[48001006278]]></part> 
        <part cnt="4"><![CDATA[123456]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[3]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="9"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[01:00]]></part> 
        <part cnt="3"><![CDATA[48001006278]]></part> 
        <part cnt="4"><![CDATA[123456]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[4]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="10"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:15]]></part> 
        <part cnt="3"><![CDATA[12345678901]]></part> 
        <part cnt="4"><![CDATA[987654]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Export]]></part> 
        <part cnt="6"><![CDATA[1]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="11"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:30]]></part> 
        <part cnt="3"><![CDATA[12345678901]]></part> 
        <part cnt="4"><![CDATA[987654]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Export]]></part> 
        <part cnt="6"><![CDATA[2]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="12"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:45]]></part> 
        <part cnt="3"><![CDATA[12345678901]]></part> 
        <part cnt="4"><![CDATA[987654]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Export]]></part> 
        <part cnt="6"><![CDATA[3]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="13"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[01:00]]></part> 
        <part cnt="3"><![CDATA[12345678901]]></part> 
        <part cnt="4"><![CDATA[987654]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[4]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="14"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:15]]></part> 
        <part cnt="3"><![CDATA[12345678901]]></part> 
        <part cnt="4"><![CDATA[987654]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[1]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="15"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:30]]></part> 
        <part cnt="3"><![CDATA[12345678901]]></part> 
        <part cnt="4"><![CDATA[987654]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[2]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="16"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[00:45]]></part> 
        <part cnt="3"><![CDATA[12345678901]]></part> 
        <part cnt="4"><![CDATA[987654]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[3]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
    <line cnt="17"> 
        <part cnt="1"><![CDATA[07.09.2015]]></part> 
        <part cnt="2"><![CDATA[01:00]]></part> 
        <part cnt="3"><![CDATA[12345678901]]></part> 
        <part cnt="4"><![CDATA[987654]]></part> 
        <part cnt="5"><![CDATA[Aggregate Active Import]]></part> 
        <part cnt="6"><![CDATA[4]]></part> 
        <part cnt="7"><![CDATA[kW]]></part> 
    </line>
</flatfile>

Gibt es denn so eventuell dann eine Möglichkeit die gewünschte XML-Datei über XSLT zu erstelllen?
Mehr Möglichkeiten habe ich leider in der Software nicht.
Wäre echt genial wenn du mir helfen könntest?

Gruß
tester23
Mitglied: 114757
114757 Sep 09, 2015 updated at 08:06:03 (UTC)
Goto Top
Moinsens,
Bitte nutze für Codes die entsprechende Formatierung für Forum wie @122990 schon geschrieben hat !! Ansonsten gehen hier Sonderzeichen flöten, und du machst es den Beteiligten einfacher wenn sie deine Codes nicht auch noch zusätzlich korrigieren müssen.

DANKE!

Gruß jodel32

p.s. Haben wir jetzt schon zum xten mal erwähnt ...face-sad, langsam nervts
Member: tester23
tester23 Sep 09, 2015 at 08:14:15 (UTC)
Goto Top
Hallo Jodel32,

sorry, nächstes mal werde ich auspassen.

Gruß
tester23
Mitglied: 114757
114757 Sep 09, 2015 updated at 08:18:28 (UTC)
Goto Top
Zitat von @tester23:
sorry, nächstes mal werde ich auspassen.
Nee, nicht nächstes mal, dann hast dus wieder vergessen, wozu gibt es wohl den Link Bearbeiten an deinem Kommentar ?! Das sind zwei kleine Wörter, ist das so schwierig ?
Member: tester23
tester23 Sep 09, 2015 at 08:25:52 (UTC)
Goto Top
Hallo Jodel32,

So, ich habe es gändert, danke für den Hinweis.
Du musst aber bedenken dass nicht jeder der hier schreibt jeden Tag hier ist, kann also mal auch einen Fehler machen oder auch etwas vergessen.

Gruß
tester23
Mitglied: 114757
114757 Sep 09, 2015 updated at 09:16:03 (UTC)
Goto Top
Zitat von @tester23:
Du musst aber bedenken dass nicht jeder der hier schreibt jeden Tag hier ist, kann also mal auch einen Fehler machen oder auch etwas vergessen.
Schon klar, aber wenn es dir jemand direkt in eine Antwort schreibt , sollte man es schon beherzigen einen kleinen Blick in die FAQ zu werfen. "Geben" und "nehmen" lautet hier die Devise.
Mitglied: 122990
122990 Sep 09, 2015 updated at 19:15:47 (UTC)
Goto Top
Zitat von @tester23:
Wäre echt genial wenn du mir helfen könntest?
Ich kann dir leider nur mit Powershell dienen:
$csv = Import-CSV 'C:\input.csv' -Delimiter "`t"  
$smartns = 'http://demo.local'  
$xml = [xml]"<?xml version=""1.0"" encoding=""utf-8""?><smart:measuringdata xmlns:smart=""$smartns""></smart:measuringdata>"  
$csv | group 'Service Point','Channel' | %{  
    $sp_node = $xml.CreateElement('smart:meterreading',$smartns)  
    $att_unit = $xml.CreateAttribute('smart:unit',$smartns)  
    $att_unit.Value = "kWh"  
    [void]$sp_node.Attributes.Append($att_unit)
    
    $att_obis = $xml.CreateAttribute('smart:obis',$smartns)  
    if($_.Group.Channel -like '*import*'){$obis = '1-2.29.0'}else{$obis = '1-1.29.0'}  
    $att_obis.Value = $obis
    [void]$sp_node.Attributes.Append($att_obis)

    $att_id = $xml.CreateAttribute('smart:id',$smartns)  
    $att_id.Value = $_.Group.'Service Point'  
    [void]$sp_node.Attributes.Append($att_id)

    $_.Group | %{
        $value_node = $xml.CreateElement('smart:value',$smartns)  
        $value_node.InnerText = [double]$_.Reading / 4
        $att_date = $xml.CreateAttribute('smart:date',$smartns)  
        $att_date.Value = (get-date "$($_.Date) $($_.Time)" -F 's')  
        [void]$value_node.Attributes.Append($att_date)
        [void]$sp_node.AppendChild($value_node)
    }
    [void]$xml.DocumentElement.AppendChild($sp_node)
}
$xml.Save('C:\output.xml')  
Gruß grexit
Member: tester23
tester23 Sep 09, 2015 at 12:15:01 (UTC)
Goto Top
Hallo Grexit,

danke.
Evtl. kann ich über einen Umweg dann mit Powershell die XML erzeugen (XSL wäre besser).
Aber es gibt trotzdem ein Problem, die Variablen (Zeit, Verbrauchswerte oder smart:id werden nicht in der XML dargestellt oder berechnet).
Ich bekomme da nur Nullwerte zu sehen.
Wie schon gesagt, es sind mehrere Zähler Untereinander und die haben als "Channel" entweder "Aggregate Active Export" das soll dann '1-1.29.0' oder ""Aggregate Active Import" als '1-2.29.0' dargestellt werden.
Diese Unterscheidung wird in deinem Powershell-Script auch nicht gemacht.

Ich selber habe gar keine Auhnung von Power-Shell,von daher weiss ich nicht ob das machbar ist!?

Danke trotzdem schon mal im Voraus.

Gruß
tester23
Mitglied: 122990
122990 Sep 09, 2015 updated at 19:17:05 (UTC)
Goto Top
Zitat von @tester23:
Aber es gibt trotzdem ein Problem, die Variablen (Zeit, Verbrauchswerte oder smart:id werden nicht in der XML dargestellt oder berechnet).
Kann ich nicht nachvollziehen geht hier einwandfrei ...
Ich bekomme da nur Nullwerte zu sehen.
Wie schon gesagt, es sind mehrere Zähler Untereinander und die haben als "Channel" entweder "Aggregate Active Export" das soll dann '1-1.29.0' oder ""Aggregate Active Import" als '1-2.29.0' dargestellt werden.
Diese Unterscheidung wird in deinem Powershell-Script auch nicht gemacht.
Die Kleinigkeit soll mal einer auf anhieb entdecken, wenn man sie nicht explizit erwähnt (da wären wir wieder beim Thema) .... lässt sich aber leicht ändern, trage ich noch nach...
#edit- oben angepasst.
Ich selber habe gar keine Auhnung von Power-Shell,von daher weiss ich nicht ob das machbar ist!?
Gegen Entgelt mach ich dir damit alles.

Mit dieser Quelldatei:
Date	 "Time"	 "Service Point"	"Meter Number"	Channel	Reading	Unit  
07.09.2015	00:15	48001006278	12345	Aggregate Active Export	1	kW
07.09.2015	00:30	48001006278	12345	Aggregate Active Export	2	kW
07.09.2015	00:45	48001006278	12345	Aggregate Active Export	3	kW
07.09.2015	01:00	48001006278	12345	Aggregate Active Export	4	kW
07.09.2015	01:15	48001006278	12345	Aggregate Active Export	5	kW
07.09.2015	01:30	48001006278	12345	Aggregate Active Export	6	kW
07.09.2015	01:45	48001006278	12345	Aggregate Active Export	7	kW
07.09.2015	02:00	48001006278	12345	Aggregate Active Export	8	kW
07.09.2015	00:15	48001006278	67890	Aggregate Active Import	1	kW
07.09.2015	00:30	48001006278	67890	Aggregate Active Import	2	kW
07.09.2015	00:45	48001006278	67890	Aggregate Active Import	3	kW
07.09.2015	01:00	48001006278	67890	Aggregate Active Import	4	kW
07.09.2015	01:15	48001006278	67890	Aggregate Active Import	5	kW
07.09.2015	01:30	48001006278	67890	Aggregate Active Import	6	kW
07.09.2015	01:45	48001006278	67890	Aggregate Active Import	7	kW
07.09.2015	02:00	48001006278	67890	Aggregate Active Import	8	kW
07.09.2015	00:15	12345678901	987654	Aggregate Active Export	1	kW
07.09.2015	00:30	12345678901	987654	Aggregate Active Export	2	kW
07.09.2015	00:45	12345678901	987654	Aggregate Active Export	3	kW
07.09.2015	01:00	12345678901	987654	Aggregate Active Export	4	kW
07.09.2015	01:15	12345678901	987654	Aggregate Active Export	5	kW
07.09.2015	01:30	12345678901	987654	Aggregate Active Export	6	kW
07.09.2015	01:45	12345678901	987654	Aggregate Active Export	7	kW
07.09.2015	02:00	12345678901	987654	Aggregate Active Export	8	kW
07.09.2015	00:15	12345678901	334456	Aggregate Active Import	1	kW
07.09.2015	00:30	12345678901	334456	Aggregate Active Import	2	kW
07.09.2015	00:45	12345678901	334456	Aggregate Active Import	3	kW
07.09.2015	01:00	12345678901	334456	Aggregate Active Import	4	kW
07.09.2015	01:15	12345678901	334456	Aggregate Active Import	5	kW
07.09.2015	01:30	12345678901	334456	Aggregate Active Import	6	kW
07.09.2015	01:45	12345678901	334456	Aggregate Active Import	7	kW
07.09.2015	02:00	12345678901	334456	Aggregate Active Import	8	kW
Ergibt der obige Powershell-Code folgendes Ergebnis:
<?xml version="1.0" encoding="utf-8"?>  
<smart:measuringdata xmlns:smart="http://demo.local">  
  <smart:meterreading smart:unit="kWh" smart:obis="1-1.29.0" smart:id="48001006278">  
    <smart:value smart:date="2015-09-07T00:15:00">0.25</smart:value>  
    <smart:value smart:date="2015-09-07T00:30:00">0.5</smart:value>  
    <smart:value smart:date="2015-09-07T00:45:00">0.75</smart:value>  
    <smart:value smart:date="2015-09-07T01:00:00">1</smart:value>  
    <smart:value smart:date="2015-09-07T01:15:00">1.25</smart:value>  
    <smart:value smart:date="2015-09-07T01:30:00">1.5</smart:value>  
    <smart:value smart:date="2015-09-07T01:45:00">1.75</smart:value>  
    <smart:value smart:date="2015-09-07T02:00:00">2</smart:value>  
  </smart:meterreading>
  <smart:meterreading smart:unit="kWh" smart:obis="1-2.29.0" smart:id="48001006278">  
    <smart:value smart:date="2015-09-07T00:15:00">0.25</smart:value>  
    <smart:value smart:date="2015-09-07T00:30:00">0.5</smart:value>  
    <smart:value smart:date="2015-09-07T00:45:00">0.75</smart:value>  
    <smart:value smart:date="2015-09-07T01:00:00">1</smart:value>  
    <smart:value smart:date="2015-09-07T01:15:00">1.25</smart:value>  
    <smart:value smart:date="2015-09-07T01:30:00">1.5</smart:value>  
    <smart:value smart:date="2015-09-07T01:45:00">1.75</smart:value>  
    <smart:value smart:date="2015-09-07T02:00:00">2</smart:value>  
  </smart:meterreading>
  <smart:meterreading smart:unit="kWh" smart:obis="1-1.29.0" smart:id="12345678901">  
    <smart:value smart:date="2015-09-07T00:15:00">0.25</smart:value>  
    <smart:value smart:date="2015-09-07T00:30:00">0.5</smart:value>  
    <smart:value smart:date="2015-09-07T00:45:00">0.75</smart:value>  
    <smart:value smart:date="2015-09-07T01:00:00">1</smart:value>  
    <smart:value smart:date="2015-09-07T01:15:00">1.25</smart:value>  
    <smart:value smart:date="2015-09-07T01:30:00">1.5</smart:value>  
    <smart:value smart:date="2015-09-07T01:45:00">1.75</smart:value>  
    <smart:value smart:date="2015-09-07T02:00:00">2</smart:value>  
  </smart:meterreading>
  <smart:meterreading smart:unit="kWh" smart:obis="1-2.29.0" smart:id="12345678901">  
    <smart:value smart:date="2015-09-07T00:15:00">0.25</smart:value>  
    <smart:value smart:date="2015-09-07T00:30:00">0.5</smart:value>  
    <smart:value smart:date="2015-09-07T00:45:00">0.75</smart:value>  
    <smart:value smart:date="2015-09-07T01:00:00">1</smart:value>  
    <smart:value smart:date="2015-09-07T01:15:00">1.25</smart:value>  
    <smart:value smart:date="2015-09-07T01:30:00">1.5</smart:value>  
    <smart:value smart:date="2015-09-07T01:45:00">1.75</smart:value>  
    <smart:value smart:date="2015-09-07T02:00:00">2</smart:value>  
  </smart:meterreading>
</smart:measuringdata>
Mehr kann ich für dich hier nicht tun...

Gruß grexit
Member: tester23
tester23 Sep 14, 2015 at 12:43:17 (UTC)
Goto Top
Hallo Gerxit,

deine Lösung funktioniert, iist aber in meinem Fall nicht anwendbar.
Danke trotzdem.

Da es leider keine anderen Lösungen gibt, schliesse ich die Frage.

Gruß
tester23