public static PartitionSimulationResult ToSAM_PartitionSimulationResult(this SurfaceData surfaceData, IEnumerable <PanelDataType> panelDataTypes = null) { if (surfaceData == null) { return(null); } PartitionSimulationResult result = new PartitionSimulationResult(surfaceData.BEName, Assembly.GetExecutingAssembly().GetName()?.Name, surfaceData.surfaceNumber.ToString()); result.SetValue("BuildingElementType", ((TBD.BuildingElementType)surfaceData.BEType).ToString()); result.SetValue("Area", surfaceData.area); result.SetValue("Orientation", surfaceData.orientation); ParameterSet parameterSet = Create.ParameterSet(ActiveSetting.Setting, surfaceData); if (panelDataTypes != null) { foreach (PanelDataType panelDataType in panelDataTypes) { List <double> values = surfaceData.AnnualSurfaceResult <double>(panelDataType); if (values == null) { continue; } JArray jArray = new JArray(); values.ForEach(x => jArray.Add(x)); parameterSet.Add(panelDataType.Text(), jArray); } } result.Add(parameterSet); return(result); }
public static Panel ToSAM(this SurfaceData surfaceData, IEnumerable <PanelDataType> panelDataTypes = null) { if (surfaceData == null) { return(null); } ParameterSet parameterSet = Create.ParameterSet(ActiveSetting.Setting, surfaceData); if (panelDataTypes != null) { foreach (PanelDataType panelDataType in panelDataTypes) { List <double> values = surfaceData.AnnualSurfaceResult <double>(panelDataType); if (values == null) { continue; } JArray jArray = new JArray(); values.ForEach(x => jArray.Add(x)); parameterSet.Add(panelDataType.Text(), jArray); } } PanelType panelType = Query.PanelType(surfaceData.BEType); PlanarBoundary3D planarBoundary3D = null; Panel panel = Analytical.Create.Panel(new Construction(surfaceData.BEName), panelType, planarBoundary3D); panel.Add(parameterSet); return(panel); }