Hi,
Almost everything is in the title.
I can make it within "arbitrary" very old time ranged dpGetPeriod() function. As dpGetPeriod() returns, in addition to the request range, the value just after this range if I request an out of archived range I will get the last value archived and his time stamp. But is there more elegant way to proceed?
Thanks,
Sebastien Blanchard
How to get time stamp of the oldest dpe archived value?
- sblancha
- Posts:64
- Joined: Thu Feb 18, 2016 4:18 pm
How to get time stamp of the oldest dpe archived value?
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: How to get time stamp of the oldest dpe archived value?
Getting the time stamp of the oldest archived value is not a simple task.
Why do you want to read this information?
Which type of archiving (value archives, RDB/Oracle) is used in this project?
Best Regards
Leopold Knipp
Senior Support Specialist
Why do you want to read this information?
Which type of archiving (value archives, RDB/Oracle) is used in this project?
Best Regards
Leopold Knipp
Senior Support Specialist
- RudiKreiner
- Posts:198
- Joined: Mon May 16, 2011 2:10 pm
Re: How to get time stamp of the oldest dpe archived value?
If you are using valarch, and you know which archive class your datapoint is in (if you don't, then you can get it with dpGet(dpname:_archive.1._class)), then the name of the first file listed in the datapoint _ValueArchive_?.files.fileNames should be pretty close to what you are looking for. Note that the date in the filename is UTC though.
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: How to get time stamp of the oldest dpe archived value?
Reading the _archive.1._class information and the list of files might work but the results may be incorrect.
If the archive config was added later than the creation of the first file in the archive the result will not be correct, e.g. the archive files was created on 1.1.2017 and the archive config was added yesterday (2017.11.20).
Also you have to take into account that the archive class can be changed during runtime, e.g. dp element was archived first in archive 1 and was then moved to archive 2. If then only the file list for archive 2 is used the result will also be incorrect.
Best Regards
Leopold Knipp
Senior Support Specialist
If the archive config was added later than the creation of the first file in the archive the result will not be correct, e.g. the archive files was created on 1.1.2017 and the archive config was added yesterday (2017.11.20).
Also you have to take into account that the archive class can be changed during runtime, e.g. dp element was archived first in archive 1 and was then moved to archive 2. If then only the file list for archive 2 is used the result will also be incorrect.
Best Regards
Leopold Knipp
Senior Support Specialist
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: How to get time stamp of the oldest dpe archived value?
What about doing a dpGet for the DPE using the _start.._offline config-attribute combination ?
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: How to get time stamp of the oldest dpe archived value?
As far as I know the attribute _start.._offline only works when using the value archives (HDB).
The value for _start.._offline does not always give the information for the timestamp of the first archived value. It gives the information what can be the possible first time to save a value in the archive for the current project configuration.
Depending on the order of configuration steps you can get different results
Example 1
-- The (current) archive files was created at 2017.11.16 13:45:30 (UTC)
-- A new datapoint is created, e.g. dp Exa_Int1 for the dp type ExampleDP_Int
-- The original value is not set and is therefore not initialized, the timestamp is 1970.01.01 00:00:00
-- The archive config is added
-- Reading the attribute _start.._offline returns 2017.11.16 13:45:30 (UTC)
-- Setting an original value for Exa_Int1. with the current time
-- Reading the attribute _start.._offline returns still 2017.11.16 13:45:30 (UTC)
Example 2
-- The (current) archive files was created at 2017.11.16 13:45:30 (UTC)
-- A new datapoint is created, e.g. dp Exa_Int2 for the dp type ExampleDP_Int
-- Setting an original value for Exa_Int2. with the current time, e.g. 2017.11.22 08:40 (UTC)
-- The archive config is added
-- Reading the attribute _start.._offline returns 2017.11.22 08:40 (UTC)
Best Regards
Leopold Knipp
Senior Support Specialist
The value for _start.._offline does not always give the information for the timestamp of the first archived value. It gives the information what can be the possible first time to save a value in the archive for the current project configuration.
Depending on the order of configuration steps you can get different results
Example 1
-- The (current) archive files was created at 2017.11.16 13:45:30 (UTC)
-- A new datapoint is created, e.g. dp Exa_Int1 for the dp type ExampleDP_Int
-- The original value is not set and is therefore not initialized, the timestamp is 1970.01.01 00:00:00
-- The archive config is added
-- Reading the attribute _start.._offline returns 2017.11.16 13:45:30 (UTC)
-- Setting an original value for Exa_Int1. with the current time
-- Reading the attribute _start.._offline returns still 2017.11.16 13:45:30 (UTC)
Example 2
-- The (current) archive files was created at 2017.11.16 13:45:30 (UTC)
-- A new datapoint is created, e.g. dp Exa_Int2 for the dp type ExampleDP_Int
-- Setting an original value for Exa_Int2. with the current time, e.g. 2017.11.22 08:40 (UTC)
-- The archive config is added
-- Reading the attribute _start.._offline returns 2017.11.22 08:40 (UTC)
Best Regards
Leopold Knipp
Senior Support Specialist
- sblancha
- Posts:64
- Joined: Thu Feb 18, 2016 4:18 pm
Re: How to get time stamp of the oldest dpe archived value?
Thanks for your reply.
I am looking for a solution working for both file archiving and RDB archiving. If there is no easy way, I will go on with the arbitrary very old timestamp request with dpGetPeriod() function.
Sebastien
I am looking for a solution working for both file archiving and RDB archiving. If there is no easy way, I will go on with the arbitrary very old timestamp request with dpGetPeriod() function.
Sebastien
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: How to get time stamp of the oldest dpe archived value?
Can you please describe what the timestamp is used for.
Maybe the requirement can be fulfilled with another solution.
Best Regards
Leopold Knipp
Senior Support Specialist
Maybe the requirement can be fulfilled with another solution.
Best Regards
Leopold Knipp
Senior Support Specialist
- sblancha
- Posts:64
- Joined: Thu Feb 18, 2016 4:18 pm
Re: How to get time stamp of the oldest dpe archived value?
We have a custom Qt EWO for trending (our users requested an history trend widget dedicated to large number of logarithmic pressures trends). Basically the EWO has an addTrend() method invoked by the PVSS panel when user want to add a DPE value trend then the EWO trig an event to the PVSS panel requesting data values and corresponding time stamps. Users can change EWO time axis range by entering start and end time manually or by using a scroll bar. In order to define valid time range the EWO shall know the oldest value for each DPE value trend, this history maximum depth shall be pass through to the EWO using an argument in addTrend() method.
Cheers,
Sebastien
Cheers,
Sebastien
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: How to get time stamp of the oldest dpe archived value?
I'm interested in learning to why you do not use the WinCC_OA std. trend widget, which can also display logarithmic curves.
What is missing in our widget ?
What is missing in our widget ?