//Private functions private bool updatePorts() { try { jbc.UpdateContinuousModeNextDataChunk((long)ID, uiContModeQueueID, 50); // Initializing the ports magnitudes to 0 to calculate the median //Debug.Print("DATA: " & JBC.GetContinuousModeDataCount(ID)) if (jbc.GetContinuousModeDataCount((long)ID, uiContModeQueueID) > 0) { for (int cnt = 0; cnt <= MAX_PORTS - 1; cnt++) { portList[cnt].P = 0; portList[cnt].F = 0; // Displacement of the temperature values in the filter for (int i = 0; i <= TEMP_FILTER_SIZE - 1 - 1; i++) { portList[cnt].T[i] = portList[cnt].T[i + 1]; } portList[cnt].T[TEMP_FILTER_SIZE - 1] = 0; //portList(cnt).nTrans = 0 } } // Getting all the transmisions from the station and calculating the median temperature and power. Power units are in per thousand and // is necessary to pass them into per hundred int transmisionCounter = 0; stContinuousModeData_SOLD ports = new stContinuousModeData_SOLD(); stContinuousModeData_HA ports_HA = new stContinuousModeData_HA(); // hadesold while (jbc.GetContinuousModeDataCount((long)ID, uiContModeQueueID) > 0) { // sold if (StationType == eStationType.SOLD) { ports = jbc.GetContinuousModeNextData((long)ID, uiContModeQueueID); if (ports.data != null) { foreach (stContinuousModePort_SOLD dt in ports.data) { // portList(dt.port).T(TEMP_FILTER_SIZE - 1) = portList(dt.port).T(TEMP_FILTER_SIZE - 1) + dt.temperature.ToCelsius // get data in UTI portList[(int)dt.port].T[TEMP_FILTER_SIZE - 1] = portList[(int)dt.port].T[TEMP_FILTER_SIZE - 1] + dt.temperature.UTI; //If dt.temperature.ToCelsius <> 0 Then portList(dt.port).nTrans = portList(dt.port).nTrans + 1 portList[(int)dt.port].I = 0; portList[(int)dt.port].P = System.Convert.ToInt32(portList[(int)dt.port].P + dt.power); } transmisionCounter++; } } // hadesold if (StationType == eStationType.HA) { ports_HA = jbc.GetContinuousModeNextData_HA((long)ID, uiContModeQueueID); if (ports_HA.data != null) { foreach (stContinuousModePort_HA dt in ports_HA.data) { // portList(dt.port).T(TEMP_FILTER_SIZE - 1) = portList(dt.port).T(TEMP_FILTER_SIZE - 1) + dt.temperature.ToCelsius // get data in UTI portList[(int)dt.port].T[TEMP_FILTER_SIZE - 1] = portList[(int)dt.port].T[TEMP_FILTER_SIZE - 1] + dt.temperature.UTI; //If dt.temperature.ToCelsius <> 0 Then portList(dt.port).nTrans = portList(dt.port).nTrans + 1 portList[(int)dt.port].I = 0; portList[(int)dt.port].P = System.Convert.ToInt32(portList[(int)dt.port].P + dt.power); portList[(int)dt.port].F = System.Convert.ToInt32(portList[(int)dt.port].F + dt.flow); } transmisionCounter++; } } } if (transmisionCounter > 0) { if (StationType == eStationType.SOLD) { foreach (stContinuousModePort_SOLD dt in ports.data) { portList[(int)dt.port].number = dt.port + 1; portList[(int)dt.port].status = dt.status; //If portList(dt.port).nTrans <> 0 Then portList(dt.port).T(TEMP_FILTER_SIZE - 1) = portList(dt.port).T(TEMP_FILTER_SIZE - 1) / portList(dt.port).nTrans portList[(int)dt.port].T[TEMP_FILTER_SIZE - 1] = portList[(int)dt.port].T[TEMP_FILTER_SIZE - 1] / transmisionCounter; portList[(int)dt.port].P = System.Convert.ToInt32(((double)portList[(int)dt.port].P / 10) / transmisionCounter); portList[(int)dt.port].I = 0; } } if (StationType == eStationType.HA) { foreach (stContinuousModePort_HA dt in ports_HA.data) { portList[(int)dt.port].number = dt.port + 1; portList[(int)dt.port].status = (ToolStatus)dt.status; //If portList(dt.port).nTrans <> 0 Then portList(dt.port).T(TEMP_FILTER_SIZE - 1) = portList(dt.port).T(TEMP_FILTER_SIZE - 1) / portList(dt.port).nTrans portList[(int)dt.port].T[TEMP_FILTER_SIZE - 1] = portList[(int)dt.port].T[TEMP_FILTER_SIZE - 1] / transmisionCounter; portList[(int)dt.port].P = System.Convert.ToInt32(((double)portList[(int)dt.port].P / 10) / transmisionCounter); portList[(int)dt.port].F = System.Convert.ToInt32(((double)portList[(int)dt.port].F / 10) / transmisionCounter); // hadesold portList[(int)dt.port].I = 0; } } } return(true); } catch (Exception ex) { Console.WriteLine("Cstation::updatePorts . error:" + ex.Message); return(false); } }