calculator

This commit is contained in:
lekrsu 2023-10-04 14:42:02 +02:00
parent d7905309db
commit 757769af1b
4 changed files with 89 additions and 7 deletions

View File

@ -119,17 +119,16 @@ The calculations and principles discussed in this section have been applied to c
- Phase limits are customizable for torque and flux. The default settings are 65A for torque and 30A for flux. - Phase limits are customizable for torque and flux. The default settings are 65A for torque and 30A for flux.
#### ADC modding info (upcoming) #### ADC modding info
130k original 10s->12s (13s not really safe but works) In the context of ADC modding, you can utilize the following interactive calculator to help with your calculations. This calculator is designed for dark mode, ensuring readability in various environments.
160k 13s <div align="center">
<iframe src="https://lekrsu.github.io/shfw-walkthrough/" width="100%" height="300"></iframe>
</div>
200k 15s
240k 16-17s **Note**: Make sure to adjust Radc, as it plays a significant role in ADC modding.
270k 20s
### License ### License

20
calculator/index.html Normal file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>ADC Offset Calculator</title>
</head>
<body>
<h1>ADC Offset Calculator</h1>
<label for="inputRadc">Radc (Ohms):</label>
<input type="number" id="inputRadc" placeholder="Enter Radc value (e.g., 130000)">
<br>
<button id="calculateButton">Calculate</button>
<br>
<div id="result"></div>
<script src="script.js"></script>
</body>
</html>

17
calculator/script.js Normal file
View File

@ -0,0 +1,17 @@
document.addEventListener("DOMContentLoaded", function () {
const calculateButton = document.getElementById("calculateButton");
calculateButton.addEventListener("click", calculate);
function calculate() {
const Radc = parseFloat(document.getElementById("inputRadc").value);
if (!isNaN(Radc)) {
const maxVoltage = 3.3; // Fixed value for Max STM voltage
const R1 = 10000; // Fixed value for R1
const Vmax = (maxVoltage * (Radc + R1)) / R1;
document.getElementById("result").textContent = `Max Battery Voltage (Vmax): ${Vmax.toFixed(2)}V`;
} else {
document.getElementById("result").textContent = "Please enter a valid Radc value.";
}
}
});

46
calculator/style.css Normal file
View File

@ -0,0 +1,46 @@
/* Apply a dark background color to the entire calculator */
body {
background-color: #333;
color: #fff;
font-family: Arial, sans-serif;
}
/* Style the calculator container */
h1 {
font-size: 24px;
}
/* Style the input field */
input[type="number"] {
width: 300px;
padding: 10px;
background-color: #444;
color: #fff;
border: 1px solid #666;
border-radius: 5px;
margin-bottom: 10px;
}
/* Style the Calculate button */
button {
padding: 10px 20px;
background-color: #007acc;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
/* Style the result div */
#result {
margin-top: 10px;
padding: 10px;
background-color: #555;
color: #fff;
border-radius: 5px;
}
/* Change button style on hover */
button:hover {
background-color: #005a9e;
}