Programmable intrusion detection for distributed energy resources in cyber–physical networked microgrids