]> git.basschouten.com Git - openhab-addons.git/blob
83c36b3693e3de4e700f7b5bbbf37b1876c52ee0
[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.astro.internal.model;
14
15 import org.openhab.core.library.dimension.Intensity;
16 import org.openhab.core.library.types.QuantityType;
17 import org.openhab.core.library.unit.Units;
18
19 /**
20  * Holds the calculated direct, diffuse and total
21  *
22  * @author GaĆ«l L'hopital - Initial contribution
23  * @author Christoph Weitkamp - Introduced UoM
24  */
25 public class Radiation {
26
27     private double direct;
28     private double diffuse;
29     private double total;
30
31     public Radiation() {
32     }
33
34     public Radiation(double direct, double diffuse, double total) {
35         this.direct = direct;
36         this.diffuse = diffuse;
37         this.total = total;
38     }
39
40     /**
41      * Sets the direct radiation.
42      */
43     public void setDirect(double direct) {
44         this.direct = direct;
45     }
46
47     /**
48      * Sets the diffuse radiation.
49      */
50     public void setDiffuse(double diffuse) {
51         this.diffuse = diffuse;
52     }
53
54     /**
55      * Sets the total radiation.
56      */
57     public void setTotal(double total) {
58         this.total = total;
59     }
60
61     /**
62      * Returns the total radiation.
63      */
64     public QuantityType<Intensity> getTotal() {
65         return new QuantityType<>(total, Units.IRRADIANCE);
66     }
67
68     /**
69      * Returns the direct radiation.
70      */
71     public QuantityType<Intensity> getDirect() {
72         return new QuantityType<>(direct, Units.IRRADIANCE);
73     }
74
75     /**
76      * Returns the diffuse radiation.
77      */
78     public QuantityType<Intensity> getDiffuse() {
79         return new QuantityType<>(diffuse, Units.IRRADIANCE);
80     }
81 }