Skip to content

Commit

Permalink
Battery calculator updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jjophi authored Oct 23, 2023
1 parent 7a4f181 commit 974fafc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
33 changes: 18 additions & 15 deletions battery-calcuator/index.html → battery-calculator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h2 class="page-title">
<div class="help-content" :class="{'active': showHelp}">
<h3>To use this program, follow these steps:</h3>
<ol>
<li>SDistance: Enter the distance between the topside and seabed modem (slant range) in meters.</li>
<li>Distance: Enter the distance between the topside and seabed modem (slant range) in meters.</li>
<li>File Size: Provide the calculated file size (in kilobytes) obtained from the ADCP software.</li>
<li>Number of Transmissions: Specify the number of times you need to transfer per day/week/month.</li>
<li>Interpret Results: The program will recommend the modem, calculate the data rate, transmission power, and various durations based on the inputs.</li>
Expand All @@ -41,8 +41,7 @@ <h3>To use this program, follow these steps:</h3>
<div class="bc-row-wrapper">
<div class="bc-row">
<div class="bc-label">
<p class="bc-label-main">What is the distance between the topside and seabed modem (in meters)?</p>
<p class="bc-label-sub">(Slant Range)</p>
<p class="bc-label-main">Distance between the topside and seabed modem <span class="bc-label-sub">(Slant Range)</span></p>
</div>
<div class="bc-input">
<input v-model="distanceInput" type="number" id="range" min="1" max="1500" maxlength="4">
Expand All @@ -55,7 +54,7 @@ <h3>To use this program, follow these steps:</h3>
<div class="bc-row-wrapper">
<div class="bc-row two-col">
<div class="bc-label">
<p class="bc-label-main">What is the preferred series of Acoustic Smart Modem to be used?</p>
<p class="bc-label-main">Acoustic Smart Modem series</p>
</div>
<div class="bc-input bc-column radio">
<label>
Expand All @@ -74,8 +73,7 @@ <h3>To use this program, follow these steps:</h3>
<div class="bc-row-wrapper">
<div class="bc-row">
<div class="bc-label">
<p class="bc-label-main">What is the file size for each transmission (in kilobytes, as obtained from the ADCP software)?</p>
<p class="bc-label-sub">(Use the filesize (in kilobytes) obtained from the ADCP software)</p>
<p class="bc-label-main">File size per download <span class="bc-label-sub">(Use the filesize obtained from the ADCP software)</span></p>
</div>
<div class="bc-input">
<input v-model="filesizeInput" type="number" id="file-size" min="0" max="1500">
Expand All @@ -88,8 +86,7 @@ <h3>To use this program, follow these steps:</h3>
<div class="bc-row-wrapper">
<div class="bc-row two-col">
<div class="bc-label">
<p class="bc-label-main">What is the frequency of downloads?</p>
<p class="bc-label-sub">(Maximum 4 (daily), 7 (weekly) or 15 (monthly))</p>
<p class="bc-label-main">Frequency of downloads</p>
</div>
<div class="bc-input bc-column bc-range">
<div class="range-row">
Expand Down Expand Up @@ -182,21 +179,21 @@ <h5>Additional Info</h5>

<div class="bc-output-group">
<div class="bc-output-row">
<div class="bc-column bc-col-label">Transmit duration</div>
<div class="bc-column bc-col-label">Transmit duration per download</div>
<div class="bc-column bc-col-value">
<span class="bc-value" v-html="updatedOutputText(resultValues.txduration)"></span>
<span class="bc-unit"></span>
</div>
</div>
<div class="bc-output-row">
<div class="bc-column bc-col-label">Receive/idle duration</div>
<div class="bc-column bc-col-label">Receive / idle duration per download</div>
<div class="bc-column bc-col-value">
<span class="bc-value" v-html="updatedOutputText(resultValues.rxduration)"></span>
<span class="bc-unit"></span>
</div>
</div>
<div class="bc-output-row">
<div class="bc-column bc-col-label">Sleep duration</div>
<div class="bc-column bc-col-label">Daily sleep duration</div>
<div class="bc-column bc-col-value">
<span class="bc-value" v-html="updatedOutputText(resultValues.sleepduration)"></span>
<span class="bc-unit"></span>
Expand Down Expand Up @@ -238,7 +235,7 @@ <h5>Additional Info</h5>

<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<script>
const { createApp, ref, reactive, nextTick, watch, computed, onMounted } = Vue;
const { createApp, ref, reactive, nextTick, watch, watchEffect, computed, onMounted } = Vue;

createApp( {
delimiters: ['[[', ']]'],
Expand Down Expand Up @@ -312,6 +309,13 @@ <h5>Additional Info</h5>
recommended.value = null;
}
});

watch([distanceInput, recommended, filesizeInput, filesizeInput, downloadTimes], (
[newDistance, newReco, newFileSize, newFrequency, newTimes],
[prevDistance, prevReco, preFileSize, prevFrequency, prevTimes]) => {
noErrors.value = false;
});

const revisedTransitTimes = computed(() => {
downloadTimes.value = 1;
return Number(donwloadFrequency.value);
Expand All @@ -321,15 +325,15 @@ <h5>Additional Info</h5>
const frequency = Math.round(donwloadFrequency.value / 2);
return downloadTimes.value <= frequency ? 'in-range' : 'out-range';
})

const calculateBattery = () => {
checkForErrors();

if(noErrors.value) {
doCalculations();
}
}

const checkForErrors = () => {

if(distanceInput.value == null) {
Expand Down Expand Up @@ -425,7 +429,6 @@ <h5>Additional Info</h5>
if(resultValues.downloadCount == 7) timeFrequency = 'weekly';
if(resultValues.downloadCount == 15) timeFrequency = 'monthly';

console.log(downloadTimes.value)
resultValues.downloadFrequency = `${downloadTimes.value} ${downloadTimes.value > 1 ? 'times' : 'time'} ${timeFrequency}`;

//sleepduration
Expand Down
13 changes: 10 additions & 3 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4239,8 +4239,7 @@ p.small-title {
font-weight: 500;
}
.bc-wrapper .bc-label-sub {
font-size: 16px;
font-style: italic;
font-size: 14px;
color: #808080;
}
.bc-wrapper .bc-button-row {
Expand Down Expand Up @@ -4373,7 +4372,7 @@ input[type="range"]::-webkit-slider-thumb {
color: #808080;
padding-top: 10px;
}
.bc-wrapper .disclaimer {
.bc-wrapper .disclaimer p{
font-size: .86rem;
margin-top: 2rem;
}
Expand Down Expand Up @@ -4734,6 +4733,14 @@ input[type="range"]::-webkit-slider-thumb {
.bc-wrapper .bc-label {
padding-right: 0;
}
.bc-wrapper .bc-output-row {
grid-template-columns: 1fr;
row-gap: 8px;
font-size: 1rem;
}
.bc-wrapper .bc-output-group {
padding: 0.8rem;
}
}

@media only screen and (max-width: 480px) {
Expand Down

0 comments on commit 974fafc

Please sign in to comment.