Skip to content

Commit

Permalink
Merge branch 'master' into base-v53
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Jul 29, 2024
2 parents 06377d8 + d287999 commit dd134b2
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 13 deletions.
181 changes: 173 additions & 8 deletions src/Aardvark.Data.Photometry/LDTData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,36 @@ namespace Aardvark.Data.Photometry
{
public class LDTLampData
{
/// <summary>
/// Number of lamps:
/// For absolute photometry, number is negative
/// </summary>
public int Number;

/// <summary>
/// Type of lamps
/// </summary>
public string Type;

/// <summary>
/// Total luminous flux of lamps (lm):
/// For absolute photometry, this field is Total Luminous Flux of Luminaire
/// </summary>
public double TotalFlux;

/// <summary>
/// Color appearance / color temperature of lamps
/// </summary>
public string Color;

/// <summary>
/// Color rendering group / color rendering index
/// </summary>
public string ColorRendering;

/// <summary>
/// Wattage including ballast (W)
/// </summary>
public double Wattage;
}

Expand Down Expand Up @@ -73,35 +98,175 @@ public static LDTData ParseMeta(string filename)
public LDTData() { }

/// <summary>
/// Intensity distribution normalized to cd per 1000 lumen
/// Company identification/databank/version/format identification (Max 78)
/// </summary>
public string CompanyName { get; set; }

/// <summary>
/// Ityp - Type indicator
///
/// 0 - point source with no symmetry
/// 1 - symmetry about the vertical axis
/// 2 - linear luminaire
/// 3 - point source with any other symmetry.
///
/// Note: only linear luminaires, Ityp = 2, are being subdivided in longitudinal and transverse directions
/// </summary>
public LDTItype Itype { get; set; }

/// <summary>
/// lsym - Symmetry indicator
///
/// 0 ... no symmetry
/// 1 - symmetry about the vertical axis
/// 2 - symmetry to plane C0-C180
/// 3 - symmetry to plane C90-C270
/// 4 - symmetry to plane C0-C180 and to plane C90-C270
/// </summary>
public LDTSymmetry Symmetry { get; set; }

/// <summary>
/// Mc - Number of C-planes between 0 and 360 degrees (usually 24 for interior, 36 for road lighting luminaires)
/// </summary>
public Matrix<double> Data { get; set; }
public double[] VerticleAngles { get; set; }
public double[] HorizontalAngles { get; set; }
public int PlaneCount { get; set; }

/// <summary>
/// Dc - Distance between C-planes (Dc = 0 for non-equidistantly available C-planes)
/// </summary>
public double HorAngleStep { get; set; }

/// <summary>
/// Ng - Number of luminous intensities in each C-plane (usually 19 or 37)
/// </summary>
public int ValuesPerPlane { get; set; }

/// <summary>
/// Dg - Distance between luminous intensities per C-plane (Dg = 0 for non-equidistantly available luminous intensities in C-planes)
/// </summary>
public double VertAngleStep { get; set; }
public LDTSymmetry Symmetry { get; set; }
public LDTItype Itype { get; set; }
public string CompanyName { get; set; }

/// <summary>
/// Measurement report number (Max 78)
/// </summary>
public string MeasurementReportNumber { get; set; }

/// <summary>
/// Luminaire name (Max 78)
/// </summary>
public string LuminaireName { get; set; }

/// <summary>
/// Luminaire number (Max 78)
/// </summary>
public string LuminaireNumber { get; set; }

/// <summary>
/// File name (8)
/// </summary>
public string FileName { get; set; }

/// <summary>
/// Date/user (Max 78)
/// </summary>
public string DateUser { get; set; }

/// <summary>
/// Length/diameter of luminaire (mm)
/// </summary>
public int LengthLuminaire { get; set; }

/// <summary>
/// b - Width of luminaire (mm) (b = 0 for circular luminaire)
/// </summary>
public int WidthLuminaire { get; set; }

/// <summary>
/// Height of luminaire (mm)
/// </summary>
public int HeightLuminare { get; set; }

/// <summary>
/// Length/diameter of luminous area (mm)
/// </summary>
public int LengthLuminousArea { get; set; }

/// <summary>
/// b1 - Width of luminous area (mm) (b1 = 0 for circular luminous area of luminaire)
/// </summary>
public int WidthLuminousArea { get; set; }

/// <summary>
/// Height of luminous area C0-plane(mm)
/// </summary>
public int HeightLuminousAreaC0 { get; set; }

/// <summary>
/// Height of luminous area C90-plane (mm)
/// </summary>
public int HeightLuminousAreaC90 { get; set; }

/// <summary>
/// Height of luminous area C180-plane (mm)
/// </summary>
public int HeightLuminousAreaC180 { get; set; }

/// <summary>
/// Height of luminous area C270-plane (mm)
/// </summary>
public int HeightLuminousAreaC270 { get; set; }

/// <summary>
/// DFF - Downward flux fraction(%)
/// </summary>
public double DownwardFluxFraction { get; set; }

/// <summary>
/// LORL - Light output ratio luminaire (%)
/// </summary>
public double LightOutputRatioLuminaire { get; set; }

/// <summary>
/// Conversion factor for luminous intensities(depending on measurement)
/// </summary>
public double ConversionIntensity { get; set; }
public double Tilt { get; set; }

/// <summary>
/// Standard sets of lamps (optional, also extendable on company-specific basis)
/// For absolute photometry, there is only one entry
/// Lamp attributes:
/// a: Number of lamps: For absolute photometry, number is negative
/// b: Type of lamps
/// c: Total luminous flux of lamps (lm): For absolute photometry, this field is Total Luminous Flux of Luminaire
/// d: Color appearance / color temperature of lamps
/// e: Color rendering group / color rendering index
/// f: Wattage including ballast (W)
/// </summary>
public LDTLampData[] LampSets { get; set; }

/// <summary>
/// Tilt of luminaire during measurement(road lighting luminaires)
/// </summary>
public double Tilt { get; set; }

/// <summary>
/// DR - Direct ratios for room indices k = 0.6 ... 5 (for determination of luminaire numbers according to utilization factor method)
/// </summary>
public double[] DirectRatios { get; set; }

/// <summary>
/// Angles C (beginning with 0 degrees)
/// </summary>
public double[] HorizontalAngles { get; set; }

/// <summary>
/// Angles G (beginning with 0 degrees)
///
/// </summary>
public double[] VerticleAngles { get; set; }

/// <summary>
/// Luminous intensity distribution normalized to cd per 1000 lumen (cd/1000 lumens)
/// </summary>
public Matrix<double> Data { get; set; }
}
}
4 changes: 2 additions & 2 deletions src/Aardvark.Data.Photometry/LDTParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ private LDTData ReadMeta(StreamReader sr)
// 6-10
ldt.ValuesPerPlane = ReadIntLine(sr);
ldt.VertAngleStep = ReadDoubleLine(sr);
var measurementReportNumber = sr.ReadLine();
ldt.MeasurementReportNumber = sr.ReadLine();
ldt.LuminaireName = sr.ReadLine();
ldt.LuminaireNumber = sr.ReadLine();
// 11-15
ldt.FileName = sr.ReadLine();
var dateUser = sr.ReadLine();
ldt.DateUser = sr.ReadLine();
ldt.LengthLuminaire = ReadIntLine(sr);
ldt.WidthLuminaire = ReadIntLine(sr);
ldt.HeightLuminare = ReadIntLine(sr);
Expand Down
13 changes: 12 additions & 1 deletion src/Aardvark.Data.Photometry/LightMeasurementData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,14 @@ public partial class LightMeasurementData : IFieldCodeable, IAwakeable
/// Symmetry across C0-C180 plane - [0, 180]
/// Symmetry across C90-C270 plane - [270, 90] in LDT or [90, 270] in IES
/// Symmetry across C0-C180 and C90-C270 planes - [0, 90]
/// NOTE: This is different to the angles in an LDT that always cover [0, 360)
/// </summary>
public double[] HorizontalAngles;

/// <summary>
/// Vertical angles of measurement in degree where 0 is pointing to the bottom and 180 to the top.
/// Typical measurement angles ranges are [0, 180], [0, 90] and [90, 180].
/// NOTE: This is different to the angles in an LDT that always cover [0, 180]
/// </summary>
public double[] VerticalAngles;

Expand Down Expand Up @@ -305,7 +307,16 @@ private Matrix<double> FixNonEquidistantAngleStep(double[] angles, Matrix<double
var valuesPerPlane = data.SX;
var planeCount = data.SY;

var angleRange = angles[angles.Length - 1] - angles[0];
// get angular range of measurement data
var first = angles[0];
var last = angles[angles.Length - 1];

// first might: 0, -90? or 270
// last might be 90, 180, 360
if (first > last)
last += 360;

var angleRange = last - first;
var elementCount = (long)(angleRange / minStep) + 1;

if (elementCount >= 4096)
Expand Down
7 changes: 6 additions & 1 deletion src/Aardvark.Data.Photometry/PhotometryDataCalculations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ public static double CalculateLumFlux(Matrix<double> equiDistantData, VerticalRa

/// <summary>
/// Calculates the luminous flux from the measurement data.
///
/// NOTE/ISSUE: Only works of euqidistance measurement data !! -> throws NotImplementedException
/// </summary>
public double CalculateLumFlux()
{
if (IsNonEquidistant(this.HorizontalAngles) || IsNonEquidistant(this.VerticalAngles))
throw new NotImplementedException();

var lumFlux = 0.0;

double segmentAreaFull = 0.0; // full sphere segment area till current angle when looping over data
Expand Down Expand Up @@ -108,7 +113,7 @@ public double CalculateLumFlux()
segmentAreaFull = segmentAreaPhi1;

// weight data points by circumference of measurement angle
var weight1 = a; // circumference is actually 2pi * r, but the constant factor can be omitted when calculating the weighed average
var weight1 = a; // circumference is actually 2pi * r, but the constant factor (2pi) can be omitted when calculating the weighed average

// if a weight is 0, this means we are the pole (0° or 180°) -> give half weight to pole sample
if (weight0 == 0) weight0 = weight1 * 0.5;
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/CSharpTests/PhotometryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Aardvark.Data.Photometry
[TestFixture]
public class PhotometryTest
{
static readonly string PhotometryDataPath = @"C:\Users\luksch\Desktop\Photometry Test Files";
static readonly string PhotometryDataPath = @"\\euclid\Hilite\Data\IntensityProfileTestLights\Photometry UnitTest Files";

[Test]
public void GetCPlaneTest()
Expand Down

0 comments on commit dd134b2

Please sign in to comment.