Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion container/oracle/initdb.d/03_default_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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', 0, 'TUN', 'N');

-- Populate Workgroup
insert into DTM_OWNER.WORKGROUP (WORKGROUP_ID, NAME) values (1, 'Group 1');
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public EventDowntimeFacade() {

@PermitAll
public List<EventDowntime> 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 "
+ "("
Expand Down Expand Up @@ -70,17 +70,6 @@ public List<EventDowntime> 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);
Expand All @@ -97,9 +86,8 @@ public List<EventDowntime> findByPeriodAndTypeSortByDuration(
}

@PermitAll
public double blockedCEBAFPhysicsDowntimeTotal(Date start, Date end) {
List<EventDowntime> downtimeList =
findByPeriodAndTypeSortByDuration(start, end, EventType.BLOCKED, null, true);
public double downtimeTotal(Date start, Date end, EventType type) {
List<EventDowntime> downtimeList = findByPeriodAndTypeSortByDuration(start, end, type, null);

double eventDowntime = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public TrendRecord load(Date start, Date end, EventType type, boolean includeCat

// Machine Overall Event Downtime
List<EventDowntime> eventList =
eventDowntimeFacade.findByPeriodAndTypeSortByDuration(start, end, type, null, null);
eventDowntimeFacade.findByPeriodAndTypeSortByDuration(start, end, type, null);
record.eventCount = eventList.size();

record.eventHours = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
// time up for events which span the period boundary

List<EventDowntime> 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\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
27 changes: 25 additions & 2 deletions src/main/webapp/WEB-INF/views/operability/joule.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,19 @@
<p>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.</p>
<p class="equation">Research = Physics Hours [BTM] + Quality - Physics Downtime</p>
<p class="equation">Quality = Bonus hours adjustment for program difficulty such as hall multiplicity</p>
<p class="equation">Physics Downtime = Event Down [DTM] - Internal Down [BTM]</p>
<p class="equation">Physics Downtime = CEBAF Blocked Event Down [DTM] - Internal Down [BTM]</p>
<p><b>Note:</b> Downtime from FSD Trips are not subtracted from research time.</p>
<c:url var="url" value="/reports/downtime-summary">
<c:param name="type" value="1"/>
<c:param name="start" value="${param.start}"/>
<c:param name="end" value="${param.end}"/>
</c:url>
<p><b>See:</b> <a href="${url}">CEBAF Blocked Summary</a></p>
<c:url var="url" value="${env['FRONTEND_SERVER_URL']}/btm/reports/beam-time-summary">
<c:param name="start" value="${param.start}"/>
<c:param name="end" value="${param.end}"/>
</c:url>
<p><b>See:</b> <a href="${url}">BTM Beam Summary</a></p>
</div>
</div>
</div>
Expand All @@ -250,9 +261,21 @@
<div class="definition-bubble-title">Delivered Tuning, Setup, &amp; Restore (TSR)</div>
<div class="definition-bubble-body">
<p>Time in which the Accelerator division used the machine for beam transport, program configuration setup (example: energy/pass), and initial machine restore.</p>
<p class="equation">TSR = ACC [BTM] + NPES Restore [BTM]</p>
<p class="equation">TSR = Tuning [DTM] + ACC [BTM] + NPES Restore [BTM]</p>
<p><b>Note:</b> Tuning is capture in Event Type CEBAF Tuning. Beam Transport incidents in CEBAF Degraded events are not included in TSR.</p>
<p><b>Note:</b> Recovery from downtime is included in downtime, not here.</p>
<p><b>Note:</b> TSR is converted to downtime if it is excessive - if it takes longer than limits negotiated in the Budget (NPES Long Term Schedule) schedule.</p>
<c:url var="url" value="${env['FRONTEND_SERVER_URL']}/btm/reports/beam-time-summary">
<c:param name="start" value="${param.start}"/>
<c:param name="end" value="${param.end}"/>
</c:url>
<p><b>See:</b> <a href="${url}">BTM Beam Summary</a></p>
<c:url var="url" value="/reports/downtime-summary">
<c:param name="type" value="9"/>
<c:param name="start" value="${param.start}"/>
<c:param name="end" value="${param.end}"/>
</c:url>
<p><b>See:</b> <a href="${url}">Tuning Summary</a></p>
</div>
</div>
</div>
Expand Down