Automated Optimization and Control of Modular Chemical Systems