Smart production systems conforming the Industry 4.0 vision are based on subsystems that are integrated in a way that supports high flexibility and re-configurability. Specific components and devices, such as industrial and mobile robots or transport systems, now pose full-blown systems, and the entire Industry 4.0 production system constitutes a system-of-systems. Testing, fine-tuning, and production planning are important tasks in the entire engineering production system life-cycle. All these steps can be significantly supported and improved by digital twins, which are digitalized replicas of physical systems that are synchronized with the real systems at runtime. However, the design and implementation of digital twins for such integrated, yet partly stand-alone, industrial sub-systems can represent challenging and significantly time-consuming engineering tasks. In this article, the problem of the digital twin design for discrete-event production systems is addressed. The article also proposes to utilize a formal description of production resources and related production operations that the resources can perform. An executable version of such formalization can be automatically derived into a form of a digital twin. Such a derived digital twin can be enhanced with operation duration times that are obtained with process mining methods, leading to more realistic simulations for the entire production system. The proposed solution was successfully tested and validated in the Industry 4.0 Testbed, equipped with four robots and a transport system, which is utilized as a use-case in this article.