subroutine PowerLimits !subroutine PowerLimits(Power_sigma) USE Pumps_VARIABLES, only: PUMP USE Drawworks_VARIABLES, only: Drawworks USE RTable_VARIABLES, only: RTable USE CPowerVariables, only: Power%NumberOfgenerators, Power%GeneratorPowerRating USE CDrillingConsoleVariables USE equipments_PowerLimit IMPLICIT NONE !integer :: ii !Power_sigma=2.d0*(PUMP(1)%Vt*PUMP(1)%ia_new)+2.d0*(PUMP(2)%Vt*PUMP(2)%ia_new)+2.d0*(PUMP(3)%Vt*PUMP(3)%ia_new)+(RTable%Vt*RTable%ia_new)+2.d0*(Drawworks%Vt*Drawworks%ia_new) !write(*,*) 'Power_sigma=', Power_sigma power_num_of_Jenerators=sngl(Power%NumberOfgenerators) Jenerator_power=Power%GeneratorPowerRating drilling_console_Jenerators(1)=DrillingConsole%GEN1BTNLED drilling_console_Jenerators(2)=DrillingConsole%GEN2BTNLED drilling_console_Jenerators(3)=DrillingConsole%GEN3BTNLED drilling_console_Jenerators(4)=DrillingConsole%GEN4BTNLED drilling_num_of_Jenerators=0.d0 !do ii=1,4 ! if (drilling_console_Jenerators(ii)=1) then ! drilling_num_of_Jenerators=drilling_num_of_Jenerators+1. ! end if !end do drilling_num_of_Jenerators=sngl(sum(drilling_console_Jenerators)) !drilling_num_of_Jenerators=1.d0 if (power_num_of_Jenerators>drilling_num_of_Jenerators) then num_of_active_Jenerators=drilling_num_of_Jenerators else if (power_num_of_Jenerators<=drilling_num_of_Jenerators) then num_of_active_Jenerators=power_num_of_Jenerators end if max_Power_sigma=num_of_active_Jenerators*Jenerator_power end subroutine PowerLimits