Example #1
0
    def test_buildRingZones(self):
        o, r = self.o, self.r
        cs = o.cs
        cs[globalSettings.CONF_ZONING_STRATEGY] = "byRingZone"
        cs["ringZones"] = []
        zonez = zones.buildZones(r.core, cs)
        self.assertEqual(len(list(zonez)), 1)
        self.assertEqual(9, r.core.numRings)

        cs["ringZones"] = [5, 8]
        zonez = zones.buildZones(r.core, cs)
        self.assertEqual(len(list(zonez)), 2)
        zone = zonez["ring-1"]
        self.assertEqual(len(zone), (5 * (5 - 1) + 1))
        zone = zonez["ring-2"]
        # Note that the actual number of rings in the reactor model is 9. Even though we
        # asked for the last zone to to to 8, the zone engine should bump it out. Not
        # sure if this is behavior that we want to preserve, but at least it's being
        # tested properly now.
        self.assertEqual(len(zone), (9 * (9 - 1) + 1) - (5 * (5 - 1) + 1))

        cs["ringZones"] = [5, 7, 8]
        zonez = zones.buildZones(r.core, cs)
        self.assertEqual(len(list(zonez)), 3)
        zone = zonez["ring-3"]
        self.assertEqual(len(zone), 30)  # rings 8 and 9. See above comment
Example #2
0
 def test_buildZonesByOrifice(self):
     o, r = self.o, self.r
     cs = o.cs
     cs[globalSettings.CONF_ZONING_STRATEGY] = "byOrifice"
     zonez = zones.buildZones(r.core, cs)
     self.assertEqual(len(list(zonez)), 2)
     self.assertIn("008-040", zonez["zone0"])
     self.assertIn("005-023", zonez["zone0"])
     self.assertIn("003-002", zonez["ltazone0"])
Example #3
0
 def test_buildZonesForEachFA(self):
     o, r = self.o, self.r
     cs = o.cs
     cs[globalSettings.CONF_ZONING_STRATEGY] = "everyFA"
     zonez = zones.buildZones(r.core, cs)
     self.assertEqual(len(list(zonez)), 53)
     self.assertIn("008-040", zonez["channel 1"])
     self.assertIn("005-023", zonez["channel 2"])
     self.assertIn("006-029", zonez["channel 3"])
Example #4
0
 def test_buildAssemTypeZones(self):
     o, r = self.o, self.r
     cs = o.cs
     cs[globalSettings.CONF_ZONING_STRATEGY] = "byFuelType"
     zonez = zones.buildZones(r.core, cs)
     self.assertEqual(len(list(zonez)), 4)
     self.assertIn("008-040", zonez["feed fuel"])
     self.assertIn("005-023", zonez["igniter fuel"])
     self.assertIn("003-002", zonez["lta fuel"])
     self.assertIn("004-003", zonez["lta fuel b"])
Example #5
0
 def test_buildManualZones(self):
     o, r = self.o, self.r
     cs = o.cs
     cs[globalSettings.CONF_ZONING_STRATEGY] = "manual"
     cs["zoneDefinitions"] = [
         "ring-1: 001-001",
         "ring-2: 002-001, 002-002",
         "ring-3: 003-001, 003-002, 003-003",
     ]
     zonez = zones.buildZones(r.core, cs)
     self.assertEqual(len(list(zonez)), 3)
     self.assertIn("003-002", zonez["ring-3"])
Example #6
0
    def test_buildZonesForEachFA(self):
        o, r = self.o, self.r
        cs = o.cs

        # customize settings for this test
        newSettings = {globalSettings.CONF_ZONING_STRATEGY: "everyFA"}
        cs = cs.modified(newSettings=newSettings)
        zonez = zones.buildZones(r.core, cs)

        self.assertEqual(len(list(zonez)), 53)
        self.assertIn("008-040", zonez["channel 1"])
        self.assertIn("005-023", zonez["channel 2"])
        self.assertIn("006-029", zonez["channel 3"])
Example #7
0
    def test_buildAssemTypeZones(self):
        o, r = self.o, self.r
        cs = o.cs

        # customize settings for this test
        newSettings = {globalSettings.CONF_ZONING_STRATEGY: "byFuelType"}
        cs = cs.modified(newSettings=newSettings)
        zonez = zones.buildZones(r.core, cs)

        self.assertEqual(len(list(zonez)), 4)
        self.assertIn("008-040", zonez["feed fuel"])
        self.assertIn("005-023", zonez["igniter fuel"])
        self.assertIn("003-002", zonez["lta fuel"])
        self.assertIn("004-003", zonez["lta fuel b"])
Example #8
0
 def test_findZoneAssemblyIsIn(self):
     cs = self.o.cs
     cs["ringZones"] = [5, 7, 8]
     daZones = zones.buildZones(self.r.core, cs)
     for zone in daZones:
         a = self.r.core.getAssemblyWithStringLocation(zone.locList[0])
         aZone = daZones.findZoneAssemblyIsIn(a)
         self.assertEqual(aZone, zone)
     # lets test if we get a none and a warning if the assembly does not exist in a zone
     a = self.r.core.getAssemblyWithStringLocation(
         daZones[daZones.names[0]].locList[0])  # get assem from first zone
     daZones.removeZone(
         daZones.names[0]
     )  # remove a zone to ensure that our assem does not have a zone anymore
     self.assertEqual(daZones.findZoneAssemblyIsIn(a), None)
Example #9
0
    def test_buildManualZones(self):
        o, r = self.o, self.r
        cs = o.cs

        # customize settings for this test
        newSettings = {globalSettings.CONF_ZONING_STRATEGY: "manual"}
        newSettings["zoneDefinitions"] = [
            "ring-1: 001-001",
            "ring-2: 002-001, 002-002",
            "ring-3: 003-001, 003-002, 003-003",
        ]
        cs = cs.modified(newSettings=newSettings)
        zonez = zones.buildZones(r.core, cs)

        self.assertEqual(len(list(zonez)), 3)
        self.assertIn("003-002", zonez["ring-3"])
Example #10
0
    def test_removeZone(self):
        o, r = self.o, self.r
        cs = o.cs
        cs[globalSettings.CONF_ZONING_STRATEGY] = "byRingZone"
        cs["ringZones"] = [5, 8]
        # produce 2 zones, with the names ringzone0 and ringzone1
        daZones = zones.buildZones(r.core, cs)
        daZones.removeZone("ring-1")
        # The names list should only house the only other remaining zone now
        self.assertEqual(["ring-2"], daZones.names)

        # if indexed like a dict, the zones object should give a key error from the removed zone
        with self.assertRaises(KeyError):
            daZones["ring-1"]

        # Ensure we can still iterate through our zones object
        for name in daZones.names:
            aZone = daZones[name]
Example #11
0
    def test_removeZone(self):
        o, r = self.o, self.r
        cs = o.cs

        # customize settings for this test
        newSettings = {globalSettings.CONF_ZONING_STRATEGY: "byRingZone"}
        newSettings["ringZones"] = [5, 8]
        cs = cs.modified(newSettings=newSettings)

        # produce 2 zones, with the names ringzone0 and ringzone1
        daZones = zones.buildZones(r.core, cs)
        daZones.removeZone("ring-1")

        # The names list should only house the only other remaining zone now
        self.assertEqual(["ring-2"], daZones.names)

        # if indexed like a dict, the zones object should give a key error from the removed zone
        with self.assertRaises(KeyError):
            daZones["ring-1"]  # pylint: disable=pointless-statement

        # Ensure we can still iterate through our zones object
        for name in daZones.names:
            _ = daZones[name]