Stateflow models are widely used in the industry to model the high-level control logic of Cyber-Physical Systems (CPSs) in Simulink--the defacto CPS simulator. Many approaches exist to test Simulink models, but once a fault is detected, the process to repair it remains manual. Such a manual process increases the software development cost, making it paramount to develop novel techniques that reduce this cost. Automated Program Repair (APR) techniques can significantly reduce the time for fixing bugs by automatically generating patches. However, current approaches face scalability issues to be applicable in the CPS context. To deal with this problem, we propose an automated search-based approach called FlowRepair, explicitly designed to repair Stateflow models. The novelty of FlowRepair includes, (1) a new algorithm that combines global and local search for patch generation; (2) a definition of novel repair objectives (e.g., the time a fault remained active) specifically designed for repairing CPSs; and (3) a set of mutation operators to repair Stateflow models automatically. We evaluated FlowRepair with three different case study systems and a total of nine faulty stateflow models. Our experiments suggest that (1) Flo wRepaircan fix bugs in stateflow models, including models with multiple faults; (2) FlowRepair surpasses or performs similarly to a baseline APR technique inspired by a well-known CPS program repair approach. Besides, we provide both a replication package and a live repository, paving the way towards the APR of CPSs modeled in Simulink.
翻译:Stateflow模型广泛应用于工业界,用于在事实上的CPS(信息物理系统)仿真器Simulink中建模高层控制逻辑。虽然存在多种测试Simulink模型的方法,但一旦检测到故障,修复过程仍需手动完成。这种手动流程增加了软件开发成本,因此开发降低该成本的新技术至关重要。自动程序修复(APR)技术可通过自动生成补丁显著缩短缺陷修复时间。然而,现有方法在应用于CPS场景时面临可扩展性问题。为此,我们提出一种名为FlowRepair的自动搜索方法,专门用于修复Stateflow模型。FlowRepair的创新点包括:(1)一种结合全局搜索与局部搜索的补丁生成新算法;(2)针对CPS修复专门定义的新型修复目标(例如故障持续活跃时间);(3)一组用于自动修复Stateflow模型的变异算子。我们通过三个不同案例系统(共包含九个故障Stateflow模型)对FlowRepair进行了评估。实验结果表明:(1)FlowRepair能够修复Stateflow模型中的缺陷(包括多故障模型);(2)FlowRepair的性能优于或等同于基于已知CPS程序修复方法构建的基线APR技术。此外,我们提供了可复现实验包和持续更新的代码库,为基于Simulink的CPS模型APR研究奠定基础。