コード例 #1
0
  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;
        }
      }
    }
  }
コード例 #2
0
  private void startCooldown(
      IoModule ioModule,
      ParamManager paramManager,
      List<ZoneState> zones,
      List<BeltState> beltStates,
      List<RailState> railStates,
      double cooldownTemp,
      Config config,
      List<Integer> nodes) {
    if (ioModule.getOutput(Can.OutputIO.IOM_HEAT_CONTACTOR) == 1) {
      // Turn off heat contactor and disable alarms
      paramManager.setAlarms(ALARM_DISABLED);
      CanComm.sendCmdSetpoint(
          Can.BoardType.BOARD_TYPE_IOM.getStartNum(),
          0,
          Can.CmdSetpoint.SETPOINT_HEAT_CONTACTOR,
          0);
      log.info("Delayed Cooldown -- Heat Contactor Off...");
    }

    // gray out heat zones on GUI
    for (ZoneState zone : zones) {
      zone.setTopHeaterFlag(Equip.HeaterFlag.OFF);
      paramManager.zeroHeaterSetpoint(true, zone);
      zone.setTopColor(GRAY);
      if (zone.isHeatZone()) {
        zone.setBottomHeaterFlag(Equip.HeaterFlag.OFF);
        paramManager.zeroHeaterSetpoint(false, zone);
        zone.setBottomColor(GRAY);
      }
    }
    // gray out belts on GUI
    for (BeltState beltState : beltStates) {
      beltState.setColor(GRAY);
    }
    // gray out rails on GUI
    for (RailState railState : railStates) {
      railState.setColor(GRAY);
    }

    // test if zone heaters are above cooldown temperature
    boolean belowTemp = true;
    for (ZoneState zone : zones) {
      if (zone.getTopTemp() > cooldownTemp) {
        belowTemp = false;
        break;
      }
      if (zone.getBottomTemp() > cooldownTemp && zone.isHeatZone()) {
        belowTemp = false;
        break;
      }
    }
    if (belowTemp) {
      // complete cooldown after all zones less than cooldown temp
      if (OvenState.getInstance().getLightTower() == LightTowerState.COOLDOWN.getTower()) {
        CanComm.setLightTower(Equip.LightTowerState.TOWER_OFF.getTower());
      }
      // set all belts to speed of zero
      for (int i = 0; i < config.getNumBelts(); i++) {
        BeltState beltState = beltStates.get(i);
        paramManager.zeroBeltSetpoint(beltState);
      }
      // turn off fan contactor
      CanComm.sendCmdSetpoint(
          Can.BoardType.BOARD_TYPE_IOM.getStartNum(), 0, Can.CmdSetpoint.SETPOINT_FAN_CONTACTOR, 0);
      CanComm.sendSystemState(
          SystemState.SYSTEM_STATE_OVEN_OFF, Can.OpId.OPER_SET.ordinal(), nodes);
      log.info("Cooldown complete - Fan Contactor Off...");
    }
  }