Jump to content

Creating a periodic condition in Seeq DataLab and push it into workbench on all signals


Francesco

Recommended Posts

Hello,

I am currently working on a project in DataLab in which I have to manage a large number of signals (around 150). The final output should a table like the one below but with the last value of all the 150 signals. 

However, in order to obtain such a table I have to create a periodic condition (hourly) in the workbench and add one signal at a time by clicking on 'columns'.   

image.png.4666921a1fddf449aacfca60edf26d34.png

Since this would be a tedious work, I was trying to create a periodic condition in DataLab and apply it to all the signals. 

Therefore, my questions are: is it possible to create a periodic condition in Seeq DataLab and push it into workbench? Is it possible to somehow apply this periodic condition to all the signals ion order to obtain the shown table? Also the table must be uploaded every hour.

I looked at the documentation but couldn't find anything.

Thank you

Link to comment
Share on other sites

  • Seeq Team

Hi Francesco,

Yes, we can push using SDL but I'm just curious how many signals you want to view in one table? 150 is a lot and have you considered creating Asset Tree instead? You can read more about Asset Tree here: https://python-docs.seeq.com/user_guide/Asset Trees 1 - Introduction.html

If you think your signals are not suitable to arrange in asset tree do let me know and I'll share a script to push the signals.

Link to comment
Share on other sites

Hello Nuraisyah Rosli,

every signal is computed with a different calculation, therefore I think that an asset tree would be of help just to have a more organized output and arrangement of the signals. The only common 'calculation' is the creation of the periodic condition. 

Thank you,

Francesco

Link to comment
Share on other sites

  • Seeq Team

You can follow steps below to push the calculation. I would suggest to split the 150 signals into 15 tables so you have 10 columns only in 1 table. You can list down your signals name in a csv file and upload to your seeq datalab project. Click New and create a new Python 3 notebook. You can then start to write the script below:

Step 1: Import the pandas library

import pandas as pd

Step 2: script below will read the signals name listed in the csv)

my_items = pd.read_csv('taglist.csv') #edit the csv file here to match the csv file name you uploaded 

Step3: search the signals listed above

my_items = spy.search(my_items)
my_items

Step 4: Since all calculations are using same periodic condition which is hourly, you can create the condition first in the workbench (1 time only) and call it in Datalab as below:

search_condition = spy.search({"Name":"Hourly"}) #make sure the condition name you created in workbench is named Hourly as well

Step 5: Apply the formula to all signals by creating a scorecard metric. In this example we're trying to find the last value so the statistic used is Value At End.

resultdf=pd.DataFrame()

for index, row in my_items.iterrows():
    my_metric_input_condition = {
        'Type': 'Metric',
        'Name': row['Name'] + '_last value',
        'Measured Item': row['ID'],
        'Statistic': 'Value At End',
        'Bounding Condition': {'ID': search_condition[search_condition['Name'] == 'Hourly']['ID'].iloc[0]},
    }
   # Append the result to the empty dataframe
    resultdf = resultdf.append(my_metric_input_condition, ignore_index=True)


resultdf

Step 6: Push the scorecard metric to your workbench.

spy.push(metadata = resultdf, workbook='0EE61BAE-3EC2-7760-9367-553D489D11D8') #change the workbook ID to your workbook ID

Step 6: Open the link to workbench, and you can see the calculations last value generate like this:

image.png

Change the View to Table and click Condition Table to view it as table. 

image.png

Let me know if you need further help.

Edited by Nuraisyah Rosli
Link to comment
Share on other sites

  • 3 weeks later...
  • Seeq Team

Yes, you can read more on how to insert here: https://python-docs.seeq.com/user_guide/Asset Trees 1 - Introduction.html#inserting-signals-conditions-and-scalars-from-seeq-server

From the screenshot seems like you already have the structure ready, now you can search the metric in the server and insert it into the correct parent.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...