Skip to content

Commit 803ecf5

Browse files
tg359Fraser Greenroyd
authored andcommitted
Updated objects to ensure names match corresponding objects in Python to avoid failure in passing data between languages
1 parent 1f14f44 commit 803ecf5

4 files changed

Lines changed: 23 additions & 29 deletions

File tree

LadybugTools_Engine/Compute/ExternalComfort.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using BH.oM.LadybugTools;
3131
using BH.Engine.Serialiser;
3232
using BH.Engine.Geometry;
33+
using BH.Engine.Base;
3334

3435
namespace BH.Engine.LadybugTools
3536
{
@@ -86,6 +87,12 @@ public static ExternalComfort ExternalComfort(SimulationResult simulationResult,
8687

8788
string output = env.RunPythonString(pythonScript).Trim().Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None).Last();
8889

90+
if (output.Substring(0, 12).Contains("error"))
91+
{
92+
BH.Engine.Base.Compute.RecordError(Serialiser.Convert.FromJson(output).PropertyValue("error").ToString());
93+
return null;
94+
}
95+
8996
// reload from Python results
9097
return (ExternalComfort)Serialiser.Convert.FromJson(output);
9198
}

LadybugTools_Engine/Compute/SimulationResult.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using System.IO;
3131
using BH.oM.LadybugTools;
3232
using BH.Engine.Serialiser;
33+
using BH.Engine.Base;
3334

3435
namespace BH.Engine.LadybugTools
3536
{
@@ -91,6 +92,12 @@ public static SimulationResult SimulationResult(string epwFile, ILadybugToolsMat
9192
});
9293
string output = env.RunPythonString(pythonScript).Trim().Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None).Last();
9394

95+
if (output.Substring(0, 12).Contains("error"))
96+
{
97+
BH.Engine.Base.Compute.RecordError(Serialiser.Convert.FromJson(output).PropertyValue("error").ToString());
98+
return null;
99+
}
100+
94101
// reload from Python results
95102
return (SimulationResult)Serialiser.Convert.FromJson(output);
96103
}

LadybugTools_Engine/Create/Typology.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static Typology Typology(List<Shelter> shelters = null, string name = "",
7777

7878
return new Typology()
7979
{
80-
Name = name,
80+
Name = rtnName,
8181
Shelters = shelters.Where(s => s != null).ToList(),
8282
EvaporativeCoolingEffect = Enumerable.Repeat(evaporativeCoolingEffect, 8760).ToList(),
8383
WindSpeedMultiplier = Enumerable.Repeat(windSpeedMultiplier, 8760).ToList(),

LadybugTools_oM/SimulationResult.cs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,47 +39,27 @@ public class SimulationResult : BHoMObject
3939

4040
// simulated properties
4141
[Description("The simulated property from this object.")]
42-
public virtual CustomObject ShadedDownDirectIrradiance { get; set; } = new CustomObject();
43-
[Description("The simulated property from this object.")]
44-
public virtual CustomObject ShadedDownDiffuseIrradiance { get; set; } = new CustomObject();
45-
[Description("The simulated property from this object.")]
46-
public virtual CustomObject ShadedDownTotalIrradiance { get; set; } = new CustomObject();
47-
[Description("The simulated property from this object.")]
4842
public virtual CustomObject ShadedDownTemperature { get; set; } = new CustomObject();
4943
[Description("The simulated property from this object.")]
50-
public virtual CustomObject ShadedUpDiffuseIrradiance { get; set; } = new CustomObject();
51-
[Description("The simulated property from this object.")]
52-
public virtual CustomObject ShadedUpDirectIrradiance { get; set; } = new CustomObject();
53-
[Description("The simulated property from this object.")]
54-
public virtual CustomObject ShadedUpTotalIrradiance { get; set; } = new CustomObject();
55-
[Description("The simulated property from this object.")]
5644
public virtual CustomObject ShadedUpTemperature { get; set; } = new CustomObject();
5745
[Description("The simulated property from this object.")]
58-
public virtual CustomObject ShadedLongwaveMeanRadiantTemperature { get; set; } = new CustomObject();
59-
[Description("The simulated property from this object.")]
60-
public virtual CustomObject ShadedShortwaveMeanRadiantTemperature { get; set; } = new CustomObject();
46+
public virtual CustomObject ShadedRadiantTemperature { get; set; } = new CustomObject();
6147
[Description("The simulated property from this object.")]
62-
public virtual CustomObject ShadedMeanRadiantTemperature { get; set; } = new CustomObject();
63-
[Description("The simulated property from this object.")]
64-
public virtual CustomObject UnshadedDownDiffuseIrradiance { get; set; } = new CustomObject();
48+
public virtual CustomObject ShadedLongwaveMeanRadiantTemperatureDelta { get; set; } = new CustomObject();
6549
[Description("The simulated property from this object.")]
66-
public virtual CustomObject UnshadedDownDirectIrradiance { get; set; } = new CustomObject();
50+
public virtual CustomObject ShadedShortwaveMeanRadiantTemperatureDelta { get; set; } = new CustomObject();
6751
[Description("The simulated property from this object.")]
68-
public virtual CustomObject UnshadedDownTotalIrradiance { get; set; } = new CustomObject();
52+
public virtual CustomObject ShadedMeanRadiantTemperature { get; set; } = new CustomObject();
6953
[Description("The simulated property from this object.")]
7054
public virtual CustomObject UnshadedDownTemperature { get; set; } = new CustomObject();
7155
[Description("The simulated property from this object.")]
72-
public virtual CustomObject UnshadedUpDiffuseIrradiance { get; set; } = new CustomObject();
73-
[Description("The simulated property from this object.")]
74-
public virtual CustomObject UnshadedUpDirectIrradiance { get; set; } = new CustomObject();
75-
[Description("The simulated property from this object.")]
76-
public virtual CustomObject UnshadedUpTotalIrradiance { get; set; } = new CustomObject();
77-
[Description("The simulated property from this object.")]
7856
public virtual CustomObject UnshadedUpTemperature { get; set; } = new CustomObject();
7957
[Description("The simulated property from this object.")]
80-
public virtual CustomObject UnshadedLongwaveMeanRadiantTemperature { get; set; } = new CustomObject();
58+
public virtual CustomObject UnshadedRadiantTemperature { get; set; } = new CustomObject();
59+
[Description("The simulated property from this object.")]
60+
public virtual CustomObject UnshadedLongwaveMeanRadiantTemperatureDelta { get; set; } = new CustomObject();
8161
[Description("The simulated property from this object.")]
82-
public virtual CustomObject UnshadedShortwaveMeanRadiantTemperature { get; set; } = new CustomObject();
62+
public virtual CustomObject UnshadedShortwaveMeanRadiantTemperatureDelta { get; set; } = new CustomObject();
8363
[Description("The simulated property from this object.")]
8464
public virtual CustomObject UnshadedMeanRadiantTemperature { get; set; } = new CustomObject();
8565
}

0 commit comments

Comments
 (0)