| | |
| | | boolean charging = current.signum() >= 0; |
| | | BigDecimal capacity = charging ? row.getChargeCapacityAh() : row.getDischargeCapacityAh(); |
| | | BigDecimal energy = charging ? row.getChargeEnergyWh() : row.getDischargeEnergyWh(); |
| | | // 实时行同样带上方向(类型与名称):甲方那一列「状态」显示的就是它,实时页的"工步名称"要用。 |
| | | StepDirection direction = directionOf(row); |
| | | return new CabinetRealtime(row.getRecordSequence() == null ? 0L : row.getRecordSequence(), |
| | | row.getDeviceTimeUtc() == null ? null : row.getDeviceTimeUtc().toInstant(), |
| | | current.doubleValue(), decimal(row.getVoltageV()), decimal(capacity), decimal(energy), |
| | | row.getCycleNo() == null ? 0 : row.getCycleNo(), row.getStepNo() == null ? 0 : row.getStepNo(), |
| | | null, null, row.getReceivedAtUtc() == null ? null : row.getReceivedAtUtc().toInstant(), |
| | | // 注意参数次序:CabinetRealtime 是 stepName 在前、stepType 在后。 |
| | | direction.displayName(), direction.label(), |
| | | row.getReceivedAtUtc() == null ? null : row.getReceivedAtUtc().toInstant(), |
| | | row.getDeviceTimeRaw(), row.getTimezoneId(), |
| | | row.getRelativeTimeSeconds() == null ? null : row.getRelativeTimeSeconds().longValue(), |
| | | "push:" + row.getRecordKey()); |
| | | } |
| | | |
| | | /** |
| | | * 单行的方向:这一类来源没有设备侧工步类型,方向只能由电流符号判定(ADR-0067), |
| | | * 恒正充电、恒负放电、恒为零搁置,电流缺失保持未知。 |
| | | */ |
| | | private static StepDirection directionOf(TDeviceIngestRecord row) |
| | | { |
| | | BigDecimal current = row.getCurrentA(); |
| | | if (current == null) return StepDirection.UNKNOWN; |
| | | if (current.signum() > 0) return StepDirection.CHARGE; |
| | | if (current.signum() < 0) return StepDirection.DISCHARGE; |
| | | return StepDirection.REST; |
| | | } |
| | | |
| | | // ------------------------------------------------------------------ 工步与循环的推导(ADR-0067) |
| | | |
| | | /** 分段推导的结果:来源库、已结束的各段,以及仍在进行的那一段所属的循环号。 */ |