forked from jmoudrik/klima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cal.js
33 lines (24 loc) · 992 Bytes
/
cal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function AppViewModel() {
this.selJidelnicek = ko.observable(typy_jidelnicku[2]);
this.jidlo_den = ko.computed(function() {
return jidelnicek[this.selJidelnicek()];
}, this);
this.dum_spotreba = ko.observable(DATA.cr_domacnost_topeni_avg);
this.cerpadlo_cop = ko.observable(3);
this.cena_kwh = ko.observable(3); // kc / kwh
this.ucinnost_kotel_uhli = ko.observable(0.9);
this.elektrokotel_co2 = ko.computed(function() {
return this.dum_spotreba() * DATA.elektrina_cr_mix_emise;
}, this);
this.kotel_na_plyn_co2 = ko.computed(function() {
return this.dum_spotreba() * DATA.plyn_emise / 0.95;
}, this);
this.kotel_na_uhli_co2 = ko.computed(function() {
return this.dum_spotreba() * DATA.hnede_uhli_emise / this.ucinnost_kotel_uhli();
}, this);
this.cerpadlo_co2 = ko.computed(function() {
return this.dum_spotreba() * DATA.elektrina_cr_mix_emise / this.cerpadlo_cop();
}, this);
}
// Activates knockout.js
ko.applyBindings(new AppViewModel());