]> git.basschouten.com Git - openhab-addons.git/blob
6f1442208d8d5ae272051fcbcc0cb86962df64a0
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.plugwise.internal.protocol.field;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The power calibration data of a relay device (Circle, Circle+, Stealth). It is used in {@link Energy} to calculate
19  * energy (kWh) and power (W) from pulses.
20  *
21  * @author Wouter Born - Initial contribution
22  */
23 @NonNullByDefault
24 public class PowerCalibration {
25
26     private final double gainA;
27     private final double gainB;
28     private final double offsetTotal;
29     private final double offsetNoise;
30
31     public PowerCalibration(double gainA, double gainB, double offsetNoise, double offsetTotal) {
32         this.gainA = gainA;
33         this.gainB = gainB;
34         this.offsetNoise = offsetNoise;
35         this.offsetTotal = offsetTotal;
36     }
37
38     public double getGainA() {
39         return gainA;
40     }
41
42     public double getGainB() {
43         return gainB;
44     }
45
46     public double getOffsetTotal() {
47         return offsetTotal;
48     }
49
50     public double getOffsetNoise() {
51         return offsetNoise;
52     }
53
54     @Override
55     public String toString() {
56         return "PowerCalibration [gainA=" + gainA + ", gainB=" + gainB + ", offsetTotal=" + offsetTotal
57                 + ", offsetNoise=" + offsetNoise + "]";
58     }
59 }