在仿真AddRecipe功能块时发现:
如果配方表是一个空表,则在执行添加新配方是PLC会报错停机,见下图。
原因应该是由于#temp_x是0, #temp_i是-1,所以#temp_j := #recipeList.RecipeList[#temp_i].Next;就报错了吧?
#recipeList.RecipeList[#temp_x] := #recipeAdded;
#temp_i := #temp_x - 1;
#temp_j := #recipeList.RecipeList[#temp_i].Next;
另外,如果配方表里只有一个配方记录时,它的prev、next应该也都是-1吧,这和无效记录一样的了,这两个问题,请问老师和同学们有什么好的解决办法吗?

