| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.DecimalFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | int sumNum = results.size(); |
| | | double co2, o2, ph3, n2; |
| | | DecimalFormat df = new DecimalFormat("#0.00"); |
| | | double sumO2 = 0.0, sumCo2 = 0.0, sumPh3 = 0.0, sumN2 = 0.0; |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (ModbusGasResult gasResult : results) { |
| | | //二氧化碳,单位:PPM,直接使用 |
| | | co2 = gasResult.getCo2().doubleValue(); |
| | | o2 = gasResult.getO2().doubleValue(); |
| | | //氧气,除以10,单位:百分比 |
| | | o2 = Double.valueOf(df.format(gasResult.getO2().doubleValue()*0.1)); |
| | | //磷化氢,单位:PPM,直接使用 |
| | | ph3 = gasResult.getPh3().doubleValue(); |
| | | n2 = -100; |
| | | |
| | | //TODO >>>>> 根据返回值进行判断和转换 |
| | | |
| | | n2 = Double.valueOf(df.format(99.9 - o2));; |
| | | |
| | | if (gas.getPerCo2Max() < co2) { |
| | | gas.setPerCo2Max(co2); |