module AnnularMain
    implicit none
    public
    contains
    
    ! subroutine Annular_Setup()
    !     ! use CSimulationVariables
    !     implicit none
    !     call OnSimulationInitialization%Add(Annular_Init)
    !     call OnSimulationStop%Add(Annular_Init)
    !     call OnAnnularStep%Add(Annular_Step)
    !     call OnAnnularOutput%Add(Annular_Output)
    !     call OnAnnularMain%Add(AnnularMainBody)
    ! end subroutine
    
    ! subroutine Annular_Init
    !     implicit none
    ! end subroutine Annular_Init
    
    subroutine Annular_Step
        use SimulationVariables
        implicit none
        if (data%State%Annular%finished_Annular/=0) then
            call ANNULAR_SUB1
            if (data%State%Annular%AnnularIsOpening .or. data%State%Annular%AnnularIsClosing .or. data%State%RAM(1)%Bottles_Charged_MalfActive) then
                if(data%State%Annular%finished_Annular==0) then
                    call ANNULAR_SUB2 !only body of loop2
                endif
            endif
        else
            call ANNULAR_SUB2
        endif        
    end subroutine Annular_Step
    

end module AnnularMain