Skip to content

Commit

Permalink
TB Thermal - fix for new heat flow method and fix for lone spray cool…
Browse files Browse the repository at this point in the history
…ing nodes (#405)

* added workaround for the new fluid heat flow method. workaround is to revert to using the old method

* removing file

* formatting

* used warnings.warn instead of print

* fix for lone spray cooling nodes

---------

Co-authored-by: Jack Davies <[email protected]>
  • Loading branch information
HusainAdam and jgsdavies authored Oct 22, 2024
1 parent bacd0c4 commit 4b91b65
Showing 1 changed file with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,23 @@ def updateMotfile(self):
## TB model will not include this logic
self.mcad.set_variable("BearingLossSource", 0)

# 9 Workaround for models created in Motor-CAD 2025R1 - ensure the old fluid heat flow
# method is used
try:
heatFlowMethod = self.mcad.get_variable("FluidHeatFlowMethod")
if heatFlowMethod == 1:
# Revert model to use the old fluid heat flow method
warnings.warn(
"The Improved Fluid Heat Flow Method setting in this .mot file is incompatible "
+ "with the Twin Builder Thermal ROM. The setting has been changed from "
+ "Improved to Original."
)
self.mcad.set_variable("FluidHeatFlowMethod", 0)
except:
# variable does not exist due to using older version of Motor-CAD
# no need to perform any action
pass

# save the updated model so it is clear which Motor-CAD file can be used to validate
# the Twin Builder Motor-CAD ROM component
self.motFileName = Path(self.inputMotFilePath).stem + "_TwinModel"
Expand Down Expand Up @@ -423,12 +440,10 @@ def generateCoolingSystemNetwork(self):
connectedNodes = self.returnConnectedNodes(
node, self.nodeNumbers_fluid, resistanceMatrix
)
if len(connectedNodes) > 0:
# non isolated node
if node not in graphNodes:
graphNodes.append(node)
for connectedNode in connectedNodes:
graphEdges.append([node, connectedNode])
if node not in graphNodes:
graphNodes.append(node)
for connectedNode in connectedNodes:
graphEdges.append([node, connectedNode])

G = nx.DiGraph()
G.add_nodes_from(graphNodes)
Expand Down

0 comments on commit 4b91b65

Please sign in to comment.