| | |
| | | private double chargeEnergy; private double dischargeEnergy; |
| | | BtsCycleAccumulator(BtsHistoryRecord first) { cycle = first.cycleNo(); } |
| | | void add(BtsHistoryRecord item) { count++; if (first == null) first = item.deviceTime(); last = item.deviceTime(); maximumCapacity = Math.max(maximumCapacity, item.capacityAh()); minimumCapacity = Math.min(minimumCapacity, item.capacityAh()); if (item.currentA() >= 0) chargeEnergy = Math.max(chargeEnergy, item.energyWh()); else dischargeEnergy = Math.max(dischargeEnergy, Math.abs(item.energyWh())); } |
| | | BtsCycleRecord finish() { double charge = Math.max(0d, maximumCapacity); double discharge = Math.max(0d, maximumCapacity - minimumCapacity); return new BtsCycleRecord(cycle, count, first, last, charge, discharge, chargeEnergy, dischargeEnergy, efficiency(charge, discharge)); } |
| | | BtsCycleRecord finish() { double charge = Math.max(0d, maximumCapacity); double discharge = Math.max(0d, maximumCapacity - minimumCapacity); return new BtsCycleRecord("", cycle, count, first, last, charge, discharge, chargeEnergy, dischargeEnergy, efficiency(charge, discharge)); } |
| | | } |
| | | |
| | | private java.util.Set<String> requestedChannels(String request) |
| | |
| | | assertEquals(60L, records.get(1).deviceTime().getEpochSecond() - records.get(0).deviceTime().getEpochSecond()); |
| | | assertEquals(1, records.get(0).cycleNo()); |
| | | assertTrue(simulator.btsSteps(1, 1).stream().anyMatch(step -> step.stepNo() == 1)); |
| | | assertTrue(simulator.btsCycles(1, 1).stream().anyMatch(cycle -> cycle.cycleNo() == 1)); |
| | | var cycle = simulator.btsCycles(1, 1).stream().filter(item -> item.cycleNo() == 1).findFirst().orElseThrow(); |
| | | assertTrue(cycle.chargeCapacityAh() >= 0d); |
| | | assertTrue(cycle.dischargeCapacityAh() >= 0d); |
| | | assertEquals(cycle.chargeCapacityAh() > 0d ? cycle.dischargeCapacityAh() / cycle.chargeCapacityAh() * 100d : 0d, |
| | | cycle.efficiency(), 0.000001d); |
| | | } |
| | | } |
| | | |