pymdt package

Configuration Arguments

There are several arguments that can be used to control the MDT from within your python script. They are extracted from the list of system arguments. Examples are provided for each as are details of when you may want to use them. Often it is not necessary to use any of them.

These arguments should be defined near the top of your python script file and must be provided before importing anything from pymdt.

INCORRECT
    import pymdt
    sys.argv.append("MDT_VERSION=1.4.2520.0")
CORRECT
    sys.argv.append("MDT_VERSION=1.4.2520.0")
    import pymdt

They are:

MDT_VERSION

The default for this is defined in pymdt\__init__.py. This is important because it tells pymdt where to find the MDT binaries as well as other things. If the version listed in pymdt\__init__.py does not match with your installed version of MDT, you will need to provide this. The format is major.minor[.build[.revision]] where each component is an integer value. For example:

sys.argv.append(“MDT_VERSION=1.4.2520.0”)

Given this and absent an explicitly provided MDT_BIN_DIR (see below), the MDT will look for MDT binaries in an installation folder that looks like:

C:\Program Files\Sandia National Laboratories\Microgrid Design Toolkit v1.4.2520.0

MDT_BIN_DIR

The location in which pymdt will look for MDT binaries to use. This should be a folder into which the MDT has been installed on your computer. It is typically something like:

C:\Program Files\Sandia National Laboratories\Microgrid Design Toolkit v1.4.2520.0

Where the version listed at the end is either the default version defined in pymdt\__init__.py or was provided as the MDT_VERSION (see above). You should use this value when your MDT installation is in a folder that does not follow the pattern. For instance, if it was installed on a drive other than the C drive or if there are any other path differences from what’s shown above (other than the version number).

sys.argv.append(“MDT_BIN_DIR=<path to MDT binaries>”)

MDT_DATA_DIR

The location in which pymdt will look for the file (been.invoked) whose presence tells the MDT whether or not this is the first invocation of the software. The location provided will have the version number appended. This is typically

C:\ProgramData\Sandia National Laboratories\Microgrid Design Toolkit\1.4.2520.0

Of course, the version number at the end will align with your current version. It should be rare that you need to provide this input.

sys.argv.append(“MDT_DATA_DIR=<path to MDT data directory>”)

MDT_SPEC_DB_DIR

The directory in which the specification DB is located. The default for this is

C:\Users\Public\Documents\Microgrid Design Toolkit v1.4.2520.0

Where the version number is the current version of the MDT you have installed. If you keep your database in a non-standard location, you can provide that path in this input.

sys.argv.append(“MDT_SPEC_DB_DIR=<path to MDT spec DB>”)

Submodules

pymdt.core module

pymdt.core.ConfigureDieselRefueller(mg: Microgrid, **kwargs)[source]

This helper function sets the properties of the diesel refueling schedule.

Parameters

mg: MDT.Microgrid

The microgrid instance for which the diesel refueller is being configured.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

time_of_day: float

The hour of day at which the first refuel action takes place. A real valued number of hours from midnight [0-24].

period: float

The amount of time in hours between refuellings.

quantity: float

The maximum amount of fuel that can be delivered in any refuelling action. A value of -1 allows for the delivery of any amount of fuel (infinite).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

pymdt.core.ConfigureGridTiedController(mg: Microgrid, **kwargs)[source]

This helper function sets the properties of the controller that manages activities in the periods between DBT occurrences.

The parameters all have to do with the tracking of failures and repairs during the grid-tied operation phase of the simulation. A couple things to note are:

1 - Even if tracking, statistics for failures and repairs are not kept

during this phase. The only real effect of doing so is that it is possible (or more possible) for an asset to be broken at the start of the next DBT.

2 - Even if not tracking, a repair for an asset that failed during the

DBT still may occur during the grid tied period and the full time of the repair will be tallied in statistics.

Parameters

mg: MDT.Microgrid

The microgrid instance for which the grid-tied controller is being configured.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

track_line_failures: bool

Whether or not to execute failures and repairs of lines during the grid-tied operations.

track_transformer_failures: bool

Whether or not to execute failures and repairs of transformers during the grid-tied operations.

track_switch_failures: bool

Whether or not to execute failures and repairs of switches during the grid-tied operations.

track_ups_failures: bool

Whether or not to execute failures and repairs of UPSs during the grid-tied operations.

track_battery_failures: bool

Whether or not to execute failures and repairs of Batteries during the grid-tied operations.

track_wind_failures: bool

Whether or not to execute failures and repairs of Wind generators during the grid-tied operations.

track_hydro_failures: bool

Whether or not to execute failures and repairs of Hydro generators during the grid-tied operations.

track_solar_failures: bool

Whether or not to execute failures and repairs of Solar generators during the grid-tied operations.

track_inverter_failures: bool

Whether or not to execute failures and repairs of inverters during the grid-tied operations.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

pymdt.core.ConfigureMicrogridController(mg: Microgrid, **kwargs)[source]

Sets the type and properties of the controller that controls islanded microgrid operations (as opposed to startup or grid-tied behavior.)

Parameters

mg: MDT.Microgrid

The microgrid for which the microgrid controller is to be configured.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

controller_type:

An optional parameter that indicates what type of controller to use. This is one of the controller_types enumeration members. If no controller_type is provided, then the default is standard.

gen_restart_delay: float

The number of seconds of delay if a generator fails to start and further attempts should be made. This is the time between attempts. The default is 15 seconds.

bus_sync_delay: float

The number of seconds required to synchronize two busses that are to be connected together. The default is 20 seconds.

gen_sync_delay: float

The number of seconds required to synchronize a generator onto an already powered bus. The default is 15 seconds.

min_power_dispatch_threshold: float

The fraction of load to current online generator below which a re-dispatch should be attempted. A re-dispatch in this case may choose to shut some generation down. The default is 0.4 (40%).

forecast_duration: float

The number of hours over which to do load, solar, etc. forecasting for the purposes of generator dispatch. The default is 1 hour.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

pymdt.core.ConfigurePRM(**kwargs)[source]

This helper function sets the properties of the PRM simulation.

Parameters

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

simulation_years: float

The total number of years of simulation to run for every configuration. This includes both DBT or “black sky” time and normal operations (or “blue sky) time. The default is 1000 years.

powerflow_type:

The type of powerflow calculations to do. The only options are DC powerflow calculations and no (NONE) calculations. These should be provided as members of the pymdt.core.powerflow_types enumeration. The default is NONE.

use_reliability: bool

Whether or not to include reliability calculations in the simulation. This serves as a means of telling the simulation to ignore reliability inputs which can be useful for comparison trials. The default is True.

use_fragility: bool

Whether or not to include fragility calculations in the simulation. This serves as a means of telling the simulation to ignore fragility inputs which can be useful for comparison trials. The default is True.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

pymdt.core.ConfigurePropaneRefueller(mg: Microgrid, **kwargs)[source]

This helper function sets the properties of the propane refueling schedule.

Parameters

mg: MDT.Microgrid

The microgrid instance for which the propane refueller is being configured.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

time_of_day: float

The hour of day at which the first refuel action takes place. A real valued number of hours from midnight [0-24].

period: float

The amount of time in hours between refuellings.

quantity: float

The maximum amount of fuel that can be delivered in any refuelling action. A value of -1 allows for the delivery of any amount of fuel (infinite).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

pymdt.core.ConfigureStartupController(mg: Microgrid, **kwargs)[source]

Sets the type and properties of the controller that controls the startup of islanded microgrid operations (as opposed to the established microgrid or grid-tied behavior.)

Parameters

mg: MDT.Microgrid

The microgrid for which the startup controller is to be configured.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

gen_restart_delay: float

The number of seconds of delay if a generator fails to start and further attempts should be made. This is the time between attempts. The default is 15 seconds.

bus_sync_delay: float

The number of seconds required to synchronize two busses that are to be connected together. The default is 20 seconds.

gen_sync_delay: float

The number of seconds required to synchronize a generator onto an already powered bus. The default is 15 seconds.

gen_failed_formation_delay: float

The number of seconds between the onset of a DBT occurrence and the formation of a microgrid if some backup generators failed to start. With a start failure, some critical load may be at risk and so it may be desirable to start networking generators with less delay. The default is 120 seconds.

no_gen_failed_formation_delay: float

The number of seconds between the onset of a DBT occurrence and the formation of a microgrid if all backup generators started properly. This allows a ride-through for short duration DBTs. The default is 600 seconds.

renewable_start_delay: float

The number of seconds of delay between the end of the startup procedure and the reconnection of any non-ride-through inverter controlled renewable assets. The default is 300 seconds.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

pymdt.core.ExtractPRMSettings() PRMSettings[source]

A helper method to extract and return the MDT.PRMSettings object.

Returns

MDT.PRMSettings:

The settings object that controls the operation of the PRM simulation that evaluates the function of microgrid configurations.

pymdt.core.FindStoredHydroConfiguration(name: str) StoredTierLoadConfiguration[source]

This function searches through all previously defined stored hydro resource data sets and returns the one found with the supplied name or None.

Parameters

name: str

The name of the stored profile to find.

Returns

MDT.StoredTierLoadConfiguration:

The found stored hydro data set with data loaded or None if there is no data set by the supplied name.

pymdt.core.FindStoredLoadConfiguration(name: str) StoredTierLoadConfiguration[source]

This function searches through all previously defined stored load profile data sets and returns the one found with the supplied name or None.

Parameters

name: str

The name of the stored profile to find.

Returns

MDT.StoredTierLoadConfiguration:

The found stored load data set with data loaded or None if there is no data set by the supplied name.

pymdt.core.FindStoredSolarConfiguration(name: str) StoredTierLoadConfiguration[source]

This function searches through all previously defined stored solar resource data sets and returns the one found with the supplied name or None.

Parameters

name: str

The name of the stored profile to find.

Returns

MDT.StoredTierLoadConfiguration:

The found stored solar data set with data loaded or None if there is no data set by the supplied name.

pymdt.core.FindStoredThermalConfiguration(name: str) StoredTierLoadConfiguration[source]

This function searches through all previously defined stored thermal load data sets and returns the one found with the supplied name or None.

Parameters

name: str

The name of the stored profile to find.

Returns

MDT.StoredTierLoadConfiguration:

The found stored thermal data set with data loaded or None if there is no data set by the supplied name.

pymdt.core.FindStoredWindConfiguration(name: str) StoredTierLoadConfiguration[source]

This function searches through all previously defined stored wind resource data sets and returns the one found with the supplied name or None.

Parameters

name: str

The name of the stored profile to find.

Returns

MDT.StoredTierLoadConfiguration:

The found stored wind data set with data loaded or None if there is no data set by the supplied name.

pymdt.core.MakeBattery(b: Bus, name: str, **kwargs) Battery[source]

This helper function creates a new battery, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this battery is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this battery. Names of batteries within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new battery. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.BatterySpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new battery. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.BatterySpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new battery. This is typically used when the new battery is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting battery. This is only useful if you intend to save and open a model in the MDT GUI.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting battery.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Battery:

The newly created battery instance.

pymdt.core.MakeBus(mg: Microgrid, name: str, **kwargs) Bus[source]

This helper function creates a new bus, extracts any provided properties, loads it into its owner, and returns it.

Parameters

mg: MDT.Microgrid

The microgrid for which this bus is being built.

name: str

The name to be given to this node. Names of nodes within a microgrid must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting bus. This is only useful if you intend to save and open a model in the MDT GUI.

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

owner:

An optional parameter to serve as the owner of the new bus. This is typically used if one does not want the bus added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting node.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Bus:

The newly created bus instance.

pymdt.core.MakeBusDesignOption(mdo: MicrogridDesignOption, b: Bus, name: str, **kwargs) BusDesignOption[source]

This helper function creates a new bus design option, extracts any provided properties, loads it into its owner (mdo), and returns it.

Parameters

mdo: MDT.MicrogridDesignOption

The microgrid design option into which the new bus design option will be installed. If an mdo is not provided (None), then an orphan bus design option is returned and should be added to an mdo at some later point.

b: MDT.Bus

The bus for which this bus design option is being built. If this option is being built for a bus that is not part of the microgrid but instead should be added as part of the mdo, then this argument should be None. In that case, a new bus will be built.

name: str

The name to be given to the new bus design option. Names of bus design options within a microgrid design option must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new bus design option. This is typically used if one does not want the bus design option added to the microgrid design option as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid design option (mdo) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting bus design option.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.BusDesignOption:

The newly created bus design option instance.

pymdt.core.MakeDesignBasisThreat(pu: PowerUtility, name: str, **kwargs) DesignBasisThreat[source]

This helper function creates a new design basis threat, extracts any provided properties, loads it into its owner (pu), and returns it.

Parameters

pu: MDT.PowerUtility

The unreliable entity for which this design basis threat is being built.

name: str

The name to be given to the new design basis threat. Names of design basis threat within an unreliable entity must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

mtbf: Common.Distributions.IDistribution

The probability distribution describing the mean time between failures for this design basis threat.

mttr: Common.Distributions.IDistribution

The probability distribution describing the mean time to repair for this design basis threat.

owner:

An optional parameter to serve as the owner of the new DBT. This is typically used if one does not want the DBT added to the power utility as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied power utility (pu) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting design basis threat.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.DesignBasisThreat:

The newly created design basis threat instance.

pymdt.core.MakeDieselGenerator(b: Bus, name: str, **kwargs) DieselGenerator[source]

This helper function creates a new diesel generator, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this diesel generator is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this diesel generator. Names of diesel generators within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new diesel generator. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.DieselGeneratorSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new diesel generator. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.DieselGeneratorSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new diesel generator. This is typically used when the new diesel generator is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting diesel generator. This is only useful if you intend to save and open a model in the MDT GUI.

tanks:

The list of the diesel tanks to be assigned to the new diesel generator. This input can be an MDT.DieselTank instance, the name of a diesel tank in which case a search will be conducted to find the correct tank in the supplied microgrid, or a list of instances and/or names. If not provided, no tanks are assigned.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting diesel generator.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.DieselGenerator:

The newly created diesel generator instance.

pymdt.core.MakeDieselTank(mg: Microgrid, name: str, **kwargs) DieselTank[source]

This helper function creates a new diesel tank, extracts any provided properties, loads it into its owner, and returns it.

Parameters

mg: MDT.Microgrid

The microgrid for which this tank is being built. If an “owner” parameter is not provided, then this microgrid is also used as the owner.

name: str

The name to be given to this tank. Names of tanks within a microgrid must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new tank. If not provided, the baseline specification is No Tank. This can either be provided as an MDT.DieselTankSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new tank. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.DieselTankSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new tank. This is typically used when the new tank is being created for a microgrid design option in which case the MDT.MicrogridDesignOption instance should be supplied. If no owner is provided, then the supplied microgrid (mg) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting tank. This is only useful if you intend to save and open a model in the MDT GUI.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

infinite_fuel: bool

Whether or not this tank should be granted infinite fuel in the controller settings. The default is False.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting tank.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.DieselTank:

The newly created diesel tank instance.

pymdt.core.MakeFailureMode(u: ~MDT.IUnreliable[], name: str, **kwargs) FailureMode[source]

This helper function creates a new failure mode, extracts any provided properties, loads it into its owner (u), and returns it.

Parameters

u: MDT.IUnreliable

The unreliable entity for which this failure mode is being built. This argument can be None and if no owner is provided or the owner provided is None, then the returned mode will not be added to any owner. It should thus be added to an owner at some later time.

name: str

The name to be given to the new failure mode. Names of failure modes within an unreliable entity must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

mtbf: Common.Distributions.IDistribution

The probability distribution describing the mean time between failures for this failure mode. This could also be a float in which case a fixed distribution will be used.

mttr: Common.Distributions.IDistribution

The probability distribution describing the mean time to repair for this failure mode. This could also be a float in which case a fixed distribution will be used.

owner:

An optional parameter to serve as the owner of the new failure mode. This is typically used if one does not want the failure mode added to the unreliable asset as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied unreliable (u) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting failure mode.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.FailureMode:

The newly created and loaded failure mode.

pymdt.core.MakeFragilityCurve(f: IFragile, name: str, haz: Hazard, **kwargs) FragilityCurve[source]

This helper function creates a new fragility curve, extracts any provided properties, loads it into its owner (f) mapped to the supplied hazard, and returns it.

Parameters

f: MDT.IFragile

The fragile entity for which this fragility curve is being built. This parameter can be None and if so, and if no explicit non-None owner is provided, the fragility curve will be built and returned but no mapping to haz will take place. At some later time, the newly created fragility curve should be added to an asset mapped to a hazard.

name: str

The name to be given to the new fragility curve. Names of fragility curves within an unreliable entity must be unique.

haz: MDT.Hazard

The hazard to which this fragility curve applies in the given fragile entity. If the parameter f is None, or if an explicit owner=None is provided, this parameter can also be None. Otherwise, it cannot.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

mttr: Common.Distributions.IDistribution

The probability distribution describing the mean time to repair for this fragility curve. This could also be a float in which case a fixed distribution will be used.

probability_generator: Common.Distributions.IDistribution

The distribution that determines the likelihood of failure in terms of the hazard intensity units for this fragility.

owner:

An optional parameter to serve as the owner of the new fragility curve. This is typically used if one does not want the fragility curve added to the fragile asset as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied fragile asset (f) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting fragility curve.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.FragilityCurve:

The newly created and loaded fragility curve.

pymdt.core.MakeHazard(dbt: DesignBasisThreat, name: str, **kwargs) Hazard[source]

This helper function creates a new hazard, extracts any provided properties, loads it into the provided DBT, and returns it.

Parameters

dbt: MDT.DesignBasisThreat

The DBT for which this hazard is being built.

name: str

The name to be given to this hazard. Names of hazards within a DBT must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

intensity_generator: MDT.IDistribution

The distribution from which intensity values are drawn at the onset of each DBT.

units:

The units of this hazard to be used as a label.

owner:

An optional parameter to serve as the owner of the new hazard. This is typically used if one does not want the hazard added to the DBT as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied DBT (dbt) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting hazard.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Hazard:

The newly created hazard instance.

pymdt.core.MakeHydroGenerator(b: Bus, name: str, **kwargs) HydroGenerator[source]

This helper function creates a new hydro generator, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this hydro generator is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this hydro generator. Names of hydro generators within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new hydro generator. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.HydroGeneratorSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new hydro generator. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.HydroGeneratorSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new hydro generator. This is typically used when the new hydro generator is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting hydro generator. This is only useful if you intend to save and open a model in the MDT GUI.

resource:

The instance or name of the hydro resource to be assigned to the new hydro generator. If not provided, no resource is assigned.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting hydro generator.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.HydroGenerator:

The newly created hydro instance.

pymdt.core.MakeHydroResource(s: Site, name: str, **kwargs) HydroResource[source]

This helper function creates a new hydro resource, extracts any provided properties, loads it into its owner, and returns it.

Parameters

s: MDT.Site

The site for which this hydro resource is being built.

name: str

The name to be given to this hydro resource. Names of hydro resources within a site must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

data: iterable of float

The data to assign to this newly created resource. The number of elements that should be in the list, if any, is determined by the period, period units, interval, and interval units of the owning load container (lc). This is only used of a stored_configuration is not provided.

stored_configuration:

Either an MDT.StoredTierLoadConfiguration or the name of one to be used as the load data for this new data object. If this is provided, then the data, period, period_units, interval, and interval_units are all taken from this configuration object and any that were provided are ignored. If a stored configuration is not to be used, then don’t provide this parameter.

period: int

The number of period_units in the period of the data of this resource. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this resource. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this resource. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this resource. The interval is the total time duration of the data set.

owner:

An optional parameter to serve as the owner of the new resource. This is typically used if one does not want the resource added to the site as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied site (s) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting hydro resource.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.HydroResource:

The newly created hydro resource instance.

pymdt.core.MakeInverter(b: Bus, name: str, **kwargs) Inverter[source]

This helper function creates a new inverter, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this inverter is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this inverter. Names of inverters within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec

The baseline specification for the new inverter. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.BatterySpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs

The list of all allowable specifications for the new inverter. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.BatterySpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner

An optional parameter to serve as the owner of the new inverter. This is typically used when the new inverter is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting inverter. This is only useful if you intend to save and open a model in the MDT GUI.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes

Any notes to assign to the resulting inverter.

Returns

MDT.Inverter:

The newly created inverter instance.

pymdt.core.MakeLine(mg: Microgrid, name: str, fn, sn, **kwargs) Line[source]

This helper function creates a new line, extracts any provided properties, loads it into its owner, and returns it.

Parameters

mg: MDT.Microgrid

The microgrid for which this line is being built. If an “owner” parameter is not provided, then this microgrid is also used as the owner.

name: str

The name to be given to this line. Names of lines within a microgrid must be unique. If the name is None, then a default name is generated using the first and second nodes.

fn

The node to which to attach the first end of this line. This parameter can be None if you wish to assign the first node at a later time.

sn

The node to which to attach the second end of this line. This parameter can be None if you wish to assign the second node at a later time.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new line. If not provided, the baseline specification is No Line. This can either be provided as an MDT.LineSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new line. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.LineSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

length: float

A value that is greater than or equal to 0 to be the length of the new line (ft).

owner:

An optional parameter to serve as the owner of the new line. This is typically used when the new line is being created for a microgrid design option in which case the MDT.MicrogridDesignOption instance should be supplied. If no owner is provided, then the supplied microgrid (mg) is used.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting line.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Line:

The newly created line instance.

pymdt.core.MakeLoadDataTier(lc: ILoadContainer, name: str, **kwargs) LoadDataWithTier[source]

This helper function creates a new load section, extracts any provided properties, loads it into its owner, and returns it.

Parameters

lc: MDT.ILoadContainer

The load container that will hold the newly created data.

name: str

The name to be given to this new load data set. Names of tier load data sets within a load container must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created data set. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

data:

A vector of double precision numbers to be the data assigned to this new tier load data set. The number of elements that should be in the list, if any, is determined by the period, period units, interval, and interval units of the owning load container (lc). This input is ignored if a stored_configuration is provided.

stored_configuration:

Either an MDT.StoredTierLoadConfiguration or the name of one to be used as the load data for this new data object if desired. If this is provided, then the data, period, period_units, interval, and interval_units are all taken from this configuration object and any that were provided are ignored. If a stored configuration is not to be used, then don’t provide this parameter.

owner:

An optional parameter to serve as the owner of the new load data. This is typically used if one does not want the load data added to the container as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied container (lc) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting load data set.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.LoadDataWithTier:

The newly created solar load data instance.

pymdt.core.MakeLoadSection(b: Bus, name: str, **kwargs) LoadSection[source]

This helper function creates a new load section, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this load section is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this load section. Names of load sections within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new load section. This is typically used when the new load section is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting load section. This is only useful if you intend to save and open a model in the MDT GUI.

period: int

The number of period_units in the period of the data of this load section. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this load section. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this load section. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this load section. The interval is the total time duration of the data set.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting load section.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.LoadSection:

The newly created solar load section instance.

pymdt.core.MakeLoadTier(name: str, priority: int, **kwargs) LoadTier[source]

This helper function creates a new load tier, extracts any provided properties, loads it into the master list, and returns it.

Parameters

name: str

The name to be given to the new load tier. Names of load tiers must be unique in the master list.

priority: int

The priority to be assigned to this new load tier. The lower the value the higher the importance. Negative numbers are not allowed.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new load tier. This is typically used if one does not want the load tier added to the driver as part of this call in which case None is specified as the owner. If no owner is provided, then the global Driver is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting load tier.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.LoadTier:

The newly created load tier instance.

pymdt.core.MakeMicrogrid(s: Site, name: str, **kwargs) Microgrid[source]

This helper function creates a new microgrid, extracts any provided properties, loads it into its owner, and returns it.

Parameters

s: MDT.Site

The site for which this microgrid is being built.

name: str

The name to be given to this microgrid. Names of microgrids within a site must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new microgrid. This is typically used if one does not want the microgrid added to the site as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied site (s) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting microgrid.

guid:

The unique identifier to use for this new microgrid. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Microgrid:

The newly created microgrid instance.

pymdt.core.MakeMicrogridDesignOption(mg: Microgrid, name: str, **kwargs) MicrogridDesignOption[source]

This helper function creates a new microgrid design option, extracts any provided properties, loads it into its owner (mg), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid into which the new design option will be installed.

name: str

The name to be given to the new design option. Names of design options within a microgrid must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new design option. This is typically used if one does not want the design option added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting design option.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.MicrogridDesignOption:

The newly created microgrid design option instance.

pymdt.core.MakeMicrogridNodeGroup(mg: Microgrid, name: str, x, y, width, height, **kwargs) MicrogridNodeGroup[source]

This helper function creates a new microgrid node group, extracts any provided properties, loads it into its owner, and returns it.

Parameters

mg: MDT.Microgrid

The microgrid for which this node group is being built.

name: str

The name to be given to this node group. Names of node groups within a microgrid must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new group. This is typically used if one does not want the group added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting node group.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Bus:

The newly created node group instance.

pymdt.core.MakeNaturalGasGenerator(b: Bus, name: str, **kwargs) NaturalGasGenerator[source]

This helper function creates a new natural gas generator, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this natural gas generator is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this natural gas generator. Names of natural gas generators within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new natural gas generator. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.NaturalGasGeneratorSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new natural gas generator. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.NaturalGasGeneratorSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new natural gas generator. This is typically used when the new natural gas generator is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting natural gas generator. This is only useful if you intend to save and open a model in the MDT GUI.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting natural gas generator.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.NaturalGasGenerator:

The newly created natural gas generator instance.

pymdt.core.MakeNode(mg: Microgrid, name: str, **kwargs) Node[source]

This helper function creates a new node, extracts any provided properties, loads it into its owner, and returns it.

Parameters

mg: MDT.Microgrid

The microgrid for which this node is being built. If an “owner” parameter is not provided, then this microgrid is also used as the owner.

name: str

The name to be given to this node. Names of nodes within a microgrid must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new node. This is typically used when the new node is being created for a microgrid design option in which case the MDT.MicrogridDesignOption instance should be supplied. If no owner is provided, then the supplied microgrid (mg) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting node. This is only useful if you intend to save and open a model in the MDT GUI.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting node.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Node:

The newly created node instance.

pymdt.core.MakePropaneGenerator(b: Bus, name: str, **kwargs) PropaneGenerator[source]

This helper function creates a new propane generator, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this propane generator is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this propane generator. Names of propane generators within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new propane generator. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.PropaneGeneratorSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new propane generator. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.PropaneGeneratorSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new propane generator. This is typically used when the new propane generator is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting propane generator. This is only useful if you intend to save and open a model in the MDT GUI.

tanks:

The list of the propane tanks to be assigned to the new propane generator. This input can be an MDT.PropaneTank instance, the name of a propane tank in which case a search will be conducted to find the correct tank in the supplied microgrid, or a list of instances and/or names. If not provided, no tanks are assigned.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting propane generator.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.PropaneGenerator:

The newly created propane generator instance.

pymdt.core.MakePropaneTank(mg: Microgrid, name: str, **kwargs) PropaneTank[source]

This helper function creates a new propane tank, extracts any provided properties, loads it into its owner, and returns it.

Parameters

mg: MDT.Microgrid

The microgrid for which this tank is being built. If an “owner” parameter is not provided, then this microgrid is also used as the owner.

name: str

The name to be given to this tank. Names of tanks within a microgrid must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new tank. If not provided, the baseline specification is No Tank. This can either be provided as an MDT.PropaneTankSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new tank. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.PropaneTankSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new tank. This is typically used when the new tank is being created for a microgrid design option in which case the MDT.MicrogridDesignOption instance should be supplied. If no owner is provided, then the supplied microgrid (mg) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting tank. This is only useful if you intend to save and open a model in the MDT GUI.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

infinite_fuel: bool

Whether or not this tank should be granted infinite fuel in the controller settings. The default is False.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting propane tank.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.PropaneTank:

The newly created propane tank instance.

pymdt.core.MakeSiteNodeGroup(s: Site, name: str, x, y, width, height, **kwargs) SiteNodeGroup[source]

This helper function creates a new site node group, extracts any provided properties, loads it into its owner, and returns it.

Parameters

s: MDT.Site

The site for which this node group is being built.

name: str

The name to be given to this node group. Names of node groups within a site must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new group. This is typically used if one does not want the group added to the site as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied site (s) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting node group.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Bus:

The newly created node group instance.

pymdt.core.MakeSolarGenerator(b: Bus, name: str, **kwargs) SolarGenerator[source]

This helper function creates a new solar generator, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this solar generator is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this solar generator. Names of solar generators within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new solar generator. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.SolarGeneratorSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new solar generator. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.SolarGeneratorSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new solar generator. This is typically used when the new solar generator is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting solar generator. This is only useful if you intend to save and open a model in the MDT GUI.

resource:

The instance or name of the solar resource to be assigned to the new solar generator. If not provided, no resource is assigned.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting solar generator.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.SolarGenerator:

The newly created solar instance.

pymdt.core.MakeSolarResource(s: Site, name: str, **kwargs) SolarResource[source]

This helper function creates a new solar resource, extracts any provided properties, loads it into its owner, and returns it.

Parameters

s: MDT.Site

The site for which this solar resource is being built.

name: str

The name to be given to this solar resource. Names of solar resources within a site must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

data: iterable of float

The data to assign to this newly created resource. This is only used of a stored_configuration is not provided.

stored_configuration:

Either an MDT.StoredTierLoadConfiguration or the name of one to be used as the load data for this new data object. If this is provided, then the data, period, period_units, interval, and interval_units are all taken from this configuration object and any that were provided are ignored. If a stored configuration is not to be used, then don’t provide this parameter.

period: int

The number of period_units in the period of the data of this resource. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this resource. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this resource. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this resource. The interval is the total time duration of the data set.

owner:

An optional parameter to serve as the owner of the new resource. This is typically used if one does not want the resource added to the site as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied site (s) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting solar resource.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.SolarResource:

The newly created solar resource instance.

pymdt.core.MakeStoredHydroDataConfiguration(name: str, **kwargs) StoredTierLoadConfiguration[source]

This helper function creates a new file containing hydro data information and makes it available for use in any models.

Parameters

name: str

The name to be given to this stored data file.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created data set. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

data: iterable of float

The data to be stored in this new stored data file.

period: int

The number of period_units in the period of the data of this new file. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this new file. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this new file. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this new file. The interval is the total time duration of the data set.

notes: str

Any notes to assign to the resulting data set.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

Returns

MDT.StoredTierLoadConfiguration:

The newly created representation of the new data file.

pymdt.core.MakeStoredLoadConfiguration(name: str, **kwargs) StoredTierLoadConfiguration[source]

This helper function creates a new file containing load data information and makes it available for use in any models.

Parameters

name: str

The name to be given to this stored data file.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created data set. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

data: iterable of float

The data to be stored in this new stored data file.

period: int

The number of period_units in the period of the data of this new file. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this new file. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this new file. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this new file. The interval is the total time duration of the data set.

notes: str

Any notes to assign to the resulting data set.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

Returns

MDT.StoredTierLoadConfiguration:

The newly created representation of the new data file.

pymdt.core.MakeStoredSolarDataConfiguration(name: str, **kwargs) StoredTierLoadConfiguration[source]

This helper function creates a new file containing solar data information and makes it available for use in any models.

Parameters

name: str

The name to be given to this stored data file.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created data set. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

data: iterable of float

The data to be stored in this new stored data file.

period: int

The number of period_units in the period of the data of this new file. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this new file. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this new file. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this new file. The interval is the total time duration of the data set.

notes: str

Any notes to assign to the resulting data set.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

Returns

MDT.StoredTierLoadConfiguration:

The newly created representation of the new data file.

pymdt.core.MakeStoredThermalDataConfiguration(name: str, **kwargs) StoredTierLoadConfiguration[source]

This helper function creates a new file containing thermal data information and makes it available for use in any models.

Parameters

name: str

The name to be given to this stored data file.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created data set. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

data: iterable of float

The data to be stored in this new stored data file.

period: int

The number of period_units in the period of the data of this new file. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this new file. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this new file. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this new file. The interval is the total time duration of the data set.

notes: str

Any notes to assign to the resulting data set.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

Returns

MDT.StoredTierLoadConfiguration:

The newly created representation of the new data file.

pymdt.core.MakeStoredWindDataConfiguration(name: str, **kwargs) StoredTierLoadConfiguration[source]

This helper function creates a new file containing wind data information and makes it available for use in any models.

Parameters

name: str

The name to be given to this stored data file.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created data set. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

data: iterable of float

The data to be stored in this new stored data file.

period: int

The number of period_units in the period of the data of this new file. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this new file. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this new file. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this new file. The interval is the total time duration of the data set.

notes: str

Any notes to assign to the resulting data set.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

Returns

MDT.StoredTierLoadConfiguration:

The newly created representation of the new data file.

pymdt.core.MakeSwitch(mg: Microgrid, name: str, **kwargs) Switch[source]

This helper function creates a new switch, extracts any provided properties, loads it into its owner, and returns it.

Parameters

mg: MDT.Microgrid

The microgrid for which this switch is being built. If an “owner” parameter is not provided, then this microgrid is also used as the owner.

name: str

The name to be given to this switch. Names of switches within a microgrid must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new switch. If not provided, the baseline specification is No Switch. This can either be provided as an MDT.SwitchSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new switch. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.SwitchSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new switch. This is typically used when the new switch is being created for a microgrid design option in which case the MDT.MicrogridDesignOption instance should be supplied. If no owner is provided, then the supplied microgrid (mg) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting switch. This is only useful if you intend to save and open a model in the MDT GUI.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting switch.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Switch:

The newly created switch instance.

pymdt.core.MakeTransformer(mg: Microgrid, name: str, **kwargs) Transformer[source]

This helper function creates a new transformer, extracts any provided properties, loads it into its owner, and returns it.

Parameters

mg: MDT.Microgrid

The microgrid for which this transformer is being built. If an “owner” parameter is not provided, then this microgrid is also used as the owner.

name: str

The name to be given to this transformer. Names of transformers within a microgrid must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new transformer. If not provided, the baseline specification is No Transformer. This can either be provided as an MDT.TransformerSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new transformer. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.TransformerSpecification object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new transformer. This is typically used when the new transformer is being created for a microgrid design option in which case the MDT.MicrogridDesignOption instance should be supplied. If no owner is provided, then the supplied microgrid (mg) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting transformer. This is only useful if you intend to save and open a model in the MDT GUI.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting transformer.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Transformer:

The newly created transformer instance.

pymdt.core.MakeUPS(b: Bus, name: str, **kwargs) UninterruptiblePowerSupply[source]

This helper function creates a new UPS, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this UPS is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this UPS. Names of UPSs within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new UPS. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.UPSSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new UPS. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.UPSSpec object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new UPS. This is typically used when the new UPS is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

load_section: MDT.LoadSection

The load section to which this UPS is assigned and to which it will provide power when/if necessary.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting UPS. This is only useful if you intend to save and open a model in the MDT GUI.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting UPS.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.UninterruptiblePowerSupply:

The newly created UPS instance.

pymdt.core.MakeWindGenerator(b: Bus, name: str, **kwargs) WindGenerator[source]

This helper function creates a new wind generator, extracts any provided properties, loads it into its owner, and returns it.

Parameters

b: MDT.Bus

The bus for which this wind generator is being built. If an “owner” parameter is not provided, then this bus is also used as the owner.

name: str

The name to be given to this wind generator. Names of wind generators within a bus must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

base_spec:

The baseline specification for the new wind generator. If not provided, the baseline specification is No Generator. This can either be provided as an MDT.WindGeneratorSpec object or as the name of the specification in which case a search will be conducted to find and assign the correct spec in the master list.

specs:

The list of all allowable specifications for the new wind generator. This can be provided as a single entity or a list of entities. Each entity can either be provided as an MDT.WindGeneratorSpecification object or as the name of the specification to use in which case a search of the master list will be conducted to find and assign the correct spec.

owner:

An optional parameter to serve as the owner of the new wind generator. This is typically used when the new wind generator is being created for a microgrid design option in which case the MDT.BusDesignOption made for the microgrid design option instance should be supplied. If no owner is provided, then the supplied bus (b) is used.

loc: tuple[float,float]

An optional parameter to set the x,y diagram location for the resulting wind generator. This is only useful if you intend to save and open a model in the MDT GUI.

resource:

The instance or name of the wind resource to be assigned to the new wind generator. If not provided, no resource is assigned.

retrofit_cost: float

The cost, if any, to keep the baseline specification in a solution. If not supplied, the value defaults to $0.

failure_modes:

A list of all defined failure modes for the resulting component, if any. The elements of the list are of type MDT.FailureMode.

fragilities:

A dictionary in which the keys are hazards and the values are fragility curves for those hazards. Each entry in the dictionary results in a fragility for the new component.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting wind generator.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.WindGenerator:

The newly created wind instance.

pymdt.core.MakeWindResource(s: Site, name: str, **kwargs) WindResource[source]

This helper function creates a new wind resource, extracts any provided properties, loads it into its owner, and returns it.

Parameters

s: MDT.Site

The site for which this wind resource is being built.

name: str

The name to be given to this wind resource. Names of wind resources within a site must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

data: iterable of float

The data to assign to this newly created resource. This is only used of a stored_configuration is not provided.

stored_configuration:

Either an MDT.StoredTierLoadConfiguration or the name of one to be used as the load data for this new data object. If this is provided, then the data, period, period_units, interval, and interval_units are all taken from this configuration object and any that were provided are ignored. If a stored configuration is not to be used, then don’t provide this parameter.

period: int

The number of period_units in the period of the data of this resource. The period is the time duration between data points.

period_units: Common.Time.TimeAccumulation.Units

The units of the period for the data of this resource. The period is the time duration between data points.

interval: int

The number of interval_units in the interval of the data of this resource. The interval is the total time duration of the data set.

interval_units: Common.Time.TimeAccumulation.Units

The units of the interval for the data of this resource. The interval is the total time duration of the data set.

owner:

An optional parameter to serve as the owner of the new resource. This is typically used if one does not want the resource added to the site as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied site (s) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting wind resource.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.WindResource:

The newly created wind resource instance.

pymdt.core.ResetRegularPeriodData(rpd: IRegularPeriodData, dataset, **kwargs)[source]

Assigns the data in the supplied data set (data) to the supplied regular period data instance.

Parameters

rpd: MDT.IRegularPeriodData

The MDT data structure to load using the items in the second argument.

data: iterable

A collection of the values that should be pushed into the MDT data construct. The items in this list must be float or convertible to float.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

pymdt.core.SetDieselInfiniteFuel(tank: DieselTank, infinite: bool = True, **kwargs)[source]

Assigns infinite fuel to the supplied tank or not depending on the value of the infinite parameter.

Parameters

tank: MDT.DieselTank

The tank to assign to have infinite fuel capacity or not.

infinite: bool

Whether or not the supplied tank should have infinite fuel capacity.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

pymdt.core.SetPropaneInfiniteFuel(tank: PropaneTank, infinite: bool = True, **kwargs)[source]

Assigns infinite fuel to the supplied tank or not depending on the value of the infinite parameter.

Parameters

tank: MDT.PropaneTank

The tank to assign to have infinite fuel capacity or not.

infinite: bool

Whether or not the supplied tank should have infinite fuel capacity.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

class pymdt.core.controller_types(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the types of microgrid controller available for selection.

CycleCharging = <ControllerTypeEnum.BatteryUser: 1>

The CycleCharging controller uses batteries aggressively in an attempt to shave peaks and minimize diesel fuel usage.

Standard = <ControllerTypeEnum.Standard: 0>

The Standard controller uses batteries as an energy source of last resort.

class pymdt.core.powerflow_types(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the possible powerflow calculations supported by the MDT.

DC = <PowerflowTypeEnum.DC: 1>

Indicates that DC powerflow calculations should be conducted.

NONE = <PowerflowTypeEnum.None: 0>

Indicates that no powerflow calculations should be conducted.

pymdt.distributions module

pymdt.distributions.MakeBernoulli(success_fraction: float = 0.5) Bernoulli[source]

Creates, configures, and returns a new instance of a Bernoulli distribution using the supplied parameters.

Parameters

success_fraction: float

The success fraction value of the new Bernoulli distribution.

Returns

Common.Distributions.Bernoulli:

The newly created and configured Bernoulli distribution.

pymdt.distributions.MakeBinomial(trials: float = 1.0, success_fraction: float = 0.5) Binomial[source]

Creates, configures, and returns a new instance of a Binomial distribution using the supplied parameters.

Parameters

trials: float

The trials value of the new Binomial distribution.

success_fraction: float

The success fraction value of the new Binomial distribution.

Returns

Common.Distributions.Binomial:

The newly created and configured Binomial distribution.

pymdt.distributions.MakeCauchy(location: float = 0.0, scale: float = 1.0) Cauchy[source]

Creates, configures, and returns a new instance of a Cauchy distribution using the supplied parameters.

Parameters

location: float

The location value of the new Cauchy distribution.

scale: float

The scale value of the new Cauchy distribution.

Returns

Common.Distributions.Cauchy:

The newly created and configured Cauchy distribution.

pymdt.distributions.MakeDiscrete(entries) Discrete[source]

Creates, configures, and returns a new instance of a Discrete distribution using the supplied parameters.

Parameters

entries

Can be a 2-tuple of a singular entry (value, probability) or a dictionary of multiple entries of the form {value1: probability1, …}.

Returns

MDT.Discrete:

The newly created and configured Discrete distribution.

pymdt.distributions.MakeExponential(mean: float, location: float = 0.0) Exponential[source]

Creates, configures, and returns a new instance of an Exponential distribution using the supplied parameters.

Parameters

mean: float

The mean of the new exponential distribution which is the inverse of the more common “lambda” parameter.

location: float

An optional parameter that shifts the distribution along the x-axis.

Returns

Common.Distributions.Exponential:

The newly created and configured Exponential distribution.

pymdt.distributions.MakeFixed(value: float = 0.0) Fixed[source]

Creates, configures, and returns a new instance of a Fixed distribution using the supplied parameters.

Parameters

value: float

The fixed value of the new Fixed distribution.

Returns

Common.Distributions.Fixed:

The newly created and configured Fixed distribution.

pymdt.distributions.MakeGamma(shape: float, scale: float = 1.0) Gamma[source]

Creates, configures, and returns a new instance of a Gamma distribution using the supplied parameters.

Parameters

shape: float

The shape value of the new Gamma distribution.

scale: float

The scale value of the new Gamma distribution.

Returns

Common.Distributions.Gamma:

The newly created and configured Gamma distribution.

pymdt.distributions.MakeLogNormal(location: float = 0.0, scale: float = 1.0) LogNormal[source]

Creates, configures, and returns a new instance of a LogNormal distribution using the supplied parameters.

Parameters

location: float

The location value of the new LogNormal distribution. This is equivalent to the mean of the logarithm of the random variable.

scale: float

The scale value of the new LogNormal distribution. This is equivalent to the standard deviation of the logarithm of the random variable.

Returns

Common.Distributions.LogNormal:

The newly created and configured LogNormal distribution.

pymdt.distributions.MakeNormal(mean: float = 0.0, std_dev: float = 1.0) Normal[source]

Creates, configures, and returns a new instance of a Normal distribution using the supplied parameters.

Parameters

mean: float

The mean of the new Normal distribution.

std_dev: float

The standard deviation of the newly created Normal distribution.

Returns

Common.Distributions.Normal:

The newly created and configured Normal distribution.

pymdt.distributions.MakePlacement(init_dist: IDistribution, subseq_dist: IDistribution) PlacementDistribution[source]

Creates, configures, and returns a new instance of a Placement distribution using the supplied parameters.

Parameters

init_dist: CD.IDistribution

The distribution used to draw the first value produced.

subseq_dist: CD.IDistribution

The distribution used to draw all subsequent values produced.

Returns

MDT.PlacementDistribution:

The newly created and configured Placement distribution.

pymdt.distributions.MakePoisson(mean: float = 1.0) Poisson[source]

Creates, configures, and returns a new instance of a Poisson distribution using the supplied parameters.

Parameters

mean: float

The mean value of the new Poisson distribution.

Returns

Common.Distributions.Poisson:

The newly created and configured Poisson distribution.

pymdt.distributions.MakeTimeOfYearBiased(basis_dist: IDistribution, time_of_year_dist: IDistribution) TimeOfYearBiasDistribution[source]

Creates, configures, and returns a new instance of a Time-of-Year Biased distribution using the supplied parameters.

Parameters

basis_dist: CD.IDistribution

The distribution used to draw number of years between occurrences.

time_of_year_dist: CD.IDistribution

The distribution used to draw the time of year of the occurrence in hours.

Returns

MDT.TimeOfYearBiasDistribution:

The newly created and configured Time-of-Year Biased distribution.

pymdt.distributions.MakeTriangular(lower: float = -1.0, mode: float = 0.0, upper: float = 1.0) Triangular[source]

Creates, configures, and returns a new instance of a Triangular distribution using the supplied parameters.

Parameters

lower: float

The lower value of the new Triangular distribution.

mode: float

The mode of the new Triangular distribution.

upper: float

The upper value of the new Triangular distribution.

Returns

Common.Distributions.Triangular:

The newly created and configured Triangular distribution.

pymdt.distributions.MakeUniform(lower: float = 0.0, upper: float = 1.0) Uniform[source]

Creates, configures, and returns a new instance of a Uniform distribution using the supplied parameters.

Parameters

lower: float

The lower value of the new Uniform distribution.

upper: float

The upper value of the new Uniform distribution.

Returns

Common.Distributions.Uniform:

The newly created and configured Uniform distribution.

pymdt.io module

class pymdt.io.ImportFormats[source]

Bases: object

A class used to organize the import file formats that can be used to read files from other applications.

MDTProject = <Common.Serialization.FileFormat object>

The project files created by the MDT that include any external data packaged in. (*.mpf)

OpenDSS = <Common.Serialization.FileFormat object>

The OpenDSS file format. (*.dss)

ReNCAT = <Common.Serialization.FileFormat object>

The JSON format exported from a ReNCAT model. (*.json)

Windmill = <Common.Serialization.FileFormat object>

The text format exported from a Windmill model. (*.txt)

pymdt.io.ImportInputFile(file_name, format=None, errLog: Log = None) Log[source]

Imports the file with the supplied name and loads MDT inputs from it.

It is possible that multiple file types can be associated with the same file extension. For example, several applications store their inputs in JSON files with a .json extension. To disambiguate, you can provide an instance of one of the constants in the ImportFormats class as the format argument.

There are a few file types that the MDT is able to import. Examples include

MDT Project Files (.mpf) OpenDSS Files (.dss) ReNCAT JSON Files (.json) Windmill Export Files (.txt)

Parameters

file_name: str

The name of the file from which to read the inputs. The extension of the provided name will determine the importer used unless a valid format argument is provided.

format

An optional identifier of the file format intended. If provided, this will take precedence over the extension of the file name. This should be one of the members of the ImportFormats class defined in this module.

errLog: Common.Logging.Log

An optional log into which to merge any messages resulting from the import operation.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

Returns

Common.Logging.Log:

A log of any and all messages produced during the import operation and any that may have been in the provided errLog argument. If the provided errLog was None, the return will be a newly created log with only those messages created during the import.

pymdt.io.ReadInputFile(file_name, errLog: Log = None, **kwargs) Log[source]

Reads the file with the supplied name and loads MDT inputs from it.

Parameters

file_name: str

The name of the file from which to read the inputs. The provided name should have a “.mbf” extension.

errLog: Common.Logging.Log

An optional log into which to merge any messages resulting from the load operation.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

make_backup: bool

Whether or not to write a backup file if the loaded file is from an older version of the MDT. The default is False.

Returns

Common.Logging.Log:

A log of any and all messages produced during the load operation and any that may have been in the provided errLog argument. If the provided errLog was None, the return will be a newly created log with only those messages created during the load.

pymdt.io.WriteInputFile(file_name, errLog: Log = None) Log[source]

Writes the current MDT inputs to a file with the supplied name.

Parameters

file_name: str

The name of the file into which to write the inputs. The provided name should have a “.mbf” extension.

errLog: Common.Logging.Log

An optional log into which to merge any messages resulting from the save operation.

Returns

Common.Logging.Log:

A log of any and all messages produced during the save operation. No matter whether an errLog is provided as a parameter to the method, the returned log will only contain those messages produced during the save operation.

pymdt.io.WriteOutputFile(file_name: str, sri, errLog: Log = None) Log[source]

Writes an MDT results file for the provided solver run info object to a file with the supplied name.

Parameters

file_name: str

The name of the file into which to write the results. The provided name have a “.mof” extension.

sri

The result set or sets to be written to the file. This can be a collection of MDT.SolverRunInfo or just a single instance thereof.

errLog: Common.Logging.Log

An optional log into which to merge any messages resulting from the save operation.

Returns

Common.Logging.Log:

A log of any and all messages produced during the save operation. No matter whether an errLog is provided as a parameter to the method, the returned log will only contain those messages produced during the save operation.

pymdt.metrics module

pymdt.metrics.MakeAverageEnergySuppliedByRenewablesMetric(mg: Microgrid, name: str, **kwargs) AverageEnergySuppliedByRenewables[source]

Builds an instance of the MDT.AverageEnergySuppliedByRenewables class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeAverageRenewableEnergySpilledMetric(mg: Microgrid, name: str, **kwargs) AverageRenewableEnergySpilledConstraint[source]

Builds an instance of the MDT.AverageRenewableEnergySpilledConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeAverageRenewablePenetrationMetric(mg: Microgrid, name: str, **kwargs) AverageRenewablePenetrationConstraint[source]

Builds an instance of the MDT.AverageRenewablePenetrationConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeAverageSpinningReserveMetric(mg: Microgrid, name: str, **kwargs) AverageSpinningReserveConstraint[source]

Builds an instance of the MDT.AverageSpinningReserveConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeDieselEfficiencyMetric(mg: Microgrid, name: str, **kwargs) DieselEfficiencyConstraint[source]

Builds an instance of the MDT.DieselEfficiencyConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeDieselFuelCostMetric(mg: Microgrid, name: str, **kwargs) DieselFuelCostConstraint[source]

Builds an instance of the MDT.DieselFuelCostConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeDieselFuelMetric(mg: Microgrid, name: str, **kwargs) DieselFuelConstraint[source]

Builds an instance of the MDT.DieselFuelConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeDieselUtilizationRateMetric(mg: Microgrid, name: str, **kwargs) DieselUtilizationConstraint[source]

Builds an instance of the MDT.DieselUtilizationConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeEnergyAvailabilityMetric(mg: Microgrid, name: str, **kwargs) EnergyAvailabilityConstraint[source]

Builds an instance of the MDT.EnergyAvailabilityConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created metric. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

phase: pymdt.metrics.sim_phases

This parameter should be a member of the pymdt.metrics.sim_phases enumeration. This indicates what phase of the simulation the new metric should be applied to. See the enumeration for details.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeFossilOffTimePercentageMetric(mg: Microgrid, name: str, **kwargs) FossilOffTimePercentageConstraint[source]

Builds an instance of the MDT.FossilOffTimePercentageConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeFrequencyOfLoadNotServedMetric(mg: Microgrid, name: str, **kwargs) FreqOfLNSConstraint[source]

Builds an instance of the MDT.FreqOfLNSConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created metric. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

phase: pymdt.metrics.sim_phases

This parameter should be a member of the pymdt.metrics.sim_phases enumeration. This indicates what phase of the simulation the new metric should be applied to. See the enumeration for details.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeHeatRecoveryMetric(mg: Microgrid, name: str, **kwargs) HeatRecoveryConstraint[source]

Builds an instance of the MDT.HeatRecoveryConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeMagnitudeOfLoadNotServedMetric(mg: Microgrid, name: str, **kwargs) MagOfLNSConstraint[source]

Builds an instance of the MDT.MagOfLNSConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

tier:

The tier for this newly created metric. This can be an MDT.LoadTier or the name of a tier in which case the actual load tier will be found in the master list and assigned.

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

phase: pymdt.metrics.sim_phases

This parameter should be a member of the pymdt.metrics.sim_phases enumeration. This indicates what phase of the simulation the new metric should be applied to. See the enumeration for details.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeMaximumMissionOutageDurationMetric(mg: Microgrid, name: str, **kwargs) MaximumMissionOutageDurationConstraint[source]

Builds an instance of the MDT.MaximumMissionOutageDurationConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

mission: MDT.Mission

The mission whose outage duration is to be tracked.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeNaturalGasEfficiencyMetric(mg: Microgrid, name: str, **kwargs) NaturalGasEfficiencyConstraint[source]

Builds an instance of the MDT.NaturalGasEfficiencyConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeNaturalGasFuelCostMetric(mg: Microgrid, name: str, **kwargs) NaturalGasFuelCostConstraint[source]

Builds an instance of the MDT.NaturalGasFuelCostConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeNaturalGasFuelMetric(mg: Microgrid, name: str, **kwargs) NaturalGasFuelConstraint[source]

Builds an instance of the MDT.NaturalGasFuelConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeNaturalGasUtilizationRateMetric(mg: Microgrid, name: str, **kwargs) NaturalGasUtilizationConstraint[source]

Builds an instance of the MDT.NaturalGasUtilizationConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakePropaneEfficiencyMetric(mg: Microgrid, name: str, **kwargs) PropaneEfficiencyConstraint[source]

Builds an instance of the MDT.PropaneEfficiencyConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakePropaneFuelCostMetric(mg: Microgrid, name: str, **kwargs) PropaneFuelCostConstraint[source]

Builds an instance of the MDT.PropaneFuelCostConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakePropaneFuelMetric(mg: Microgrid, name: str, **kwargs) PropaneFuelConstraint[source]

Builds an instance of the MDT.PropaneFuelConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakePropaneUtilizationRateMetric(mg: Microgrid, name: str, **kwargs) PropaneUtilizationConstraint[source]

Builds an instance of the MDT.PropaneUtilizationConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is maximize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeResponseFunctionGroup(s: SolverInterface, name: str, metrics, **kwargs) ResponseFunctionGroup[source]

Builds an instance of a TMO.ResponseFunctionGroup class, loads its properties, adds it to the solver (if provided), and returns it.

Parameters

s: TMO.SolverInterface

The solver to which to add the new group. If this argument is None, then the group is created and loaded but not added to any solvers group list. That will have to happen later.

name: str

The name for the new response function group. This must be unique within the supplied solver.

metrics: collection of TMO.Constraint

The list of metrics to be included in this group. Additional metrics can be added directly to the group afterwards if desired.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new group. This is typically used if one does not want the group added to the solver as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied solver (s) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

pymdt.metrics.MakeTotalFuelCostMetric(mg: Microgrid, name: str, **kwargs) TotalFuelCostConstraint[source]

Builds an instance of the MDT.TotalFuelCostConstraint class, loads its properties, adds it to the microgrid (if provided), and returns it.

Parameters

mg: MDT.Microgrid

The microgrid to which to add the new metric. If this argument is None, then the metric is created and loaded but not added to any entities metric list. That will have to happen later.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

improvement_type: pymdt.metrics.improvement_types

A member of the pymdt.metrics.improvement_types enumeration indicating the desired improvement direction of the new metric. The default improvement type for this metric type is minimize.

limit: float

The worst acceptable value for this metric. This defines the boundary between acceptable and not acceptable. This is required.

objective: float

The desired value for this metric. This is a value that, if achieved, provides full satisfaction. Achieving values better than the objective may still provide benefit but at a diminishing rate of return. This is required.

limit_stiffness: pymdt.metrics.limit_stiffnesses

A member of the pymdt.metrics.limit_stiffnesses enumeration indicating the desired strength of the limit for the new metric. The default stiffness for this metric type is medium.

relative_importance: float

The desired weight of this metric in trade-offs that occur. It is advised that you not use this parameter unless absolutely necessary. Instead, the limit and objective values should be the primary means by which a metric is valued. Using the relative_importance may not provide the results expected. The default value for this is 1.0.

value_beyond_objective: pymdt.metrics.value_beyond_objective

A member of the pymdt.metrics.value_beyond_objective enumeration, this parameter controls the rate of diminishing returns for exceeding (doing better than) the objective for a configuration. the lower the VBO, the faster the rate of diminishing returns. The default for this is medium.

owner:

An optional parameter to serve as the owner of the new metric. This is typically used if one does not want the metric added to the microgrid as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied microgrid (mg) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting metric. Not required.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

class pymdt.metrics.improvement_types(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the improvement types used for metrics.

maximize = <ImprovementType.MAXIMIZE: 1>

The metric is to be maximized (higher is better).

minimize = <ImprovementType.MINIMIZE: 0>

The metric is to be minimized (lower is better).

seek_value = <ImprovementType.SEEK_VALUE: 2>

The specified value is sought (value is better).

class pymdt.metrics.limit_stiffnesses(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the stiffness indicator used for metrics.

maximize = <StiffnessLevel.Medium: 1>

The limit is such that violation is bad and causes a significant detriment to fitness.

minimize = <StiffnessLevel.Soft: 0>

The limit is such that violation is bad but not a really big deal.

seek_value = <StiffnessLevel.Hard: 2>

The limit is such that violation is very bad and causes a major detriment to fitness. In addition, this limit is treated as a hard constraint by the optimizer such that its satisfaction is paramount when comparing solution quality amongst candidate solutions.

class pymdt.metrics.sim_phases(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the different phases of simulation over which metrics may be calculated.

n_a = <PHASE_ENUM.N_A: 3>

Used in limited circumstances when it is appropriate to indicate that a simulation phase need or should not be provided.

overall = <PHASE_ENUM.OVERALL: 2>

The period of simulation that begins at the onset of the DBT and ends when the DBT ends. This includes startup and microgrid operations phases but excludes any periods of grid-tied operation.

post_startup = <PHASE_ENUM.POST_STARTUP: 0>

The period of simulation that begins when the startup phase ends and ends when the DBT ends. This excludes the startup phase and any periods of grid-tied operation.

startup = <PHASE_ENUM.STARTUP: 1>

The period of simulation that begins at the onset of the DBT and ends when the Microgrid is ready to begin networked operation. This excludes the startup phase and any periods of grid-tied operation.

class pymdt.metrics.value_beyond_objective(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the value beyond objective indicator used for metrics.

high = <ValueBeyondObjective.High: 0>

Indicates that the rate if diminishing returns is low and therefore the value of exceeding the objective is high.

low = <ValueBeyondObjective.Low: 2>

Indicates that the rate if diminishing returns is high and therefore the value of exceeding the objective is low.

medium = <ValueBeyondObjective.Medium: 1>

Indicates that the rate if diminishing returns is moderate and therefore the value of exceeding the objective is moderate.

pymdt.missions module

pymdt.missions.MakeAndNode(parent, children, **kwargs) AndNode[source]

This helper function creates a new and node, extracts any provided properties, loads it into its parent, and returns it.

Parameters

parent

The parent node of the new and node being created. This can be a mission function or another node such as an and, or, or M of N node.

children

The nodes to include as children in this new and node. This can be an empty collection if desired as children can be added subsequently.

kwargs: dict

A dictionary of all the variable arguments provided to this function. This function does not use any keyword arguments.

Returns

TMO.AndNode:

The newly created and node instance.

pymdt.missions.MakeMission(s: Site, name: str, **kwargs) Mission[source]

This helper function creates a new mission, extracts any provided properties, loads it into its owner, and returns it.

Parameters

s: MDT.Site

The site for which this mission is being built.

name: str

The name to be given to this mission. Names of missions within a site must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new mission. This is typically used if one does not want the mission added to the site as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied site (s) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting mission.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.Mission:

The newly created mission instance.

pymdt.missions.MakeMissionFunction(s: Site, name: str, **kwargs) MissionFunction[source]

This helper function creates a new mission function, extracts any provided properties, loads it into its owner, and returns it.

Parameters

s: MDT.Site

The site for which this mission function is being built.

name: str

The name to be given to this mission function. Names of mission functions within a site must be unique.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

owner:

An optional parameter to serve as the owner of the new mission function. This is typically used if one does not want the mission function added to the site as part of this call in which case None is specified as the owner. If no owner is provided, then the supplied site (s) is used.

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new item. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting mission function.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.MissionFunction:

The newly created mission function instance.

pymdt.missions.MakeMofNNode(parent, children, m: int, **kwargs) MofNNode[source]

This helper function creates a new M of N node, extracts any provided properties, loads it into its parent, and returns it.

Parameters

parent

The parent node of the new M of N node being created. This can be a mission function or another node such as an and, or, or M of N node.

children

The nodes to include as children in this new M of N node. This can be an empty collection if desired as children can be added subsequently.

kwargs: dict

A dictionary of all the variable arguments provided to this function. This function does not use any keyword arguments.

Returns

TMO.MofNNode:

The newly created M of N node instance.

pymdt.missions.MakeNotNode(parent, child, **kwargs) NotNode[source]

This helper function creates a new not node, extracts any provided properties, loads it into its parent, and returns it.

Parameters

parent

The parent node of the new not node being created. This can be a mission function or another node such as an and, or, or M of N node.

child

The node to include as the children in this new not node. This can be none if desired as the child can be added subsequently.

kwargs: dict

A dictionary of all the variable arguments provided to this function. This function does not use any keyword arguments.

Returns

TMO.NotNode:

The newly created not node instance.

pymdt.missions.MakeOrNode(parent, children, **kwargs) OrNode[source]

This helper function creates a new or node, extracts any provided properties, loads it into its parent, and returns it.

Parameters

parent

The parent node of the new or node being created. This can be a mission function or another node such as an and, or, or M of N node.

children

The nodes to include as children in this new or node. This can be an empty collection if desired as children can be added subsequently.

kwargs: dict

A dictionary of all the variable arguments provided to this function. This function does not use any keyword arguments.

Returns

TMO.OrNode:

The newly created or node instance.

pymdt.results module

pymdt.results.FindCorrespondingAsset(asset, within)[source]
pymdt.results.FindCorrespondingAssetFromConfig(asset, inConfig: SiteUpgradeConfiguration)[source]
pymdt.results.FindCorrespondingAssetFromRunInfo(asset, inSRI: SolverRunInfo)[source]
pymdt.results.FindCorrespondingAssetFromSite(asset, inSite: Site)[source]
pymdt.results.FindCorrespondingBus(b: Bus, within) Bus[source]
pymdt.results.FindCorrespondingBusFromConfig(b: Bus, inConfig: SiteUpgradeConfiguration) Bus[source]
pymdt.results.FindCorrespondingBusFromRunInfo(b: Bus, inSRI: SolverRunInfo) Bus[source]
pymdt.results.FindCorrespondingBusFromSite(b: Bus, inSite: Site) Bus[source]
pymdt.results.FindCorrespondingMicrogrid(mg: Microgrid, within) Microgrid[source]
pymdt.results.FindCorrespondingMicrogridFromConfig(mg: Microgrid, inConfig: SiteUpgradeConfiguration) Microgrid[source]
pymdt.results.FindCorrespondingMicrogridFromRunInfo(mg: Microgrid, inSRI: SolverRunInfo) Microgrid[source]
pymdt.results.FindCorrespondingMicrogridFromSite(mg: Microgrid, inSite: Site) Microgrid[source]
pymdt.results.FindCorrespondingSite(s: Site, within) Site[source]
pymdt.results.FindCorrespondingSiteFromConfig(s: Site, inConfig: SiteUpgradeConfiguration) Site[source]
pymdt.results.FindCorrespondingSiteFromRunInfo(s: Site, inSRI: SolverRunInfo) Site[source]
pymdt.results.FindCorrespondingSiteFromSite(s: Site, inSite: Site) Microgrid[source]
pymdt.results.GetFinalSolutionSet(sri: SolverRunInfo) IterationData[source]

One can use the .Configurations property of the returned IterationData object to access an iterable collection of the actual SiteUpgradeConfiguration objects.

pymdt.results.GetMicrogridRealization(mg: Microgrid, config: SiteUpgradeConfiguration) MicrogridRealization[source]

Extracts and returns the MDT.MicrogridRealization for the specified Microgrid (mg) from the specified upgrade configuration.

The supplied microgrid must be one extracted from a result set as opposed to one created as part of an input set. See the FindCorrespondingMicrogridFromRunInfo or similar function in this module for more information.

Parameters

mg: MDT.Microgrid

The microgrid for which the realization is sought.

config: MDT.SiteUpgradeConfiguration

The site configuration from which to attempt to extract a realization for the supplied Microgrid.

Returns

MDT.MicrogridRealization:

The found realization if one. None otherwise.

pymdt.results.GetResponseFunctionGroups(sri: SolverRunInfo) IKeyedCollectionWithUndo[Guid, ResponseFunctionGroup][source]

Extracts and returns the collection of TMO.ResponseFunctionGroup objects used in the creation of the results in sri.

Parameters

sri: TMO.SolverRunInfo

The solver run information object that contains results. These results were generated for a set of response function groups. Those groups are extracted from this object.

Returns

Common.Databinding.IKeyedCollectionWithUndo[System.Guid, TMO.ResponseFunctionGroup]:

The collection of response function groups found. None otherwise.

pymdt.results.GetResultManagers() IKeyedCollectionWithUndo[Guid, ResultViewManager][source]
pymdt.results.GetVariableSelections(config: SiteUpgradeConfiguration)[source]
pymdt.results.MakeResultManager(sri) ResultViewManager[source]

pymdt.solving module

pymdt.solving.MakeParameterStudySolver(psConfig: ParameterStudyConfig, **kwargs) ParameterStudySolver[source]
pymdt.solving.RunIslandedSolver() tuple[SolverRunInfo, Log][source]

pymdt.specs module

pymdt.specs.MakeBatterySpecification(name: str, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) BatterySpec[source]

This helper function creates a new BatterySpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capital_cost: float

The cost for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

charge_efficiencies: [float]

A list of 5 charging efficiency values, 1 each for this battery at 0%, 25%, 50%, 75%, and 100% state of charge. The units of efficiency are fraction (0.0-1.0).

discharge_efficiencies: [float]

A list of 5 discharging efficiency values, 1 each for this battery at 0%, 25%, 50%, 75%, and 100% state of charge. The units of efficiency are fraction (0.0-1.0).

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

max_charge_rate: float

The maximum rate at which power can be pushed into the battery in kW.

max_discharge_rate: float

The maximum rate at which power can be extracted from the battery in kW.

energy_capacity: float

The maximum number of kWh that can be stored in this battery (at 100% state of charge).

min_state_of_charge: float

The minimum allowable state of charge of the battery in %. The default is 10%.

max_state_of_charge: float

The maximum allowable state of charge of the battery in %. The default is 90%.

desired_state_of_charge: float

The desired state of charge of the battery in %. The default is 70%.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.BatterySpec:

The newly created specification instance.

pymdt.specs.MakeDieselGeneratorSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) DieselGeneratorSpec[source]

This helper function creates a new DieselGeneratorSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The maximum output power this generator can produce (in kW).

capital_cost: float

The cost for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

efficiencies: [float]

A list of 5 efficiency values, 1 each for this generator running at 0% (idle), 25%, 50%, 75%, and 100% running rate. The units of efficiency are fraction (0.0-1.0).

fuel_usages: [float]

A list of 5 fuel use values, 1 each for this generator running at 0% (idle), 25%, 50%, 75%, and 100% running rate. The units of efficiency during idling are gallons per hour. The units of the other rates is gallon per kW per hour.

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

start_probabilities: [float]

A list of 1 or more startup probability values as fractions (0.0-1.0). The first is the likelihood of a generator starting on the first attempt. Each subsequent value corresponds to the likelihood of the generator starting on subsequent attempts. The number of items in the list defines the maximum number of start attempts allowed before the generator is considered to have suffered startup failure.

startup_mttr: Common.Distributions.IDistribution

The distribution used to determine the time required to repair a startup failure for this generator. If no startup MTTR distribution is provided, then the generator cannot be repaired during the DBT occurrence.

startup_time: float

The amount of time required to start this generator and warm it up to the point that it can begin to carry load in hours.

recoverable_heat_rate: float

An indicator of how much heat energy can be extracted from this generator as a function of it’s electrical output as a fraction (0.0-1.0). The fraction represents the number of kWh of heat per kWh of electrical energy that can be extracted.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.DieselGeneratorSpec:

The newly created specification instance.

pymdt.specs.MakeDieselTankSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) DieselTankSpec[source]

This helper function creates a new DieselTankSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The capacity of this tank to hold fuel (in gallons).

capital_cost: float

The cost for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.DieselTankSpec:

The newly created specification instance.

pymdt.specs.MakeHydroGeneratorSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) HydroGeneratorSpec[source]

This helper function creates a new HydroGeneratorSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The maximum output power this generator can produce (in kW).

capital_cost: float

The cost per foot for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs/ft of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

failure_modes:

A list of all defined failure modes for the resulting specification, if any. The elements of the list are of type MDT.FailureMode.

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.HydroGeneratorSpec:

The newly created specification instance.

pymdt.specs.MakeInverterSpecification(name: str, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) InverterSpec[source]

This helper function creates a new InverterSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capital_cost: float

The cost per foot for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs/ft of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

failure_modes:

A list of all defined failure modes for the resulting specification, if any. The elements of the list are of type MDT.FailureMode.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.InverterSpec:

The newly created specification instance.

pymdt.specs.MakeLineSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) LineSpec[source]

This helper function creates a new LineSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The capacity of this component type to carry power (in kW).

capital_cost: float

The cost per foot for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs/ft of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

failure_modes:

A list of all defined failure modes for the resulting specification, if any. The elements of the list are of type MDT.FailureMode.

impedance

A 2 element tuple or a list with 2 items in it where the first is the resistance part and the second is the reactance.

resistance: float

The resistance component of impedance. Only used if the “impedance” keyword argument is not provided.

reactance: float

The reactance component of impedance. Only used if the “impedance” keyword argument is not provided.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.LineSpec:

The newly created specification instance.

pymdt.specs.MakeNaturalGasGeneratorSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) NaturalGasGeneratorSpec[source]

This helper function creates a new NaturalGasGeneratorSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The maximum output power this generator can produce (in kW).

capital_cost: float

The cost for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

efficiencies: [float]

A list of 5 efficiency values, 1 each for this generator running at 0% (idle), 25%, 50%, 75%, and 100% running rate. The units of efficiency are fraction (0.0-1.0).

fuel_usages: [float]

A list of 5 fuel use values, 1 each for this generator running at 0% (idle), 25%, 50%, 75%, and 100% running rate. The units of efficiency during idling are MMBTUs per hour. The units of the other rates is MMBTU per kW per hour.

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

start_probabilities: [float]

A list of 1 or more startup probability values as fractions (0.0-1.0). The first is the likelihood of a generator starting on the first attempt. Each subsequent value corresponds to the likelihood of the generator starting on subsequent attempts. The number of items in the list defines the maximum number of start attempts allowed before the generator is considered to have suffered startup failure.

startup_mttr: Common.Distributions.IDistribution

The distribution used to determine the time required to repair a startup failure for this generator. If no startup MTTR distribution is provided, then the generator cannot be repaired during the DBT occurrence.

startup_time: float

The amount of time required to start this generator and warm it up to the point that it can begin to carry load in hours.

recoverable_heat_rate: float

An indicator of how much heat energy can be extracted from this generator as a function of it’s electrical output as a fraction (0.0-1.0). The fraction represents the number of kWh of heat per kWh of electrical energy that can be extracted.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.NaturalGasGeneratorSpec:

The newly created specification instance.

pymdt.specs.MakePropaneGeneratorSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) PropaneGeneratorSpec[source]

This helper function creates a new PropaneGeneratorSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The maximum output power this generator can produce (in kW).

capital_cost: float

The cost for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

efficiencies: [float]

A list of 5 efficiency values, 1 each for this generator running at 0% (idle), 25%, 50%, 75%, and 100% running rate. The units of efficiency are fraction (0.0-1.0).

fuel_usages: [float]

A list of 5 fuel use values, 1 each for this generator running at 0% (idle), 25%, 50%, 75%, and 100% running rate. The units of efficiency during idling are gallons per hour. The units of the other rates is gallon per kW per hour.

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

start_probabilities: [float]

A list of 1 or more startup probability values as fractions (0.0-1.0). The first is the likelihood of a generator starting on the first attempt. Each subsequent value corresponds to the likelihood of the generator starting on subsequent attempts. The number of items in the list defines the maximum number of start attempts allowed before the generator is considered to have suffered startup failure.

startup_mttr: Common.Distributions.IDistribution

The distribution used to determine the time required to repair a startup failure for this generator. If no startup MTTR distribution is provided, then the generator cannot be repaired during the DBT occurrence.

startup_time: float

The amount of time required to start this generator and warm it up to the point that it can begin to carry load in hours.

recoverable_heat_rate: float

An indicator of how much heat energy can be extracted from this generator as a function of it’s electrical output as a fraction (0.0-1.0). The fraction represents the number of kWh of heat per kWh of electrical energy that can be extracted.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.PropaneGeneratorSpec:

The newly created specification instance.

pymdt.specs.MakePropaneTankSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) PropaneTankSpec[source]

This helper function creates a new PropaneTankSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The capacity of this tank to hold fuel (in gallons).

capital_cost: float

The cost for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.PropaneTankSpec:

The newly created specification instance.

pymdt.specs.MakeSolarGeneratorSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) SolarGeneratorSpec[source]

This helper function creates a new SolarGeneratorSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The maximum output power this generator can produce (in kW).

capital_cost: float

The cost per foot for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs/ft of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

failure_modes:

A list of all defined failure modes for the resulting specification, if any. The elements of the list are of type MDT.FailureMode.

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.SolarGeneratorSpec:

The newly created specification instance.

pymdt.specs.MakeSwitchSpecification(name: str, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) SwitchSpec[source]

This helper function creates a new SwitchSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capital_cost: float

The cost per foot for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

failure_modes:

A list of all defined failure modes for the resulting specification, if any. The elements of the list are of type MDT.FailureMode.

impedance

A 2 element tuple or a list with 2 items in it where the first is the resistance part and the second is the reactance.

resistance: float

The resistance component of impedance. Only used if the “impedance” keyword argument is not provided.

reactance: float

The reactance component of impedance. Only used if the “impedance” keyword argument is not provided.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.SwitchSpec:

The newly created specification instance.

pymdt.specs.MakeTransformerSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) TransformerSpec[source]

This helper function creates a new TransformerSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The capacity of this component type to carry power (in kW).

capital_cost: float

The cost per foot for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

failure_modes:

A list of all defined failure modes for the resulting specification, if any. The elements of the list are of type MDT.FailureMode.

impedance

A 2 element tuple or a list with 2 items in it where the first is the resistance part and the second is the reactance.

resistance: float

The resistance component of impedance. Only used if the “impedance” keyword argument is not provided.

reactance: float

The reactance component of impedance. Only used if the “impedance” keyword argument is not provided.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.TransformerSpec:

The newly created specification instance.

pymdt.specs.MakeUPSSpecification(name: str, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) UPSSpec[source]

This helper function creates a new UPSSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capital_cost: float

The cost for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

charge_efficiencies: [float]

A list of 5 charging efficiency values, 1 each for this UPS at 0%, 25%, 50%, 75%, and 100% state of charge. The units of efficiency are fraction (0.0-1.0).

discharge_efficiencies: [float]

A list of 5 discharging efficiency values, 1 each for this UPS at 0%, 25%, 50%, 75%, and 100% state of charge. The units of efficiency are fraction (0.0-1.0).

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

max_charge_rate: float

The maximum rate at which power can be pushed into the UPS in kW.

max_discharge_rate: float

The maximum rate at which power can be extracted from the UPS in kW.

energy_capacity: float

The maximum number of kWh that can be stored in this UPS (at 100% state of charge).

min_state_of_charge: float

The minimum allowable state of charge of the UPS in %. The default is 10%.

max_state_of_charge: float

The maximum allowable state of charge of the UPS in %. The default is 90%.

desired_state_of_charge: float

The desired state of charge of the UPS in %. The default is 70%.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.UPSSpec:

The newly created specification instance.

pymdt.specs.MakeWindGeneratorSpecification(name: str, capacity: float, capital_cost: float, op_cost: float = 0.0, weight: float = 0.0, volume: float = 0.0, **kwargs) WindGeneratorSpec[source]

This helper function creates a new WindGeneratorSpec, extracts any provided properties, loads it into the master list of specifications, and returns it.

Parameters

name: str

The name to be given to the new specification. Names of like-type specifications must be unique.

capacity: float

The maximum output power this generator can produce (in kW).

capital_cost: float

The cost per foot for this component type.

op_cost: float

The cost per hour of operation of this type of component.

weight: float

The weight in lbs/ft of this component type.

volume: float

The physical volume in cubic feet of this component type.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

failure_modes:

A list of all defined failure modes for the resulting specification, if any. The elements of the list are of type MDT.FailureMode.

voltage

A 2 element tuple or a list with 2 items in it where the first is the real part and the second is the imaginary.

real: float

The real component of voltage. Only used if the “voltage” keyword argument is not provided.

imaginary: float

The imaginary component of voltage. Only used if the “voltage” keyword argument is not provided.

sync: bool

Whether or not to save the newly created spec to the specification database. This can be done later using the SaveSpecificationDatabase method. The default is to save the change (True).

err_log: Common.Logging.Log

The log into which to record any errors encountered during the building, loading, or saving of the new specification. If this argument is not provided, messages will be recorded into the pymdt.GlobalErrorLog instance.

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

notes: str

Any notes to assign to the resulting specification.

guid:

The unique identifier to use for this new asset. This can be a string formatted as described in: https://learn.microsoft.com/en-us/dotnet/api/system.guid.-ctor?view=net-8.0#system-guid-ctor(system-string) or a System.Guid instance. If not provided, a newly created, random Guid is used.

Returns

MDT.WindGeneratorSpec:

The newly created specification instance.

pymdt.specs.SaveSpecificationDatabase(errLog: Log = None) Log[source]

A helper function to store any new, deleted, or changed specifications to the underlying database.

Without calling this function, any changes made will not be saved for use in the future.

Parameters

errLog: Common.Logging.Log

A log that will receive any messages produced while saving the database changes and additions. If this parameter is None, then the pymdt.GlobalErrorLog will be used.

Returns

Common.Logging.Log:

A log containing any errors or messages creating during the synchronization operation. If the errLog parameter is None, then the pymdt.GlobalErrorLog will be used and returned.

pymdt.utils module

pymdt.utils.ExecutePropertySet(obj, propName, value, custom_cancel_evt_name=None, **kwargs) Log[source]

A helper function for setting properties on MDT (or associated library) class objects. This helps with management of messages that may occur when setting a property that should be processed (error messages for example).

Parameters

obj:

The object on which a property set should occur.

propName: str

The name of the property to set.

value:

The value to assign to the property (as in obj.propName = value).

custom_cancel_evt_name: str

The name of a function that should be called if the property set is rejected by the library. If not provided, the default handler is used which will push the cancellation message into a log (either a provided one or the GlobalErrorLog).

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

undos: Common.Undoing.IUndoPack

An optional undo pack into which to load the undoable objects generated during this operation (if any).

err_log: Common.Logging.Log

A Log object into which to capture any messages generated during this operation. If not provided, messages will be added into the pymdt.GlobalErrorLog.

pymdt.utils.FindEntityByName(all_ents, name: str, **kwargs)[source]

Searches through a collection to find an item with the given name.

In the case of the MDT interface, the name is indicated by the value of the StringID property of an entry in all_ents.

Parameters

all_ents:

Something that can be iterated to search for an item with the supplied name. Then entities in this list must have a property named StringID that is used as the name getter.

name: str

The name to search for.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

find_context:

A descriptor of the find operation that is happening, typically a description of the list being searched. This is used if no matching item is found to give a more meaningful error message. If not supplied, the context is an empty string.

case_sensitive:

An indicator of whether the search should be case sensitive or not. if not provided, the default is True for a case sensitive search.

find_fail_behavior: find_fail_behavior

A member of the find_fail_behavior enumeration indicating what to do if the search is unsuccessful. The default is to ignore and return None. Optionally, if this argument is find_fail_behavior.throw, an exception is thrown with a message meant to give information about the failed search.

Returns

Found Item:

The item that was found or None if no matching item is found.

pymdt.utils.MakeUsableName(all_ents, name: str, **kwargs) str[source]

Creates a usable name from the supplied name that does not duplicate any names in the collection all_ents by adding digits to the end.

In the case of the MDT interface, the name is indicated by the value of the StringID property of an entry in all_ents.

Parameters

all_ents:

Something that can be iterated to search for an item with the supplied name. Then entities in this list must have a property named StringID that is used as the name getter.

name: str

The name to search for.

kwargs: dict

A dictionary of all the variable arguments provided to this function. The arguments used by this method include:

start: int

The lowest usable digit to append in the case of the need to append them to get a unique name.

Returns

str:

The name that is unique to the supplied collection which may be the supplied name if it was already unique.

pymdt.utils.PrintLog(log: Log, writeTags: bool = False, maxEntries: int = -1)[source]

A simple helper function to print out the contents of a Log.

Parameters

log: Common.Logging.Log

The log to print using the print() function.

writeTags: bool

True if the tags (like E0001, W0032, etc.) should be written along with each entry in the log.

maxEntries: int

The maximum number of log entries to write. if this value is -1 (the default), than all log entries are written.

class pymdt.utils.find_fail_behavior(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the possible responses to a failed attempt to find something in a list using the FindEntityByName function.

ignore = 0

Indicates that the find function should just return None.

throw = 1

Indicates that the find function should throw an exception. See the docs for the FindEntityByName function for details of what the exception message will say.

class pymdt.utils.text_alignment(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the possible text alignment settings. These are used for example by the node groups to place their text.

bottom_center = <TextAlignEnum.BottomCenter: 7>

Indicates that the text should be aligned to the bottom center of its parent.

bottom_left = <TextAlignEnum.BottomLeft: 6>

Indicates that the text should be aligned to the bottom left of its parent.

bottom_right = <TextAlignEnum.BottomRight: 8>

Indicates that the text should be aligned to the bottom right of its parent.

middle_center = <TextAlignEnum.MiddleCenter: 4>

Indicates that the text should be aligned to the middle center of its parent. This typically means centered vertically and horizontally.

middle_left = <TextAlignEnum.MiddleLeft: 3>

Indicates that the text should be aligned to the middle left of its parent. This typically means centered vertically and aligned left horizontally.

middle_right = <TextAlignEnum.MiddleRight: 5>

Indicates that the text should be aligned to the middle right of its parent. This typically means centered vertically and aligned right horizontally.

top_center = <TextAlignEnum.TopCenter: 1>

Indicates that the text should be aligned to the top center of its parent.

top_left = <TextAlignEnum.TopLeft: 0>

Indicates that the text should be aligned to the top left of its parent.

top_right = <TextAlignEnum.TopRight: 2>

Indicates that the text should be aligned to the top right of its parent.

class pymdt.utils.time_units(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumeration of the possible time units for various inputs. These are commonly used for data sets for example.

days = <Units.Days: 4>

Indicates that a given time value is given in days.

hours = <Units.Hours: 3>

Indicates that a given time value is given in hours.

milliseconds = <Units.Milliseconds: 0>

Indicates that a given time value is given in milliseconds.

minutes = <Units.Minutes: 2>

Indicates that a given time value is given in minutes.

months = <Units.Months: 6>

Indicates that a given time value is given in months.

seconds = <Units.Seconds: 1>

Indicates that a given time value is given in seconds.

weeks = <Units.Weeks: 5>

Indicates that a given time value is given in weeks.

years = <Units.Years: 7>

Indicates that a given time value is given in years.