A component-based virtual engineering approach to PLC code generation for automation systems