Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
Added a time to empty/time to full readout on the LSC (#85)
Browse files Browse the repository at this point in the history
* gradle

* Adding empty/filling readout to lsc

Update GTMTE_LapotronicSuperCapacitor.java

Update GTMTE_LapotronicSuperCapacitor.java

Update GTMTE_LapotronicSuperCapacitor.java

Update GTMTE_LapotronicSuperCapacitor.java

Update GTMTE_LapotronicSuperCapacitor.java

Update GTMTE_LapotronicSuperCapacitor.java

Update GTMTE_LapotronicSuperCapacitor.java

* Adding caching to avgin and avgout

* Moving cache up to include a few more variables

* Moved it to be inside the method call

* Spotless applied
  • Loading branch information
Reflex18 authored Apr 5, 2024
1 parent 6c875cb commit a5eb98a
Showing 1 changed file with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,10 @@ public String[] getInfoData() {
NumberFormat nf = NumberFormat.getNumberInstance();
int secInterval = DURATION_AVERAGE_TICKS / 20;

// Caching avgin and avgout
double avgIn = getAvgIn();
double avgOut = getAvgOut();

final ArrayList<String> ll = new ArrayList<>();
ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET);
ll.add("EU Stored (exact): " + nf.format(stored) + "EU");
Expand All @@ -917,8 +921,27 @@ public String[] getInfoData() {
ll.add("Passive Loss: " + nf.format(passiveDischargeAmount) + "EU/t");
ll.add("EU IN: " + GT_Utility.formatNumbers(inputLastTick) + "EU/t");
ll.add("EU OUT: " + GT_Utility.formatNumbers(outputLastTick) + "EU/t");
ll.add("Avg EU IN: " + nf.format(getAvgIn()) + " (last " + secInterval + " seconds)");
ll.add("Avg EU OUT: " + nf.format(getAvgOut()) + " (last " + secInterval + " seconds)");
ll.add("Avg EU IN: " + nf.format(avgIn) + " (last " + secInterval + " seconds)");
ll.add("Avg EU OUT: " + nf.format(avgOut) + " (last " + secInterval + " seconds)");

// Check if the system is charging or discharging
if (avgIn > avgOut) {
// Calculate time to full if charging
if (avgIn != 0) {
double timeToFull = (capacity.longValue() - stored.longValue()) / avgIn / 60;
ll.add("Time to Full: " + nf.format(timeToFull) + " minutes");
} else {
ll.add("Completely full");
}
} else {
// Calculate time to empty if discharging
if (avgOut != 0) {
double timeToEmpty = stored.longValue() / avgOut / 60;
ll.add("Time to Empty: " + nf.format(timeToEmpty) + " minutes");
} else {
ll.add("Completely empty");
}
}
ll.add(
"Maintenance Status: " + ((super.getRepairStatus() == super.getIdealStatus())
? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET
Expand Down

0 comments on commit a5eb98a

Please sign in to comment.