The WEAPWQConstituent class represents a single Water Quality Constituent, whereas WEAPWQConstituents is a collection of all the Water Quality Constituents in the active area.
You can get access to a WEAPWQConstituent in two different ways:
WEAPApplication.WQConstituents(WQConstituentName or Index), specifying either the name of the Constituent or a number from 1 to WEAPApplication.WQConstituents.Count, e.g., WEAP.WQConstituents("BOD") or WEAP.WQConstituents(1)
Iterate through the collection of WQ Constituents, e.g., FOR EACH WQCon IN WEAP.WQConstituents
WEAPWQConstituents Properties and Methods |
Example (using VB script) |
Active: Enable or disable water quality modeling for the active area, or determine its setting. This is equivalent to the "Enable water quality modeling" setting on the Water Quality Constituents screen. |
WEAP.WQConstituents.Active = TRUE
IF WEAP.WQConstituents.Active THEN PRINT "Water Quality modeling IS active" ELSE PRINT "Water Quality modeling is NOT active" END IF
|
Add(Name, LoadUnit, ConcentrationUnit, CalculationMethod, DecayRate, Note, Qual2KConstituent): Create a new water quality constituent. Name is required, the others are optional: LoadUnit (e.g., "kg" or "pH"), ConcentrationUnit (e.g., "mg/l" or "C"), CalculationMethod (one of the following: Conservative (No Decay), First-Order Decay, BOD Model, DO Model, Temperature (Modeled in WEAP), Temperature (Data), or Modeled in QUAL2K), DecayRate (daily first-order decay rate), Note and Qual2KConstituent. If not specified, LoadUnit will default to kg, ConcentrationUnit to mg/l, and CalculationMethod to Conservative (No Decay). If a constituent already exists with the same Name, its parameters will be overwritten with the new parameters given. |
CALL WEAP.WQConstituents.Add("BOD", "kg", "mg/l", "BOD Model", 0, "Biological Oxygen Demand") CALL WEAP.WQConstituents.Add("Temperature", "C", "C", "Temperature (Data)", 0, "Entered as data for each reach")
|
Count: Get the number of WEAP water quality constituents in the active area. Read only. |
PRINT "There are " & WEAP.WQConstituents.Count & " water quality constituents in " & WEAP.ActiveArea.Name ' Delete all WHILE WQConstituents.Count > 0 WQConstituents(1).Delete WEND ' Report FOR i = 1 TO WEAP.WQConstituents.Count PRINT WEAP.WQConstituents(i).Name & "["
& WEAP.WQConstituents(i).LoadUnit
& "]: " & WEAP.WQConstituents(i).CalculationMethod ' This is equivalent to: FOR EACH WQCon IN WEAP.WQConstituents
PRINT WQCon.Name & "[" & WQCon.LoadUnit & "]:
" & WQCon.CalculationMethod |
Exists(Name): Returns True if the named constituent exists. Read only. |
IF WEAP.WQConstituents.Exists("BOD") THEN WEAP.WQConstituents("BOD").Delete
' delete
it if it exists IF NOT WEAP.WQConstituents.Exists("BOD") THEN CALL WEAP.WQConstituents.Add("BOD", "kg", "mg/l", "BOD Model", 0, "Biological Oxygen Demand") ' add it only if it isn't already there END IF |
Item(TagName or Index): Get the Tag identified by name or index (from 1 to Tags.Count). Item is the default property, so ".Item" can be omitted. Read only. |
PRINT WEAP.WQConstituents.Item("BOD").CalculationMethod PRINT WEAP.WQConstituents("BOD").CalculationMethod WEAP.WQConstituents("BOD").LoadUnit = "1000 kg" Note: the Item property is the "default" property, and therefore is usually omitted. Thus, the first two examples above are equivalent. |
NameList: Get a list of water quality constituents separated by character specified by optional parameter ListSeparator (which defaults to comma). Read only. |
PRINT "WQ Constituents: " & WEAP.WQConstituents.NameList |
WEAPWQConstituent Properties and Methods |
Example (using VB script) |
CalculationMethod: Set or get the method by which the constituent is calculated: Conservative (No Decay), First-Order Decay, BOD Model, DO Model, Temperature (Modeled in WEAP), Temperature (Data), or Modeled in QUAL2K. |
PRINT WEAP.WQConstituents("Temperature").CalculationMethod WEAP.WQConstituents("BOD").CalculationMethod = "BOD Model" WEAP.WQConstituents("Salinity").CalculationMethod = "Conservative" WEAP.WQConstituents("Chlorine").CalculationMethod = "First-Order Decay" |
ConcentrationUnit: Set or get a string containing the concentration unit, e.g., "mg/l" or "pH," used for entering concentrations of constituents in demand site outflows. |
PRINT WEAP.WQConstituents("Temperature").ConcentrationUnit WEAP.WQConstituents("BOD").ConcentrationUnit = "mg/L" |
DecayRate: Set or get the daily first-order decay rate. Only used if calculation method is First-Order Decay. |
PRINT WEAP.WQConstituents("Chlorine").DecayRate WEAP.WQConstituents("Chlorine").DecayRate= 0.25 |
Delete: Delete the water quality constituent |
IF WEAP.WQConstituents.Exists("BOD") THEN WEAP.WQConstituents("BOD").Delete
FOR EACH WQCon IN WEAP.WQConstituents ' Delete them all WQCon.Delete NEXT |
ID: Get WEAP's internal ID code of the Constituent. Most users will never need this information. Read only. |
PRINT "ID code for "; WEAP.WQConstituents("BOD").Name; "is "; WEAP.WQConstituents("BOD").ID |
LoadUnit: Set or get a string containing the scale and units of the pollution load, e.g., "1000 kg" or "pH," used for entering the annual production of the constituent by the demand site, per unit of activity. |
PRINT WEAP.WQConstituents("Chlorine").LoadUnit WEAP.WQConstituents("BOD").LoadUnit= "kg"
|
Name: Set or get the constituent's name.
|
FOR EACH WQCon IN WEAP.WQConstituents NEXT WEAP.WQConstituents("BOD").Name = "Biol Oxygen Demand" |
Note: Set or get the plain text note describing the constituent. |
FOR EACH WQCon IN WEAP.WQConstituents NEXT WEAP.WQConstituents("BOD").Note = "Biological Oxygen Demand" |