-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `solaris_1_control`
--

DELIMITER $$
--
-- Procedures
--
CREATE DEFINER=`logic`@`localhost` PROCEDURE `logic_procedure_1` ()  MODIFIES SQL DATA
    SQL SECURITY INVOKER
BEGIN
SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;


-- TOP LEVEL
SET @R = 8.50209;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="7713825325462179116272302021281489133203941954520125" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(900);/*7713825325462179116272302021281489133203941954520125*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="3850125162154302534818532425669470141631713179" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((1.6 / @R) * 60);/*3850125162154302534818532425669470141631713179*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="2081892217519315916225266101462208622824724532352402" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(7200 - (1.6 / @R) * 60);/*2081892217519315916225266101462208622824724532352402*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="246826992179232417124638109735521920220785152119248" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((3.2 / @R) * 60);/*246826992179232417124638109735521920220785152119248*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="16918214021654228132102524222610216241315313425323196" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(10800 - (3.2 / @R) * 60);/*16918214021654228132102524222610216241315313425323196*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="1042161733410082211911441768731219771173821224716897" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((4.8 / @R) * 60);/*1042161733410082211911441768731219771173821224716897*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="1031051202328219115973150781982715566579310077163237" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(10800 - (4.8 / @R) * 60);/*1031051202328219115973150781982715566579310077163237*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="1128810221681692396525214159216102174164241103212562" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((6.4 / @R) * 60);/*1128810221681692396525214159216102174164241103212562*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="10620281611116022390252116112439597179473152899" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(10800 - (6.4 / @R) * 60);/*10620281611116022390252116112439597179473152899*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="162244191631461817869312448010110514521010019720321157" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((8 / @R) * 60);/*162244191631461817869312448010110514521010019720321157*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="972279617358169166704585116157771292429616120123183" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(10800 - (8 / @R) * 60);/*972279617358169166704585116157771292429616120123183*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="2052090599222015415220754202552174592201212027641" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((10.4 / @R) * 60);/*2052090599222015415220754202552174592201212027641*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="4846118185520117219239144991155639311731240058" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(10800 - (10.4 / @R) * 60);/*4846118185520117219239144991155639311731240058*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="10212410220133209228181715712552252111658693106234153" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((12 / @R) * 60);/*10212410220133209228181715712552252111658693106234153*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="381311242501731351682252084111221492225121522821478178" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(10800 - (12 / @R) * 60);/*381311242501731351682252084111221492225121522821478178*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="19195522525198249325519212237912325412416445109128" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((16 / @R) * 60);/*19195522525198249325519212237912325412416445109128*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="2191951992262072051451441111152311872131601056710314718699" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(10800 - (16 / @R) * 60);/*2191951992262072051451441111152311872131601056710314718699*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 65;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="1513089847450143661171764222711120391053123112555" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((17.6 / @R) * 60);/*1513089847450143661171764222711120391053123112555*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
SET @Set_Pump4 = 0;
START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="58170212110156302248743239594715202351821144287" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP(10800 - (17.6 / @R) * 60);/*58170212110156302248743239594715202351821144287*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Air_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_O2_Flow,@Orig_Set_O2_Flow,@Status_O2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_O2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_N2_Flow,@Orig_Set_N2_Flow,@Status_N2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_N2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_CO2_Flow,@Orig_Set_CO2_Flow,@Status_CO2_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_CO2_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Gas_Flow,@Orig_Set_Gas_Flow,@Status_Gas_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Gas_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Gas_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1,@Orig_Set_Pump1,@Status_Pump1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump1_Total_Flow,@Orig_Set_Pump1_Total_Flow,@Status_Pump1_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump1_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump1_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2,@Orig_Set_Pump2,@Status_Pump2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump2_Total_Flow,@Orig_Set_Pump2_Total_Flow,@Status_Pump2_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump2_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump2_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3,@Orig_Set_Pump3,@Status_Pump3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump3_Total_Flow,@Orig_Set_Pump3_Total_Flow,@Status_Pump3_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump3_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump3_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4,@Orig_Set_Pump4,@Status_Pump4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pump4_Total_Flow,@Orig_Set_Pump4_Total_Flow,@Status_Pump4_Total_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pump4_Total_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pump4_Total_Flow = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_1,@Orig_Set_Level_1,@Status_Level_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Level_2,@Orig_Set_Level_2,@Status_Level_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Level_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Level_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Jacket_Level,@Orig_Set_Jacket_Level,@Status_Jacket_Level FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Jacket_Level";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Jacket_Level = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_Aux,@Orig_Set_Temperature_Aux,@Status_Temperature_Aux FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_Aux";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_Aux = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Weight,@Orig_Set_Weight,@Status_Weight FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Weight";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Weight = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_1,@Orig_Set_A_In_1,@Status_A_In_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_2,@Orig_Set_A_In_2,@Status_A_In_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_3,@Orig_Set_A_In_3,@Status_A_In_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_In_4,@Orig_Set_A_In_4,@Status_A_In_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_In_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_In_4 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_1,@Orig_Set_A_Out_1,@Status_A_Out_1 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_1 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_2,@Orig_Set_A_Out_2,@Status_A_Out_2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_3,@Orig_Set_A_Out_3,@Status_A_Out_3 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_3 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_A_Out_4,@Orig_Set_A_Out_4,@Status_A_Out_4 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_A_Out_4 = NULL;
WHILE TRUE DO
  SET @Set_Pump4 = 65;
  SET @Set_Pump3 = @R;
  START TRANSACTION;
IF(@Set_Temperature IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Temperature,Logic_Active=1 WHERE Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Stirring IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Stirring,Logic_Active=1 WHERE Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_pH IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_pH,Logic_Active=1 WHERE Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_dO2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_dO2,Logic_Active=1 WHERE Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pressure IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pressure,Logic_Active=1 WHERE Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Air_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Air_Flow,Logic_Active=1 WHERE Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_O2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_O2_Flow,Logic_Active=1 WHERE Name="O2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_N2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_N2_Flow,Logic_Active=1 WHERE Name="N2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_CO2_Flow IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_CO2_Flow,Logic_Active=1 WHERE Name="CO2_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump1,Logic_Active=1 WHERE Name="Pump1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump2,Logic_Active=1 WHERE Name="Pump2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump3,Logic_Active=1 WHERE Name="Pump3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_Pump4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_Pump4,Logic_Active=1 WHERE Name="Pump4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_1 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_1,Logic_Active=1 WHERE Name="A_Out_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_2 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_2,Logic_Active=1 WHERE Name="A_Out_2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_3 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_3,Logic_Active=1 WHERE Name="A_Out_3";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
IF(@Set_A_Out_4 IS NOT NULL) THEN SET @query = CONCAT('UPDATE process_data SET Logic_Set_Value=@Set_A_Out_4,Logic_Active=1 WHERE Name="A_Out_4";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END IF;
COMMIT;
SET @query = CONCAT('UPDATE solaris_server.logic_threads SET Sleep_Block="21968202212116524416023814421718120135657153144174197" WHERE Source=1 AND Procedure_Name="logic_procedure_1";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DO SLEEP((20 / @R) * 60);/*21968202212116524416023814421718120135657153144174197*/SELECT Elapsed_Time,Phase_Id,Current_Step INTO @Elapsed_Time,@Phase_Id,@Current_Step FROM info;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Heater,@Orig_Set_Heater,@Status_Heater FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Heater";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Heater = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Cooler,@Orig_Set_Cooler,@Status_Cooler FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Cooler";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Cooler = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature,@Orig_Set_Temperature,@Status_Temperature FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring,@Orig_Set_Stirring,@Status_Stirring FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Power,@Orig_Set_Stirring_Power,@Status_Stirring_Power FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Power";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Power = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Stirring_Current,@Orig_Set_Stirring_Current,@Status_Stirring_Current FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Stirring_Current";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Stirring_Current = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_pH,@Orig_Set_pH,@Status_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_pH,@Orig_Set_Temperature_pH,@Status_Temperature_pH FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_pH";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_pH = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_ORP,@Orig_Set_ORP,@Status_ORP FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="ORP";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_ORP = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_dO2,@Orig_Set_dO2,@Status_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Temperature_dO2,@Orig_Set_Temperature_dO2,@Status_Temperature_dO2 FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Temperature_dO2";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Temperature_dO2 = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Conductivity,@Orig_Set_Conductivity,@Status_Conductivity FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Conductivity";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Conductivity = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Pressure,@Orig_Set_Pressure,@Status_Pressure FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Pressure";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @Set_Pressure = NULL;
SET @query = CONCAT('SELECT process_data.Process_Value,process_data.Set_Value,phases.Status INTO @Process_Air_Flow,@Orig_Set_Air_Flow,@Status_Air_Flow FROM process_data LEFT JOIN phases ON phases.Name = process_data.Name AND phases.Phase_Id=',@Phase_Id,' WHERE process_data.Name="Air_Flow";');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
