cancel
Showing results for 
Search instead for 
Did you mean: 

PCo Notification Trigger Expression for timed Notification

0 Kudos

Dear community,

i'm using PCo 15.1 to send Notifications to a DB or send sensor data to MII.

Right now, the trigger is always on, what generates a lot of data. Is it possible to write a trigger expression to send a notification every minute?

It is just a test scenario, where i would like to send a room temperature every minute, since i don't need it every second...

Tag comes from OPC Server.

Thanks and best regards

Stefan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, In the trigger type select condition as onTrue

and try to compare seconds in the expression

ex: if second is 00 then only raise the notification. This happens once in every minute so i think your requirement gets full filled.

Pls refer to the functions of expression editor here.

Functions in the Expression Editor - SAP Plant Connectivity - SAP Library

former_member196557
Active Contributor
0 Kudos

The PCo Notification trigger does not evaluate functions for the expression logic., only tag values that can be modified by the expressions. For example, this trigger expression does not cause a WhileTrue trigger to fire: second(datenow)%5==0 when the function returns a value of 5, 10, 15, etc.

If the PLC or OPC Server exposes a seconds tag (i.e., for Kepware it is _System.Time_Second) then subscribe to that tag and then use the MOD operator in PCo to fire a WhileTrue trigger every x seconds like this: (Time_Seconds%5)==0 will evaluate to True every 5 seconds.

An alternate method of doing this is to create an additional OPC Agent with an update rate identical to the sample rate that you want to use, and then choose an Always trigger. However, this will NOT trigger a notification unless at least one of the subscribed tags changes value between the update rate interval.

Regards, Steve

0 Kudos

it works for me Thanks

0 Kudos

Hi Steve,

thanks for describing the two methods to send notifications based on a given time.

In my case, i could only find the current time, provided by the server. Is it also possible to create an expression for that?

The tag "current time" has the value      2016-06-17T10:16:05:564Z

In my opinion, it has to be possible to create an expression where only the "05" is the relevant part of the value to trigger a notification. Could you provide such an expression?

For the second method: Were can i alter the general OPC Agent Update rate?

Thank you

Best regards

Stefan

former_member196557
Active Contributor
0 Kudos

Hi Stefan,

You can use this expression in a WhileTrue trigger:  second('tagname') where tagname is the tag name that you defined in the Subscription list.  Use the Expression Editor to select the second(date) function and replace date with a selected subscription item. So to do a 5 second interval for the trigger, the expression would be:

second('CurrentTime')%5==0

Where CurrrentTime is the name of the Subscription item for your current time value.

Regards, Steve

0 Kudos

Hi Steve,

thanks again for your help! It works with the expression you just posted.

I'm just wondering why there isn't a simple way to update the single tags like there is in "common" OPC clients...

former_member196557
Active Contributor
0 Kudos

Hi Stefan,

What is it that you are trying to update in PCo? Can you provide some details?

Regards, Steve

former_member196557
Active Contributor
0 Kudos

Hi Stefan,

OPC Agent Update Rate is a setting value on the OPC Agent Settings Tab in Group Settings.

Regards, Steve

0 Kudos

Hi Steve,

sry for the delay..

I just compared PCo with other OPC Clients, which give the oppertunity to see live changes and alter the update rate every single tag with one click. If I use the trigger expression that you suggested, PCo sends the value in the database (roomtemperature every 5 minutes to name one example).

best regards

Stefan

former_member196557
Active Contributor
0 Kudos

Hi Stefan,

PCo Management Console was not designed or intended to be used as a general OPC Client.  Since most OPC Servers already offer a client as part of the software, this was not seen as a requirement.

You can only change the Agent Update rate when the associated Agent Instances are not running. Do you have a requirement to be able to change Update rate while the associated Agent Instances are Running?

Not sure about what you asking here: 'If I use the trigger expression that you suggested, PCo sends the value in the database (roomtemperature every 5 minutes to name one example).'

Regards, Steve

0 Kudos

Hi Steve,

you already answered my question, that wasn't supposed to be another one, sry.

So thanks again.

Best regards,

Stefan

Answers (1)

Answers (1)

0 Kudos

Hello,

I want to store the metadata about the tags.

Example, when I subscribe the new tag, i want to store the information about the tag such as name, source, data type in HANA.

How can it be possible using PCo?

Best Regards,

Megha

former_member196557
Active Contributor
0 Kudos

Hi Megha,

Tag Metadata is only maintained in PCo. In PCo 15.1, If you set up an ODBC Destination (to write data to HANA tables) you can access the PCo metadata and write it with the tag data as part of the record.

Can you provide more detail about what you are trying to accomplish?

Regards, Steve

0 Kudos

Hi Steve,

Thanks for your reply.

My objective to use PCo is to get data from OPC serverand using PCo store it in HANA DB.

I created restful destination and i am able to store the data.

But my requirement is to collect the metadata of all tags from different machine in a separate table in HANA. Suppose if someone is adding new machine then i want to store the tags information in a table in HANA.

If I use the ODBC connection, It will give data in narrow format, can we changed it to wide format?

Regards,

Megha

0 Kudos

Hi Steve,

I tried odbc connection in sql sever , it works.

Can you please guide me how to connect hana from PCo.

I created DSN ( HDBODBC ) .

But its not coming up in configuration tab.

Thanks & Regards,

Megha

former_member196557
Active Contributor
0 Kudos

Hi Megha,

PCo is a 32bit application and needs to have 32bit ODBC DSN created for it. Please use this 32bit ODBC Data Source Administrator on your PCo server to create the 32bit Hana ODBC DSN:

C:\Windows\SysWOW64\odbcad32.exe

Regards, Steve

0 Kudos

Thanks for your reply steve.

I  tried many times creating 32bit, bt HDBODBC32  is not coming in the list of drivers.

Thanks & regards,

Megha

former_member196557
Active Contributor
0 Kudos

Hi Megha,

Did you try both System and User DSN for HANA?

Regards, Steve

0 Kudos

Thanks a lot Steve.

It is not finding the drivers i guess.

I installed the 32 bit HANA client separately, it worked.

Thanks

0 Kudos

Hi Steve,

I am able to simulate the data in HANA successfully.

Can I send data for multiple tables.

Suppose If i am selecting different tables which has same column name ex: TAB1 [COL1, COL2, COL3],   TAB2[COL1,COL2,COL3]

I want to send data in first table from different machine or tags and in second table from different.

What I see in destination tab, only unique column names gets populated.

Is there any way that we can achieve the above scenario.

Regards,

Megha

former_member196557
Active Contributor
0 Kudos

Hi Megha,

Yes, you can do this by creating additional destinations in PCo, one for each table that you need to populate.  You can assign more than one destination to a PCo Notification and map the same or different Subscription items to each destination as well.

Regards, Steve

0 Kudos

Thanks Steve

but in case we have 100 or large number of machines in a plant, we have to create equal number of destinations to store data in respective tables.

Can we avoid it ?

Thanks & regards,

Megha

former_member196557
Active Contributor
0 Kudos

Hi Megha,

I will need to understand your schema in order to best answer this.  why are you creating a table per machine?

Regards, Steve