Models describing the material flow of discrete manufacturing systems are important documentation artefacts and the basis for a comprehensive understanding of the underlying processes. The analysis of such models allows deriving important key performance indicators enabling the assessment of the current system implementation. However, manual modeling as well as up-to-date model maintenance is an error-prone and costly task. In an effort to allow for the automatic derivation of material flow models, this paper introduces the concept of Material Flow Petri Nets (MFPNs) and presents a learning algorithm for their automatic generation based on recorded PLC I/O data. The proposed algorithm has been evaluated on a case study of a laboratory plant with successful results.