Multi-dimensional invariant detection for cyber-physical system security : a case study of smart meters and smart medical devices.