{"payload":{"meta":{"Graph":{"@Type":"81297157","@Value":{"Guid":"(Guid)95b205c8-87e7-498a-a8f4-0a325c9916db","ParentGuid":"(Guid)06de3360-6eb7-495c-8a1d-e3e8eabed0e6","Name":"(string)validateIngMode","Properties":{"@Type":"2c41fa04:IDictionary","@Value":{}},"TypeGuid":"(Guid)f8a58466-d7f6-439f-bbb8-d4600e41d099","EmbeddedTypeGuids":{"@Type":"[Guid]","@Value":["(Guid)a9ed5b7e-75c5-4651-af16-d2c27e98cb94","(Guid)3b83b776-fb25-43b8-99f2-3c507c9143fc"]}}},"TypeInfos":{"2c41fa04":"{2c41fa04-1834-41c1-816e-303c7aa2c05b}","81297157":"{81297157-7ec9-45ce-845e-84cab2b88ade}","Guid":"System.Guid","string":"System.String"}},"object":{"Graph":{"@Type":"f8a58466","@Value":{"Implementation":{"@Type":"3b83b776","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)\n//If any mode has a count of more then 1 then clear all of that mode\nIF getModeCount(mode := atIngredientMode.onPremix) > 1 THEN\n\tsetMode(modeFrom := atIngredientMode.onPremix, modeTo := atIngredientMode.off);\nEND_IF\nIF getModeCount(mode := atIngredientMode.backup) > 1 THEN\n\tsetMode(modeFrom := atIngredientMode.backup, modeTo := atIngredientMode.off);\nEND_IF\nIF getModeCount(mode := atIngredientMode.onWheat) > 1 THEN\n\tsetMode(modeFrom := atIngredientMode.onWheat, modeTo := atIngredientMode.off);\nEND_IF\n\n//Apply any attempts at setting the mode\nub := UPPER_BOUND(in_ingredients,1);\nFOR i := 0 TO ub DO\n\tCASE in_ingredients[i].setMode OF\n\t\t//If desired mode is off, just set the mode to off\n\t\tatIngredientMode.off:\n\t\t\tin_ingredients[i].mode := atIngredientMode.off;\n\t\t//If desired mode is one of the main modes, then only set it if there is no other ingredient with that mode\n\t\tatIngredientMode.onPremix, atIngredientMode.backup, atIngredientMode.onWheat:\n\t\t\tIF getModeCount(mode := in_ingredients[i].setMode) = 0 THEN\n\t\t\t\tin_ingredients[i].mode := in_ingredients[i].setMode;\n\t\t\tEND_IF\n\tEND_CASE\n\t//Clear the desired mode\n\tin_ingredients[i].setMode := atIngredientMode.notSet;\nEND_FOR\n\n//Check if wheat is enabled\nwheatEn := FALSE;\nFOR i := 0 TO ub DO\n\tIF in_ingredients[i].mode = atIngredientMode.onWheat THEN\n\t\twheatEn := TRUE;\n\tEND_IF\nEND_FOR\n\n//Premix = 100%, if wheat is enabled then premix percent = 100% - wheat%\npremixPct := 100;\nIF wheatEn THEN\n\tpremixPct := 100 - in_wheatPct;\nEND_IF\n\n//Set each ingredients weight percent\nFOR i := 0 TO ub DO\n\tCASE in_ingredients[i].mode OF\n\t\t//Any not used ingredient\n\t\tatIngredientMode.off, atIngredientMode.backup, atIngredientMode.notSet:\n\t\t\tin_ingredients[i].mixWhtPct := 0;\n\t\t//Premix\n\t\tatIngredientMode.onPremix:\n\t\t\tin_ingredients[i].mixWhtPct := premixPct;\n\t\t//Wheat\n\t\tatIngredientMode.onWheat:\n\t\t\tin_ingredients[i].mixWhtPct := in_wheatPct;\n\tEND_CASE\nEND_FOR\n","LineInfoPersistence":"(string)95b205c8-87e7-498a-a8f4-0a325c9916db_Impl_LineIds"}}}},"Interface":{"@Type":"a9ed5b7e","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)//Verify that there are not two of any mode, set both to off if found\nMETHOD PRIVATE validateIngMode\nVAR\n\ti: DINT; //Loop variable\n\tub: DINT; //Array uppder bound\n\tpremixCnt: INT; //Count of premix primary\n\tbackupCnt: INT; //Count of premix backup\n\twheatCnt: INT; //Count of wheat\nEND_VAR\n\n\n","LineInfoPersistence":"(string)95b205c8-87e7-498a-a8f4-0a325c9916db_Decl_LineIds"}}}}}},"TypeInfos":{"3b83b776":"{3b83b776-fb25-43b8-99f2-3c507c9143fc}","a9ed5b7e":"{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}","f3878285":"{f3878285-8e4f-490b-bb1b-9acbb7eb04db}","f8a58466":"{f8a58466-d7f6-439f-bbb8-d4600e41d099}","string":"System.String"}}},"FormatVersion":"1.0"}