{"payload":{"meta":{"Graph":{"@Type":"81297157","@Value":{"Guid":"(Guid)34ee8fb2-472e-402c-93f7-bfac7de46c78","ParentGuid":"(Guid)74ccca2f-50e3-4d5a-9d7a-9fd420284f83","Name":"(string)atCurveGetKey","Properties":{"@Type":"2c41fa04:IDictionary","@Value":[{"@Key":"(Guid)829a18f2-c514-4f6e-9634-1df173429203","@Value":{"@Type":"829a18f2","@Value":{"ParentObjects":{"@Type":"fa2ee218:IDictionary","@Value":[{"@Key":"(Guid)d9b2b2cc-ea99-4c3b-aa42-1e5c49e65b84","@Value":"(Guid)5f17b7ee-332a-4cd1-9df3-56ff0089d83a"}]}}}}]},"TypeGuid":"(Guid)6f9dac99-8de1-4efc-8465-68ac443b7d08","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}","829a18f2":"{829a18f2-c514-4f6e-9634-1df173429203}","fa2ee218":"{fa2ee218-a39b-4b6d-b249-49dbddbd168a}","Guid":"System.Guid","string":"System.String"}},"object":{"Graph":{"@Type":"6f9dac99","@Value":{"SpecialFunc":{"@Type":"0db3d7bb:Enum","@Value":"None"},"Implementation":{"@Type":"3b83b776","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string)//Curve is used to calculate a value given an index and a table of indexs and values\n//This function will handle getting the two indexes that surround the desired index and a ratio of how far between the two indexes is the desired index\n\n//Always enable first key\nkeys[0].en := TRUE;\n//Find the highest valid curve idx\ncurveHi := 0;\nFOR i := 1 TO DINT_TO_INT(UPPER_BOUND(keys,1)) DO\n\tkeys[i].en := FALSE;\n\tIF keys[i].key > keys[i-1].key THEN\n\t\tcurveHi := i;\n\t\tkeys[i].en := TRUE;\n\tEND_IF\nEND_FOR\n\n//Find the highest index that is lower then the input\nout_idxLo := 0;\nFOR i := 0 TO curveHi DO\n\t\tIF keys[i].key <= in_key THEN\n\t\t\tout_idxLo := i;\n\t\tEND_IF\nEND_FOR\n\n//Find the lowest index that is higher then the input\nout_idxHi := curveHi;\nFOR i := curveHi TO 0 BY -1 DO\n\t\tIF keys[i].key >= in_key THEN\n\t\t\tout_idxHi := i;\n\t\tEND_IF\nEND_FOR\n\n//Calculate the ratio\nscaling(\n\tin_raw:=in_key,\n\tin_rawMin := keys[out_idxLo].key,\n\tin_rawMax := keys[out_idxHi].key,\n\tin_clamp := TRUE,\n\tout_eu => out_ratio);\n\n\n\n\n\n\n","LineInfoPersistence":"(string)34ee8fb2-472e-402c-93f7-bfac7de46c78_Impl_LineIds"}}}},"Interface":{"@Type":"a9ed5b7e","@Value":{"TextDocument":{"@Type":"f3878285","@Value":{"TextBlobForSerialisation":"(string){attribute 'no_assign'}\nFUNCTION_BLOCK atCurveGetKey\nVAR_IN_OUT\n\tkeys: ARRAY[*] OF atCurveKey;\nEND_VAR\nVAR_INPUT\n\tin_key: REAL; //input index\n\nEND_VAR\nVAR_OUTPUT\n\tout_idxHi: INT; //High output index\n\tout_idxLo: INT; //Low output index\n\tout_ratio: REAL; //Ratio between low and high \nEND_VAR\nVAR\n\ti: INT; //loop VAR\n\tcurveHi: INT; //Highest valid curve idx\n\tscaling: atScaling;\nEND_VAR\n","LineInfoPersistence":"(string)34ee8fb2-472e-402c-93f7-bfac7de46c78_Decl_LineIds"}}}},"UniqueIdGenerator":"(string)361","POULevel":{"@Type":"8e575c5b:Enum","@Value":"Standard"},"ChildObjectGuids":{"@Type":"ArrayList:IList","@Value":[]},"AddAttributeSubsequent":"(bool)False"}},"TypeInfos":{"0db3d7bb":"{0db3d7bb-cde0-4416-9a7b-ce49a0124323}","3b83b776":"{3b83b776-fb25-43b8-99f2-3c507c9143fc}","6f9dac99":"{6f9dac99-8de1-4efc-8465-68ac443b7d08}","8e575c5b":"{8e575c5b-1d37-49c6-941b-5c0ec7874787}","a9ed5b7e":"{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}","ArrayList":"System.Collections.ArrayList","bool":"System.Boolean","f3878285":"{f3878285-8e4f-490b-bb1b-9acbb7eb04db}","string":"System.String"}}},"FormatVersion":"1.0"}