2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.astro.internal.model;
15 import org.openhab.core.library.dimension.Intensity;
16 import org.openhab.core.library.types.QuantityType;
17 import org.openhab.core.library.unit.Units;
20 * Holds the calculated direct, diffuse and total
22 * @author Gaƫl L'hopital - Initial contribution
23 * @author Christoph Weitkamp - Introduced UoM
25 public class Radiation {
27 private double direct;
28 private double diffuse;
34 public Radiation(double direct, double diffuse, double total) {
36 this.diffuse = diffuse;
41 * Sets the direct radiation.
43 public void setDirect(double direct) {
48 * Sets the diffuse radiation.
50 public void setDiffuse(double diffuse) {
51 this.diffuse = diffuse;
55 * Sets the total radiation.
57 public void setTotal(double total) {
62 * Returns the total radiation.
64 public QuantityType<Intensity> getTotal() {
65 return new QuantityType<>(total, Units.IRRADIANCE);
69 * Returns the direct radiation.
71 public QuantityType<Intensity> getDirect() {
72 return new QuantityType<>(direct, Units.IRRADIANCE);
76 * Returns the diffuse radiation.
78 public QuantityType<Intensity> getDiffuse() {
79 return new QuantityType<>(diffuse, Units.IRRADIANCE);