62 lines
1.6 KiB
Dart
62 lines
1.6 KiB
Dart
|
import 'package:flutter/cupertino.dart';
|
||
|
|
||
|
class variables extends ChangeNotifier {
|
||
|
double _startH = 0; //in Meter
|
||
|
double _endH = 0; // in Meter
|
||
|
double _startG = 0; // in m / s
|
||
|
double _endG = 0; // in m / s
|
||
|
|
||
|
double _masse = 0; // in KG
|
||
|
final double _g = 9.81; // m / s^2
|
||
|
|
||
|
double _startTempWasser = 20; // Grad Celcius
|
||
|
double _endTempWasser = 100; // Grad Celcius --> hier kocht Wasser
|
||
|
double get wasserTempDif => _endTempWasser - _startTempWasser;
|
||
|
double _startTempEisen = 20; // Grad Celcius
|
||
|
double _endTempEisen = 700; // Grad Celcius --> hier glüht Eisen
|
||
|
double get eisenTempDif => _endTempEisen - _startTempEisen;
|
||
|
|
||
|
final double _cEisen =
|
||
|
449; // J pro KG * K --> 1KG Eisen braucht 449 Joule um 1 Grad erhitzt zu werden
|
||
|
final double _cWasser =
|
||
|
4181; // J pro KG * K --> 1KG / 1L Wasser braucht 4181 Joule um 1 Grad erhöht zu werden
|
||
|
|
||
|
// Getter
|
||
|
double get hDif => _endH - _startH;
|
||
|
|
||
|
double get gDif => _endG - _startG;
|
||
|
|
||
|
double get eLage => _masse * _g * hDif; // kg*m / s^2*m = Joule
|
||
|
double get eBewegung => (_masse * (gDif * gDif)) / 2; // kg*(m/s)^2 = Joule
|
||
|
|
||
|
double get literWasser => ((eLage + eBewegung) / _cWasser) / wasserTempDif;
|
||
|
|
||
|
double get kgEisen => ((eLage + eBewegung) / _cEisen) / eisenTempDif;
|
||
|
|
||
|
// Setter
|
||
|
void setStartH(double h) {
|
||
|
_startH = h;
|
||
|
notifyListeners();
|
||
|
}
|
||
|
|
||
|
void setEndH(double h) {
|
||
|
_endH = h;
|
||
|
notifyListeners();
|
||
|
}
|
||
|
|
||
|
void setStartGes(double ges) {
|
||
|
_startG = ges;
|
||
|
notifyListeners();
|
||
|
}
|
||
|
|
||
|
void setEndGes(double ges) {
|
||
|
_endG = ges;
|
||
|
notifyListeners();
|
||
|
}
|
||
|
|
||
|
void setMasse(double m) {
|
||
|
_masse = m;
|
||
|
notifyListeners();
|
||
|
}
|
||
|
}
|