{"id":9937,"date":"2016-02-23T12:56:56","date_gmt":"2016-02-23T04:56:56","guid":{"rendered":"http:\/\/localhost\/help\/?page_id=9937"},"modified":"2024-08-15T10:31:33","modified_gmt":"2024-08-15T02:31:33","slug":"timeweightedaverage_sampled","status":"publish","type":"page","link":"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/timeweightedaverage_sampled\/","title":{"rendered":"TimeWeightedAverage_Sampled()"},"content":{"rendered":"\n<h2><span id=\"Format\">Format<\/span><\/h2>\n<p class=\"intro-text\"><strong>TimeWeightedAverage_Sampled(Expr ,StartTime [,EndTime])<\/strong><\/p>\n<p class=\"left-bar-p2blue\">Note: This function was named\u00a0<em>Hist_TimeWeightedAverage<\/em>\u00a0in v2.6.<\/p>\n<h2><span id=\"Returns\">Returns<\/span><\/h2>\n<p class=\"intro-text\">Returns the time-weighted average of the values of\u00a0an expression over a range of time.<\/p>\n<h2><span id=\"Parameters\">Inputs<\/span><\/h2>\n<p class=\"intro-text\"><strong>Expr<\/strong>: The expression whose values should be averaged.<br \/>\n Behaviour: Required<br \/>\n Dimension:\u00a0Collection<br \/>\n Valid\u00a0data types:\u00a0Boolean, Decimal, Integer<\/p>\n<p class=\"intro-text\"><strong>StartTime<\/strong>: The start time over which to produce the average.\u00a0<br \/>\n Behaviour: Required <br \/>\n Dimension: Collection, SingleValue<br \/>\n Valid data types: DateTime, Decimal, Integer, String<\/p>\n<p class=\"left-bar-p2blue\">Note: You can use the <a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/time\/\">Time<\/a>() function to use a valid DateTime argument.<\/p>\n<p class=\"intro-text\"><strong>EndTime<\/strong>: The end time over which to produce the average.\u00a0If not specified, it assumes the current time.\u00a0<br \/>\n Behaviour: Optional\u00a0<br \/>\n Dimension: Collection, SingleValue<br \/>\n Valid data types: DateTime, Decimal, Integer, String<\/p>\n<p class=\"left-bar-p2blue\">Note: You can use the <a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/time\/\">Time<\/a>() function to use a valid DateTime argument.<\/p>\n<p class=\"left-bar\"><a href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/calculation-syntax\/#Data_Type\">How to format data types<\/a><\/p>\n<h2>When to Use<\/h2>\n<p class=\"intro-text\">A time-weighted average takes all the values that the expression held during a period of time, multiplies them by the time that the value was in effect, sums them, and then divides by the total time. This is most appropriate when producing averages of sampled continuous functions, such as the temperature of a furnace.<\/p>\n<p class=\"left-bar-yellow\">It is possible to retrieve very large volumes of data through indiscriminate use of this function. Retrieving large amounts of Historian data across a slow network can affect system performance for all users of the system.<\/p>\n<h2><span id=\"Examples\">Examples<\/span><\/h2>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">TimeWeightedAverage_Sampled(Expr, Time() - 60, Time())<\/span><br \/>\n Result: Average over the last minute (60 seconds).<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">TimeWeightedAverage_Sampled<\/span><span class=\"code-fragment\">(Expr, Time() - 60)<\/span><br \/>\n Result: Average over the last minute (60 seconds).<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">TimeWeightedAverage_Sampled<\/span><span class=\"code-fragment\">(Expr, Midnight(Time()))<\/span><br \/>\n Result: Average since midnight (the start of the day).<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">TimeWeightedAverage_Sampled<\/span><span class=\"code-fragment\">({tag, sampleMethod = \"Raw\"}, Time() \u2013 60)<\/span><br \/>\n Result: Average\u00a0of the raw values over the last minute.<\/p>\n<p class=\"intro-text\">Expression: <span class=\"code-fragment\">TimeWeightedAverage_Sampled<\/span><span class=\"code-fragment\">(Sampling(Expr, \"raw\"), Time() - 60)<\/span><br \/>\n Result: Average\u00a0of the raw values over the last minute.<\/p>\n<p class=\"intro-text\">\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use TimeWeightedAverage_Sampled() to get the time-weighted average of the values of an expression over a range of time.<\/p>\n<p class=\"continue-reading-button\"> <a class=\"continue-reading-link\" href=\"https:\/\/oihelp.corporate.ifs.com\/help\/p2-server\/calculations\/timeweightedaverage_sampled\/\">Read more<i class=\"crycon-right-dir\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":9939,"parent":3650,"menu_order":232,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":"","_members_access_role":[],"_members_access_error":""},"categories":[9],"tags":[285,100,413,422],"class_list":["post-9937","page","type-page","status-publish","has-post-thumbnail","hentry","category-tech-ref","tag-average","tag-calculations","tag-sampled","tag-time-weighted","Product-srv"],"_links":{"self":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/9937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/comments?post=9937"}],"version-history":[{"count":1,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/9937\/revisions"}],"predecessor-version":[{"id":46262,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/9937\/revisions\/46262"}],"up":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/pages\/3650"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media\/9939"}],"wp:attachment":[{"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/media?parent=9937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/categories?post=9937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oihelp.corporate.ifs.com\/help\/wp-json\/wp\/v2\/tags?post=9937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}