|
|
Experimental Physics and
| ||||||||||||||
|
|
The Data Browser widget and thus “trend” in your script have no “start_time” property.
You need to see what “trend” is via
print(trend.__class__.__name__)
and then study the source code for the API.
The API is specifically not guaranteed, you might have to rewrite your scripts for future versions.
Here’s an example that might help you in the current version of CS-Studio:
# Script triggered by a "minutes" or "start" PV # # pvs[0]: Either 'loc://minutes(10.0)' or 'loc://start("2025-10-09 11:00”)' # depending on option chosen below
from org.csstudio.display.builder.runtime.script import PVUtil, ScriptUtil from org.phoebus.util.time import TimeRelativeInterval, TimestampFormats from java.time import Duration, Instant
# DataBrowserWidget db = ScriptUtil.findWidgetByName(widget, "Data Browser")
# org.csstudio.trends.databrowser3.model.Model model = db.getDataBrowserModel()
# Option 1 for PV with number of minutes # Create relative time range ending 'now' #minutes = PVUtil.getDouble(pvs[0]) #millis = int(minutes*60*1000) #range = TimeRelativeInterval.startsAt(Duration.ofMillis(millis))
# Option 2 for PV with start date, also ending ’now' start = TimestampFormats.parse(PVUtil.getString(pvs[0])) end = Instant.now() range = TimeRelativeInterval.of(start, end)
# Option 3 for two PVs with start and end date #start = TimestampFormats.parse(PVUtil.getString(pvs[0])) #end = TimestampFormats.parse(PVUtil.getString(pvs[1]))
#range = TimeRelativeInterval.of(start, end)
print(range) model.setTimerange(range)
---
I am trying to set start and end time of my trends in data browser with the python script
| ||||||||||||||
| ANJ, 19 Mar 2026 |
·
Home
·
News
·
About
·
Talk
·
Base
·
Modules
·
Extensions
·
· Distributions · Download · Documents · Links · Licensing · |