0
votes

I have a Network which includes compound modules. One submodule should be create x times defined by the parameter numberOfBuildings. Namely, the buildings submodule.

In the .ned file I set the default to 1 however in the .ini file the value is then overwritten by 11.

Network.ned

network Network
{
        utility: Utility {
            @display("p=71,117");
        }
        energyDistrict: EnergyDistrict {
            @display("p=272,117");
        }
        supplier: Supplier {
            @display("p=272,23");
        }

    connections allowunconnected:

        utility.outElectricty --> energyDistrict.inCityElectrictyGrid;
        utility.outGas --> energyDistrict.inCityGasGrid;
        utility.outWater --> energyDistrict.inCityWaterGrid;
        supplier.outFuelOil --> energyDistrict.inSupplierFuelOil;
}

module EnergyDistrict extends Network
{
    //Here the parameter of the number of buildings is defined.
    parameters:
        int numberOfBuildings = default(1);
        int numberDistributionBuildings = default(1);

    gates:
        input inCityElectrictyGrid;
        input inCityGasGrid;
        input inCityWaterGrid;
        input inSupplierFuelOil;

        output outCityElectricityGrid;
        output outCityGasGrid;
        output outWaterGrid;
        output outSupplierFuelOil; 

    submodules:
        electricalDistributionBoxDistrict: ElectricalDistributionBoxDistrict {
            @display("p=119,192");
        }
        waterDistributionDistrict: WaterDistributionDistrict {
            @display("p=311,192");
        }
        gasDistributionDistrict: GasDistributionDistrict {
            @display("p=474,192");
        }
        fuelOilTransporter: FuelOilTransporter {
            @display("p=618,192");
        }
        buildings[numberOfBuildings]: Buildings {
            @display("p=272,273");
        } 

           connections allowunconnected:
                //The connection of electricity, gas and water city grid to the various buildings.
        //Connection Electricity City Grid
        energyDistrict.outCityElectricityGrid --> electricalDistributionBoxDistrict.inElectricityCityGridDistributionBox;
        energyDistrict.outCityGasGrid --> gasDistributionDistrict.inGasCityGridDistributionBox;
        energyDistrict.outWaterGrid --> waterDistributionDistrict.inWaterCityGridDistributionBox;
        energyDistrict.outSupplierFuelOil --> fuelOilTransporter.inFuelOilSupplier; 

                for i=0..numberDistributionBuildings-1{
            electricalDistributionBoxDistrict.outCityElectricityGridDistributionBox[i] --> buildings[i].inElectricityCityGridBuilding[i];

            //Connection Gas City Grid
            gasDistributionDistrict.outCityGasGridDistributionBox[i] --> buildings[i].inGasCityGridBuidling[i];

            //Connection Water City Grid
            waterDistributionDistrict.outCityWaterGridDistributionBox[i] --> buildings[i].inWaterCityGridBuilding[i];

            //Connection to Supplier for Fuel Oil
            fuelOilTransporter.outFuelOilTransporter[i] --> buildings[i].inSupplierFuelOilBuilding[i];

        }

        module Buildings extends EnergyDistrict
{
    //The parameter of a building consists of the buildingID, which type of building it is, the number of accommodated units (living unit and business premise)
    //and wether the building has installed a solar system on the roof.
    parameters:
        int buildingID = default(1);
        string typeOfBuilding = default("Gas Heater");
        int numberOfUnits = default(1);
        bool installedSolarSystem = default(false);
        .....
}

omnetpp.ini:

[Config EnergyDistrict]
Network.energyDistrict.numberOfBuildings = 11

If I run then the network as Omnet++ Simulation I get the following error.

Error: Submodule nesting too deep (71) (potential infinite recursion?) -- in module (omnetpp::cModule)
Network.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict.energyDistrict (id=550), during network setup

It looks like the energy district instead of the buildings submodule is created infinite.

Could someone please help me with this issue?

1

1 Answers

0
votes

This is clearly an infinite recursion. You have a Network which contains an energyDistrict submodule, but the type of EnergyDistrict itself extends Network so it contains also an energyDistrict submodule, and so...

Why module EnergyDistrict extends Network ???