blob: 4042fec7d803e47448f9328c7e25f1240f282841 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pierre Allard,
* Regent L'Archeveque - initial API and implementation
*
* SPDX-License-Identifier: EPL-1.0
*
*******************************************************************************/
package org.eclipse.apogy.addons.telecoms.impl;
public class SimpleConicalRadiationPatternCustomImpl extends SimpleConicalRadiationPatternImpl {
protected double maxGain = Double.NaN;
@Override
public void setApexAngle(double newApexAngle) {
super.setApexAngle(newApexAngle);
this.maxGain = computeMaximumGain();
}
@Override
public double computeGain(double theta, double phi) {
// Checks to see if the direction falls inside the cone.
if (theta <= (getApexAngle() / 2.0)) {
return getMaxGain();
} else {
return Double.NEGATIVE_INFINITY;
}
}
private double getMaxGain() {
if (Double.isNaN(this.maxGain)) {
this.maxGain = computeMaximumGain();
}
return this.maxGain;
}
private double computeMaximumGain() {
double coneSolidAngle = Math.PI * 2.0 * (1.0 - Math.cos(getApexAngle() / 2.0));
double apertureRatio = 4 * Math.PI / coneSolidAngle;
double gain = 10.0 * Math.log10(apertureRatio);
return gain;
}
} // SimpleConicalRadiationPatternImpl