def test_Erosion_load(): dict1 = {'Channel': {0: [10.0, 0.001, 2.68, 0.7]}} conc = [] conc1 = [] flow = [] flow1 = [] with Simulation("./inps/LinkTest_variableinflow.inp") as sim: ER = Link_Quality(sim, dict1) channel = Links(sim)["Channel"] tailwater = Nodes(sim)["TailWater"] for step in sim: ER.Erosion() c = channel.pollut_quality conc.append(c['P1']) c1 = tailwater.pollut_quality conc1.append(c1['P1']) flow.append(sim._model.getLinkResult("Channel", 0)) flow1.append(sim._model.getNodeResult("Tailwater", 0)) load = [a * b for a, b in zip(conc, flow)] cum_load = np.cumsum(load) load1 = [a * b for a, b in zip(conc1, flow1)] cum_load1 = np.cumsum(load1) error = (cum_load1[-1] / cum_load[-1]) / cum_load1[-1] print(error) assert error <= 0.03
def test_CoRemoval_load(): dict1 = {'Culvert': {0: [0.75, 0.15]}} dict2 = {'Culvert': {1: 0.15}} conc = [] conc1 = [] flow = [] flow1 = [] with Simulation("./inps/LinkTest_variableinflow2.inp") as sim: CR = Link_Quality(sim, dict1) culvert = Links(sim)["Culvert"] outlet = Nodes(sim)["Outlet"] for step in sim: CR.CoRemoval() c = culvert.pollut_quality conc.append(c['P1']) c1 = outlet.pollut_quality conc1.append(c1['P1']) flow.append(sim._model.getLinkResult("Culvert", 0)) flow1.append(sim._model.getNodeResult("Outlet", 0)) load = [a * b for a, b in zip(conc, flow)] cum_load = np.cumsum(load) load1 = [a * b for a, b in zip(conc1, flow1)] cum_load1 = np.cumsum(load1) error = (cum_load1[-1] / cum_load[-1]) / cum_load1[-1] print(error) assert error <= 0.03
Wetland_flooding = [] Wetland_outflow = [] Wetland_cumload = [] Wtlnd_bp_inflows = [] Channel_flow = [] Channel_conc = [] Cannel_cuminload = [] Channel_depth = [] Channel_cumload = [] # Setup toolbox simulation with Simulation("./modifiedMBDoyle_TSS_V2.inp") as sim: # Setup toolbox methods GS = Node_Quality(sim, dict1) ER_GS = Link_Quality(sim, dict2) # Get asset information Ellsworth = Nodes(sim)["93-50408"] DBasin = Nodes(sim)["93-50404"] Wetland = Nodes(sim)["93-49759"] Wtlnd_bypass = Links(sim)["95-70294"] Channel = Links(sim)["95-70277"] # Step through the simulation for index, step in enumerate(sim): # Calculate gravity settling in basins GS.GravitySettling() # Calculate erosion andn gravity settling in channels ER_GS.Erosion_and_Settling()
Wetland_conc = [] Wetland_outflow = [] Wetland_cumload = [] Channel_conc = [] Channel_flow = [] Channel_cumload = [] Outfall_inflow = [] Outfall_conc = [] Outfall_cumload = [] # Setup toolbox simulation with Simulation("./TSS.inp") as sim: # Setup toolbox methods ER = Link_Quality(sim, dict2) # Get asset information Wetland = Nodes(sim)["93-49759"] Channel = Links(sim)["95-70277"] Outfall = Nodes(sim)["97-50253"] # Step through the simulation for step in enumerate(sim): # Calculate erosion produced ER.Erosion() # Get TSS conc for each asset Wt_p = Wetland.pollut_quality['TSS'] Wetland_conc.append(Wt_p) Ch_p = Channel.pollut_quality['TSS']
Wetland_cumload = [] Wetland_DO1 = [] Wetland_DO2 = [] Wetland_DO3 = [] Channel_flow = [] Channel_conc = [] Cannel_cuminload = [] Channel_depth = [] Channel_cumload = [] # Setup toolbox simulation with Simulation("./modifiedMBDoyle_TSS_AArain.inp") as sim: # Setup toolbox methods GS = Node_Quality(sim, dict1) ER = Link_Quality(sim, dict2) GS2 = Link_Quality(sim, dict3) # Get asset information Ellsworth = Nodes(sim)["93-50408"] DBasin = Nodes(sim)["93-50404"] Wetland = Nodes(sim)["93-49759"] Channel = Links(sim)["95-70277"] # Tracking time for DO reaction t = 0 # Step through the simulation for index,step in enumerate(sim): # Calculate gravity settling