0

Asset-Based Calculations with Output to Multiple Tags

Hi all, I’m working on setting up asset-based calculations in Canary and could use some guidance.

My goal:
Apply the same 5m calculation (e.g. 5-minute average of Real Power) across multiple assets defined in a Virtual View and asset model, and write the output tags to a centralized dataset (like CalcTest) using a dynamic path format like: "MyCalcs.{OriginalDataSetName}.5m.Real Power"

Id like to include additional tags in the asset model down the line and add additional expressions to my calculation.

Is this possible? I'm kind of at a loss here. 

 

20 replies

null
    • damon_vinciguerra.1
    • 7 days ago
    • Reported - view

    It's definitely possible. It's just a little hard to explain without sitting down and talking over it. There's a lot of steps. Are the images from a small sample set?

    This section (https://helpcenter.canarylabs.com/t/y4yfmn0/calcs-events-tile-version-25#calculation-expression) has a good writeup on how to employ the %Asset% variable to do asset-relative math and write data to asset-relative tags.

    And yes, you would want to write them to a MyCalcs DataSet. Then, you can import MyCalcs into your main View. Use rules to grab the calc tags you care about and strip off "MyCalc." from the front.

    Does that make sense? Happy to talk over it if you want.

      • srieger
      • 7 days ago
      • Reported - view

       unfortunately I feel completely lost with this process. I feel like the documentation doesn't provide this use case enough clarity.

      The first screenshot is a view including two actual sites. there are more but I figured keep it simple for now. Some of the paths to the Real Power tag vary in the naming of the device, so my first match is a model rule to ensure they all get renamed properly. I may not be doing this right but it seems to work.

      In the calculation I don't have any "Asset Tags" just "Tags", and I'm not sure how to reference the Real Power tag properly in the TimeAverage function.

      • damon_vinciguerra.1
      • 7 days ago
      • Reported - view

       If I'm reading your View right, you're assigning the 5MIN Asset Type to ".Real Power". Since there is nothing after Real Power, that asset won't have any Asset Tags. The segment before the Real Power is where you want to assign the Asset Type.

      Also, what is the intent of your first rule? It looks like you're renaming all your tags to Real Power, which is why it says there's a duplicate.

      • srieger
      • 7 days ago
      • Reported - view

       

      Yea, how this is supposed to work isn't click for me yet. Let me try restating my goal and what I have so far.

      Below is a new view, I have two datasets included in this view for simplicity. I'm trying to isolate the Real Power and SOC tags from each site so I can use them in the calculations.

      However I can't seem to figure out how to reference the tags properly to use in a calculation.

      In the end i'd like to setup this one calculation with multiple expressions. Each expression would write out a tag per dataset within the view with a matching asset.

      so in the example above id like to end up with the 5m average of 4 tags, 2 from each dataset within the view.

      • calcs.{site a}.5min.Real Power Avg
      • calcs.{site b}.5min.Real Power Avg
      • calcs.{site a}.5min.SOC Avg
      • calcs.{site b}.5min.SOC Avg
      • damon_vinciguerra.1
      • 7 days ago
      • Reported - view

       Since the tag paths leading up to Real Power and Site Avg SOC are different, then you wouldn't be able to do all of this in 1 calc. Because the calc can only accommodate one asset type. Unless all of the tags in your view will only have 3 segments, then we could do it.

       

      Add a rule to your View with the following (it may be not quite right, but it will get you in the ballpark):
      Match: ^Plant Control\.Site Control\.
      Asset Type: Site

      Then go back to the Calc and choose Site from the Asset Type Dropdown. Now you should see Site Avg SOC in your Asset Tags list on the right.

      See if that at least helps you understand how it's working.

      Also, hit me up on Teams or shoot me an email if you want to talk through it. Damon.Vinciguerra@cse-icon.com

      • srieger
      • 7 days ago
      • Reported - view

       ok this is making a bit more sense.

      So it's clear what I want to do would require having all the tags needed in the same Asset Type.  I'm assuming I can use the asset model to rename any tags I need to fall under that same asset type.

      My next question here is, how do I write the tag output so that it writes a value for each dataset in the model and to include the original dataset name in the path?

      • srieger
      • 7 days ago
      • Reported - view

       

      Hrm when I do this I get duplicates=1 for each model

    • srieger
    • 6 days ago
    • Reported - view

     I think I have this partially worked out. when i group the tags required for this 5m calculation into the same asset type path, in this instance "DataSet.5min.TagName" and use localhost.DatasetName instead of DatasetName when brining the DataSet into the view, it includes the site name (dataset) as an asset

    Then in the calculation understand now that it will be repeated for each Asset in the view.

    Where I think this is going to fail is with any expression where there could be an unknow number of units for a particular site (dataset). here is the example of one not using an asset model

    Here there are 6 BESS units for this particular site. However, at another site there could be 2, 4, 9 or any other number really.

    I understand I can bring these tags all together in the view, however in the calculation using the asset model, how could I perform this calculation without knowing how many tags I need to perform this on? 

      • damon_vinciguerra.1
      • 6 days ago
      • Reported - view

      I think you're looking for the Rollup (https://helpcenter.canarylabs.com/t/x2y8gla/available-functions-of-the-calculation-server-version-24#:~:text=a%20new%20interval.-,Rollup,-Calculates%20a%20sum) calc. But it would take a few steps to implement. You would have to add the Charge Limit as a tag on a child asset to 5min asset.

      So the resulting tags would look like "DataSet.PartYouHaveBlackedOut.5min.BESSs.BESS 1.Discharge Limit". Then set an asset type on the BESS 1 level.

      Then do a Calc on the BESS Asset Type to calculate the 5 minute average and call it "Discharge Limit (5min)" or something.

      Then do the rollup function in a different Calc.

      Rollup('[PJM 5M View.%Asset%]', 'SUM', 'BESS', 'Discharge Limit')

      Then you can do your absolute value and max in the same calc as the rollup.

      I guess if you're tag limited, you could do the rollup of the Limit tags, save that to a single tag per site, then do a 5 minute average of that. That's significantly less tags.

      • srieger
      • 6 days ago
      • Reported - view

       ok I think I'm getting there

      However I can't seem to sum them up

      • damon_vinciguerra.1
      • 6 days ago
      • Reported - view

       It definitely appears to be right. I see it's saying No Data as quality. I'm guessing all of your Online Racks tags have an integer value populated?

      • srieger
      • 6 days ago
      • Reported - view

       Is this taking the current value at the time of calculation and summing them up? What if i was to do average over time, would this rollup work? like TimeAverage, 5m ?

      • damon_vinciguerra.1
      • 6 days ago
      • Reported - view

       Yes to your first question. I thought about building in a time average, but I can't see how that would be done.   may know of a way. But that's why my original suggestion has a time average followed by rollup or rollup followed by time average.

      • srieger
      • 6 days ago
      • Reported - view

       But i would have to know in advance how many tags for each BESS to time average and that will change from asset to asset

      • damon_vinciguerra.1
      • 6 days ago
      • Reported - view

       not necessarily. Can you sum up every 1 minute or 5s or whatever you need, and save that to a tag, then come along with a 2nd analytic to time average the sum?

      • smason
      • 2 days ago
      • Reported - view

      Assuming BESS is an asset-type and [Online Racks] is one of its tags, the Rollup function will sum up all of the [Online Racks] tags at a given moment using their current value and roll them up to their respective parent asset type that is configured at the top of the screen. Here is an example where I'm rolling up the [TotalVolumeDaily] of each Pump asset to its respective District. A District can have any number of Pumps.

      The Rollup function does not do aggregated data over a given interval. It uses the current value across all child asset tags. But I agree with  , you would either have to do the 5-minute average of these tags first then do a rollup, or vice versa.

      • srieger
      • 2 days ago
      • Reported - view

       

      Okay, I think I get it now. If the number of "online racks" varies per asset, I can't use a calculation expression on an asset/asset type to get a 5-minute average. This is because rollup calculations don't average over time, and the number of online racks isn't known beforehand. So, I'll have to create manual calculations for each site.

      This brings up a question about execution order: If I have two calculations set to run every 5 minutes, does the first one in the main list run first, or do they run at the same time in their own threads?

      • smason
      • 2 days ago
      • Reported - view

      If the calculations are independent of each other, they will run at the same time, but you can build in delays if you need to using the Delay field. If, on the other hand, one calc is dependent on a prerequisite calc, it will wait for the first one to trigger before it does its own calculation. In that scenario, Delays from both calculations are added together before the 2nd one runs.

      • srieger
      • 2 days ago
      • Reported - view

       Thanks Steve, how is that dependency determination made. Is this handled by the calculation server automatically, identifying tags in calculation expressions that are generated by other calculation entirely?

      • smason
      • 2 days ago
      • Reported - view

      Yes, the calc service knows if one of its output tags is being used in a subsequent calc. In that way, if you stop the first level calc, the 2nd level calc will stay in a "Waiting on dependency" state until the first one is restarted and gets back to live mode.

Content aside

print this pagePrint this page
  • 2 days agoLast active
  • 20Replies
  • 18Views
  • 3 Following