yeg
4 天以前 3194ad3ce5526148df9009aeaa917b888dc53b40
battery-device-neware/src/main/java/com/battery/device/neware/NewareMysqlAdapter.java
@@ -54,7 +54,8 @@
 * </ul>
 *
 * <p>单位换算按实测公式:电压与电流除以 10000(原单位 0.1 mV / 0.1 mA),容量与能量除以 36000000
 * (原单位 1e-4 C / 1e-4 J)。工步类型保留设备给出的数字,不按电流符号猜测方向;
 * (原单位 1e-4 C / 1e-4 J)。工步类型保留设备给出的数字,不按电流符号猜测方向;工步名称由该类型
 * 经 {@link NewareStepDirectionResolver} 解释出的方向名称填写(未确认取值留空,ADR-0067 §4b);
 * 内阻与温度的单位语义仍未确认,因此不对外暴露。
 */
public final class NewareMysqlAdapter implements DeviceAdapter, TestDataObservationAdapter
@@ -436,8 +437,8 @@
    }
    /**
     * 一条工步记录。工步时间取设备给的 {@code test_time}(毫秒 → 秒),四组容量能量与中值电压
     * 放进扩展测量;单项容量只在方向已确认时给出。
     * 一条工步记录。工步名称是设备工步类型解释出的方向名称(类型未确认时留空);工步时间取设备给的
     * {@code test_time}(毫秒 → 秒),四组容量能量与中值电压放进扩展测量;单项容量只在方向已确认时给出。
     */
    private StepRecord stepRecord(long testId, StepGroup group)
    {
@@ -475,7 +476,7 @@
        Double capacityAh = capacity == null ? null : scaled(capacity, CAPACITY_ENERGY_DIVISOR);
        Double energyWh = energy == null ? null : scaled(energy, CAPACITY_ENERGY_DIVISOR);
        return new StepRecord(sourceRecordId(testId, "step", group.key().cycle() + ":" + group.key().stepId()),
                group.key().cycle(), group.key().stepId(), null, last.stepType(), first.deviceTime(),
                group.key().cycle(), group.key().stepId(), direction.displayName(), last.stepType(), first.deviceTime(),
                last.deviceTime(), scaled(last.voltage(), VOLTAGE_CURRENT_DIVISOR),
                scaled(last.current(), VOLTAGE_CURRENT_DIVISOR), capacityAh, energyWh,
                last.deviceTimeRaw(), deviceZone.getId(), last.deviceTime(), measurements);
@@ -527,7 +528,9 @@
        BigDecimal energy = charging ? row.energyCharge() : row.energyDischarge();
        return new CabinetRealtime(row.sequenceId(), row.deviceTime(), scaled(row.current(), VOLTAGE_CURRENT_DIVISOR),
                scaled(row.voltage(), VOLTAGE_CURRENT_DIVISOR), scaled(capacity, CAPACITY_ENERGY_DIVISOR),
                scaled(energy, CAPACITY_ENERGY_DIVISOR), row.cycle(), row.stepId(), null, row.stepType(),
                scaled(energy, CAPACITY_ENERGY_DIVISOR), row.cycle(), row.stepId(),
                // 工步名称填设备工步类型解释出的方向名称;类型未确认时留空,不用默认名冒充已知。
                directions.resolve(row.stepType()).displayName(), row.stepType(),
                clock.instant(), row.deviceTimeRaw(), deviceZone.getId(),
                row.testTimeMillis() == null ? null : row.testTimeMillis() / 1000,
                "neware:" + row.testId() + ":" + row.sequenceId());