Hi Mikko,
I have to write the following array in the meter.
<Array Qty="01">
<Array Qty="02">
<Structure Qty="02">
<OctetString Value="070000FF"/>
<OctetString Value="060000FF"/>
</Structure>
<Structure Qty="02">
<OctetString Value="080000FF"/>
<OctetString Value="090000FF"/>
</Structure>
</Array >
</Array>
Can you please provide c# code for the same
As I got below from my code. where second node coming as structure instead of Array.
<Array Qty="01">
<Structure Qty="02">
<Structure Qty="02">
<OctetString Value="070000FF"/>
<OctetString Value="060000FF"/>
</Structure>
<Structure Qty="02">
<OctetString Value="080000FF"/>
<OctetString Value="090000FF"/>
</Structure>
</Structure>
</Array>
Can you please provide…
Can you please provide update on this?
Hi, You can do it like this:…
Hi,
You can do it like this:
GXArray arr1 = new GXArray();
GXArray arr2 = new GXArray();
GXStructure s1= new GXStructure();
GXStructure s2 = new GXStructure();
arr1.Add(arr2);
arr2.Add(s1);
arr2.Add(s2);
s1.Add(GXDLMSTranslator.HexToBytes("070000FF"));
s1.Add(GXDLMSTranslator.HexToBytes("060000FF"));
s2.Add(GXDLMSTranslator.HexToBytes("080000FF"));
s2.Add(GXDLMSTranslator.HexToBytes("090000FF"));
BR,
Mikko
Hi Mikko, Thanks for the…
Hi Mikko,
Thanks for the update.
I have multiple entires in the array.
with this code still second node coming as Structure. By default it takes structure, Can you please suggest what to update in code to get as array.
<Array Qty="02" >
<Structure Qty="02" >
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 08:00:*
<OctetString Value="0800FFFF" />
# 08:00:*
<OctetString Value="0800FFFF" />
</Structure>
</Structure>
<Structure Qty="02" >
<Structure Qty="02" >
# 05:00:*
<OctetString Value="0500FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 07:00:*
<OctetString Value="0700FFFF" />
</Structure>
</Structure>
</Array>
I want output as below
<Array Qty="03" >
<Array Qty="02" >
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 08:00:*
<OctetString Value="0800FFFF" />
# 08:00:*
<OctetString Value="0800FFFF" />
</Structure>
</Array>
<Array Qty="02" >
<Structure Qty="02" >
# 05:00:*
<OctetString Value="0500FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 07:00:*
<OctetString Value="0700FFFF" />
</Structure>
</Array >
</Array>
my c# code is as below
GXArray gXSchedulerArray = new GXArray();
foreach (Month month in SchedulerMonth)
{
GXArray gXMonthArray = new GXArray();
// -------- Quarter 1 ---------
GXStructure gxStructQtr1 = new GXStructure();
GXTime gXTimeQtr1On = new GXTime(month.Quater1.RelayOnTime);
GXTime gXTimeQtr1Off = new GXTime(month.Quater1.RelayOFFTime);
gxStructQtr1.Add(GXDLMSTranslator.HexToBytes(gXTimeQtr1On.ToHex(false, true))); // Add GXTime object
gxStructQtr1.Add(GXDLMSTranslator.HexToBytes(gXTimeQtr1Off.ToHex(false, false))); // Add GXTime object
// -------- Quarter 2 ---------
GXStructure gxStructQtr2 = new GXStructure();
GXTime gXTimeQtr2On = new GXTime(month.Quater2.RelayOnTime);
GXTime gXTimeQtr2Off = new GXTime(month.Quater2.RelayOFFTime);
gxStructQtr2.Add(GXDLMSTranslator.HexToBytes(gXTimeQtr2On.ToHex(false,true))); // Add GXTime object
gxStructQtr2.Add(GXDLMSTranslator.HexToBytes(gXTimeQtr2On.ToHex(false, true))); // Add GXTime objec
// Add both structures into month array
gXMonthArray.Add(gxStructQtr1);
gXMonthArray.Add(gxStructQtr2);
gXSchedulerArray.Add(gXMonthArray);
}
Hi, Use the code that I…
Hi,
Use the code that I shared as a template. It will generate the correct structure.
BR,
Mikko
Hi Mikko, I have used the…
Hi Mikko,
I have used the same structure, but still not generating the expected structure.
Please check and give me the updated code template.
<SetRequest>
<SetRequestNormal>
# Priority: High, ServiceClass: Confirmed, Invoke ID: 1
<InvokeIdAndPriority Value="C1" />
<AttributeDescriptor>
# Data
<ClassId Value="0001" />
# 1.0.128.8.128.255
<InstanceId Value="0100800880FF" />
# Value
<AttributeId Value="02" />
</AttributeDescriptor>
<Value>
<Array Qty="03" >
<Structure Qty="02" > <== This should come as array instead of Structure
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 08:00:*
<OctetString Value="0800FFFF" />
# 08:00:*
<OctetString Value="0800FFFF" />
</Structure>
</Structure>
<Structure Qty="02" >
<Structure Qty="02" >
# 05:00:*
<OctetString Value="0500FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 07:00:*
<OctetString Value="0700FFFF" />
</Structure>
</Structure>
<Structure Qty="02" >
<Structure Qty="02" >
# 05:00:*
<OctetString Value="0500FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 07:00:*
<OctetString Value="0700FFFF" />
</Structure>
</Structure>
</Structure>
</Array>
</Value>
</SetRequestNormal>
</SetRequest>
I want as below
<SetRequest>
<SetRequestNormal>
# Priority: High, ServiceClass: Confirmed, Invoke ID: 1
<InvokeIdAndPriority Value="C1" />
<AttributeDescriptor>
# Data
<ClassId Value="0001" />
# 1.0.128.8.128.255
<InstanceId Value="0100800880FF" />
# Value
<AttributeId Value="02" />
</AttributeDescriptor>
<Value>
<Array Qty="03" >
<Array Qty="02" >
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 08:00:*
<OctetString Value="0800FFFF" />
# 08:00:*
<OctetString Value="0800FFFF" />
</Structure>
</Array >
<Array Qty="02" >
<Structure Qty="02" >
# 05:00:*
<OctetString Value="0500FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 07:00:*
<OctetString Value="0700FFFF" />
</Structure>
</Array >
<Array Qty="02" >
<Structure Qty="02" >
# 05:00:*
<OctetString Value="0500FFFF" />
# 06:00:*
<OctetString Value="0600FFFF" />
</Structure>
<Structure Qty="02" >
# 07:00:*
<OctetString Value="0700FFFF" />
# 07:00:*
<OctetString Value="0700FFFF" />
</Structure>
</Array >
</Array>
</Value>
</SetRequestNormal>
</SetRequest>
Hi Mikko, I have used same…
Hi Mikko,
I have used same template as you have provided. From that also I am getting structure elements instead of Array element (second node)
Please check and provide updated template.
0001003000010040d13e3000000004483c2ceb395d0462ef5b0ff28ae7187c807674f75f36b24ee2cee3534223a5e332584c5cc2ef388702bd711c1ae0b3ab9457fbee49c7d9526c
------------------------------
BlockCipher key: 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
Authentication Key:32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
1: 00 01 00 30 00 01 00 40 D1 3E 30 00 00 00 04 48 3C 2C EB 39 5D 04 62 EF 5B 0F F2 8A E7 18 7C 80 76 74 F7 5F 36 B2 4E E2 CE E3 53 42 23 A5 E3 32 58 4C 5C C2 EF 38 87 02 BD 71 1C 1A E0 B3 AB 94 57 FB EE 49 C7 D9 52 6C
<WRAPPER len="40" >
<SourceAddress Value="30" />
<TargetAddress Value="1" />
<PDU>
<!-- Invocation Counter: 4 -->
<!-- Decrypt data: C1 01 C1 00 01 01 00 80 08 80 FF 02 00 01 01 02 02 02 02 09 04 07 00 00 FF 09 04 06 00 00 FF 02 02 09 04 08 00 00 FF 09 04 09 00 00 FF
<SetRequest>
<SetRequestNormal>
# Priority: High, ServiceClass: Confirmed, Invoke ID: 1
<InvokeIdAndPriority Value="C1" />
<AttributeDescriptor>
# Data
<ClassId Value="0001" />
# 1.0.128.8.128.255
<InstanceId Value="0100800880FF" />
# Value
<AttributeId Value="02" />
</AttributeDescriptor>
<Value>
<Array Qty="01" >
<Structure Qty="02" > ==============> This should come as array
<Structure Qty="02" >
# 07:00:00
<OctetString Value="070000FF" />
# 06:00:00
<OctetString Value="060000FF" />
</Structure>
<Structure Qty="02" >
# 08:00:00
<OctetString Value="080000FF" />
# 09:00:00
<OctetString Value="090000FF" />
</Structure>
</Structure>
</Array>
</Value>
</SetRequestNormal>
</SetRequest>
-->
<ded_SetRequest Value="3000000004483C2CEB395D0462EF5B0FF28AE7187C807674F75F36B24EE2CEE3534223A5E332584C5CC2EF388702BD711C1AE0B3AB9457FBEE49C7D9526C" />
</PDU>
</WRAPPER>
Can you please provide an…
Can you please provide an update ?