Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello everyone,
I'm trying to make an estimation about the duration of a cooling down process according to the measured temperature datas. I'm inteding to do this by writing a service to compare logged temperature values from the sensor and calculate the change of the temperature in a specific time intervall. I created a value stream and logged the temperature property, however I don't know how to retrieve the logged values with a custom service. I couldn't also find a tutorial about this. Can someone help me about this topic?
Thank you!
Solved! Go to Solution.
I just created a subscription according to the DataChange of temperature. In that subscripton I substracted the old value of the data from the new value of the data and set that result as a property called tempDiff (me.tempDiff = eventData.oldValue.value-eventData.newValue.value;). According to this difference the estimated cool down time is calculated.
You can retrieve property values through the Thing assigned to the value stream using a snippet QueryPropertyHistory (for example) against the time interval. Returned result will be in an infotable format. Also, you may use a FOR function to loop through the values treating it as a table.
I just created a subscription according to the DataChange of temperature. In that subscripton I substracted the old value of the data from the new value of the data and set that result as a property called tempDiff (me.tempDiff = eventData.oldValue.value-eventData.newValue.value;). According to this difference the estimated cool down time is calculated.