cpd_2022_energy/lib/widgets/calculate.dart

44 lines
1.0 KiB
Dart
Raw Permalink Normal View History

2022-11-05 20:31:09 +01:00
import 'package:flutter/material.dart';
class Calculate {
static const num _gravity = 9.807;
static const num _waterHeatCapacityBoil = 335200;// heat the water to 80 degrees with a heat capacity of 4190 Joule
static const num _ironHeatCapacityGlow = 340000;// heat the iron to 680 degrees with a heat capacity of 500 Joule
final num _v1, _v2, _h1, _h2, _m;
Calculate( this._v1, this._v2, this. _h1, this._h2, this._m);
calculateLWater() {
num e = _calculateEKin() + _calculateEPot();
num lWater = e/_waterHeatCapacityBoil;
return lWater;
}
calculateKgIron(){
num e = _calculateEKin() + _calculateEPot();
num kgIron = e/_ironHeatCapacityGlow;
return kgIron;
}
calculateJoule(){
return _calculateEKin() + _calculateEPot();
}
_calculateEPot(){
num h = _h2 - _h1;
num ePot = _m * _gravity * h;
return ePot;
}
_calculateEKin(){
num v = _v2 - _v1;
num eKin = (_m*v*v)/2;
return eKin;
}
}