/* Copyright 2000 Charles G. Wright * This software may be distributed under the terms of the * GNU General Public License. * * $Id: SOLorientation.java,v 1.1 2000-06-15 10:15:02-05 chuckles Exp chuckles $ */ import java.math.*; import java.util.*; /**

This class represents the orientation of a surface exposed to * sunlight. Its class variables define the surface's position on Earth * (a SOLlocation object) and orientation. Its methods calculate * the angle of incidence of sunlight falling on it. *

Multiple surfaces with this orientation can be defined by * SOLsurface objects. All of these are contained in the "surfaces" * linked list attached to this SOLorientation object. *

The defining parameters of this object can be set using the * SOLorientationControl object, which provides a graphical interface. */ public class SOLorientation{ /** The SOLlocation object that defines the location of this orientation.*/ public SOLlocation location; // surface /** Azimuth of the surface, in degrees, measured from true south * (East is negative, West is positive). */ public double surface_azimuth; /** Tilt angle of the surface, in degrees. Vertical surface is 90. */ public double surface_tilt; /** Name of the orientation. For user interface purposes only. */ public String name; /** Linked List of surfaces with this orientation. */ public Vector surfaces; //-------------------- Constructors ----------------------------- /**

Create an SOLorientation object, which represents the orientation of * a surface exposed to sunlight. The parameters defining the orientation * are: *

*/ public SOLorientation(SOLlocation location, double surface_azimuth, double surface_tilt, String name){ this.location = location; // location.orientations.add(this); this.surface_azimuth = surface_azimuth; this.surface_tilt = surface_tilt; this.name = name; surfaces = new Vector(); // System.out.println("[SOLorientation]: latitude = " + latitude + " longitude = " + longitude + // " time zone = " + time_zone + " surface_azimuth = " + surface_azimuth + // " surface_tilt = " + surface_tilt); } /**

Create an SOLorientation object, which represents the orientation of * a surface exposed to sunlight. The parameters defining the orientation * are: *

*/ public SOLorientation(TMYdata tmystuff, double surface_azimuth, double surface_tilt, String name){ location = tmystuff.location; location.orientations.addElement(this); this.surface_azimuth = surface_azimuth; this.surface_tilt = surface_tilt; this.name = name; surfaces = new Vector(); } //----------------------------- Cos of Angle of Incidence ------------- /** Returns cosine of angle between solar radiation and normal to surface, * given solar time, in seconds, and day number. */ public double getCosTheta(int daynum, int solar_time){ double decl = location.getDeclination(daynum); double alt = location.getSolarAltitude(decl, solar_time); double azi = location.getSolarAzimuth(decl, solar_time); double rel_azi = azi - surface_azimuth; double cosIncidentAngle = (Math.cos(SOLlocation.toRadians(alt)) * Math.cos(SOLlocation.toRadians(rel_azi)) * Math.sin(SOLlocation.toRadians(surface_tilt))) + (Math.sin(SOLlocation.toRadians(alt)) * Math.cos(SOLlocation.toRadians(surface_tilt))); //System.out.println("[getCosTheta]:decl:"+decl+" alt:"+alt+" azi:"+ //azi+" rel_azi:"+rel_azi+" surface_tilt"+surface_tilt+"cos theta="+cosIncidentAngle); return(Math.max(0.0, cosIncidentAngle)); } //----------------------------- Angle of Incidence ---------------------- /** Returns angle between solar radiation and normal to surface, * given solar time, in seconds, and day number. */ public double getTheta(int daynum, int solar_time){ return(SOLlocation.toDegrees(Math.acos(getCosTheta(daynum, solar_time)))); } } /* End of class SOLorientation */