Interface Network

  • All Superinterfaces:
    Container<Network>, Extendable<Network>, Identifiable<Network>
    All Known Implementing Classes:
    MergingView

    public interface Network
    extends Container<Network>
    A power network model.

    Characteristics

    Attribute Type Unit Required Defaut value Description
    Id String - yes - Unique identifier of the network
    Name String - yes - Human-readable name of the network
    CaseDate DateTime - no Now The date of the case
    ForecastDistance integer - no 0 The number of minutes between the date of the case generation and the date of the case
    To create a new empty network with default implementation:
        Network n = Network.create("test", "test");
    

    The network is initially created with one variant identified by VariantManagerConstants.INITIAL_VARIANT_ID. VariantManager is responsible for variant management and is accessible from the network thanks to getVariantManager().

    Instances of Network are not thread safe except for attributes depending of the variant (always specified in the javadoc) if VariantManager.allowVariantMultiThreadAccess(boolean) is set to true.

    Author:
    Geoffroy Jamgotchian
    See Also:
    NetworkFactory, VariantManager
    • Method Detail

      • read

        static Network read​(Path file,
                            ComputationManager computationManager,
                            ImportConfig config,
                            Properties parameters,
                            NetworkFactory networkFactory,
                            ImportersLoader loader,
                            Reporter reporter)
        Read a network from the specified file, trying to guess its format.
        Parameters:
        file - The file to be loaded.
        computationManager - A computation manager which may be used by import post-processors
        config - The import config, in particular definition of post processors
        parameters - Import-specific parameters
        networkFactory - Network factory
        loader - Provides the list of available importers and post-processors
        reporter - The reporter used for functional logs
        Returns:
        The loaded network
      • read

        static Network read​(Path file,
                            ComputationManager computationManager,
                            ImportConfig config,
                            Properties parameters,
                            ImportersLoader loader)
        Read a network from the specified file, trying to guess its format.
        Parameters:
        file - The file to be loaded.
        computationManager - A computation manager which may be used by import post-processors
        config - The import config, in particular definition of post processors
        parameters - Import-specific parameters
        loader - Provides the list of available importers and post-processors
        Returns:
        The loaded network
      • read

        static Network read​(Path file,
                            ComputationManager computationManager,
                            ImportConfig config,
                            Properties parameters)
        Read a network from the specified file, trying to guess its format, and using importers and post processors defined as services.
        Parameters:
        file - The file to be loaded.
        computationManager - A computation manager which may be used by import post-processors
        config - The import config, in particular definition of post processors
        parameters - Import-specific parameters
        Returns:
        The loaded network
      • read

        static Network read​(Path file)
        Read a network from the specified file, trying to guess its format, and using importers and post processors defined as services. Import will be performed using import configuration defined in default platform config, and with no importer-specific parameters. Post processors will use the default LocalComputationManager, as defined in default platform config.
        Parameters:
        file - The file to be loaded.
        Returns:
        The loaded network
      • read

        static Network read​(String file)
        Loads a network from the specified file path, see read(Path).
        Parameters:
        file - The file to be loaded.
        Returns:
        The loaded network
      • read

        static Network read​(String filename,
                            InputStream data,
                            ComputationManager computationManager,
                            ImportConfig config,
                            Properties parameters,
                            NetworkFactory networkFactory,
                            ImportersLoader loader,
                            Reporter reporter)
        Read a network from a raw input stream, trying to guess the format from the specified filename. Please note that the input stream must be from a simple file, not a zipped one.
        Parameters:
        filename - The name of the file to be imported.
        data - The raw data from which the network should be loaded
        computationManager - A computation manager which may be used by import post-processors
        config - The import config, in particular definition of post processors
        parameters - Import-specific parameters
        networkFactory - Network factory
        loader - Provides the list of available importers and post-processors
        reporter - The reporter used for functional logs
        Returns:
        The loaded network
      • read

        static Network read​(String filename,
                            InputStream data,
                            ComputationManager computationManager,
                            ImportConfig config,
                            Properties parameters,
                            ImportersLoader loader,
                            Reporter reporter)
        Read a network from a raw input stream, trying to guess the format from the specified filename. Please note that the input stream must be from a simple file, not a zipped one.
        Parameters:
        filename - The name of the file to be imported.
        data - The raw data from which the network should be loaded
        computationManager - A computation manager which may be used by import post-processors
        config - The import config, in particular definition of post processors
        parameters - Import-specific parameters
        loader - Provides the list of available importers and post-processors
        reporter - The reporter used for functional logs
        Returns:
        The loaded network
      • read

        static Network read​(String filename,
                            InputStream data,
                            ComputationManager computationManager,
                            ImportConfig config,
                            Properties parameters,
                            ImportersLoader loader)
        Read a network from a raw input stream, trying to guess the format from the specified filename. Please note that the input stream must be from a simple file, not a zipped one.
        Parameters:
        filename - The name of the file to be imported.
        data - The raw data from which the network should be loaded
        computationManager - A computation manager which may be used by import post-processors
        config - The import config, in particular definition of post processors
        parameters - Import-specific parameters
        loader - Provides the list of available importers and post-processors
        Returns:
        The loaded network
      • read

        static Network read​(String filename,
                            InputStream data,
                            ComputationManager computationManager,
                            ImportConfig config,
                            Properties parameters)
        Read a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services. Please note that the input stream must be from a simple file, not a zipped one.
        Parameters:
        filename - The name of the file to be imported.
        data - The raw data from which the network should be loaded
        computationManager - A computation manager which may be used by import post-processors
        config - The import config, in particular definition of post processors
        parameters - Import-specific parameters
        Returns:
        The loaded network
      • read

        static Network read​(String filename,
                            InputStream data,
                            ComputationManager computationManager)
        Read a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services. Import will be performed using import configuration defined in default platform config, and with no importer-specific parameters. Please note that the input stream must be from a simple file, not a zipped one.
        Parameters:
        filename - The name of the file to be imported.
        data - The raw data from which the network should be loaded
        computationManager - A computation manager which may be used by import post-processors
        Returns:
        The loaded network
      • read

        static Network read​(String filename,
                            InputStream data)
        Read a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services. Import will be performed using import configuration defined in default platform config, and with no importer-specific parameters. Post processors will use the default LocalComputationManager, as defined in default platform config. Please note that the input stream must be from a simple file, not a zipped one.
        Parameters:
        filename - The name of the file to be imported.
        data - The raw data from which the network should be loaded
        Returns:
        The loaded network
      • read

        static Network read​(String filename,
                            InputStream data,
                            Reporter reporter)
        Read a network from a raw input stream, trying to guess the format from the specified filename, and using importers and post processors defined as services. Import will be performed using import configuration defined in default platform config, and with no importer-specific parameters. Post processors will use the default LocalComputationManager, as defined in default platform config. Please note that the input stream must be from a simple file, not a zipped one.
        Parameters:
        filename - The name of the file to be imported.
        data - The raw data from which the network should be loaded
        reporter - The reporter used for functional logs
        Returns:
        The loaded network
      • create

        static Network create​(String id,
                              String sourceFormat)
        Create an empty network using default implementation.
        Parameters:
        id - id of the network
        sourceFormat - source format
        Returns:
        an empty network
      • getCaseDate

        org.joda.time.DateTime getCaseDate()
        Get the date that the network represents.
      • setCaseDate

        Network setCaseDate​(org.joda.time.DateTime date)
        Set the date that the network represents.
        Throws:
        IllegalArgumentException - if date is null.
      • getForecastDistance

        int getForecastDistance()
        Get the forecast distance in minutes.

        Example: 0 for a snapshot, 6*60 to 30*60 for a DACF.

      • setForecastDistance

        Network setForecastDistance​(int forecastDistance)
      • getSourceFormat

        String getSourceFormat()
        Get the source format.
        Returns:
        the source format
      • getVariantManager

        VariantManager getVariantManager()
        Get the variant manager of the network.
      • getCountries

        Set<Country> getCountries()
        Get all countries.
      • getCountryCount

        int getCountryCount()
        Get the country count.
      • newSubstation

        SubstationAdder newSubstation()
        Get a builder to create a new substation.
      • getSubstationStream

        Stream<Substation> getSubstationStream()
        Get all substations.
      • getSubstationCount

        int getSubstationCount()
        Get the substation count.
      • getSubstations

        Iterable<Substation> getSubstations​(Country country,
                                            String tsoId,
                                            String... geographicalTags)
        Get substation located in a specific county, TSO and marked with a list of geographical tag.
        Parameters:
        country - the country, if null there is no filtering on countries
        tsoId - the id of the TSO, if null there is no filtering on TSOs
        geographicalTags - a list a geographical tags
      • getSubstations

        Iterable<Substation> getSubstations​(String country,
                                            String tsoId,
                                            String... geographicalTags)
        Get substation located in a specific county, TSO and marked with a list of geographical tag.
        Parameters:
        country - the country name, if empty string, the filtering will be on substations without country, if null there is no filtering on countries
        tsoId - the id of the TSO, if null there is no filtering on TSOs
        geographicalTags - a list a geographical tags
      • getSubstation

        Substation getSubstation​(String id)
        Get a substation.
        Parameters:
        id - the id or an alias of the substation
      • newVoltageLevel

        default VoltageLevelAdder newVoltageLevel()
        Get a builder to create a new voltage level (without substation). Note: if this method is not implemented, it will create an intermediary fictitious Substation.
      • getVoltageLevelStream

        Stream<VoltageLevel> getVoltageLevelStream()
        Get all substation voltage levels.
      • getVoltageLevelCount

        int getVoltageLevelCount()
        Get the voltage level count.
      • getVoltageLevel

        VoltageLevel getVoltageLevel​(String id)
        Get a substation voltage level.
        Parameters:
        id - the id or an alias of the substation voltage level
      • newLine

        LineAdder newLine()
        Get a builder to create a new AC line.
      • getBranch

        Branch getBranch​(String branchId)
        Get a branch
        Parameters:
        branchId - the id of the branch
      • getBranchStream

        Stream<Branch> getBranchStream()
        Get all branches
      • getBranchCount

        int getBranchCount()
        Get the branch count.
      • getLineStream

        Stream<Line> getLineStream()
        Get all AC lines.
      • getLineCount

        int getLineCount()
        Get the AC line count.
      • getLine

        Line getLine​(String id)
        Get a AC line.
        Parameters:
        id - the id or an alias of the AC line
      • newTieLine

        TieLineAdder newTieLine()
        Get a builder to create a new AC tie line.
      • newTwoWindingsTransformer

        default TwoWindingsTransformerAdder newTwoWindingsTransformer()
        Get a builder to create a two windings transformer. Only use if at least one of the transformer's ends does not belong to any substation. Else use Substation.newTwoWindingsTransformer(). Note: if this method is not implemented, it will create an intermediary fictitious Substation.
      • getTwoWindingsTransformerCount

        int getTwoWindingsTransformerCount()
        Get the two windings transformer count.
      • getTwoWindingsTransformer

        TwoWindingsTransformer getTwoWindingsTransformer​(String id)
        Get a two windings transformer.
        Parameters:
        id - the id or an alias of the two windings transformer
      • newThreeWindingsTransformer

        default ThreeWindingsTransformerAdder newThreeWindingsTransformer()
        Get a builder to create a three windings transformer. Only use this builder if at least one of the transformer's ends does not belong to any substation. Else use Substation.newThreeWindingsTransformer(). Note: if this method is not implemented, it will create an intermediary fictitious Substation.
      • getThreeWindingsTransformerCount

        int getThreeWindingsTransformerCount()
        Get the 3 windings transformer count.
      • getThreeWindingsTransformer

        ThreeWindingsTransformer getThreeWindingsTransformer​(String id)
        Get a 3 windings transformer.
        Parameters:
        id - the id or an alias of the 3 windings transformer
      • getGeneratorStream

        Stream<Generator> getGeneratorStream()
        Get all generators.
      • getGeneratorCount

        int getGeneratorCount()
        Get the generator count.
      • getGenerator

        Generator getGenerator​(String id)
        Get a generator.
        Parameters:
        id - the id or an alias of the generator
      • getBatteryStream

        Stream<Battery> getBatteryStream()
        Get all batteries.
      • getBatteryCount

        int getBatteryCount()
        Get the battery count.
      • getBattery

        Battery getBattery​(String id)
        Get a battery.
        Parameters:
        id - the id or an alias of the battery
      • getLoadStream

        Stream<Load> getLoadStream()
        Get all loads.
      • getLoadCount

        int getLoadCount()
        Get the load count.
      • getLoad

        Load getLoad​(String id)
        Get a load.
        Parameters:
        id - the id or an alias of the load
      • getShuntCompensatorCount

        int getShuntCompensatorCount()
        Get the shunt count.
      • getShuntCompensator

        ShuntCompensator getShuntCompensator​(String id)
        Get a compensator shunt.
        Parameters:
        id - the id or an alias of the compensator shunt
      • getDanglingLineStream

        Stream<DanglingLine> getDanglingLineStream()
        Get all dangling lines.
      • getDanglingLineCount

        int getDanglingLineCount()
        Get the dangling line count.
      • getDanglingLine

        DanglingLine getDanglingLine​(String id)
        Get a dangling line.
        Parameters:
        id - the id or an alias of the dangling line
      • getStaticVarCompensatorCount

        int getStaticVarCompensatorCount()
        Get the static var compensator count.
      • getStaticVarCompensator

        StaticVarCompensator getStaticVarCompensator​(String id)
        Get a static var compensator.
        Parameters:
        id - the id or an alias of the static var compensator
      • getSwitch

        Switch getSwitch​(String id)
        Get a switch from its id or an alias.
        Parameters:
        id - id or an alias of the switch
        Returns:
        the switch
      • getSwitches

        Iterable<Switch> getSwitches()
        Get all switches.
        Returns:
        all switches
      • getSwitchStream

        Stream<Switch> getSwitchStream()
        Get all switches.
        Returns:
        all switches
      • getSwitchCount

        int getSwitchCount()
        Get the switch count.
        Returns:
        the switch count
      • getBusbarSection

        BusbarSection getBusbarSection​(String id)
        Get a busbar section from its id or an alias.
        Parameters:
        id - the id or an alias of the busbar section
        Returns:
        the busbar section
      • getBusbarSections

        Iterable<BusbarSection> getBusbarSections()
        Get all busbar sections.
        Returns:
        all busbar sections
      • getBusbarSectionStream

        Stream<BusbarSection> getBusbarSectionStream()
        Get all busbar sections.
        Returns:
        all busbar sections
      • getBusbarSectionCount

        int getBusbarSectionCount()
        Get the busbar section count.
        Returns:
        the busbar section count.
      • getHvdcConverterStations

        Iterable<HvdcConverterStation<?>> getHvdcConverterStations()
        Get all HVDC converter stations.
        Returns:
        all HVDC converter stations
      • getHvdcConverterStationStream

        Stream<HvdcConverterStation<?>> getHvdcConverterStationStream()
        Get all HVDC converter stations.
        Returns:
        all HVDC converter stations
      • getHvdcConverterStationCount

        int getHvdcConverterStationCount()
        Get HVDC converter stations count.
        Returns:
        HVDC converter station count
      • getHvdcConverterStation

        HvdcConverterStation<?> getHvdcConverterStation​(String id)
        Get an HVDC converter station.
        Parameters:
        id - the id or an alias of the HVDC converter station
        Returns:
        the HVDC converter station or null if not found
      • getLccConverterStations

        Iterable<LccConverterStation> getLccConverterStations()
        Get all LCC converter stations.
        Returns:
        all LCC converter stations
      • getLccConverterStationStream

        Stream<LccConverterStation> getLccConverterStationStream()
        Get all LCC converter stations.
        Returns:
        all LCC converter stations
      • getLccConverterStationCount

        int getLccConverterStationCount()
        Get LCC converter stations count.
        Returns:
        LCC converter station count
      • getLccConverterStation

        LccConverterStation getLccConverterStation​(String id)
        Get an LCC converter station.
        Parameters:
        id - the id or an alias of the LCC converter station
        Returns:
        the LCC converter station or null if not found
      • getVscConverterStations

        Iterable<VscConverterStation> getVscConverterStations()
        Get all VSC converter stations.
        Returns:
        all VSC converter stations
      • getVscConverterStationStream

        Stream<VscConverterStation> getVscConverterStationStream()
        Get all VSC converter stations.
        Returns:
        all VSC converter stations
      • getVscConverterStationCount

        int getVscConverterStationCount()
        Get VSC converter stations count.
        Returns:
        VSC converter station count
      • getVscConverterStation

        VscConverterStation getVscConverterStation​(String id)
        Get an VSC converter station.
        Parameters:
        id - the id or an alias of the VSC converter station
        Returns:
        the VSC converter station or null if not found
      • getHvdcLines

        Iterable<HvdcLine> getHvdcLines()
        Get all HVDC lines.
        Returns:
        all HVDC lines
      • getHvdcLineStream

        Stream<HvdcLine> getHvdcLineStream()
        Get all HVDC lines.
        Returns:
        all HVDC lines
      • getHvdcLineCount

        int getHvdcLineCount()
        Get HVDC lines count.
        Returns:
        HVDC lines count
      • getHvdcLine

        HvdcLine getHvdcLine​(String id)
        Get an HVDC line.
        Parameters:
        id - the id or an alias of the HVDC line
        Returns:
        the HVDC line or null if not found
      • getHvdcLine

        default HvdcLine getHvdcLine​(HvdcConverterStation converterStation)
        Get an HVDC line from a converter station
        Parameters:
        converterStation - a HVDC converter station
        Returns:
        the HVDC line or null if not found
      • newHvdcLine

        HvdcLineAdder newHvdcLine()
        Get a builder to create a new HVDC line.
        Returns:
        a builder to create a new HVDC line
      • getIdentifiable

        Identifiable<?> getIdentifiable​(String id)
        Get an equipment by its ID or alias
        Parameters:
        id - the id or an alias of the equipment
      • getIdentifiables

        Collection<Identifiable<?>> getIdentifiables()
        Get all identifiables of the network.
        Returns:
        all identifiables of the network
      • getConnectables

        default <C extends ConnectableIterable<C> getConnectables​(Class<C> clazz)
        Get all connectables of the network for a given type
        Parameters:
        clazz - connectable type class
        Returns:
        all the connectables of the given type
      • getConnectableStream

        default <C extends ConnectableStream<C> getConnectableStream​(Class<C> clazz)
        Get a stream of all connectables of the network for a given type
        Parameters:
        clazz - connectable type class
        Returns:
        a stream of all the connectables of the given type
      • getConnectableCount

        default <C extends Connectable> int getConnectableCount​(Class<C> clazz)
        Count the connectables of the network for a given type
        Parameters:
        clazz - connectable type class
        Returns:
        the count of all the connectables of the given type
      • getConnectables

        default Iterable<Connectable> getConnectables()
        Get all connectables of the network
        Returns:
        all the connectables
      • getConnectableStream

        default Stream<Connectable> getConnectableStream()
        Get a stream of all connectables of the network
        Returns:
        a stream of all the connectables
      • getConnectable

        default Connectable<?> getConnectable​(String id)
        Get a connectable by its ID or alias
        Parameters:
        id - the id or an alias of the equipment
      • getConnectableCount

        default int getConnectableCount()
        Count the connectables of the network
        Returns:
        the count of all the connectables
      • merge

        void merge​(Network other)
        Merge with an other network. At the end of the merge the other network is empty.
        Parameters:
        other - the other network
      • merge

        void merge​(Network... others)
      • runValidationChecks

        default ValidationLevel runValidationChecks()
        If network is valid, do nothing.
        If network not valid, check if each network component is valid. A ValidationException is thrown with an explicit message if one network component is not valid.
        If all network components are valid, network validation status is updated to true. Return the network validation status.
      • runValidationChecks

        default ValidationLevel runValidationChecks​(boolean throwsException)
        If network is valid, do nothing.
        If network not valid and throwsException is true, check if each network component is valid. A ValidationException is thrown with an explicit message if one network component is not valid.
        If all network components are valid, network validation status is updated to true. Return the network validation status.
      • runValidationChecks

        default ValidationLevel runValidationChecks​(boolean throwsException,
                                                    Reporter reporter)
        If network is valid, do nothing.
        If network not valid and throwsException is true, check if each network component is valid. A ValidationException is thrown with an explicit message if one network component is not valid.
        If all network components are valid, network validation status is updated to true. Return the network validation status.
      • getValidationLevel

        default ValidationLevel getValidationLevel()
        Return the network validation status. Do not run any validation check.
      • setMinimumAcceptableValidationLevel

        default Network setMinimumAcceptableValidationLevel​(ValidationLevel validationLevel)
      • write

        default void write​(ExportersLoader loader,
                           String format,
                           Properties parameters,
                           DataSource dataSource,
                           Reporter reporter)
        Write the network to a given format.
        Parameters:
        format - the export format
        parameters - some properties to configure the export
        dataSource - data source
        reporter - the reporter used for functional logs
      • write

        default void write​(ExportersLoader loader,
                           String format,
                           Properties parameters,
                           Path file,
                           Reporter reporter)
        Write the network to a given format.
        Parameters:
        format - the export format
        parameters - some properties to configure the export
        file - the network file
        reporter - the reporter used for functional logs
      • write

        default void write​(ExportersLoader loader,
                           String format,
                           Properties parameters,
                           String directory,
                           String baseName,
                           Reporter reporter)
        Write the network to a given format.
        Parameters:
        format - the export format
        parameters - some properties to configure the export
        directory - the output directory where files are generated
        baseName - a base name for all generated files
        reporter - the reporter used for functional logs