| | |
| | | @TableField("gp_monitorerr_st") |
| | | @ApiModelProperty("高频监控单元故障-使用状态[0-真实值 1-模拟值]-CPSS") |
| | | private Integer gpMonitorErrSt; |
| | | |
| | | @TableField("breaker_state1") |
| | | @ApiModelProperty("'bit0-JK11 bit1-JK12 ....[1-分闸 0-合闸]") |
| | | private Integer breakerState1; |
| | | |
| | | @TableField("breaker_state2") |
| | | @ApiModelProperty("bit0-DK18 bit1-DK19.....[1-分闸 0-合闸") |
| | | private Integer breakerState2; |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private List<CKPowerDevBreakAlarmConfig> breakerAlmConifgList; |
| | | |
| | | |
| | | @ApiModelProperty(value = "断路器分合闸对应数据库字段名称") |
| | | private Integer switchNodeName; |
| | | |
| | | @ApiModelProperty(value = "断路器分合闸对应位") |
| | | private Integer switchNodeBit; |
| | | |
| | | } |
| | |
| | | QueryWrapper<CKPowerDevSignal> query = Wrappers.query(); |
| | | query.last(" limit 1"); |
| | | CKPowerDevSignal switchReal=mapper.selectOne(query); |
| | | int onSwitch=0; |
| | | int breakSwitch=0; |
| | | int offSwitch=0; |
| | | if(switchReal!=null){ |
| | | //交流微段开关 |
| | | if (switchReal.getAc1InSwitchTripSt()==0){ |
| | | onSwitch+=CommonUtil.getIntToBinary(switchReal.getAc1InSwitchTripReal(),new int[]{0}); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getAc1InSwitchTripReal(),new int[]{0}); |
| | | }else{ |
| | | onSwitch+=CommonUtil.getIntToBinary(switchReal.getAc1InSwitchTripFake(),new int[]{0}); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getAc1InSwitchTripFake(),new int[]{0}); |
| | | } |
| | | //1段交流 |
| | | if(switchReal.getAc1OutSwitch1TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | |
| | | } |
| | | /*if(switchReal.getAc1OutSwitch2TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch2TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch2TripFake()); |
| | | } |
| | | if(switchReal.getAc1OutSwitch3TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch3TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch3TripFake()); |
| | | } |
| | | if(switchReal.getAc1OutSwitch4TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch4TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc1OutSwitch4TripFake()); |
| | | }*/ |
| | | |
| | | //交流微段开关 |
| | | if (switchReal.getAc2InSwitchTripSt()==0){ |
| | | onSwitch+=CommonUtil.getIntToBinary(switchReal.getAc2InSwitchTripReal(),new int[]{0}); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getAc2InSwitchTripReal(),new int[]{0}); |
| | | }else{ |
| | | onSwitch+=CommonUtil.getIntToBinary(switchReal.getAc2InSwitchTripFake(),new int[]{0}); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getAc2InSwitchTripFake(),new int[]{0}); |
| | | } |
| | | //2段交流 |
| | | if(switchReal.getAc2OutSwitch1TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | } |
| | | /* if(switchReal.getAc2OutSwitch2TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch2TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch2TripFake()); |
| | | } |
| | | if(switchReal.getAc2OutSwitch3TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch3TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch3TripFake()); |
| | | } |
| | | if(switchReal.getAc2OutSwitch4TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch4TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getAc2OutSwitch4TripFake()); |
| | | }*/ |
| | | |
| | | //直流微段开关 |
| | | if (switchReal.getDcIn1SwitchTripSt()==0){ |
| | | onSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn1SwitchTripReal(),new int[]{0}); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn1SwitchTripReal(),new int[]{0}); |
| | | }else{ |
| | | onSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn1SwitchTripFake(),new int[]{0}); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn1SwitchTripFake(),new int[]{0}); |
| | | } |
| | | //1段直流 |
| | | if(switchReal.getDc1Switch1TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | |
| | | } |
| | | /* if(switchReal.getDc1Switch2TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch2TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch2TripFake()); |
| | | } |
| | | if(switchReal.getDc1Switch3TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch3TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch3TripFake()); |
| | | } |
| | | if(switchReal.getDc1Switch4TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch4TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc1Switch4TripFake()); |
| | | }*/ |
| | | |
| | | |
| | | //直流微段开关 |
| | | if (switchReal.getDcIn2SwitchTripSt()==0){ |
| | | onSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn2SwitchTripReal(),new int[]{0}); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn2SwitchTripReal(),new int[]{0}); |
| | | }else{ |
| | | onSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn2SwitchTripFake(),new int[]{0}); |
| | | breakSwitch+=CommonUtil.getIntToBinary(switchReal.getDcIn2SwitchTripFake(),new int[]{0}); |
| | | } |
| | | //2段直流 |
| | | if(switchReal.getDc2Switch1TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch1TripReal(),new int[]{0,1,2,3,4,5,6,7}); |
| | | |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | breakSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch1TripFake(),new int[]{0,1,2,3,4,5,6,7}); |
| | | } |
| | | /*if(switchReal.getDc2Switch2TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch2TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch2TripFake()); |
| | | } |
| | | if(switchReal.getDc2Switch3TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch3TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch3TripFake()); |
| | | } |
| | | if(switchReal.getDc2Switch4TripSt()==0){//真实值 |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch4TripReal()); |
| | | }else{ |
| | | onSwitch+= CommonUtil.getIntToBinary(switchReal.getDc2Switch4TripFake()); |
| | | }*/ |
| | | //统计分闸 |
| | | offSwitch+=CommonUtil.getIntToBinary(switchReal.getBreakerState1(),new int[]{0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24}); |
| | | offSwitch+=CommonUtil.getIntToBinary(switchReal.getBreakerState2(),new int[]{0,1,2,3,4,5,6,7,9,10}); |
| | | |
| | | map.put("recordTime", DateUtil.format_YYYY_MM_DD_HH_MM_SS(switchReal.getRecordTime())); |
| | | } |
| | | map.put("onSwitch",String.valueOf(onSwitch)); |
| | | |
| | | //获取总的启用断路器开关数 |
| | | int swtichAll=breakerInfMapper.getSwtichAll(); |
| | | map.put("offSwitch",String.valueOf(swtichAll-onSwitch)); |
| | | map.put("offSwitch",String.valueOf(offSwitch)); |
| | | map.put("onSwitch",String.valueOf(swtichAll-offSwitch)); |
| | | map.put("breakSwitch",String.valueOf(breakSwitch)); |
| | | return new Response().set(1,map); |
| | | } |
| | | } |
| | |
| | | //将数转换成二进制字符串并统计1的个数 |
| | | public static int getIntToBinary(int switchState,int[] bit){ |
| | | int count=0; |
| | | /*int ss=switchState&(1<<bit); |
| | | while (ss != 0){ |
| | | ss = ss & (ss - 1); |
| | | count++; |
| | | }*/ |
| | | if(bit.length>0){ |
| | | for (int i=0;i<bit.length;i++){ |
| | | int ss=switchState&(1<<bit[i]); |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(getIntToBinary(15,new int[]{0,1,2,3})); |
| | | System.out.println(getIntToBinary(15,new int[]{0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24})); |
| | | } |
| | | } |