コード例 #1
0
  private MTO_376 PutInCommandItem(
      Map datacellParams,
      CircleDataItems circleDataItems,
      String commandItemCode,
      String LogicAddress,
      int MpSn) {
    MTO_376 MTO = new MTO_376();
    CollectObject object = new CollectObject();
    CommandItem citem = new CommandItem();
    if (datacellParams != null) citem.setDatacellParam(datacellParams);
    if (circleDataItems != null) {
      citem.setCircleDataItems(circleDataItems);
      citem.setCircleLevel(1);
    }

    citem.setIdentifier(commandItemCode); // 终端上行通信口通信参数设置
    object.AddCommandItem(citem);
    object.setLogicalAddr(LogicAddress);
    object.setEquipProtocol("01");
    object.setMpSn(new int[] {MpSn});

    MTO.getCollectObjects().add(object);

    return MTO;
  }
コード例 #2
0
  //  @Test
  public void testReadEquipmentParametersF10() throws Exception {
    Map datacellParams10 = new TreeMap();
    datacellParams10.put("1004001001", "1"); // 主用IP地址和端口

    CircleDataItems circleDataItems = new CircleDataItems();
    for (int i = 1; i <= 3; i++) {
      DataItemGroup group = new DataItemGroup();
      group.AddDataItem(
          new DataItem("1004001002000" + i, String.valueOf(i))); // 本次配置第0001块电能表/交流采样装置序号
      circleDataItems.AddDataItemGroup(group);
    }

    CommandItem commandItem = new CommandItem();
    commandItem.setIdentifier("10040010");
    commandItem.setDatacellParam(datacellParams10);
    commandItem.setCircleDataItems(circleDataItems);

    CollectObject obj = new CollectObject();
    obj.setLogicalAddr("96123456");
    obj.setMpSn(new int[] {0});
    obj.AddCommandItem(commandItem);

    MTO_376 MTO3 = new MTO_376();
    MTO3.addCollectObject(obj);

    RealTimeProxy376 instance = proxy;
    long SequenceCode = instance.readParameters(MTO3);

    //        this.taskService.insertRecvMsg(SequenceCode, "96123456", "55 68 A2 00 A2 00 68 98 12
    // 96 56 34 00 0A 60 00 00 04 00 C0 A8 00 01 90 1F C0 A8 00 02 90 1F 5A 4A 44 4C 2E 5A 4A 00 00
    // 00 00 00 00 00 00 00 6F 16 55 ");
    //        this.taskService.insertRecvMsg(SequenceCode, "96123456", "55 68 A2 00 A2 00 68 98 12
    // 96 56 34 00 0A 60 00 00 04 00 C0 A8 00 01 90 1F C0 A8 00 02 90 1F 5A 4A 44 4C 2E 5A 4A 00 00
    // 00 00 00 00 00 00 00 6F 16 55 ");

    //        Map datacellParams10 = new TreeMap();
    //        datacellParams10.put("1004001001","1");//本次电能表/交流采样装置配置数量
    //        CircleDataItems circleDataItems = new CircleDataItems();
    //        DataItemGroup diGroup1 = new DataItemGroup();
    //        diGroup1.AddDataItem(new DataItem("10040010020001","1"));//本次配置第0001块电能表/交流采样装置序号
    //        diGroup1.AddDataItem(new DataItem("10040010030001","1"));//本次配置第0001块电能表/交流采样装置所属测量点号
    //        diGroup1.AddDataItem(new DataItem("10040010040001","6"));//本次配置第0001块电能表/交流采样装置通信波特率
    //        diGroup1.AddDataItem(new DataItem("10040010050001","1"));//本次配置第0001块电能表/交流采样装置通信端口号
    //        diGroup1.AddDataItem(new
    // DataItem("10040010060001","100"));//本次配置第0001块电能表/交流采样装置通信协议类型
    //        diGroup1.AddDataItem(new DataItem("10040010070001","0"));//本次配置第0001块电能表/交流采样装置通信地址
    //        diGroup1.AddDataItem(new DataItem("10040010080001","0"));//本次配置第0001块电能表/交流采样装置通信密码
    //        diGroup1.AddDataItem(new
    // DataItem("10040010100001","000001"));//本次配置第0001块电能表/交流采样装置电能费率个数
    //        diGroup1.AddDataItem(new
    // DataItem("10040010120001","00"));//本次配置第0001块电能表/交流采样装置有功电能示值的整数位个数
    //        diGroup1.AddDataItem(new
    // DataItem("10040010130001","00"));//本次配置第0001块电能表/交流采样装置有功电能示值的小数位个数
    //        diGroup1.AddDataItem(new
    // DataItem("10040010140001","999999999999"));//本次配置第0001块电能表/交流采样装置所属采集器通信地址
    //        diGroup1.AddDataItem(new
    // DataItem("10040010150001","0000"));//本次配置第0001块电能表/交流采样装置所属的用户大类号
    //        diGroup1.AddDataItem(new
    // DataItem("10040010160001","0000"));//本次配置第0001块电能表/交流采样装置所属的用户小类号

    //        expResult.put("96123456#0#10040010",MapDataItem);
    //        Map result = instance.getReturnByREP(SequenceCode);
    //        assertEquals(expResult, result);
  }