コード例 #1
0
ファイル: IcdSupport.py プロジェクト: nasa/gunns
    def initialize(self, id, atLeastOneActiveEntry, action, icdElement):

        ## Create an XmlParser.
        parser = XmlParser()

        ## Comment out if not ready.
        if 'true' != icdElement.get(
                "isReadyForIcd") or False == atLeastOneActiveEntry:
            self.mCommentChar = "#"

        ## Initialize job data.
        self.mAction = action
        self.mRate = parser.getChildText(icdElement, "rate", id)
        self.mSimObject = parser.getChildText(icdElement, "simObject", id)
        self.mSimVarName = parser.getChildText(icdElement, "simVarName",
                                               id).replace("%s", id)
コード例 #2
0
    def __init__(self):
        uninitialized = "[not initialized]"

        ## An XmlParser() object for getting data from xml elements.
        self.mParser = XmlParser()
        ## An xml entry from a registry file. This object is only associated with a single entry.
        self.mEntry = uninitialized
        ## A dictionary with the definitions of symbols used in the registries
        self.mSymMap = uninitialized
        ## Name of the Thermal Gunns link, as read from the registry entry.
        self.mName = uninitialized
        ## The link's number in the network's array. Initialized to an invalid value of -1.
        self.mEnumIndex = -1
        ## The link's description
        self.mDescription = uninitialized
        ## Initialization flag.
        self.mIsInitialized = False
コード例 #3
0
    def __init__(self):
        uninitialized = "[not initialized]"

        ## IcdSettings() object contains specifics used in Thermal Aspect ICD printing.
        ## For example, the IcdBuilder needs to know that:
        ## - On the registry, a capacitance link uses the XML tag <temperature> to describe
        ##    an ICD "READ" exchange.
        ## - The unit for temperature is "K".
        ## - The PTCS member that contains the temperature is
        ##    "therm.mCapacitanceLinks[%s].mTemperature".
        self.mIcdSettings = uninitialized

        ## Name of network using this IcdBuilder() class.
        self.mNetwork = uninitialized

        ## List of Icd Exchange() objects. This list is appended with all the WRITE/READ groups
        ## that are described in the thermal registry files. After all data has been read,
        ## the IcdBuilder loops through each and prints them to the PTCS.txt icd-file.
        self.mListOfExchanges = []

        ## An XmlParser() object for setting data in xml elements.
        self.mParser = XmlParser()
コード例 #4
0
ファイル: TestThermAspectGenerate.py プロジェクト: nasa/gunns
 def test_51_execution(self):
     print "\n(5.1) Test execution.\n  ",
     
     capExplicit = "0"
     radEntries = None
     radCoeffRegis = ""
     radCoeffTd = ""
     try:
         self.article.execute()
         
         ## Check mass calculation
         parser = XmlParser()
         data = parser.loadFile(tNodePath % tNetwork)
         ## Open it for reading and save its xml data.
         entries = parser.getElements(data, "node")
 
         ## Loop through each source entry, totaling the mass.
         massSum = 0;
         for entry in entries:                
             ## Create and initialize XmlEntryAnalyzer object.
             mass = parser.getChildText(entry, "mass")
             massSum = massSum + float(mass)
             
             ## Store capacitance of a specific node in question.
             if "GOOD_EXPLICIT_12" == parser.getChildText(entry, "name"):
                 capExplicit = parser.getChildText(entry, "capacitance") 
         
         ## Read radiation data for testing.    
         radData = parser.loadFile(tRadPath % tNetwork)
         radEntries = parser.getElements(radData, "radiation")
         ## Check radiation coefficients.  
         radCoeffTd = parser.getChildText(radEntries[0], "coefficient")
         radCoeffRegis = parser.getChildText(radEntries[1], "coefficient")
                     
     except (Exception), e:
         print e
         self.fail("Uncaught exception during execute().")
コード例 #5
0
ファイル: SymbolLoading.py プロジェクト: nasa/gunns
    def __init__(self):
        ## An XmlParser() object for getting data from xml elements.
        self.mParser = XmlParser()

        ## Stores name of current file being parsed.
        self.mCurrentFile = "[mCurrentFile not set]"
コード例 #6
0
ファイル: IndivNetworkBuilding.py プロジェクト: nasa/gunns
    def __init__(self):

        ## Initialization flag.
        self.mInitialized = False
        uninitialized = "[%s not initialized]"

        ## Name (abbreviation) of network to be built. Must be identical to string found
        ## in network-specific file names (e.g., 'trussMid' -> ThermNodes_trussMid.xml).
        self.mNetwork = uninitialized % "mNetwork"

        ## Name of top-level script that creates the ThermAspectBuilder that creates this object.
        self.mCallingScript = uninitialized % "mCallingScript"

        ## A dictionary with the definitions of symbols used in the registries
        self.mSymMap = uninitialized % "mSymMap"

        ## Assumption to use for any specific heat values (Cp) not provided directly.
        self.mAssumedCp = uninitialized % "mAssumedCp"

        ## An XmlParser() object for getting data from xml elements.
        self.mParser = XmlParser()
        ## A ThermPrinter() object for some printing utility functions.
        self.mPrinter = ThermPrinter()
        ## A dictionary used to maintain a record of Thermal Desktop nodes that were also
        ## included in the Thermal Aspect Registry.
        self.isRegistered = {}

        ## ICD builder object. Handles all ICD functionality.
        self.mIcdBuilder = IcdBuilder()

        #Files to read ............................................
        ## Path and file name of Thermal Aspect Registry file.
        self.mRegisFile = uninitialized % "mRegisFile"
        ## Path and file name of Thermal Desktop file (TdNetworkConfig).
        self.mTdFile = uninitialized % "mTdFile"
        ## Path and file name of HtrRegistry file.
        self.mHtrFile = uninitialized % "mHtrFile"
        ## Path and file name of ThermalPanel registry/config file.
        self.mPanFile = uninitialized % "mPanFile"

        #Files to generate ........................................
        ## Path and file name of Node configuration file.
        self.mNodeFile = uninitialized % "mNodeFile"
        ## Path and file name of Conduction configuration file.
        self.mCondFile = uninitialized % "mCondFile"
        ## Path and file name of Radiation configuration file.
        self.mRadFile = uninitialized % "mRadFile"
        ## Path and file name of Et.Cetera (potentials, sources) configuration file.
        self.mEtcFile = uninitialized % "mEtcFile"
        ## Path and file name of TrickView file. Each network produces its own TrickView file.
        self.mTvFile = uninitialized % "mTvFile"

        ## Initialize lists for enumerating.
        self.tdNodeList = []
        self.tdRadList = []
        self.regisNodeList = []
        self.masterNodeList = []
        self.mMassDict = {}
        self.mTempDict = {}
        self.mEditCapGroupList = []
        self.mPotList = []
        self.mSrcList = []
        self.mRadList = []
        self.mHtrList = []
        self.mPanList = []
        self.mCondNum = 0

        ## Boolean to determine if the mass of structural nodes should be adjusted to match a
        ## total-mass expected value.
        self.mIsMassAdjustable = uninitialized % "mIsMassAdjustable"
        ## Expected/Rated mass (kg) of the thermal network
        self.mExpectedMass = uninitialized % "mExpectedMass"
        ## Raw, unadjusted mass (kg) of the thermal network
        self.mUnadjustedMass = 0
        ## Scalar to multiply all structural node mass with the aim of matching the network's
        ## modeled mass to the rated mass.
        self.mStructMassScalar = 0

        ## Initialize new PTCS XML elements. These elements will be built up during the course of
        ## the network parsing/analysis. At the conclusion, when the xml trees are complete, they
        ## will be printed to generated thermal config-files.
        self.mNodeXml = self.mParser.newElement("list")
        self.mCondXml = self.mParser.newElement("list")
        self.mRadXml = self.mParser.newElement("list")
        self.mEtcXml = self.mParser.newElement("list")