Esempio n. 1
0
 def test_add(self):
     zone = zones.Zone("TestZone")
     zone.addRing(5)
     otherZone = zones.Zone("OtherZone")
     otherZone.addRing(6, 3, 9)
     combinedZoneList = zone + otherZone
     self.assertIn("005-003", combinedZoneList)
     self.assertIn("006-003", combinedZoneList)
     self.assertIn("006-009", combinedZoneList)
Esempio n. 2
0
    def test_addAssemblyLocations(self):
        zone = zones.Zone("TestZone")
        zone.addAssemblyLocations(self.aList)
        for a in self.aList:
            self.assertIn(a.getLocation(), zone)

        self.assertRaises(RuntimeError, zone.addAssemblyLocations, self.aList)
Esempio n. 3
0
    def test_iteration(self):
        locs = [a.getLocation() for a in self.aList]
        zone = zones.Zone("TestZone")
        zone.addAssemblyLocations(self.aList)
        for aLoc in zone:
            self.assertIn(aLoc, locs)

        # loop twice to make sure it iterates nicely.
        for aLoc in zone:
            self.assertIn(aLoc, locs)
Esempio n. 4
0
    def test_addRing(self):
        zone = zones.Zone("TestZone")
        zone.addRing(5)
        self.assertIn("A5003", zone)
        self.assertNotIn("A6002", zone)

        zone.addRing(6, 3, 9)
        self.assertIn("A6003", zone)
        self.assertIn("A6009", zone)
        self.assertNotIn("A6002", zone)
        self.assertNotIn("A6010", zone)
Esempio n. 5
0
    def test_createHotZones(self):
        # Test to make sure createHotZones identifies the highest p/f location in a zone
        # Test to make sure createHotZones can remove the peak assembly from that zone and place it in a new zone
        # Test that the power in the old zone and the new zone is conserved.
        # Test that if a hot zone can not be created from a single assembly zone.
        o, r = test_reactors.loadTestReactor(inputFileName="partisnTestReactor.yaml")
        cs = o.cs
        cs["splitZones"] = False
        cs[globalSettings.CONF_ZONING_STRATEGY] = "byRingZone"
        cs["ringZones"] = [9]  # build one giant zone
        r.core.buildZones(cs)
        daZones = r.core.zones

        originalassemblies = []
        originalPower = 0.0
        peakZonePFRatios = []

        # Create a single assembly zone to verify that it will not create a hot zone
        single = zones.Zone("single")
        daZones.add(single)
        aLoc = r.core.getFirstAssembly(Flags.FUEL).getLocation()
        single.append(aLoc)

        # Set power and flow.
        # Also gather channel peak P/F ratios, assemblies and power.
        for zone in daZones:
            powerToFlow = []
            zoneLocations = daZones.getZoneLocations(zone.name)
            assems = r.core.getLocationContents(zoneLocations, assemblyLevel=True)
            power = 300.0
            flow = 300.0
            for a in assems:
                a.getFirstBlock().p.power = power
                assemblyPower = a.calcTotalParam("power")
                a[-1].p.THmassFlowRate = flow
                powerToFlow.append(assemblyPower / a[-1].p.THmassFlowRate)
                originalPower += assemblyPower
                originalassemblies.append(a)
                power += 1
                flow -= 1
            peakZonePFRatios.append(max(powerToFlow))

        daZones = zones.createHotZones(r.core, daZones)
        # Test that the hot zones have the peak P/F from the host channels
        i = 0
        for zone in daZones:
            if zone.hotZone:
                hotAssemLocation = daZones.getZoneLocations(zone.name)
                hotAssem = r.core.getLocationContents(
                    hotAssemLocation, assemblyLevel=True
                )[0]
                self.assertEqual(
                    peakZonePFRatios[i],
                    hotAssem.calcTotalParam("power") / hotAssem[-1].p.THmassFlowRate,
                )
                i += 1

        powerAfterHotZoning = 0.0
        assembliesAfterHotZoning = []

        # Check that power is conserved and that we did not lose any assemblies
        for zone in daZones:
            locs = daZones.getZoneLocations(zone.name)
            assems = r.core.getLocationContents(locs, assemblyLevel=True)
            for a in assems:
                assembliesAfterHotZoning.append(a)
                powerAfterHotZoning += a.calcTotalParam("power")
        self.assertEqual(powerAfterHotZoning, originalPower)
        self.assertEqual(len(assembliesAfterHotZoning), len(originalassemblies))

        # check that the original zone with 1 channel has False for hotzone
        self.assertEqual(single.hotZone, False)
        # check that we have the correct number of hot and normal zones.
        hotCount = 0
        normalCount = 0
        for zone in daZones:
            if zone.hotZone:
                hotCount += 1
            else:
                normalCount += 1
        self.assertEqual(hotCount, 1)
        self.assertEqual(normalCount, 2)
Esempio n. 6
0
 def test_index(self):
     zone = zones.Zone("TestZone")
     zone.addAssemblyLocations(self.aList)
     for i, loc in enumerate(zone.locList):
         self.assertEqual(i, zone.index(loc))
Esempio n. 7
0
 def test_extend(self):
     zone = zones.Zone("TestZone")
     zone.extend([a.getLocation() for a in self.aList])
     for a in self.aList:
         self.assertIn(a.getLocation(), zone)