From 1708ebab64b9988d15ea5587fc01df3a402afbe8 Mon Sep 17 00:00:00 2001 From: ryans Date: Mon, 3 Nov 2025 13:44:59 -0500 Subject: [PATCH 1/3] Tuning in Joule Fixes #45 --- container/oracle/initdb.d/03_default_data.sql | 5 ++++- .../webapp/WEB-INF/views/operability/joule.jsp | 14 +++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/container/oracle/initdb.d/03_default_data.sql b/container/oracle/initdb.d/03_default_data.sql index 5a1ca92..3d945a3 100644 --- a/container/oracle/initdb.d/03_default_data.sql +++ b/container/oracle/initdb.d/03_default_data.sql @@ -9,6 +9,7 @@ insert into dtm_owner.event_type (event_type_id, name, description, weight, abbr insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(6, 'LERF', 'LERF Program', 8, 'LRF', 'N'); insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(7, 'CEBAF Non-Program', 'CEBAF Program Unaffected', 3, 'NP', 'N'); insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(8, 'CEBAF Degraded', 'CEBAF Program Degraded', 2, 'DGD', 'N'); +insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(9, 'CEBAF Tuning', 'CEBAF Tuning', 9, 'TUN', 'N'); -- Populate Workgroup insert into DTM_OWNER.WORKGROUP (WORKGROUP_ID, NAME) values (1, 'Group 1'); @@ -127,7 +128,6 @@ insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (1, 1); insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (1, 3); insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (1, 4); insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (1, 5); -insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (1, 381); -- DGD insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (8, 1); insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (8, 3); @@ -160,6 +160,9 @@ insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (6, 4); insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (6, 5); insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (6, 381); +-- TUN +insert into DTM_OWNER.TYPE_CATEGORY (EVENT_TYPE_ID, CATEGORY_ID) values (9, 381); + -- Populate Alpha_Categories -- Other insert into DTM_OWNER.ALPHA_CATEGORY (CATEGORY_ID) values (3); diff --git a/src/main/webapp/WEB-INF/views/operability/joule.jsp b/src/main/webapp/WEB-INF/views/operability/joule.jsp index 6417ef6..421b2bb 100644 --- a/src/main/webapp/WEB-INF/views/operability/joule.jsp +++ b/src/main/webapp/WEB-INF/views/operability/joule.jsp @@ -250,9 +250,21 @@
Delivered Tuning, Setup, & Restore (TSR)

Time in which the Accelerator division used the machine for beam transport, program configuration setup (example: energy/pass), and initial machine restore.

-

TSR = ACC [BTM] + NPES Restore [BTM]

+

TSR = Tuning [DTM] + ACC [BTM] + NPES Restore [BTM]

+

Note: Tuning is capture in Event Type CEBAF Tuning. Beam Transport incidents in CEBAF Degraded events are not included in TSR.

Note: Recovery from downtime is included in downtime, not here.

Note: TSR is converted to downtime if it is excessive - if it takes longer than limits negotiated in the Budget (NPES Long Term Schedule) schedule.

+ + + + +

See: BTM Beam Summary

+ + + + + +

See: Tuning Summary

From 9adf4c356ed2bea59266b49ad032a869d8a336b4 Mon Sep 17 00:00:00 2001 From: ryans Date: Mon, 3 Nov 2025 14:03:17 -0500 Subject: [PATCH 2/3] Tuning in Joule --- .../business/session/EventDowntimeFacade.java | 18 +++--------------- .../business/session/JouleReportFacade.java | 7 +++++-- .../business/session/TrendReportFacade.java | 2 +- .../jlab/dtm/persistence/entity/EventType.java | 1 + .../controller/excel/ExcelEventList.java | 2 +- .../reports/DowntimeSummaryReport.java | 2 +- .../reports/EventDowntimeReport.java | 2 +- .../webapp/WEB-INF/views/operability/joule.jsp | 13 ++++++++++++- 8 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/jlab/dtm/business/session/EventDowntimeFacade.java b/src/main/java/org/jlab/dtm/business/session/EventDowntimeFacade.java index f36ccc9..d68a68a 100644 --- a/src/main/java/org/jlab/dtm/business/session/EventDowntimeFacade.java +++ b/src/main/java/org/jlab/dtm/business/session/EventDowntimeFacade.java @@ -36,7 +36,7 @@ public EventDowntimeFacade() { @PermitAll public List findByPeriodAndTypeSortByDuration( - Date start, Date end, EventType type, Boolean beamTransport, Boolean research) { + Date start, Date end, EventType type, Boolean beamTransport) { String sql = "select x.event_id, (x.duration / 60 / 60) as downtime_hours, (nvl(y.restore_bounded, 0) / 60 / 60) as restore_hours_bounded, x.number_of_incidents, x.event_title as title, cast(x.time_down as date), cast(x.time_up as date), cast(x.time_down_bounded as date), cast(x.time_up_bounded as date), (x.duration_bounded / 60 / 60) as downtime_hours_bounded from " + "(" @@ -70,17 +70,6 @@ public List findByPeriodAndTypeSortByDuration( } } - // research Y = only program PHYSICS - // research N = only program INTERNAL - // Null means don't filter program specially - if (research != null) { - if (research) { - // todo - } else { - // todo - } - } - sql = sql + "order by x.duration_bounded desc"; LOGGER.log(Level.FINEST, "Query: {0}", sql); @@ -97,9 +86,8 @@ public List findByPeriodAndTypeSortByDuration( } @PermitAll - public double blockedCEBAFPhysicsDowntimeTotal(Date start, Date end) { - List downtimeList = - findByPeriodAndTypeSortByDuration(start, end, EventType.BLOCKED, null, true); + public double downtimeTotal(Date start, Date end, EventType type) { + List downtimeList = findByPeriodAndTypeSortByDuration(start, end, type, null); double eventDowntime = 0; diff --git a/src/main/java/org/jlab/dtm/business/session/JouleReportFacade.java b/src/main/java/org/jlab/dtm/business/session/JouleReportFacade.java index 5ee274a..5ab8149 100644 --- a/src/main/java/org/jlab/dtm/business/session/JouleReportFacade.java +++ b/src/main/java/org/jlab/dtm/business/session/JouleReportFacade.java @@ -24,6 +24,7 @@ import org.jlab.dtm.business.params.JouleReportParams; import org.jlab.dtm.business.util.DtmDateIterator; import org.jlab.dtm.business.util.DtmTimeUtil; +import org.jlab.dtm.persistence.entity.EventType; import org.jlab.dtm.persistence.model.BeamSummaryTotals; import org.jlab.smoothness.business.service.SettingsService; @@ -125,7 +126,9 @@ private JouleRecord createRecord( record.setBin(start); - double downtimeHours = eventDowntimeFacade.blockedCEBAFPhysicsDowntimeTotal(start, end); + double downtimeHours = eventDowntimeFacade.downtimeTotal(start, end, EventType.BLOCKED); + + double tuningHours = eventDowntimeFacade.downtimeTotal(start, end, EventType.TUNING); BeamSummaryTotals beamSummary = accHourService.reportTotals(start, end); @@ -167,7 +170,7 @@ private JouleRecord createRecord( double deliveredBeamStudiesHours = beamSummary.getStudiesSeconds() / 3600.0; double deliveredTuningAndRestoreHours = - (beamSummary.getRestoreSeconds() + beamSummary.getAccSeconds()) / 3600.0; + tuningHours + ((beamSummary.getRestoreSeconds() + beamSummary.getAccSeconds()) / 3600.0); double totalDeliveredHours = deliveredResearchHours + deliveredBeamStudiesHours + deliveredTuningAndRestoreHours; diff --git a/src/main/java/org/jlab/dtm/business/session/TrendReportFacade.java b/src/main/java/org/jlab/dtm/business/session/TrendReportFacade.java index c6e75c5..3b3c0be 100644 --- a/src/main/java/org/jlab/dtm/business/session/TrendReportFacade.java +++ b/src/main/java/org/jlab/dtm/business/session/TrendReportFacade.java @@ -150,7 +150,7 @@ public TrendRecord load(Date start, Date end, EventType type, boolean includeCat // Machine Overall Event Downtime List eventList = - eventDowntimeFacade.findByPeriodAndTypeSortByDuration(start, end, type, null, null); + eventDowntimeFacade.findByPeriodAndTypeSortByDuration(start, end, type, null); record.eventCount = eventList.size(); record.eventHours = 0; diff --git a/src/main/java/org/jlab/dtm/persistence/entity/EventType.java b/src/main/java/org/jlab/dtm/persistence/entity/EventType.java index cc374f3..b4bfbd1 100644 --- a/src/main/java/org/jlab/dtm/persistence/entity/EventType.java +++ b/src/main/java/org/jlab/dtm/persistence/entity/EventType.java @@ -20,6 +20,7 @@ public class EventType implements Serializable { private static final long serialVersionUID = 1L; public static EventType BLOCKED = new EventType(BigInteger.ONE); + public static EventType TUNING = new EventType(BigInteger.valueOf(9L)); // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these // annotations to enforce field validation diff --git a/src/main/java/org/jlab/dtm/presentation/controller/excel/ExcelEventList.java b/src/main/java/org/jlab/dtm/presentation/controller/excel/ExcelEventList.java index d91d01c..c487704 100644 --- a/src/main/java/org/jlab/dtm/presentation/controller/excel/ExcelEventList.java +++ b/src/main/java/org/jlab/dtm/presentation/controller/excel/ExcelEventList.java @@ -91,7 +91,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) // time up for events which span the period boundary List eventList = - downtimeFacade.findByPeriodAndTypeSortByDuration(start, end, type, beamTransport, null); + downtimeFacade.findByPeriodAndTypeSortByDuration(start, end, type, beamTransport); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setHeader("content-disposition", "attachment;filename=\"incident-list.xlsx\""); diff --git a/src/main/java/org/jlab/dtm/presentation/controller/reports/DowntimeSummaryReport.java b/src/main/java/org/jlab/dtm/presentation/controller/reports/DowntimeSummaryReport.java index f0466bf..cf937eb 100644 --- a/src/main/java/org/jlab/dtm/presentation/controller/reports/DowntimeSummaryReport.java +++ b/src/main/java/org/jlab/dtm/presentation/controller/reports/DowntimeSummaryReport.java @@ -196,7 +196,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) duration = (end.getTime() - start.getTime()) / 1000 / 60 / 60; downtimeList = - downtimeFacade.findByPeriodAndTypeSortByDuration(start, end, type, beamTransport, null); + downtimeFacade.findByPeriodAndTypeSortByDuration(start, end, type, beamTransport); eventCount = downtimeList.size(); for (int i = 0; i < downtimeList.size(); i++) { diff --git a/src/main/java/org/jlab/dtm/presentation/controller/reports/EventDowntimeReport.java b/src/main/java/org/jlab/dtm/presentation/controller/reports/EventDowntimeReport.java index cf6bcad..2d6053a 100644 --- a/src/main/java/org/jlab/dtm/presentation/controller/reports/EventDowntimeReport.java +++ b/src/main/java/org/jlab/dtm/presentation/controller/reports/EventDowntimeReport.java @@ -89,7 +89,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) downtimeList = downtimeFacade.findByPeriodAndTypeSortByDuration( - params.getStart(), params.getEnd(), type, params.getBeamTransport(), null); + params.getStart(), params.getEnd(), type, params.getBeamTransport()); eventCount = downtimeList.size(); for (int i = 0; i < downtimeList.size(); i++) { diff --git a/src/main/webapp/WEB-INF/views/operability/joule.jsp b/src/main/webapp/WEB-INF/views/operability/joule.jsp index 421b2bb..11191f7 100644 --- a/src/main/webapp/WEB-INF/views/operability/joule.jsp +++ b/src/main/webapp/WEB-INF/views/operability/joule.jsp @@ -228,8 +228,19 @@

Time in which the Accelerator division provided the machine to the Physics division minus any downtime events during this time and plus any quality adjustment.

Research = Physics Hours [BTM] + Quality - Physics Downtime

Quality = Bonus hours adjustment for program difficulty such as hall multiplicity

-

Physics Downtime = Event Down [DTM] - Internal Down [BTM]

+

Physics Downtime = CEBAF Blocked Event Down [DTM] - Internal Down [BTM]

Note: Downtime from FSD Trips are not subtracted from research time.

+ + + + + +

See: CEBAF Blocked Summary

+ + + + +

See: BTM Beam Summary

From eb11e633847f451dc7d36e26483f2f78ad96267f Mon Sep 17 00:00:00 2001 From: ryans Date: Mon, 3 Nov 2025 14:09:07 -0500 Subject: [PATCH 3/3] Tuning in Joule --- container/oracle/initdb.d/03_default_data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container/oracle/initdb.d/03_default_data.sql b/container/oracle/initdb.d/03_default_data.sql index 3d945a3..61c2498 100644 --- a/container/oracle/initdb.d/03_default_data.sql +++ b/container/oracle/initdb.d/03_default_data.sql @@ -9,7 +9,7 @@ insert into dtm_owner.event_type (event_type_id, name, description, weight, abbr insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(6, 'LERF', 'LERF Program', 8, 'LRF', 'N'); insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(7, 'CEBAF Non-Program', 'CEBAF Program Unaffected', 3, 'NP', 'N'); insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(8, 'CEBAF Degraded', 'CEBAF Program Degraded', 2, 'DGD', 'N'); -insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(9, 'CEBAF Tuning', 'CEBAF Tuning', 9, 'TUN', 'N'); +insert into dtm_owner.event_type (event_type_id, name, description, weight, abbreviation, archived_yn) values(9, 'CEBAF Tuning', 'CEBAF Tuning', 0, 'TUN', 'N'); -- Populate Workgroup insert into DTM_OWNER.WORKGROUP (WORKGROUP_ID, NAME) values (1, 'Group 1');