Charge Generated: 1.389 C, Power Output: 138.889 W, Efficiency: 2777.78%
Radiation Type | Charge (C) | Power (W) | Efficiency (%) |
---|---|---|---|
gamma | 1.389 | 138.889 | 2777.78 |
This web application simulates radiation-induced charge generation in different materials under various conditions:
This interactive simulation uses HTML5, Bootstrap 5.3, and Chart.js to allow dynamic graphing and user control over inputs.
The HTML structure consists of form inputs and sliders for user interaction. The page is laid out using Bootstrap to ensure responsiveness, and it displays real-time results using a dynamic table and Chart.js for visualizations.
The JavaScript code dynamically updates the results and graph based on user input.
The HTML starts with a <!DOCTYPE html>
declaration. The <div>
elements contain form controls for selecting radiation type, material thickness, intensity, and applied electric field. These inputs dynamically trigger the simulation and update the results.
This simulation calculates charge generation, current, and power based on the selected radiation type, material thickness, intensity, and electric field.
updateSimulation()
: Calculates the energy absorbed, charge generated, and power output based on the material's properties and the applied electric field.LET * thickness * intensity
.energyAbsorbed / ePerPair
.current * field
.(powerOutput / totalRadiationEnergy) * 100
.The code below represents the HTML and JavaScript used to simulate the radiation-induced charge generation experiment. You can explore the code and see how the calculations and dynamic updates are handled.
xxxxxxxxxx
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Radiation-Induced Charge Generation</title>
<!-- Bootstrap 5.3 CSS -->
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<div class="container">
<h1 class="text-center mb-4">Radiation-Induced Charge Generation</h1>
<!-- Radiation Type Selection -->
<div class="mb-3">
<label for="radiationType" class="form-label">Select Radiation Type</label>
<select class="form-select" id="radiationType" onchange="updateSimulation()">
<option value="gamma">Gamma Radiation</option>
<option value="neutron">Neutron Radiation</option>
<option value="alpha">Alpha Radiation</option>
<option value="beta">Beta Radiation</option>
</select>
</div>
<!-- Material Thickness Input -->
<div class="mb-3">
<label for="materialThickness" class="form-label">Material Thickness (nm)</label>
<input type="range" class="form-range" id="materialThickness" min="10" max="1000" step="10" value="100"
oninput="updateSimulation()">
<div>Thickness: <span id="thicknessValue">100</span> nm</div>
</div>
<!-- Radiation Intensity Input -->
<div class="mb-3">
<label for="radiationIntensity" class="form-label">Radiation Intensity (Gy)</label>
<input type="range" class="form-range" id="radiationIntensity" min="0" max="10" step="0.1" value="1"
oninput="updateSimulation()">
<div>Intensity: <span id="intensityValue">1.0</span> Gy</div>
</div>
<!-- Applied Electric Field -->
<div class="mb-3">
<label for="electricField" class="form-label">Applied Electric Field (kV/cm)</label>
<input type="range" class="form-range" id="electricField" min="0" max="50" step="1" value="10"
oninput="updateSimulation()">
<div>Field: <span id="fieldValue">10</span> kV/cm</div>
</div>
<!-- Results -->
<div class="result-box">
<p id="results">Charge Generated: 0 C, Power Output: 0 W, Efficiency: 0%</p>
</div>
<!-- Graph: Charge Generation and Current -->
<div class="graph-container">
<canvas id="chargeChart"></canvas>
</div>
<!-- History Log - Moved to Bottom -->
<table class="history-table">
<thead>
<tr>
<th>Radiation Type</th>
<th>Charge (C)</th>
<th>Power (W)</th>
<th>Efficiency (%)</th>
</tr>
</thead>
<tbody id="historyTableBody"></tbody>
</table>
</div>
<footer>
© 2024 Quantum Dot Simulation
</footer>
<!-- JavaScript to handle simulation -->
<script>
const materialProperties = {
gamma: { LET: 0.05, ePerPair: 3.6, maxIntensity: 5 }, // LET: linear energy transfer in MeV/cm, ePerPair: Energy per e-h pair
neutron: { LET: 0.1, ePerPair: 5.0, maxIntensity: 10 },
alpha: { LET: 0.3, ePerPair: 3.0, maxIntensity: 7 },
beta: { LET: 0.2, ePerPair: 4.0, maxIntensity: 8 }
};
let history = [];
let chargeChart = null;
function updateSimulation() {
const radiationType = document.getElementById("radiationType").value;
const thickness = parseFloat(document.getElementById("materialThickness").value);
const intensity = parseFloat(document.getElementById("radiationIntensity").value);
const field = parseFloat(document.getElementById("electricField").value);
document.getElementById("thicknessValue").textContent = thickness;
document.getElementById("intensityValue").textContent = intensity.toFixed(1);
document.getElementById("fieldValue").textContent = field;
const material = materialProperties[radiationType];
if (intensity > material.maxIntensity) {
document.getElementById("results").textContent = `Error: Intensity exceeds max value for ${radiationType}.`;
return;
}
const LET = material.LET;
const ePerPair = material.ePerPair;
const energyAbsorbed = LET * thickness * intensity;
const chargeGenerated = energyAbsorbed / ePerPair;
const current = chargeGenerated * field;
const powerOutput = current * field;
const totalRadiationEnergy = intensity * thickness * LET;
const efficiency = (powerOutput / totalRadiationEnergy) * 100;
document.getElementById("results").textContent = `Charge Generated: ${chargeGenerated.toFixed(3)} C, Power Output: ${powerOutput.toFixed(3)} W, Efficiency: ${efficiency.toFixed(2)}%`;
logHistory(radiationType, chargeGenerated, powerOutput, efficiency);
updateChart(chargeGenerated, current);
}
function logHistory(type, charge, power, efficiency) {
history.push({ type, charge, power, efficiency });
// Prepend the most recent entry to the table so that the latest shows first
const row = document.createElement('tr');
row.innerHTML = `<td>${type}</td><td>${charge.toFixed(3)}</td><td>${power.toFixed(3)}</td><td>${efficiency.toFixed(2)}</td>`;
const historyTableBody = document.getElementById('historyTableBody');
historyTableBody.prepend(row);
}
function updateChart(charge, current) {
const ctx = document.getElementById('chargeChart').getContext('2d');
const data = {
labels: ['Charge Generated (C)', 'Current (A)'],
datasets: [{
label: 'Generated Charge and Current',
data: [charge, current],
backgroundColor: ['#007bff', '#28a745'],
borderColor: ['#007bff', '#28a745'],
borderWidth: 1
}]
};
const config = {
type: 'bar',
data: data,
options: {
scales: {
y: { beginAtZero: true }
}
}
};
if (chargeChart) {
chargeChart.destroy();
}
chargeChart = new Chart(ctx, config);
}
// Initialize simulation with default values
updateSimulation();
</script>
</body>
</html>
To run the simulation: