public override void SetObjectData() { base.SetObjectData(); int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionHXRatingModel", typeof(int)); if (persistedClassVersion == 1) { this.owner = info.GetValue("Owner", typeof(HeatExchanger)) as HeatExchanger; this.procVarList = info.GetValue("ProcVarList", typeof(ArrayList)) as ArrayList; this.flowDirection = (FlowDirectionType)info.GetValue("FlowDirection", typeof(FlowDirectionType)); this.coldSideHeatTransferCoefficient = RecallStorableObject("ColdSideHeatTransferCoefficient", typeof(ProcessVarDouble)) as ProcessVarDouble; this.hotSideHeatTransferCoefficient = RecallStorableObject("HotSideHeatTransferCoefficient", typeof(ProcessVarDouble)) as ProcessVarDouble; this.coldSideFoulingFactor = RecallStorableObject("ColdSideFoulingFactor", typeof(ProcessVarDouble)) as ProcessVarDouble; this.hotSideFoulingFactor = RecallStorableObject("HotSideFoulingFactor", typeof(ProcessVarDouble)) as ProcessVarDouble; this.includeWallEffect = (bool)info.GetValue("IncludeWallEffect", typeof(bool)); this.wallThermalConductivity = RecallStorableObject("WallThermalConductivity", typeof(ProcessVarDouble)) as ProcessVarDouble; this.wallThickness = RecallStorableObject("WallThickness", typeof(ProcessVarDouble)) as ProcessVarDouble; this.totalHeatTransferCoefficient = RecallStorableObject("TotalHeatTransferCoefficient", typeof(ProcessVarDouble)) as ProcessVarDouble; this.totalHeatTransferArea = RecallStorableObject("TotalHeatTransferArea", typeof(ProcessVarDouble)) as ProcessVarDouble; this.numberOfHeatTransferUnits = RecallStorableObject("NumberOfHeatTransferUnits", typeof(ProcessVarDouble)) as ProcessVarDouble; this.exchangerEffectiveness = RecallStorableObject("ExchangerEffectiveness", typeof(ProcessVarDouble)) as ProcessVarDouble; this.hotSideRe = RecallStorableObject("HotSideRe", typeof(ProcessVarDouble)) as ProcessVarDouble; this.coldSideRe = RecallStorableObject("ColdSideRe", typeof(ProcessVarDouble)) as ProcessVarDouble; } }
private void heatExchanger_SolveComplete(object sender, SolveState solveState) { HXRatingModel ratingModel = (sender as HeatExchanger).CurrentRatingModel as HXRatingModel; FlowDirectionType flowDirection = ratingModel.FlowDirection; this.SetFlowDirection(flowDirection); }
public ErrorMessage SpecifyFlowDirection(FlowDirectionType aValue) { if (aValue != flowDirection) { flowDirection = aValue; owner.HasBeenModified(true); } return(null); }
public override void SetObjectData() { base.SetObjectData(); int persistedClassVersion = (int)info.GetValue("ClassPersistenceVersionDryerRatingModel", typeof(int)); if (persistedClassVersion == 1) { this.owner = info.GetValue("Owner", typeof(Dryer)) as Dryer; this.procVarList = info.GetValue("ProcVarList", typeof(ArrayList)) as ArrayList; this.flowDirection = (FlowDirectionType)info.GetValue("FlowDirection", typeof(FlowDirectionType)); this.gasVelocity = (ProcessVarDouble)RecallStorableObject("GasVelocity", typeof(ProcessVarDouble)); } }
private void SetFlowDirection(FlowDirectionType direction) { if (direction == FlowDirectionType.Counter) { this.comboBoxFlowDirection.SelectedIndex = HXRatingSimpleGenericValuesControl.INDEX_COUNTER; } else if (direction == FlowDirectionType.Cross) { this.comboBoxFlowDirection.SelectedIndex = HXRatingSimpleGenericValuesControl.INDEX_CROSS; } else if (direction == FlowDirectionType.Parallel) { this.comboBoxFlowDirection.SelectedIndex = HXRatingSimpleGenericValuesControl.INDEX_PARALLEL; } }
// If originalConnector != null, use that connector for AddConnection routine, instead of connector. private static void ProcessConnections(ExporterIFC exporterIFC, Connector connector, Connector originalConnector) { Domain domain = connector.Domain; bool isElectricalDomain = (domain == Domain.DomainElectrical); bool supportsDirection = (domain == Domain.DomainHvac || domain == Domain.DomainPiping); ConnectorType connectorType = connector.ConnectorType; if (connectorType == ConnectorType.End || connectorType == ConnectorType.Curve || connectorType == ConnectorType.Physical) { if (connector.IsConnected) { ConnectorSet connectorSet = connector.AllRefs; ConnectorSetIterator csi = connectorSet.ForwardIterator(); while (csi.MoveNext()) { Connector connected = csi.Current as Connector; if (connected != null && connected.Owner != null && connector.Owner != null) { if (connected.Owner.Id != connector.Owner.Id) { // look for physical connections ConnectorType connectedType = connected.ConnectorType; if (connectedType == ConnectorType.End || connectedType == ConnectorType.Curve || connectedType == ConnectorType.Physical) { Connector originalConnectorToUse = (originalConnector != null) ? originalConnector : connector; FlowDirectionType flowDirection = supportsDirection ? connector.Direction : FlowDirectionType.Bidirectional; if (flowDirection == FlowDirectionType.Out) { AddConnection(exporterIFC, connected, originalConnectorToUse, false, isElectricalDomain); } else { bool isBiDirectional = (flowDirection == FlowDirectionType.Bidirectional); AddConnection(exporterIFC, originalConnectorToUse, connected, isBiDirectional, isElectricalDomain); } } } } } } } }
public static Connector GetProperConnector(FamilyInstance fi, FlowDirectionType dir, DuctSystemType dst) { if (fi.MEPModel == null) { return(null); } foreach (Connector conn in fi.MEPModel.ConnectorManager.Connectors) { if ((conn.Direction == dir) && (conn.DuctSystemType == dst)) { return(conn); } } return(null); }
protected HXRatingModel(HeatExchanger heatExchanger) { this.owner = heatExchanger; flowDirection = FlowDirectionType.Counter; hotSideHeatTransferCoefficient = new ProcessVarDouble(StringConstants.HOT_SIDE_HEAT_TRANSFER_COEFFICIENT, PhysicalQuantity.HeatTransferCoefficient, VarState.Specified, owner); coldSideHeatTransferCoefficient = new ProcessVarDouble(StringConstants.COLD_SIDE_HEAT_TRANSFER_COEFFICIENT, PhysicalQuantity.HeatTransferCoefficient, VarState.Specified, owner); hotSideFoulingFactor = new ProcessVarDouble(StringConstants.HOT_SIDE_FOULING_FACTOR, PhysicalQuantity.FoulingFactor, 0.0, VarState.Specified, owner); coldSideFoulingFactor = new ProcessVarDouble(StringConstants.COLD_SIDE_FOULING_FACTOR, PhysicalQuantity.FoulingFactor, 0.0, VarState.Specified, owner); totalHeatTransferCoefficient = new ProcessVarDouble(StringConstants.TOTAL_HEAT_TRANSFER_COEFFICIENT, PhysicalQuantity.HeatTransferCoefficient, VarState.Specified, owner); totalHeatTransferArea = new ProcessVarDouble(StringConstants.TOTAL_HEAT_TRANSFER_AREA, PhysicalQuantity.Area, VarState.Specified, owner); numberOfHeatTransferUnits = new ProcessVarDouble(StringConstants.NUMBER_OF_HEAT_TRANSFER_UNITS, PhysicalQuantity.Fraction, VarState.AlwaysCalculated, owner); exchangerEffectiveness = new ProcessVarDouble(StringConstants.EXCHANGER_EFFECTIVENESS, PhysicalQuantity.Fraction, VarState.AlwaysCalculated, owner); includeWallEffect = false; wallThermalConductivity = new ProcessVarDouble(StringConstants.WALL_THERMAL_CONDUCTIVITY, PhysicalQuantity.ThermalConductivity, 17.5, VarState.Specified, owner); wallThickness = new ProcessVarDouble(StringConstants.WALL_THICKNESS, PhysicalQuantity.SmallLength, 0.002, VarState.Specified, heatExchanger); hotSideRe = new ProcessVarDouble(StringConstants.HOT_SIDE_RE, PhysicalQuantity.Unknown, VarState.AlwaysCalculated, owner); coldSideRe = new ProcessVarDouble(StringConstants.COLD_SIDE_RE, PhysicalQuantity.Unknown, VarState.AlwaysCalculated, owner); }
public ErrorMessage SpecifyFlowDirection(FlowDirectionType aValue) { ErrorMessage retMsg = null; if (aValue != flowDirection) { FlowDirectionType oldValue = flowDirection; flowDirection = aValue; try { owner.HasBeenModified(true); } catch (Exception e) { flowDirection = oldValue; retMsg = owner.HandleException(e); } } return(retMsg); }
protected DryerRatingModel(Dryer dryer) { this.owner = dryer; flowDirection = FlowDirectionType.Counter; gasVelocity = new ProcessVarDouble(StringConstants.GAS_VELOCITY, PhysicalQuantity.Velocity, 2.0, VarState.Specified, dryer); }
// If originalConnector != null, use that connector for AddConnection routine, instead of connector. private static void ProcessConnections(ExporterIFC exporterIFC, Connector connector, Connector originalConnector) { // Port connection is not allowed for IFC4RV MVD if (ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView) { return; } Domain domain = connector.Domain; bool isElectricalDomain = (domain == Domain.DomainElectrical); bool supportsDirection = (domain == Domain.DomainHvac || domain == Domain.DomainPiping); ConnectorType connectorType = connector.ConnectorType; if (connectorType == ConnectorType.End || connectorType == ConnectorType.Curve || connectorType == ConnectorType.Physical) { Connector originalConnectorToUse = (originalConnector != null) ? originalConnector : connector; FlowDirectionType flowDirection = supportsDirection ? connector.Direction : FlowDirectionType.Bidirectional; bool isBiDirectional = (flowDirection == FlowDirectionType.Bidirectional); if (connector.IsConnected) { ConnectorSet connectorSet = connector.AllRefs; ConnectorSetIterator csi = connectorSet.ForwardIterator(); while (csi.MoveNext()) { Connector connected = csi.Current as Connector; if (connected != null && connected.Owner != null && connector.Owner != null) { if (connected.Owner.Id != connector.Owner.Id) { // look for physical connections ConnectorType connectedType = connected.ConnectorType; if (connectedType == ConnectorType.End || connectedType == ConnectorType.Curve || connectedType == ConnectorType.Physical) { if (flowDirection == FlowDirectionType.Out) { AddConnection(exporterIFC, connected, originalConnectorToUse, false, isElectricalDomain); } else { AddConnection(exporterIFC, originalConnectorToUse, connected, isBiDirectional, isElectricalDomain); } } } } } } else { string guid = GUIDUtil.CreateGUID(); IFCFlowDirection flowDir = (isBiDirectional) ? IFCFlowDirection.SourceAndSink : (flowDirection == FlowDirectionType.Out ? IFCFlowDirection.Sink : IFCFlowDirection.Source); Element hostElement = connector.Owner; IFCAnyHandle hostElementIFCHandle = ExporterCacheManager.MEPCache.Find(hostElement.Id); if (ExporterCacheManager.ExportOptionsCache.ExportAs4 && !(IFCAnyHandleUtil.IsSubTypeOf(hostElementIFCHandle, IFCEntityType.IfcDistributionElement))) { return; } IFCAnyHandle localPlacement = CreateLocalPlacementForConnector(exporterIFC, connector, hostElementIFCHandle, flowDir); IFCFile ifcFile = exporterIFC.GetFile(); IFCAnyHandle ownerHistory = ExporterCacheManager.OwnerHistoryHandle; IFCAnyHandle port = IFCInstanceExporter.CreateDistributionPort(exporterIFC, null, guid, ownerHistory, localPlacement, null, flowDir); string portName = "Port_" + hostElement.Id; IFCAnyHandleUtil.OverrideNameAttribute(port, portName); string portType = "Flow"; // Assigned as Port.Description IFCAnyHandleUtil.SetAttribute(port, "Description", portType); // Attach the port to the element guid = GUIDUtil.CreateGUID(); string connectionName = hostElement.Id + "|" + guid; IFCAnyHandle connectorHandle = IFCInstanceExporter.CreateRelConnectsPortToElement(ifcFile, guid, ownerHistory, connectionName, portType, port, hostElementIFCHandle); HashSet <MEPSystem> systemList = new HashSet <MEPSystem>(); try { MEPSystem system = connector.MEPSystem; if (system != null) { systemList.Add(system); } } catch { } if (isElectricalDomain) { foreach (MEPSystem system in systemList) { ExporterCacheManager.SystemsCache.AddElectricalSystem(system.Id); ExporterCacheManager.SystemsCache.AddHandleToElectricalSystem(system.Id, hostElementIFCHandle); ExporterCacheManager.SystemsCache.AddHandleToElectricalSystem(system.Id, port); } } else { foreach (MEPSystem system in systemList) { ExporterCacheManager.SystemsCache.AddHandleToBuiltInSystem(system, hostElementIFCHandle); ExporterCacheManager.SystemsCache.AddHandleToBuiltInSystem(system, port); } } } } }
// If originalConnector != null, use that connector for AddConnection routine, instead of connector. private static void ProcessConnections(ExporterIFC exporterIFC, Connector connector, Connector originalConnector) { // Port connection is not allowed for IFC4RV MVD bool isIFC4AndAbove = !ExporterCacheManager.ExportOptionsCache.ExportAsOlderThanIFC4; Domain domain = connector.Domain; bool isElectricalDomain = (domain == Domain.DomainElectrical); bool supportsDirection = (domain == Domain.DomainHvac || domain == Domain.DomainPiping); ConnectorType connectorType = connector.ConnectorType; if (connectorType == ConnectorType.End || connectorType == ConnectorType.Curve || connectorType == ConnectorType.Physical) { Connector originalConnectorToUse = originalConnector ?? connector; FlowDirectionType flowDirection = supportsDirection ? connector.Direction : FlowDirectionType.Bidirectional; bool isBiDirectional = (flowDirection == FlowDirectionType.Bidirectional); if (connector.IsConnected) { ConnectorSet connectorSet = connector.AllRefs; ConnectorSetIterator csi = connectorSet.ForwardIterator(); while (csi.MoveNext()) { Connector connected = csi.Current as Connector; if (connected != null && connected.Owner != null && connector.Owner != null) { if (connected.Owner.Id != connector.Owner.Id) { // look for physical connections ConnectorType connectedType = connected.ConnectorType; if (connectedType == ConnectorType.End || connectedType == ConnectorType.Curve || connectedType == ConnectorType.Physical) { if (flowDirection == FlowDirectionType.Out) { AddConnection(exporterIFC, connected, originalConnectorToUse, false, isElectricalDomain); } else { AddConnection(exporterIFC, originalConnectorToUse, connected, isBiDirectional, isElectricalDomain); } } } } } } else { Element hostElement = connector.Owner; IFCFlowDirection flowDir = (isBiDirectional) ? IFCFlowDirection.SourceAndSink : (flowDirection == FlowDirectionType.Out ? IFCFlowDirection.Source : IFCFlowDirection.Sink); IFCAnyHandle hostElementIFCHandle = ExporterCacheManager.MEPCache.Find(hostElement.Id); string guid = GUIDUtil.GenerateIFCGuidFrom(IFCEntityType.IfcDistributionPort, connector.Id.ToString(), hostElementIFCHandle); IFCAnyHandle localPlacement = CreateLocalPlacementForConnector(exporterIFC, connector, hostElementIFCHandle, flowDir); IFCFile ifcFile = exporterIFC.GetFile(); IFCAnyHandle ownerHistory = ExporterCacheManager.OwnerHistoryHandle; IFCAnyHandle port = IFCInstanceExporter.CreateDistributionPort(exporterIFC, null, guid, ownerHistory, localPlacement, null, flowDir); string portType = "Flow"; // Assigned as Port.Description ExporterCacheManager.MEPCache.CacheConnectorHandle(connector, port); SetDistributionPortAttributes(port, connector, portType, hostElement.Id, ref flowDir); // Port connection is changed in IFC4 to use IfcRelNests for static connection. IfcRelConnectsPortToElement is used for a dynamic connection and it is restricted to IfcDistributionElement // The following code collects the ports that are nested to the object to be assigned later if (isIFC4AndAbove) { AddNestedMembership(hostElementIFCHandle, port); } else { // Attach the port to the element string relGuid = GUIDUtil.GenerateIFCGuidFrom(IFCEntityType.IfcRelConnectsPortToElement, connector.Id.ToString(), port); string connectionName = hostElement.Id + "|" + guid; IFCInstanceExporter.CreateRelConnectsPortToElement(ifcFile, relGuid, ownerHistory, connectionName, portType, port, hostElementIFCHandle); } HashSet <MEPSystem> systemList = new HashSet <MEPSystem>(); try { MEPSystem system = connector.MEPSystem; if (system != null) { systemList.Add(system); } } catch { } if (isElectricalDomain) { foreach (MEPSystem system in systemList) { ExporterCacheManager.SystemsCache.AddElectricalSystem(system.Id); ExporterCacheManager.SystemsCache.AddHandleToElectricalSystem(system.Id, hostElementIFCHandle); ExporterCacheManager.SystemsCache.AddHandleToElectricalSystem(system.Id, port); } } else { foreach (MEPSystem system in systemList) { ExporterCacheManager.SystemsCache.AddHandleToBuiltInSystem(system, hostElementIFCHandle); ExporterCacheManager.SystemsCache.AddHandleToBuiltInSystem(system, port); } } } } }
public void SetNEOfRiver(bool river, FlowDirectionType flowDir) { if (flowDir != FlowDirectionType.NorthWest && flowDir != FlowDirectionType.SouthEast) throw new Exception("West of the plot can only flow the river from northwest to southeast and vice versa, not " + flowDir); int riverMask = (63 - (int)flowDir); River = (byte)(River & riverMask); River += river ? (byte)flowDir : (byte)0; }
public void SetRiver(FlowDirectionType flowDir) { switch(flowDir) { case FlowDirectionType.South: case FlowDirectionType.North: SetWOfRiver(true,flowDir); break; case FlowDirectionType.SouthEast: case FlowDirectionType.NorthWest: SetNEOfRiver(true, flowDir); break; case FlowDirectionType.SouthWest: case FlowDirectionType.NorthEast: SetNWOfRiver(true, flowDir); break; } }