Spaces:
Running
Running
Wichtig die Temperatur soll langsamer ansteigen bei CPU Auslastung. - Initial Deployment
Browse files- README.md +7 -5
- index.html +613 -19
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: cpu-fan-simulator
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: green
|
5 |
+
colorTo: purple
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,613 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>CPU Fan Simulator</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
9 |
+
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
|
10 |
+
<style>
|
11 |
+
.fan-blades {
|
12 |
+
animation: spin linear infinite;
|
13 |
+
transform-origin: center;
|
14 |
+
}
|
15 |
+
|
16 |
+
@keyframes spin {
|
17 |
+
from { transform: rotate(0deg); }
|
18 |
+
to { transform: rotate(360deg); }
|
19 |
+
}
|
20 |
+
|
21 |
+
.temp-indicator {
|
22 |
+
transition: all 0.5s ease;
|
23 |
+
}
|
24 |
+
|
25 |
+
.slider-thumb::-webkit-slider-thumb {
|
26 |
+
-webkit-appearance: none;
|
27 |
+
width: 20px;
|
28 |
+
height: 20px;
|
29 |
+
border-radius: 50%;
|
30 |
+
background: #3b82f6;
|
31 |
+
cursor: pointer;
|
32 |
+
}
|
33 |
+
|
34 |
+
.slider-thumb::-moz-range-thumb {
|
35 |
+
width: 20px;
|
36 |
+
height: 20px;
|
37 |
+
border-radius: 50%;
|
38 |
+
background: #3b82f6;
|
39 |
+
cursor: pointer;
|
40 |
+
}
|
41 |
+
</style>
|
42 |
+
</head>
|
43 |
+
<body class="bg-gray-900 text-white min-h-screen">
|
44 |
+
<div class="container mx-auto px-4 py-8">
|
45 |
+
<h1 class="text-4xl font-bold text-center mb-8 text-blue-400">CPU Fan Simulator</h1>
|
46 |
+
|
47 |
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
48 |
+
<!-- CPU Visualization -->
|
49 |
+
<div class="bg-gray-800 rounded-xl p-6 shadow-lg col-span-1">
|
50 |
+
<h2 class="text-2xl font-semibold mb-4 text-center">CPU Status</h2>
|
51 |
+
|
52 |
+
<div class="flex flex-col items-center">
|
53 |
+
<div class="relative w-48 h-48 mb-6">
|
54 |
+
<!-- CPU Chip -->
|
55 |
+
<div class="absolute inset-0 bg-gray-700 rounded-lg flex items-center justify-center">
|
56 |
+
<div class="w-32 h-32 bg-gray-600 rounded-md flex items-center justify-center">
|
57 |
+
<div class="text-center">
|
58 |
+
<div id="cpuTemp" class="text-3xl font-bold">35°C</div>
|
59 |
+
<div id="cpuLoad" class="text-lg">0% Load</div>
|
60 |
+
</div>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<!-- Fan -->
|
65 |
+
<div id="fan" class="absolute -bottom-8 left-1/2 transform -translate-x-1/2 w-24 h-24">
|
66 |
+
<svg viewBox="0 0 100 100" class="w-full h-full">
|
67 |
+
<circle cx="50" cy="50" r="45" fill="#4b5563" />
|
68 |
+
<g class="fan-blades" id="fanBlades">
|
69 |
+
<path d="M50,5 L55,45 L50,50 L45,45 Z" fill="#9ca3af" />
|
70 |
+
<path d="M95,50 L55,55 L50,50 L55,45 Z" fill="#9ca3af" />
|
71 |
+
<path d="M50,95 L45,55 L50,50 L55,55 Z" fill="#9ca3af" />
|
72 |
+
<path d="M5,50 L45,45 L50,50 L45,55 Z" fill="#9ca3af" />
|
73 |
+
</g>
|
74 |
+
<circle cx="50" cy="50" r="15" fill="#374151" />
|
75 |
+
</svg>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
|
79 |
+
<!-- Temperature indicator -->
|
80 |
+
<div class="w-full h-6 bg-gradient-to-r from-blue-500 via-yellow-500 to-red-500 rounded-full mb-2 relative">
|
81 |
+
<div id="tempIndicator" class="temp-indicator absolute top-0 left-0 w-2 h-6 bg-white rounded-full -ml-1"></div>
|
82 |
+
</div>
|
83 |
+
|
84 |
+
<div class="flex justify-between w-full text-xs">
|
85 |
+
<span>0°C</span>
|
86 |
+
<span>50°C</span>
|
87 |
+
<span>100°C</span>
|
88 |
+
</div>
|
89 |
+
|
90 |
+
<!-- Fan speed -->
|
91 |
+
<div class="mt-6 w-full">
|
92 |
+
<div class="flex justify-between mb-1">
|
93 |
+
<span>Fan Speed</span>
|
94 |
+
<span id="fanSpeedDisplay">0%</span>
|
95 |
+
</div>
|
96 |
+
<div class="w-full h-4 bg-gray-700 rounded-full overflow-hidden">
|
97 |
+
<div id="fanSpeedBar" class="h-full bg-blue-500 rounded-full" style="width: 0%"></div>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
|
103 |
+
<!-- Controls -->
|
104 |
+
<div class="bg-gray-800 rounded-xl p-6 shadow-lg col-span-1">
|
105 |
+
<h2 class="text-2xl font-semibold mb-4 text-center">Controls</h2>
|
106 |
+
|
107 |
+
<div class="space-y-6">
|
108 |
+
<!-- CPU Load Slider -->
|
109 |
+
<div>
|
110 |
+
<label for="cpuLoadSlider" class="block mb-2">CPU Load: <span id="cpuLoadValue">0</span>%</label>
|
111 |
+
<input type="range" id="cpuLoadSlider" min="0" max="100" value="0" class="w-full slider-thumb">
|
112 |
+
</div>
|
113 |
+
|
114 |
+
<!-- Max Temp Slider -->
|
115 |
+
<div>
|
116 |
+
<label for="maxTempSlider" class="block mb-2">Max Safe Temperature: <span id="maxTempValue">85</span>°C</label>
|
117 |
+
<input type="range" id="maxTempSlider" min="60" max="100" value="85" class="w-full slider-thumb">
|
118 |
+
</div>
|
119 |
+
|
120 |
+
<!-- Fan Curve Type -->
|
121 |
+
<div>
|
122 |
+
<label class="block mb-2">Fan Curve Type:</label>
|
123 |
+
<div class="grid grid-cols-2 gap-2">
|
124 |
+
<button id="curveLinear" class="bg-blue-600 hover:bg-blue-700 py-2 px-4 rounded">Linear</button>
|
125 |
+
<button id="curveAggressive" class="bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded">Aggressive</button>
|
126 |
+
<button id="curveSilent" class="bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded">Silent</button>
|
127 |
+
<button id="curveCustom" class="bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded">Custom</button>
|
128 |
+
</div>
|
129 |
+
</div>
|
130 |
+
|
131 |
+
<!-- Fan Speed Limit -->
|
132 |
+
<div>
|
133 |
+
<label for="maxFanSpeedSlider" class="block mb-2">Max Fan Speed: <span id="maxFanSpeedValue">100</span>%</label>
|
134 |
+
<input type="range" id="maxFanSpeedSlider" min="20" max="100" value="100" class="w-full slider-thumb">
|
135 |
+
</div>
|
136 |
+
|
137 |
+
<!-- Buttons -->
|
138 |
+
<div class="grid grid-cols-2 gap-4 pt-4">
|
139 |
+
<button id="startStress" class="bg-red-600 hover:bg-red-700 py-3 px-4 rounded-lg font-medium">
|
140 |
+
<i class="fas fa-bolt mr-2"></i> Stress Test
|
141 |
+
</button>
|
142 |
+
<button id="stopStress" class="bg-gray-600 hover:bg-gray-500 py-3 px-4 rounded-lg font-medium">
|
143 |
+
<i class="fas fa-stop mr-2"></i> Stop
|
144 |
+
</button>
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
|
149 |
+
<!-- Fan Curve Editor -->
|
150 |
+
<div class="bg-gray-800 rounded-xl p-6 shadow-lg col-span-1 lg:col-span-1">
|
151 |
+
<h2 class="text-2xl font-semibold mb-4 text-center">Fan Curve</h2>
|
152 |
+
|
153 |
+
<div class="h-64 mb-4">
|
154 |
+
<canvas id="fanCurveChart"></canvas>
|
155 |
+
</div>
|
156 |
+
|
157 |
+
<div id="customCurveControls" class="space-y-4 opacity-50 pointer-events-none">
|
158 |
+
<div>
|
159 |
+
<label for="lowTemp" class="block mb-2">Low Temp (<span id="lowTempValue">30</span>°C):</label>
|
160 |
+
<input type="range" id="lowTemp" min="20" max="50" value="30" class="w-full slider-thumb">
|
161 |
+
</div>
|
162 |
+
|
163 |
+
<div>
|
164 |
+
<label for="lowSpeed" class="block mb-2">Low Speed (<span id="lowSpeedValue">20</span>%):</label>
|
165 |
+
<input type="range" id="lowSpeed" min="0" max="50" value="20" class="w-full slider-thumb">
|
166 |
+
</div>
|
167 |
+
|
168 |
+
<div>
|
169 |
+
<label for="highTemp" class="block mb-2">High Temp (<span id="highTempValue">70</span>°C):</label>
|
170 |
+
<input type="range" id="highTemp" min="50" max="90" value="70" class="w-full slider-thumb">
|
171 |
+
</div>
|
172 |
+
|
173 |
+
<div>
|
174 |
+
<label for="highSpeed" class="block mb-2">High Speed (<span id="highSpeedValue">80</span>%):</label>
|
175 |
+
<input type="range" id="highSpeed" min="50" max="100" value="80" class="w-full slider-thumb">
|
176 |
+
</div>
|
177 |
+
</div>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
|
181 |
+
<!-- Logs -->
|
182 |
+
<div class="bg-gray-800 rounded-xl p-6 shadow-lg mt-8">
|
183 |
+
<h2 class="text-2xl font-semibold mb-4">System Log</h2>
|
184 |
+
<div id="systemLog" class="h-40 overflow-y-auto bg-gray-900 p-3 rounded font-mono text-sm space-y-1">
|
185 |
+
<div class="text-gray-400">System initialized. Ready to simulate CPU fan behavior.</div>
|
186 |
+
</div>
|
187 |
+
</div>
|
188 |
+
</div>
|
189 |
+
|
190 |
+
<script>
|
191 |
+
// State variables
|
192 |
+
let cpuLoad = 0;
|
193 |
+
let cpuTemp = 35;
|
194 |
+
let maxTemp = 85;
|
195 |
+
let fanSpeed = 0;
|
196 |
+
let maxFanSpeed = 100;
|
197 |
+
let stressTestInterval = null;
|
198 |
+
let fanCurveType = 'linear';
|
199 |
+
let fanCurvePoints = [];
|
200 |
+
|
201 |
+
// DOM elements
|
202 |
+
const cpuTempElement = document.getElementById('cpuTemp');
|
203 |
+
const cpuLoadElement = document.getElementById('cpuLoad');
|
204 |
+
const cpuLoadSlider = document.getElementById('cpuLoadSlider');
|
205 |
+
const cpuLoadValue = document.getElementById('cpuLoadValue');
|
206 |
+
const maxTempSlider = document.getElementById('maxTempSlider');
|
207 |
+
const maxTempValue = document.getElementById('maxTempValue');
|
208 |
+
const maxFanSpeedSlider = document.getElementById('maxFanSpeedSlider');
|
209 |
+
const maxFanSpeedValue = document.getElementById('maxFanSpeedValue');
|
210 |
+
const fanSpeedDisplay = document.getElementById('fanSpeedDisplay');
|
211 |
+
const fanSpeedBar = document.getElementById('fanSpeedBar');
|
212 |
+
const tempIndicator = document.getElementById('tempIndicator');
|
213 |
+
const fanBlades = document.getElementById('fanBlades');
|
214 |
+
const startStress = document.getElementById('startStress');
|
215 |
+
const stopStress = document.getElementById('stopStress');
|
216 |
+
const systemLog = document.getElementById('systemLog');
|
217 |
+
|
218 |
+
// Fan curve buttons
|
219 |
+
const curveLinear = document.getElementById('curveLinear');
|
220 |
+
const curveAggressive = document.getElementById('curveAggressive');
|
221 |
+
const curveSilent = document.getElementById('curveSilent');
|
222 |
+
const curveCustom = document.getElementById('curveCustom');
|
223 |
+
|
224 |
+
// Custom curve controls
|
225 |
+
const customCurveControls = document.getElementById('customCurveControls');
|
226 |
+
const lowTemp = document.getElementById('lowTemp');
|
227 |
+
const lowTempValue = document.getElementById('lowTempValue');
|
228 |
+
const lowSpeed = document.getElementById('lowSpeed');
|
229 |
+
const lowSpeedValue = document.getElementById('lowSpeedValue');
|
230 |
+
const highTemp = document.getElementById('highTemp');
|
231 |
+
const highTempValue = document.getElementById('highTempValue');
|
232 |
+
const highSpeed = document.getElementById('highSpeed');
|
233 |
+
const highSpeedValue = document.getElementById('highSpeedValue');
|
234 |
+
|
235 |
+
// Chart
|
236 |
+
const ctx = document.getElementById('fanCurveChart').getContext('2d');
|
237 |
+
let fanCurveChart = new Chart(ctx, {
|
238 |
+
type: 'line',
|
239 |
+
data: {
|
240 |
+
datasets: [{
|
241 |
+
label: 'Fan Speed (%)',
|
242 |
+
data: [],
|
243 |
+
borderColor: 'rgb(59, 130, 246)',
|
244 |
+
backgroundColor: 'rgba(59, 130, 246, 0.1)',
|
245 |
+
borderWidth: 2,
|
246 |
+
fill: true,
|
247 |
+
tension: 0.4
|
248 |
+
}]
|
249 |
+
},
|
250 |
+
options: {
|
251 |
+
responsive: true,
|
252 |
+
maintainAspectRatio: false,
|
253 |
+
scales: {
|
254 |
+
x: {
|
255 |
+
title: {
|
256 |
+
display: true,
|
257 |
+
text: 'Temperature (°C)',
|
258 |
+
color: '#fff'
|
259 |
+
},
|
260 |
+
min: 0,
|
261 |
+
max: 100,
|
262 |
+
ticks: {
|
263 |
+
color: '#fff'
|
264 |
+
},
|
265 |
+
grid: {
|
266 |
+
color: 'rgba(255, 255, 255, 0.1)'
|
267 |
+
}
|
268 |
+
},
|
269 |
+
y: {
|
270 |
+
title: {
|
271 |
+
display: true,
|
272 |
+
text: 'Fan Speed (%)',
|
273 |
+
color: '#fff'
|
274 |
+
},
|
275 |
+
min: 0,
|
276 |
+
max: 100,
|
277 |
+
ticks: {
|
278 |
+
color: '#fff'
|
279 |
+
},
|
280 |
+
grid: {
|
281 |
+
color: 'rgba(255, 255, 255, 0.1)'
|
282 |
+
}
|
283 |
+
}
|
284 |
+
},
|
285 |
+
plugins: {
|
286 |
+
legend: {
|
287 |
+
labels: {
|
288 |
+
color: '#fff'
|
289 |
+
}
|
290 |
+
},
|
291 |
+
tooltip: {
|
292 |
+
callbacks: {
|
293 |
+
label: function(context) {
|
294 |
+
return `Fan Speed: ${context.parsed.y}% at ${context.parsed.x}°C`;
|
295 |
+
}
|
296 |
+
}
|
297 |
+
}
|
298 |
+
}
|
299 |
+
}
|
300 |
+
});
|
301 |
+
|
302 |
+
// Initialize
|
303 |
+
updateFanCurve();
|
304 |
+
updateUI();
|
305 |
+
|
306 |
+
// Event listeners
|
307 |
+
cpuLoadSlider.addEventListener('input', function() {
|
308 |
+
cpuLoad = parseInt(this.value);
|
309 |
+
cpuLoadValue.textContent = cpuLoad;
|
310 |
+
updateCPUState();
|
311 |
+
updateUI();
|
312 |
+
});
|
313 |
+
|
314 |
+
maxTempSlider.addEventListener('input', function() {
|
315 |
+
maxTemp = parseInt(this.value);
|
316 |
+
maxTempValue.textContent = maxTemp;
|
317 |
+
updateFanCurve();
|
318 |
+
updateUI();
|
319 |
+
});
|
320 |
+
|
321 |
+
maxFanSpeedSlider.addEventListener('input', function() {
|
322 |
+
maxFanSpeed = parseInt(this.value);
|
323 |
+
maxFanSpeedValue.textContent = maxFanSpeed;
|
324 |
+
updateFanCurve();
|
325 |
+
updateUI();
|
326 |
+
});
|
327 |
+
|
328 |
+
startStress.addEventListener('click', function() {
|
329 |
+
if (stressTestInterval) clearInterval(stressTestInterval);
|
330 |
+
|
331 |
+
cpuLoad = 100;
|
332 |
+
cpuLoadSlider.value = 100;
|
333 |
+
cpuLoadValue.textContent = '100';
|
334 |
+
|
335 |
+
stressTestInterval = setInterval(function() {
|
336 |
+
updateCPUState();
|
337 |
+
updateUI();
|
338 |
+
}, 500);
|
339 |
+
|
340 |
+
addLog("Started CPU stress test");
|
341 |
+
});
|
342 |
+
|
343 |
+
stopStress.addEventListener('click', function() {
|
344 |
+
if (stressTestInterval) {
|
345 |
+
clearInterval(stressTestInterval);
|
346 |
+
stressTestInterval = null;
|
347 |
+
}
|
348 |
+
|
349 |
+
cpuLoad = 0;
|
350 |
+
cpuLoadSlider.value = 0;
|
351 |
+
cpuLoadValue.textContent = '0';
|
352 |
+
|
353 |
+
updateCPUState();
|
354 |
+
updateUI();
|
355 |
+
|
356 |
+
addLog("Stopped CPU stress test");
|
357 |
+
});
|
358 |
+
|
359 |
+
// Fan curve type buttons
|
360 |
+
curveLinear.addEventListener('click', function() {
|
361 |
+
fanCurveType = 'linear';
|
362 |
+
updateButtonStates();
|
363 |
+
updateFanCurve();
|
364 |
+
addLog("Fan curve set to Linear");
|
365 |
+
});
|
366 |
+
|
367 |
+
curveAggressive.addEventListener('click', function() {
|
368 |
+
fanCurveType = 'aggressive';
|
369 |
+
updateButtonStates();
|
370 |
+
updateFanCurve();
|
371 |
+
addLog("Fan curve set to Aggressive");
|
372 |
+
});
|
373 |
+
|
374 |
+
curveSilent.addEventListener('click', function() {
|
375 |
+
fanCurveType = 'silent';
|
376 |
+
updateButtonStates();
|
377 |
+
updateFanCurve();
|
378 |
+
addLog("Fan curve set to Silent");
|
379 |
+
});
|
380 |
+
|
381 |
+
curveCustom.addEventListener('click', function() {
|
382 |
+
fanCurveType = 'custom';
|
383 |
+
updateButtonStates();
|
384 |
+
updateFanCurve();
|
385 |
+
addLog("Fan curve set to Custom");
|
386 |
+
});
|
387 |
+
|
388 |
+
// Custom curve controls
|
389 |
+
lowTemp.addEventListener('input', function() {
|
390 |
+
lowTempValue.textContent = this.value;
|
391 |
+
if (fanCurveType === 'custom') updateFanCurve();
|
392 |
+
});
|
393 |
+
|
394 |
+
lowSpeed.addEventListener('input', function() {
|
395 |
+
lowSpeedValue.textContent = this.value;
|
396 |
+
if (fanCurveType === 'custom') updateFanCurve();
|
397 |
+
});
|
398 |
+
|
399 |
+
highTemp.addEventListener('input', function() {
|
400 |
+
highTempValue.textContent = this.value;
|
401 |
+
if (fanCurveType === 'custom') updateFanCurve();
|
402 |
+
});
|
403 |
+
|
404 |
+
highSpeed.addEventListener('input', function() {
|
405 |
+
highSpeedValue.textContent = this.value;
|
406 |
+
if (fanCurveType === 'custom') updateFanCurve();
|
407 |
+
});
|
408 |
+
|
409 |
+
// Functions
|
410 |
+
function updateButtonStates() {
|
411 |
+
curveLinear.className = fanCurveType === 'linear' ?
|
412 |
+
'bg-blue-600 hover:bg-blue-700 py-2 px-4 rounded' :
|
413 |
+
'bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded';
|
414 |
+
|
415 |
+
curveAggressive.className = fanCurveType === 'aggressive' ?
|
416 |
+
'bg-blue-600 hover:bg-blue-700 py-2 px-4 rounded' :
|
417 |
+
'bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded';
|
418 |
+
|
419 |
+
curveSilent.className = fanCurveType === 'silent' ?
|
420 |
+
'bg-blue-600 hover:bg-blue-700 py-2 px-4 rounded' :
|
421 |
+
'bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded';
|
422 |
+
|
423 |
+
curveCustom.className = fanCurveType === 'custom' ?
|
424 |
+
'bg-blue-600 hover:bg-blue-700 py-2 px-4 rounded' :
|
425 |
+
'bg-gray-700 hover:bg-gray-600 py-2 px-4 rounded';
|
426 |
+
|
427 |
+
if (fanCurveType === 'custom') {
|
428 |
+
customCurveControls.className = 'space-y-4';
|
429 |
+
customCurveControls.classList.remove('opacity-50', 'pointer-events-none');
|
430 |
+
} else {
|
431 |
+
customCurveControls.className = 'space-y-4 opacity-50 pointer-events-none';
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
function updateCPUState() {
|
436 |
+
// Simulate temperature based on load with slower response
|
437 |
+
const targetTemp = 30 + (cpuLoad * 0.7); // Base temp + load impact
|
438 |
+
const tempChange = (targetTemp - cpuTemp) * 0.03; // Much more gradual change
|
439 |
+
|
440 |
+
cpuTemp = Math.min(100, Math.max(30, cpuTemp + tempChange));
|
441 |
+
|
442 |
+
// Calculate fan speed based on curve
|
443 |
+
calculateFanSpeed();
|
444 |
+
}
|
445 |
+
|
446 |
+
function calculateFanSpeed() {
|
447 |
+
let newFanSpeed = 0;
|
448 |
+
|
449 |
+
if (fanCurveType === 'linear') {
|
450 |
+
// Linear curve from 30°C (0%) to maxTemp (100%)
|
451 |
+
const minTemp = 30;
|
452 |
+
const maxTempEffective = maxTemp;
|
453 |
+
|
454 |
+
if (cpuTemp <= minTemp) {
|
455 |
+
newFanSpeed = 0;
|
456 |
+
} else if (cpuTemp >= maxTempEffective) {
|
457 |
+
newFanSpeed = 100;
|
458 |
+
} else {
|
459 |
+
newFanSpeed = ((cpuTemp - minTemp) / (maxTempEffective - minTemp)) * 100;
|
460 |
+
}
|
461 |
+
}
|
462 |
+
else if (fanCurveType === 'aggressive') {
|
463 |
+
// More aggressive curve that ramps up quickly
|
464 |
+
const minTemp = 30;
|
465 |
+
const midTemp = 50;
|
466 |
+
const maxTempEffective = maxTemp;
|
467 |
+
|
468 |
+
if (cpuTemp <= minTemp) {
|
469 |
+
newFanSpeed = 0;
|
470 |
+
} else if (cpuTemp <= midTemp) {
|
471 |
+
newFanSpeed = 20 + ((cpuTemp - minTemp) / (midTemp - minTemp)) * 30;
|
472 |
+
} else if (cpuTemp >= maxTempEffective) {
|
473 |
+
newFanSpeed = 100;
|
474 |
+
} else {
|
475 |
+
newFanSpeed = 50 + ((cpuTemp - midTemp) / (maxTempEffective - midTemp)) * 50;
|
476 |
+
}
|
477 |
+
}
|
478 |
+
else if (fanCurveType === 'silent') {
|
479 |
+
// Silent curve that keeps fan low as long as possible
|
480 |
+
const minTemp = 30;
|
481 |
+
const midTemp = 70;
|
482 |
+
const maxTempEffective = maxTemp;
|
483 |
+
|
484 |
+
if (cpuTemp <= minTemp) {
|
485 |
+
newFanSpeed = 0;
|
486 |
+
} else if (cpuTemp <= midTemp) {
|
487 |
+
newFanSpeed = ((cpuTemp - minTemp) / (midTemp - minTemp)) * 40;
|
488 |
+
} else if (cpuTemp >= maxTempEffective) {
|
489 |
+
newFanSpeed = 100;
|
490 |
+
} else {
|
491 |
+
newFanSpeed = 40 + ((cpuTemp - midTemp) / (maxTempEffective - midTemp)) * 60;
|
492 |
+
}
|
493 |
+
}
|
494 |
+
else if (fanCurveType === 'custom') {
|
495 |
+
// Custom curve based on user settings
|
496 |
+
const customLowTemp = parseInt(lowTemp.value);
|
497 |
+
const customLowSpeed = parseInt(lowSpeed.value);
|
498 |
+
const customHighTemp = parseInt(highTemp.value);
|
499 |
+
const customHighSpeed = parseInt(highSpeed.value);
|
500 |
+
|
501 |
+
if (cpuTemp <= customLowTemp) {
|
502 |
+
newFanSpeed = customLowSpeed;
|
503 |
+
} else if (cpuTemp >= customHighTemp) {
|
504 |
+
newFanSpeed = customHighSpeed;
|
505 |
+
} else {
|
506 |
+
newFanSpeed = customLowSpeed +
|
507 |
+
((cpuTemp - customLowTemp) / (customHighTemp - customLowTemp)) *
|
508 |
+
(customHighSpeed - customLowSpeed);
|
509 |
+
}
|
510 |
+
}
|
511 |
+
|
512 |
+
// Apply max fan speed limit
|
513 |
+
newFanSpeed = Math.min(newFanSpeed, maxFanSpeed);
|
514 |
+
|
515 |
+
// Smooth fan speed changes
|
516 |
+
fanSpeed = fanSpeed * 0.7 + newFanSpeed * 0.3;
|
517 |
+
|
518 |
+
// Round to nearest integer
|
519 |
+
fanSpeed = Math.round(fanSpeed);
|
520 |
+
}
|
521 |
+
|
522 |
+
function updateFanCurve() {
|
523 |
+
const points = [];
|
524 |
+
|
525 |
+
if (fanCurveType === 'linear') {
|
526 |
+
points.push({x: 30, y: 0});
|
527 |
+
points.push({x: maxTemp, y: 100});
|
528 |
+
}
|
529 |
+
else if (fanCurveType === 'aggressive') {
|
530 |
+
points.push({x: 30, y: 0});
|
531 |
+
points.push({x: 50, y: 50});
|
532 |
+
points.push({x: maxTemp, y: 100});
|
533 |
+
}
|
534 |
+
else if (fanCurveType === 'silent') {
|
535 |
+
points.push({x: 30, y: 0});
|
536 |
+
points.push({x: 70, y: 40});
|
537 |
+
points.push({x: maxTemp, y: 100});
|
538 |
+
}
|
539 |
+
else if (fanCurveType === 'custom') {
|
540 |
+
const customLowTemp = parseInt(lowTemp.value);
|
541 |
+
const customLowSpeed = parseInt(lowSpeed.value);
|
542 |
+
const customHighTemp = parseInt(highTemp.value);
|
543 |
+
const customHighSpeed = parseInt(highSpeed.value);
|
544 |
+
|
545 |
+
points.push({x: 20, y: customLowSpeed});
|
546 |
+
points.push({x: customLowTemp, y: customLowSpeed});
|
547 |
+
points.push({x: customHighTemp, y: customHighSpeed});
|
548 |
+
points.push({x: 100, y: customHighSpeed});
|
549 |
+
}
|
550 |
+
|
551 |
+
fanCurvePoints = points;
|
552 |
+
updateChart();
|
553 |
+
}
|
554 |
+
|
555 |
+
function updateChart() {
|
556 |
+
fanCurveChart.data.datasets[0].data = fanCurvePoints;
|
557 |
+
fanCurveChart.update();
|
558 |
+
}
|
559 |
+
|
560 |
+
function updateUI() {
|
561 |
+
// Update CPU display
|
562 |
+
cpuTempElement.textContent = `${Math.round(cpuTemp)}°C`;
|
563 |
+
cpuLoadElement.textContent = `${cpuLoad}% Load`;
|
564 |
+
|
565 |
+
// Update temperature indicator position
|
566 |
+
const tempPercentage = Math.min(100, Math.max(0, cpuTemp));
|
567 |
+
tempIndicator.style.left = `${tempPercentage}%`;
|
568 |
+
|
569 |
+
// Update fan speed display
|
570 |
+
fanSpeedDisplay.textContent = `${fanSpeed}%`;
|
571 |
+
fanSpeedBar.style.width = `${fanSpeed}%`;
|
572 |
+
|
573 |
+
// Change fan speed bar color based on speed
|
574 |
+
if (fanSpeed < 30) {
|
575 |
+
fanSpeedBar.className = 'h-full bg-blue-500 rounded-full';
|
576 |
+
} else if (fanSpeed < 70) {
|
577 |
+
fanSpeedBar.className = 'h-full bg-yellow-500 rounded-full';
|
578 |
+
} else {
|
579 |
+
fanSpeedBar.className = 'h-full bg-red-500 rounded-full';
|
580 |
+
}
|
581 |
+
|
582 |
+
// Update fan animation
|
583 |
+
const animationDuration = fanSpeed > 0 ? `${2 - (fanSpeed / 100 * 1.8)}s` : '0s';
|
584 |
+
fanBlades.style.animationDuration = animationDuration;
|
585 |
+
|
586 |
+
// Change CPU color based on temperature
|
587 |
+
if (cpuTemp < 50) {
|
588 |
+
cpuTempElement.className = 'text-3xl font-bold text-blue-400';
|
589 |
+
} else if (cpuTemp < 70) {
|
590 |
+
cpuTempElement.className = 'text-3xl font-bold text-yellow-400';
|
591 |
+
} else if (cpuTemp < maxTemp) {
|
592 |
+
cpuTempElement.className = 'text-3xl font-bold text-orange-500';
|
593 |
+
} else {
|
594 |
+
cpuTempElement.className = 'text-3xl font-bold text-red-500';
|
595 |
+
}
|
596 |
+
}
|
597 |
+
|
598 |
+
function addLog(message) {
|
599 |
+
const now = new Date();
|
600 |
+
const timeString = now.toLocaleTimeString();
|
601 |
+
const logEntry = document.createElement('div');
|
602 |
+
logEntry.innerHTML = `<span class="text-gray-400">[${timeString}]</span> ${message}`;
|
603 |
+
systemLog.appendChild(logEntry);
|
604 |
+
systemLog.scrollTop = systemLog.scrollHeight;
|
605 |
+
|
606 |
+
// Keep only the last 50 log entries
|
607 |
+
if (systemLog.children.length > 50) {
|
608 |
+
systemLog.removeChild(systemLog.children[0]);
|
609 |
+
}
|
610 |
+
}
|
611 |
+
</script>
|
612 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=PrinzPesia/cpu-fan-simulator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
613 |
+
</html>
|