Ejemplo n.º 1
0
 def test_plotHexBlock(self):
     with TemporaryDirectoryChanger():
         first_fuel_block = self.r.core.getFirstBlock(Flags.FUEL)
         first_fuel_block.autoCreateSpatialGrids()
         plotting.plotBlockDiagram(first_fuel_block, "blockDiagram23.svg",
                                   True)
         self.assertTrue(os.path.exists("blockDiagram23.svg"))
Ejemplo n.º 2
0
    def test_plotCartesianBlock(self):
        from armi import settings
        from armi.reactor import blueprints, reactors

        with TemporaryDirectoryChanger():
            cs = settings.Settings(
                os.path.join(TEST_ROOT, "tutorials", "c5g7-settings.yaml"))

            blueprint = blueprints.loadFromCs(cs)
            r = reactors.factory(cs, blueprint)
            for name, bDesign in blueprint.blockDesigns.items():
                b = bDesign.construct(cs, blueprint, 0, 1, 1, "AA", {})
                plotting.plotBlockDiagram(b, "{}.svg".format(name), True)
            self.assertTrue(os.path.exists("uo2.svg"))
            self.assertTrue(os.path.exists("mox.svg"))
Ejemplo n.º 3
0
def insertBlockDiagrams(cs, blueprint, report, cold):
    """Adds Block Diagrams to the report

    Parameters
    ----------
    cs: Case Settings
    blueprint: Blueprint
    report: ReportContent
    cold: boolean
        True for dimensions at cold temps
    """
    materialList = []
    for bDesign in blueprint.blockDesigns:
        block = bDesign.construct(cs, blueprint, 0, 1, 0, "A", dict())
        for component in block:
            if isinstance(component.material, custom.Custom):
                materialName = component.p.customIsotopicsName
            else:
                materialName = component.material.name
            if materialName not in materialList:
                materialList.append(materialName)

    report[DESIGN]["Block Diagrams"] = newReports.Section("Block Diagrams")
    for bDesign in blueprint.blockDesigns:
        block = bDesign.construct(cs, blueprint, 0, 1, 0, "A", dict())
        fileName = plotting.plotBlockDiagram(
            block, "{}.svg".format(bDesign.name), cold, materialList=materialList
        )
        plotting.close()
        if fileName is not None:
            report[DESIGN]["Block Diagrams"][
                bDesign.name.capitalize()
            ] = newReports.Image(
                "Diagram of {} Block at Cold Temperature".format(
                    bDesign.name.capitalize()
                ),
                fileName,
                "{}".format(bDesign.name.capitalize()),
            )