Kalkulator Sił Wewnętrznych w Ramie Prostokątnej
Poniżej przedstawiam prosty kalkulator do obliczania sił wewnętrznych w ramie prostokątnej, który dynamicznie reaguje na zmiany wymiarów.
HTML + JavaScript Kalkulator
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kalkulator Sił Wewnętrznych w Ramie</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
line-height: 1.6;
}
.container {
display: flex;
flex-wrap: wrap;
gap: 20px;
}
.controls {
flex: 1;
min-width: 300px;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f9f9f9;
}
.diagram {
flex: 2;
min-width: 400px;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #f0f8ff;
position: relative;
}
.results {
margin-top: 20px;
padding: 15px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #e6f7ff;
}
input, select {
width: 100%;
padding: 8px;
margin: 5px 0 15px;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #45a049;
}
.frame {
position: relative;
height: 300px;
width: 100%;
border: 1px solid #000;
}
.column, .beam {
position: absolute;
background-color: #333;
}
.column {
width: 20px;
}
.beam {
height: 20px;
}
.load {
position: absolute;
color: red;
font-weight: bold;
}
.support {
position: absolute;
width: 30px;
height: 30px;
background-color: #4CAF50;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
color: white;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Kalkulator Sił Wewnętrznych w Ramie Prostokątnej</h1>
<div class="container">
<div class="controls">
<h2>Parametry ramy</h2>
<label for="columnHeight">Wysokość słupa (m):</label>
<input type="number" id="columnHeight" value="3" step="0.1" min="1">
<label for="beamWidth">Szerokość rygla (m):</label>
<input type="number" id="beamWidth" value="4" step="0.1" min="1">
<label for="loadType">Typ obciążenia:</label>
<select id="loadType">
<option value="point">Obciążenie skupione</option>
<option value="uniform">Obciążenie równomierne</option>
</select>
<div id="pointLoadControls">
<label for="pointLoadValue">Wartość obciążenia (kN):</label>
<input type="number" id="pointLoadValue" value="10" step="0.1" min="0">
<label for="pointLoadPosition">Pozycja obciążenia (m):</label>
<input type="number" id="pointLoadPosition" value="2" step="0.1" min="0">
</div>
<div id="uniformLoadControls" style="display: none;">
<label for="uniformLoadValue">Wartość obciążenia (kN/m):</label>
<input type="number" id="uniformLoadValue" value="5" step="0.1" min="0">
</div>
<button onclick="calculateForces()">Oblicz siły wewnętrzne</button>
</div>
<div class="diagram">
<h2>Schemat ramy</h2>
<div class="frame" id="frameDiagram">
<!-- Diagram will be drawn here by JavaScript -->
</div>
</div>
</div>
<div class="results">
<h2>Wyniki</h2>
<div id="resultsContent">
<!-- Results will be displayed here -->
</div>
</div>
<script>
// Global variables
let columnHeight = 3;
let beamWidth = 4;
let loadType = 'point';
let pointLoadValue = 10;
let pointLoadPosition = 2;
let uniformLoadValue = 5;
// Initialize the diagram
function initializeDiagram() {
const frame = document.getElementById('frameDiagram');
frame.innerHTML = '';
// Draw columns
const columnLeft = document.createElement('div');
columnLeft.className = 'column';
columnLeft.style.height = `${columnHeight * 50}px`;
columnLeft.style.left = '0';
columnLeft.style.bottom = '0';
frame.appendChild(columnLeft);
const columnRight = document.createElement('div');
columnRight.className = 'column';
columnRight.style.height = `${columnHeight * 50}px`;
columnRight.style.right = '0';
columnRight.style.bottom = '0';
frame.appendChild(columnRight);
// Draw beam
const beam = document.createElement('div');
beam.className = 'beam';
beam.style.width = `${beamWidth * 50}px`;
beam.style.bottom = `${columnHeight * 50}px`;
beam.style.left = '0';
frame.appendChild(beam);
// Draw supports
const supportLeft = document.createElement('div');
supportLeft.className = 'support';
supportLeft.style.left = '-15px';
supportLeft.style.bottom = '-15px';
supportLeft.textContent = 'A';
frame.appendChild(supportLeft);
const supportRight = document.createElement('div');
supportRight.className = 'support';
supportRight.style.right = '-15px';
supportRight.style.bottom = '-15px';
supportRight.textContent = 'B';
frame.appendChild(supportRight);
// Draw load
drawLoad();
}
// Draw load on the diagram
function drawLoad() {
const frame = document.getElementById('frameDiagram');
const loadElements = document.querySelectorAll('.load');
loadElements.forEach(el => el.remove());
if (loadType === 'point') {
const load = document.createElement('div');
load.className = 'load';
load.style.left = `${pointLoadPosition * 50}px`;
load.style.bottom = `${columnHeight * 50 + 20}px`;
load.textContent = `${pointLoadValue} kN`;
frame.appendChild(load);
// Draw arrow for point load
const arrow = document.createElement('div');
arrow.style.position = 'absolute';
arrow.style.left = `${pointLoadPosition * 50}px`;
arrow.style.bottom = `${columnHeight * 50 + 40}px`;
arrow.style.width = '0';
arrow.style.height = '0';
arrow.style.borderLeft = '10px solid transparent';
arrow.style.borderRight = '10px solid transparent';
arrow.style.borderTop = '20px solid red';
frame.appendChild(arrow);
} else if (loadType === 'uniform') {
// Draw uniform load as arrows along the beam
const arrowCount = Math.floor(beamWidth * 50 / 30);
const arrowSpacing = (beamWidth * 50) / arrowCount;
for (let i = 0; i < arrowCount; i++) {
const arrow = document.createElement('div');
arrow.style.position = 'absolute';
arrow.style.left = `${i * arrowSpacing + 10}px`;
arrow.style.bottom = `${columnHeight * 50 + 40}px`;
arrow.style.width = '0';
arrow.style.height = '0';
arrow.style.borderLeft = '5px solid transparent';
arrow.style.borderRight = '5px solid transparent';
arrow.style.borderTop = '10px solid red';
frame.appendChild(arrow);
}
// Add load value text
const loadText = document.createElement('div');
loadText.className = 'load';
loadText.style.left = '50%';
loadText.style.bottom = `${columnHeight * 50 + 60}px`;
loadText.style.transform = 'translateX(-50%)';
loadText.textContent = `${uniformLoadValue} kN/m`;
frame.appendChild(loadText);
}
}
// Calculate internal forces
function calculateForces() {
// Update global variables from inputs
columnHeight = parseFloat(document.getElementById('columnHeight').value);
beamWidth = parseFloat(document.getElementById('beamWidth').value);
loadType = document.getElementById('loadType').value;
pointLoadValue = parseFloat(document.getElementById('pointLoadValue').value);
pointLoadPosition = parseFloat(document.getElementById('pointLoadPosition').value);
uniformLoadValue = parseFloat(document.getElementById('uniformLoadValue').value);
// Update diagram
initializeDiagram();
// Calculate reactions and internal forces
let results = '';
if (loadType === 'point') {
// Point load calculations
const totalLoad = pointLoadValue;
const momentArm = pointLoadPosition;
// Reactions
const RBy = totalLoad * (beamWidth - momentArm) / beamWidth;
const RAy = totalLoad - RBy;
// Moments
const Mmax = RAy * momentArm;
results = `
<h3>Reakcje podporowe:</h3>
<p>RAy = ${RAy.toFixed(2)} kN (pionowa w podporze A)</p>
<p>RBy = ${RBy.toFixed(2)} kN (pionowa w podporze B)</p>
<p>RAx = 0 kN (pozioma w podporze A - zakładamy brak obciążenia poziomego)</p>
<h3>Siły wewnętrzne:</h3>
<p>Maksymalny moment zginający w ryglu: ${Mmax.toFixed(2)} kNm</p>
<p>Siła poprzeczna w słupach: ${RAy.toFixed(2)} kN (lewy słup), ${RBy.toFixed(2)} kN (prawy słup)</p>
`;
} else if (loadType === 'uniform') {
// Uniform load calculations
const totalLoad = uniformLoadValue * beamWidth;
// Reactions
const RAy = totalLoad / 2;
const RBy = totalLoad / 2;
// Moments
const Mmax = (uniformLoadValue * beamWidth * beamWidth) / 8;
results = `
<h3>Reakcje podporowe:</h3>
<p>RAy = ${RAy.toFixed(2)} kN (pionowa w podporze A)</p>
<p>RBy = ${RBy.toFixed(2)} kN (pionowa w podporze B)</p>
<p>RAx = 0 kN (pozioma w podporze A - zakładamy brak obciążenia poziomego)</p>
<h3>Siły wewnętrzne:</h3>
<p>Maksymalny moment zginający w ryglu: ${Mmax.toFixed(2)} kNm (w środku rozpiętości)</p>
<p>Siła poprzeczna w słupach: ${RAy.toFixed(2)} kN (obydwa słupy)</p>
<p>Maksymalna siła poprzeczna w ryglu: ${RAy.toFixed(2)} kN (na podporach)</p>
`;
}
document.getElementById('resultsContent').innerHTML = results;
}
// Toggle load controls based on load type
document.getElementById('loadType').addEventListener('change', function() {
loadType = this.value;
if (loadType === 'point') {
document.getElementById('pointLoadControls').style.display = 'block';
document.getElementById('uniformLoadControls').style.display = 'none';
} else {
document.getElementById('pointLoadControls').style.display = 'none';
document.getElementById('uniformLoadControls').style.display = 'block';
}
drawLoad();
});
// Initialize
initializeDiagram();
</script>
</body>
</html>
Jak używać kalkulatora
-
Wprowadź parametry ramy:
- Wysokość słupa (w metrach)
- Szerokość rygla (w metrach)
-
Wybierz typ obciążenia:
- Obciążenie skupione (punktowe) - podaj wartość i pozycję
- Obciążenie równomierne - podaj wartość obciążenia na metr
-
Kliknij przycisk "Oblicz siły wewnętrzne"
-
Wyniki:
- Reakcje podporowe
- Siły poprzeczne w słupach
- Maksymalne momenty zginające w ryglu
Założenia kalkulatora
- Rama jest statycznie wyznaczalna (dwa słupy i jeden rygiel)
- Podpory są przegubowe (nie przenoszą momentów)
- Obciążenie działa pionowo w dół
- Materiał jest liniowo-sprężysty
- Nie uwzględnia się efektów drugiego rzędu
Kalkulator ten jest uproszczoną wersją do szybkich obliczeń. W rzeczywistych projektach należy używać specjalistycznego oprogramowania inżynierskiego.