Create ACTION_SCHEDULE

3 posts / 0 new
Last post
imand
Create ACTION_SCHEDULE

Dear Team,

I'm trying to write four schedules to a meter. But I'm getting Data Block Unavailable all the time.
I suspect it has something to do with default values inserted by GDXDateTime.

Here is the my Java code. I copied this from one of your posts.

GXReplyData reply = new GXReplyData();
GXDLMSActionSchedule ac = new GXDLMSActionSchedule("0.0.15.128.3.255");

GXTime schedule[] = { new GXTime(255, 0, 0, 0), new GXTime(255, 15, 0, 0),
new GXTime(255, 30, 0, 0), new GXTime(255, 45, 0, 0) };
ac.setExecutionTime(schedule);
try {
byte[][] result = client.write(ac, 4);
readDataBlock(result, reply);
} catch (Exception e) {
e.printStackTrace();
}

Here is the XML trace.

<TargetAddress Value="1" />
<SourceAddress Value="1" />
<PDU>
<SetRequest>
<SetRequestNormal>
<!--Priority: HIGH ServiceClass: CONFIRMED invokeID: 1-->
<InvokeIdAndPriority Value="193" />
<AttributeDescriptor>
<!--ACTION_SCHEDULE-->
<ClassId Value="22" />
<!--0.0.15.128.3.255-->
<InstanceId Value="00000F8003FF" />
<AttributeId Value="4" />
</AttributeDescriptor>
<Value>
<Array Qty="4" >
<Structure Qty="2" >
<OctetString Value="FF0000FF" />
<OctetString Value="FFFFFFFF05" />
</Structure>
<Structure Qty="2" >
<OctetString Value="FF0F00FF" />
<OctetString Value="FFFFFFFF05" />
</Structure>
<Structure Qty="2" >
<OctetString Value="FF1E00FF" />
<OctetString Value="FFFFFFFF05" />
</Structure>
<Structure Qty="2" >
<OctetString Value="FF2D00FF" />
<OctetString Value="FFFFFFFF05" />
</Structure>
</Array>
</Value>
</SetRequestNormal>
</SetRequest>
</PDU>
</WRAPPER>

A default milliseconds (hundredths) is inserted: FF. I wanted to set it to 0 but it's overwritten. How do I keep the 0?

A default week value is added to the date: 05. It should be FF. How do I change it to FF?

Thanks in advance.

Dayah

Kurumi
Kurumi's picture

Hi,

There is a historical reason for this because hundredths was causing problems with some big meter manufacturers. For this reason, hundredths are skipped if it's zero.
You need to remove it by yourself. Like this:

GXTime value = new GXTime(255, 0, 0, 0);
value.getSkip().remove(DateTimeSkips.MILLISECOND);

DayOfWeek should be ignored by default when you create the time object, but it's missing from this constructor. It's added to the next version. In the meantime you can add it like this:

You can ignore week date like this:
value.getSkip().add(DateTimeSkips.DAY_OF_WEEK);

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

imand

Hi Mikko,

That did it. I needed to set the MILLISECOND to 0 again after removing the skipping value.

<WRAPPER len="83" >
<TargetAddress Value="1" />
<SourceAddress Value="1" />
<PDU>
<SetRequest>
<SetRequestNormal>
<!--Priority: HIGH ServiceClass: CONFIRMED invokeID: 1-->
<InvokeIdAndPriority Value="193" />
<AttributeDescriptor>
<!--ACTION_SCHEDULE-->
<ClassId Value="22" />
<!--0.0.15.128.3.255-->
<InstanceId Value="00000F8003FF" />
<AttributeId Value="4" />
</AttributeDescriptor>
<Value>
<Array Qty="4" >
<Structure Qty="2" >
<OctetString Value="FF000000" />
<OctetString Value="FFFFFFFFFF" />
</Structure>
<Structure Qty="2" >
<OctetString Value="FF0F0000" />
<OctetString Value="FFFFFFFFFF" />
</Structure>
<Structure Qty="2" >
<OctetString Value="FF1E0000" />
<OctetString Value="FFFFFFFFFF" />
</Structure>
<Structure Qty="2" >
<OctetString Value="FF2D0000" />
<OctetString Value="FFFFFFFFFF" />
</Structure>
</Array>
</Value>
</SetRequestNormal>
</SetRequest>
</PDU>
</WRAPPER>

Thank you! Really appreciated it.

I have another question regarding meter firmware version check. I will create another post for this.

Dayah