private void checkRailPosition( List<RailState> railStates, SystemState state, List<Integer> nodes) { for (RailState railState : railStates) { Rail rail = railState.getRail(); double setpoint = railState.getRailWidget().getSetpoint(); double position = railState.getRailPosition(); double home = rail.getHomeDistance(); double tol = rail.getTolPlus(); switch (railState.getRailFlag()) { case NOT_HOMED: yellowFlag = true; railState.setColor(GRAY); break; case HOMING: if (position > home - tol && position < home + tol) railState.setRailFlag(Equip.RailFlag.HOMED); yellowFlag = true; railState.setColor(WHITE); break; case HOMED: yellowFlag = true; railState.setColor(WHITE); break; case SEEKING: if (position > setpoint - tol && position < setpoint + tol) railState.setRailFlag(Equip.RailFlag.ACTIVE); yellowFlag = true; railState.setColor(WHITE); break; case ACTIVE: railState.setColor(GREEN); if (position < setpoint - tol || position > setpoint + tol) { yellowFlag = true; if (railState.getColor().equals(GREEN)) { railState.setColor(YELLOW); if (state.equals(SystemState.SYSTEM_STATE_RUN)) { CanComm.sendSystemState( SystemState.SYSTEM_STATE_RUN_PAUSE, Can.OpId.OPER_SET.ordinal(), nodes); CanComm.setLightTower(Equip.LightTowerState.WARNING.getTower()); log.error("Rail out of tolerance (warning) band..."); } } } break; default: break; } } }
private void checkBeltSpeed(List<BeltState> beltStates, SystemState state, List<Integer> nodes) { for (BeltState beltState : beltStates) { // determine upper and lower thresholds for alarms and warnings double setpoint = beltState.getBeltUnit().getSetpoint(); double processValue = beltState.getBeltSpeed(); double upperLimit = setpoint + beltState.getBeltUnit().getHiWarn(); double lowerLimit = setpoint - beltState.getBeltUnit().getLoWarn(); if (setpoint == 0.0) { yellowFlag = true; beltState.setColor(WHITE); continue; } switch (beltState.getBeltFlag()) { case OFF: yellowFlag = true; beltState.setColor(GRAY); break; case SET: yellowFlag = true; beltState.setColor(WHITE); break; case SEEKING: yellowFlag = true; if (processValue > lowerLimit && processValue < upperLimit) beltState.setBeltFlag(GenFlag.ACTIVE); beltState.setColor(WHITE); break; case ACTIVE: beltState.setColor(GREEN); if (processValue < lowerLimit || processValue > upperLimit) { yellowFlag = true; if (beltState.getColor().equals(GREEN)) { beltState.setColor(YELLOW); if (state.equals(SystemState.SYSTEM_STATE_RUN)) { CanComm.sendSystemState( SystemState.SYSTEM_STATE_RUN_PAUSE, Can.OpId.OPER_SET.ordinal(), nodes); CanComm.setLightTower(Equip.LightTowerState.WARNING.getTower()); log.error("beltSpeed out of warning band: " + processValue); } } } break; default: break; } } }
private void checkHeaterTemps( List<ZoneState> zones, double heaterOutputLimit, SystemState state, List<Integer> nodes) { for (ZoneState zone : zones) { Unit unit = zone.getTopUnit(); double setpoint = unit.getSetpoint(); double lowerLimit = setpoint - unit.getLoWarn(); double upperLimit = setpoint + unit.getHiWarn(); double upperAlarm = setpoint + unit.getHiAlarm(); double lowerAlarm = setpoint - unit.getLoAlarm(); // test action with heaterFlag switch (zone.getTopHeaterFlag()) { case OFF: zone.setTopColor(GRAY); yellowFlag = true; break; case SET: zone.setTopColor(WHITE); yellowFlag = true; break; case POWER: zone.setTopColor(WHITE); yellowFlag = true; if (zone.getTopPercentOP() < heaterOutputLimit) zone.setTopHeaterFlag(HeaterFlag.HEATING); break; case HEATING: zone.setTopColor(WHITE); yellowFlag = true; if (zone.getTopTemp() > lowerLimit && zone.getTopTemp() < upperLimit) { zone.setTopHeaterFlag(HeaterFlag.ACTIVE); } break; case ACTIVE: if (zone.getTopTemp() < lowerAlarm || zone.getTopTemp() > upperAlarm) { redZone = true; if (!zone.getTopColor().equals(RED)) { zone.setTopColor(RED); if (state.equals(SystemState.SYSTEM_STATE_RUN_STARTUP) || state.equals(SystemState.SYSTEM_STATE_RUN)) { OvenManager.getInstance().startCooldown(LightTowerState.ALARM_COOLDOWN.getTower()); log.error( "Zone: " + zone.getId() + " top heater out of alarm band: " + zone.getTopTemp()); } } } else if (zone.getTopTemp() < lowerLimit || zone.getTopTemp() > upperLimit) { yellowFlag = true; if (zone.getTopColor().equals(GREEN)) { zone.setTopColor(YELLOW); if (state.equals(SystemState.SYSTEM_STATE_RUN)) { CanComm.sendSystemState( SystemState.SYSTEM_STATE_RUN_PAUSE, Can.OpId.OPER_SET.ordinal(), nodes); CanComm.setLightTower(Equip.LightTowerState.WARNING.getTower()); log.error( "Zone: " + zone.getId() + " top heater out of warning band: " + zone.getTopTemp()); } } } else { zone.setTopColor(GREEN); } break; default: break; } if (zone.isHeatZone()) { unit = zone.getBottomUnit(); setpoint = unit.getSetpoint(); upperLimit = setpoint + unit.getHiWarn(); lowerLimit = setpoint - unit.getLoWarn(); upperAlarm = setpoint + unit.getHiAlarm(); lowerAlarm = setpoint - unit.getLoAlarm(); // test action with heaterFlag switch (zone.getBottomHeaterFlag()) { case OFF: zone.setBottomColor(GRAY); yellowFlag = true; break; case SET: zone.setBottomColor(WHITE); yellowFlag = true; break; case POWER: zone.setBottomColor(WHITE); yellowFlag = true; if (zone.getBottomPercentOP() < heaterOutputLimit) zone.setBottomHeaterFlag(HeaterFlag.HEATING); break; case HEATING: zone.setBottomColor(WHITE); yellowFlag = true; if (zone.getBottomTemp() > lowerLimit && zone.getBottomTemp() < upperLimit) { zone.setBottomHeaterFlag(HeaterFlag.ACTIVE); } break; case ACTIVE: if (zone.getBottomTemp() < lowerAlarm || zone.getBottomTemp() > upperAlarm) { redZone = true; if (!zone.getBottomColor().equals(RED)) { zone.setBottomColor(RED); if (state.equals(SystemState.SYSTEM_STATE_RUN_STARTUP) || state.equals(SystemState.SYSTEM_STATE_RUN)) { OvenManager.getInstance() .startCooldown(LightTowerState.ALARM_COOLDOWN.getTower()); log.error( "Zone: " + zone.getId() + " bottom heater out of alarm band: " + zone.getBottomTemp()); } } } else if (zone.getBottomTemp() < lowerLimit || zone.getBottomTemp() > upperLimit) { yellowFlag = true; if (zone.getBottomColor().equals(GREEN)) { zone.setBottomColor(YELLOW); if (state.equals(SystemState.SYSTEM_STATE_RUN)) { CanComm.sendSystemState( SystemState.SYSTEM_STATE_RUN_PAUSE, Can.OpId.OPER_SET.ordinal(), nodes); CanComm.setLightTower(Equip.LightTowerState.WARNING.getTower()); log.error( "Zone: " + zone.getId() + " bottom heater out of warning band: " + zone.getBottomTemp()); } } } else { zone.setBottomColor(GREEN); } break; default: break; } } } }