matt mcdowell Posted June 14 Share Posted June 14 Is there a way to export the calculation hierarchy for different assets in an asset Tree in SEEQ workbench? Possibly using Data lab? Link to comment Share on other sites More sharing options...
Administrators Teddy Posted June 17 Administrators Share Posted June 17 Hello Matt, Can you elaborate a little bit more on what you would like the final hierarchy to be? e.g. (A hierarchal display of an asset tree). Regards, Teddy Link to comment Share on other sites More sharing options...
matt mcdowell Posted June 25 Author Share Posted June 25 I may have used "Asset Tree" incorrectly. I think I meant to say, asset group. For an asset group, I would like to export the underlying items for each column/calculated item. For example, in an asset group, asset 1 column A may be a tag that is a sum of other tags. Is there a way to export these underlying items? You can view these underlying items when clicking on the Calculation hierarchy but its not as feasible if the asset group is large with many columns. Link to comment Share on other sites More sharing options...
Solution Thorsten Vogt Posted June 27 Solution Share Posted June 27 Hi Matt, only way I know currently is using the API, which can be called from SDL. As an example I created the following Asset Group: The following script extracts the data from the Asset Group. It needs the ID of the root element, which you can get from within Workbench, and iterates over the underlying items: import seeq.sdk as sdk treesApi = sdk.TreesApi(spy.client) itemsApi = sdk.ItemsApi(spy.client) parent_id = '0EF3492F-A4CE-EE30-BBD7-361933D678D8' tree = treesApi.get_tree(id=parent_id) for child in tree.children: print(f'Items for {child.name}') print() tree = treesApi.get_tree(id=child.id) for child in tree.children: print(f'Name: {child.name}') formulaProperty = [x for x in child.properties if x.name == 'Formula'][0] print(f'Formula: {formulaProperty.value}') dependency = itemsApi.get_formula_dependencies(id=child.id) formula_params = {} for parameter in child.parameters: formula_params[parameter.item.id] = parameter.name for d in dependency.dependencies: text = d.name if d.id in formula_params.keys(): text = text + f' => ${formula_params[d.id]}' for parameter in d.parameter_of: text = text + f' ({parameter.name})' print (text) print('------------') print() print() Output looks like this: Items for First Asset Name: Cold Formula: $t < 70 Temperature => $t (Cold) Area A_Temperature (Temperature) ------------ Name: Events per Day Formula: ($hot or $cold).aggregate(count(), days('CET'), durationKey()) Hot => $hot (Events per Day) Cold => $cold (Events per Day) Temperature (Hot) (Cold) Area A_Temperature (Temperature) ------------ Name: Hot Formula: ($t > 90).merge(20min, true) Temperature => $t (Hot) Area A_Temperature (Temperature) ------------ Name: Rate of Change Formula: $t.agileFilter(20min).derivative('h') Temperature => $t (Rate of Change) Area A_Temperature (Temperature) ------------ Name: Temperature Formula: $signal Area A_Temperature => $signal (Temperature) ------------ Items for Second Asset Name: Cold Formula: $t < 70 Temperature => $t (Cold) Area B_Temperature (Temperature) ------------ Name: Events per Day Formula: ($hot or $cold).aggregate(count(), days('CET'), durationKey()) Hot => $hot (Events per Day) Cold => $cold (Events per Day) Temperature (Hot) (Cold) Area B_Temperature (Temperature) ------------ Name: Hot Formula: ($t > 90).merge(20min, true) Temperature => $t (Hot) Area B_Temperature (Temperature) ------------ Name: Rate of Change Formula: $t.agileFilter(20min).derivative('h') Temperature => $t (Rate of Change) Area B_Temperature (Temperature) ------------ Name: Temperature Formula: $signal Area B_Temperature => $signal (Temperature) ------------ Items for Third Asset Name: Cold Formula: $t < 70 Temperature => $t (Cold) Area C_Temperature (Temperature) ------------ Name: Events per Day Formula: ($hot or $cold).aggregate(count(), days('CET'), durationKey()) Hot => $hot (Events per Day) Cold => $cold (Events per Day) Temperature (Hot) (Cold) Area C_Temperature (Temperature) ------------ Name: Hot Formula: ($t > 90).merge(20min, true) Temperature => $t (Hot) Area C_Temperature (Temperature) ------------ Name: Rate of Change Formula: $t.agileFilter(20min).derivative('h') Temperature => $t (Rate of Change) Area C_Temperature (Temperature) ------------ Name: Temperature Formula: $signal Area C_Temperature => $signal (Temperature) ------------ It displays the formula for each element and the variables assigned to it. In this example Area A_Temperature is included in Temperature, which is part of "Hot" and "Cold". "Hot" and "Cold" are assigned the vairables $hot and $cold and part of the formula of "Events per Day": Name: Events per Day Formula: ($hot or $cold).aggregate(count(), days('CET'), durationKey()) Hot => $hot (Events per Day) Cold => $cold (Events per Day) Temperature (Hot) (Cold) Area A_Temperature (Temperature) Hope this helps. Regards, Thorsten Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now