本文主要是介绍风扇开启执行逻辑,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
执行流程
public static void businessExecutionWork(){//以下为业务逻辑部分System.out.println("1、根据电池包控制风扇服务执行 开始!");//1、获取电池包电压、电流、环境温度//获取电池包电压、电流、环境温度ObtainBatteryDataService obtainBatteryDataService = new ObtainBatteryDataServiceImpl();List<ObtainBatteryBean> sendObtainBatteryData= obtainBatteryDataService.obtainBatteryDataList(BATTERY_ID);//2、通过CAN总线发送 CAN信号到总控制系统CanChannelUtil canChannelUtil = new CanChannelUtil();canChannelUtil.sendObtainBattery(sendObtainBatteryData);System.out.println("2、通过CAN总线发送 CAN信号到总控制系统!");//3、总控制系统接收CAN信号MainCenterBussinessService mainCenterBussinessService = new MainCenterBussinessServiceImpl();List<ObtainBatteryBean> receiveObtainBatteryData= canChannelUtil.receiveObtainBattery();//4、对电池包电压、电流、环境温度监测System.out.println("4、对电池包电压、电流、环境温度监测!");boolean status = mainCenterBussinessService.checkBatterystatus(receiveObtainBatteryData);//5、根据电池包电压、电流、环境温度控制风扇System.out.println("5、根据电池包控制风扇服务执行!");if(status){//控制风扇打开 打开时间为1分钟!mainCenterBussinessService.fanHeatExchanger(true);}else{mainCenterBussinessService.fanHeatExchanger(false);}//6、根据电池包控制风扇服务执行 结束System.out.println("6、根据电池包控制风扇服务执行 结束!");}
监测风扇
public boolean checkBatterystatus(List<ObtainBatteryBean> obtainBatteryBeanList) {System.out.println("4.1、检测开始");if (obtainBatteryBeanList.size() == 0) {return false;}int i = 0;System.out.println("4.1、判断温度、电流、环境温度是否达到临界阀值");for (ObtainBatteryBean obtainBatteryBean : obtainBatteryBeanList) {if (obtainBatteryBean.getCurrent() > Constants.CURRENT) {i++;continue;}if (obtainBatteryBean.getTemperature() > Constants.TEMPERATURE) {i++;continue;}if (obtainBatteryBean.getVoltage() > Constants.VOLTAGE) {i++;continue;}}System.out.println("4.2、估算soc");if(i>obtainBatteryBeanList.size()/2){System.out.println("4.3、需要预警保护");return true;}System.out.println("4.3、不需要预警保护");return false;}
main方法执行效果
这篇关于风扇开启执行逻辑的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!