Dynamic Analysis And Control Of Multi-Machine Power System With Microgrids: A Koopman Mode Analysis Approach