HEX
Server: Apache
System: Windows NT MAGNETO-ARM 10.0 build 22000 (Windows 10) AMD64
User: Michel (0)
PHP: 7.4.7
Disabled: NONE
Upload Files
File: C:/Redmine-4.x/redmine-4.2.9/files/2025/04/250416153649_OpenOpcUaCoreServer.lua
function this.FixedRateLua_60000()

ALFA17_PROD_TPH=this:GetUAValue("ns=3;s=ALFA17_PROD_TPH",13);
ALFA17_PROD_DENS=this:GetUAValue("ns=3;s=ALFA17_PROD_DENS",13);
ALFA17_PROD_DENS_PID_SP=this:GetUAValue("ns=3;s=ALFA17_PROD_DENS_PID_SP",13);
ALFA18_PROD_TPH=this:GetUAValue("ns=3;s=ALFA18_PROD_TPH",13);
ALFA18_PROD_DENS=this:GetUAValue("ns=3;s=ALFA18_PROD_DENS",13);
ALFA18_PROD_DENS_PID_SP=this:GetUAValue("ns=3;s=ALFA18_PROD_DENS_PID_SP",13);
KPI_below_24h_ALFA17=this:GetUAValue("ns=4;s=KPI_below_24h_ALFA17",13);
KPI_below_1h_ALFA17=this:GetUAValue("ns=4;s=KPI_below_1h_ALFA17",13);
KPI_above_24h_ALFA17=this:GetUAValue("ns=4;s=KPI_above_24h_ALFA17",13);
KPI_above_1h_ALFA17=this:GetUAValue("ns=4;s=KPI_above_1h_ALFA17",13);
KPI_inrange_24h_ALFA17=this:GetUAValue("ns=4;s=KPI_inrange_24h_ALFA17",13);
KPI_inrange_1h_ALFA17=this:GetUAValue("ns=4;s=KPI_inrange_1h_ALFA17",13);

KPI_below_24h_ALFA17_RT=this:GetUAValue("ns=4;s=KPI_below_24h_ALFA17_RT",13);
KPI_below_1h_ALFA17_RT=this:GetUAValue("ns=4;s=KPI_below_1h_ALFA17_RT",13);
KPI_above_24h_ALFA17_RT=this:GetUAValue("ns=4;s=KPI_above_24h_ALFA17_RT",13);
KPI_above_1h_ALFA17_RT=this:GetUAValue("ns=4;s=KPI_above_1h_ALFA17_RT",13);
KPI_inrange_24h_ALFA17_RT=this:GetUAValue("ns=4;s=KPI_inrange_24h_ALFA17_RT",13);
KPI_inrange_1h_ALFA17_RT=this:GetUAValue("ns=4;s=KPI_inrange_1h_ALFA17_RT",13);
TPH_Threshold_ALFA17=this:GetUAValue("ns=4;s=TPH_Threshold_ALFA17",13);
Density_Threshold_ALFA17=this:GetUAValue("ns=4;s=Density_Threshold_ALFA17",13);
Low_Density_Specification_ALFA17=this:GetUAValue("ns=4;s=Low_Density_Specification_ALFA17",13);
High_Density_Specification_ALFA17=this:GetUAValue("ns=4;s=High_Density_Specification_ALFA17",13);

KPI_below_24h_ALFA18=this:GetUAValue("ns=4;s=KPI_below_24h_ALFA18",13);
KPI_below_1h_ALFA18=this:GetUAValue("ns=4;s=KPI_below_1h_ALFA18",13);
KPI_above_24h_ALFA18=this:GetUAValue("ns=4;s=KPI_above_24h_ALFA18",13);
KPI_above_1h_ALFA18=this:GetUAValue("ns=4;s=KPI_above_1h_ALFA18",13);
KPI_inrange_24h_ALFA18=this:GetUAValue("ns=4;s=KPI_inrange_24h_ALFA18",13);
KPI_inrange_1h_ALFA18=this:GetUAValue("ns=4;s=KPI_inrange_1h_ALFA18",13);

KPI_below_24h_ALFA18_RT=this:GetUAValue("ns=4;s=KPI_below_24h_ALFA18_RT",13);
KPI_below_1h_ALFA18_RT=this:GetUAValue("ns=4;s=KPI_below_1h_ALFA18_RT",13);
KPI_above_24h_ALFA18_RT=this:GetUAValue("ns=4;s=KPI_above_24h_ALFA18_RT",13);
KPI_above_1h_ALFA18_RT=this:GetUAValue("ns=4;s=KPI_above_1h_ALFA18_RT",13);
KPI_inrange_24h_ALFA18_RT=this:GetUAValue("ns=4;s=KPI_inrange_24h_ALFA18_RT",13);
KPI_inrange_1h_ALFA18_RT=this:GetUAValue("ns=4;s=KPI_inrange_1h_ALFA18_RT",13);
TPH_Threshold_ALFA18=this:GetUAValue("ns=4;s=TPH_Threshold_ALFA18",13);
Density_Threshold_ALFA18=this:GetUAValue("ns=4;s=Density_Threshold_ALFA18",13);
Low_Density_Specification_ALFA18=this:GetUAValue("ns=4;s=Low_Density_Specification_ALFA18",13);
High_Density_Specification_ALFA18=this:GetUAValue("ns=4;s=High_Density_Specification_ALFA18",13);

milisecond =  os.date("%S")
second =  os.date("%S") 
minute =  os.date("%M")
hour =  os.date("%H")
hour_comp=tonumber(hour)
minute_comp=tonumber(minute)
second_comp=tonumber(second)

	if( ALFA17_PROD_TPH > TPH_Threshold_ALFA17 ) then 
		
		if (ALFA17_PROD_DENS > Density_Threshold_ALFA17) then
			
			if ( ALFA17_PROD_DENS < (ALFA17_PROD_DENS_PID_SP - Low_Density_Specification_ALFA17))then
				
				temp24=(KPI_below_24h_ALFA17_RT/100+((60000/86400000)*(1-KPI_below_24h_ALFA17_RT/100)))*100
				temp1=(KPI_below_1h_ALFA17_RT/100+((60000/3600000)*(1-KPI_below_1h_ALFA17_RT/100)))*100
				this:SetUAValue("ns=4;s=KPI_below_24h_ALFA17_RT",temp24)
				this:SetUAValue("ns=4;s=KPI_below_1h_ALFA17_RT",temp1)
				
				if (minute_comp	== 0) then
				
					this:SetUAValue("ns=4;s=KPI_below_1h_ALFA17",temp1)
				end
				if (minute_comp	== 0)  and (hour_comp == 0) then
				
					this:SetUAValue("ns=4;s=KPI_below_24h_ALFA17",temp24)
				end
				
				
			else
				
				temp24=(KPI_below_24h_ALFA17_RT/100+((60000/86400000)*(-KPI_below_24h_ALFA17_RT)))*100
				temp1=(KPI_below_1h_ALFA17_RT/100+((60000/3600000)*(-KPI_below_1h_ALFA17_RT)))*100
				this:SetUAValue("ns=4;s=KPI_below_24h_ALFA17_RT",temp24)
				this:SetUAValue("ns=4;s=KPI_below_1h_ALFA17_RT",temp1)
				if (minute_comp	== 0)  then
				
					this:SetUAValue("ns=4;s=KPI_below_1h_ALFA17",temp1)
				end
				if (minute_comp	== 0)  and (hour_comp == 0) then
				
					this:SetUAValue("ns=4;s=KPI_below_24h_ALFA17",temp24)
				end
				
			end
			if ( ALFA17_PROD_DENS > (ALFA17_PROD_DENS_PID_SP + High_Density_Specification_ALFA17)) then
				temp24=(KPI_above_24h_ALFA17_RT/100+((60000/86400000)*(1-KPI_above_24h_ALFA17_RT/100)))*100
				temp1=(KPI_above_1h_ALFA17_RT/100+((60000/3600000)*(1-KPI_above_1h_ALFA17_RT/100)))*100
				this:SetUAValue("ns=4;s=KPI_above_24h_ALFA17_RT",temp24)
				this:SetUAValue("ns=4;s=KPI_above_1h_ALFA17_RT",temp1)
				if (minute_comp	== 0)  then
				
					this:SetUAValue("ns=4;s=KPI_above_1h_ALFA17",temp1)
				end
				if (minute_comp	== 0) and (hour_comp == 0) then
				
					this:SetUAValue("ns=4;s=KPI_above_24h_ALFA17",temp24)
				end
			else
				temp24=(KPI_above_24h_ALFA17_RT/100+((60000/86400000)*(-KPI_above_24h_ALFA17_RT)))*100
				temp1=(KPI_above_1h_ALFA17_RT/100+((60000/3600000)*(-KPI_above_1h_ALFA17_RT)))*100
				this:SetUAValue("ns=4;s=KPI_above_24h_ALFA17_RT",temp24)
				this:SetUAValue("ns=4;s=KPI_above_1h_ALFA17_RT",temp1)
				if (minute_comp	== 0) then
				
					this:SetUAValue("ns=4;s=KPI_above_1h_ALFA17",temp1)
				end
				if (minute_comp	== 0) and (hour_comp == 0) then
				
					this:SetUAValue("ns=4;s=KPI_above_24h_ALFA17",temp24)
				end
			end
			
			Calculation_In_Range_24h=100-KPI_above_24h_ALFA17_RT-KPI_below_24h_ALFA17_RT
			Calculation_In_Range_1h=100-KPI_above_1h_ALFA17_RT-KPI_below_1h_ALFA17_RT
			this:SetUAValue("ns=4;s=KPI_inrange_24h_ALFA17_RT",Calculation_In_Range_24h)
			this:SetUAValue("ns=4;s=KPI_inrange_1h_ALFA17_RT",Calculation_In_Range_1h)
			if (minute_comp	== 0)  then
				
					this:SetUAValue("ns=4;s=KPI_inrange_1h_ALFA17",Calculation_In_Range_1h)
			end
			if (minute_comp	== 0)  and (hour_comp == 0) then
				
					this:SetUAValue("ns=4;s=KPI_inrange_24h_ALFA17",Calculation_In_Range_24h)
			end
		end


	end	
	if( ALFA18_PROD_TPH > TPH_Threshold_ALFA18 ) then 
		
		if (ALFA18_PROD_DENS > Density_Threshold_ALFA18) then 
			
			if ( ALFA18_PROD_DENS < (ALFA18_PROD_DENS_PID_SP - Low_Density_Specification_ALFA18))then
				
				temp24=(KPI_below_24h_ALFA18_RT/100+((60000/86400000)*(1-KPI_below_24h_ALFA18_RT/100)))*100
				temp1=(KPI_below_1h_ALFA18_RT/100+((60000/3600000)*(1-KPI_below_1h_ALFA18_RT/100)))*100
				this:SetUAValue("ns=4;s=KPI_below_24h_ALFA18_RT",temp24)
				this:SetUAValue("ns=4;s=KPI_below_1h_ALFA18_RT",temp1)
				if (minute_comp	== 0) then
					this:SetUAValue("ns=4;s=KPI_below_1h_ALFA18",temp1)
				end
				if (minute_comp	== 0) and (hour_comp == 0) then
					this:SetUAValue("ns=4;s=KPI_below_24h_ALFA18",temp24)
				end
				
			else
				
				temp24=(KPI_below_24h_ALFA18_RT/100+((60000/86400000)*(-KPI_below_24h_ALFA18_RT)))*100
				temp1=(KPI_below_1h_ALFA18_RT/100+((60000/3600000)*(-KPI_below_1h_ALFA18_RT)))*100
				this:SetUAValue("ns=4;s=KPI_below_24h_ALFA18_RT",temp24)
				this:SetUAValue("ns=4;s=KPI_below_1h_ALFA18_RT",temp1)
				if (minute_comp	== 0) then
					this:SetUAValue("ns=4;s=KPI_below_1h_ALFA18",temp1)
				end
				if (minute_comp	== 0) and (hour_comp==0) then
					this:SetUAValue("ns=4;s=KPI_below_24h_ALFA18",temp24)
				end
			end
			if ( ALFA18_PROD_DENS > (ALFA18_PROD_DENS_PID_SP + High_Density_Specification_ALFA18)) then
				
				temp24=(KPI_above_24h_ALFA18_RT/100+((60000/86400000)*(1-KPI_above_24h_ALFA18_RT/100)))*100
				temp1=(KPI_above_1h_ALFA18_RT/100+((60000/3600000)*(1-KPI_above_1h_ALFA18_RT/100)))*100
				this:SetUAValue("ns=4;s=KPI_above_24h_ALFA18_RT",temp24)
				this:SetUAValue("ns=4;s=KPI_above_1h_ALFA18_RT",temp1)
				if (minute_comp	== 0) then
					this:SetUAValue("ns=4;s=KPI_above_1h_ALFA18",temp1)
				end
				if (minute_comp	== 0) and (hour_comp== 0) then
					this:SetUAValue("ns=4;s=KPI_above_24h_ALFA18",temp24)
				end
			else
				temp24=(KPI_above_24h_ALFA18_RT/100+((60000/86400000)*(-KPI_above_24h_ALFA18_RT)))*100
				temp1=(KPI_above_1h_ALFA18_RT/100+((60000/3600000)*(-KPI_above_1h_ALFA18_RT)))*100
				this:SetUAValue("ns=4;s=KPI_above_24h_ALFA18_RT",temp24)
				this:SetUAValue("ns=4;s=KPI_above_1h_ALFA18_RT",temp1)
				if (minute_comp	== 0) then
					this:SetUAValue("ns=4;s=KPI_above_1h_ALFA18",temp1)
				end
				if (minute_comp	== 0) and (hour_comp == 0) then
					this:SetUAValue("ns=4;s=KPI_above_24h_ALFA18",temp24)
				end
				
			end
			
			Calculation_In_Range_24h=100-KPI_above_24h_ALFA18_RT-KPI_below_24h_ALFA18_RT
			Calculation_In_Range_1h=100-KPI_above_1h_ALFA18_RT-KPI_below_1h_ALFA18_RT
			this:SetUAValue("ns=4;s=KPI_inrange_24h_ALFA18_RT",Calculation_In_Range_24h)
			this:SetUAValue("ns=4;s=KPI_inrange_1h_ALFA18_RT",Calculation_In_Range_1h)
			if (minute_comp	== 0)  then
				
					this:SetUAValue("ns=4;s=KPI_inrange_1h_ALFA18",Calculation_In_Range_1h)
			end
			if (minute_comp	== 0) and (hour_comp == 0) then
				
					this:SetUAValue("ns=4;s=KPI_inrange_24h_ALFA18",Calculation_In_Range_24h)
			end
		end


	end	
end



function this.FixedRateLua_01000()

ALFA17_PROD_TPH=this:GetUAValue("ns=3;s=ALFA17_PROD_TPH",13);
test=ALFA17_PROD_TPH
this:SetUAValue("ns=4;i=6034",test)
end