subroutine Pump2_MainSolver
    
    use SimulationVariables
    
    Implicit none
    
    
    
              
    if (data%State%Pump(2)%Throttle<=0.d0) then
        data%State%Pump(2)%K_throttle = 1
    end if
    
    
    if((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1) .and. (data%State%Pump(2)%K_throttle==1) .and. (data%State%Pump(2)%PowerFailMalf==0) .and. (data%State%Pump(2)%Failure==0)) then
    
        data%State%Pump(2)%SoundBlower = .true.
        data%State%Pump(2)%BLWR        = 1
        
        !========================== Pump 2 Rate limit ==========================
        if (((data%State%Pump(2)%N_new-data%State%Pump(2)%N_old)/data%State%Pump(2)%time_step)>data%State%Pump(2)%RateChange) then
            data%State%Pump(2)%Speed =(data%State%Pump(2)%RateChange*data%State%Pump(2)%time_step)+data%State%Pump(2)%N_old
        else if (((data%State%Pump(2)%N_old-data%State%Pump(2)%N_new)/data%State%Pump(2)%time_step)>data%State%Pump(2)%RateChange) then
            data%State%Pump(2)%Speed = (-data%State%Pump(2)%RateChange*data%State%Pump(2)%time_step)+data%State%Pump(2)%N_old
        else
            data%State%Pump(2)%Speed = data%State%Pump(2)%N_new
        end if
        !=======================================================================
        
        Call Pump_OnMode_Solver(2)
        
    else
        
        if ((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1)) then
            data%State%Pump(2)%SoundBlower = .true.
        else
            data%State%Pump(2)%SoundBlower = .false.
        end if
        
        if ((any(data%State%Pump(2)%AssignmentSwitchh==(/1,2,3,4,5,7,8,11/))) .and. (data%State%Pump(2)%Switch==-1) .and. (data%State%Pump(2)%PowerFailMalf==0) .and. (data%State%Pump(2)%Failure==0)) then
            data%State%Pump(2)%BLWR = 1
        else
            data%State%Pump(2)%BLWR = 0
        end if
        
        
        Call Pump_OffMode_Solver(2)
        data%State%Pump(2)%K_throttle = 0
    
    end if
    
    
    data%State%Pump(2)%N_old = data%State%Pump(2)%Speed
    
              
              
end subroutine Pump2_MainSolver