Git Product home page Git Product logo

aide_featurescript's Introduction

aguaclara

Pypi Version Documentation Build Status Code Coverage

aguaclara is a Python package developed by AguaClara Cornell and AguaClara Reach for designing and performing research on AguaClara water treatment plants. The package has several main functionalities:

  • DESIGN of AguaClara water treatment plant components
  • MODELING of physical, chemical, and hydraulic processes in water treatment
  • PLANNING of experimental setup for water treatment research
  • ANALYSIS of data collected by ProCoDA (process control and data acquisition tool)

Installing

The aguaclara package can be installed from Pypi by running the following command in the command line:

pip install aguaclara

To upgrade an existing installation, run

pip install aguaclara --upgrade

Using aguaclara

aguaclara's main functionalities come from several sub-packages.

  1. Core: fundamental physical, chemical, and hydraulic functions and values
  2. Design: modules for designing components of an AguaClara water treatment plant
  3. Research: modules for process modeling, experimental design, and data analysis in AguaClara research

To use aguaclara's registry of scientific units (based on the Pint package), use from aguaclara.core.units import u. Any other function or value in a sub-package can be accessed by importing the package itself:

Example Usage: Design

import aguaclara as ac
from aguaclara.core.units import u

# Design a water treatment plant
plant = ac.Plant(
    q = 40 * u.L / u.s,
    cdc = ac.CDC(coag_type = 'pacl'),
    floc = ac.Flocculator(hl = 40 * u.cm),
    sed = ac.Sedimentor(temp = 20 * u.degC),
    filter = ac.Filter(q = 20 * u.L / u.s)
)

Example Usage: Core

# continued from Example Usage: Design

# Model physical, chemical, and hydraulic properties 
cdc = plant.cdc
coag_tube_reynolds_number = ac.re_pipe(
    FlowRate = cdc.coag_q_max,
    Diam = cdc.coag_tube_id,
    Nu = cdc.coag_nu(cdc.coag_stock_conc, cdc.coag_type)
)

Example Usage: Research

import aguaclara as ac
from aguaclara.core.units import u
import matplotlib.pyplot as plt

# Plan a research experiment
reactor = ac.Variable_C_Stock(
    Q_sys = 2 * u.mL / u.s, 
    C_sys = 1.4 * u.mg / u.L, 
    Q_stock = 0.01 * u.mL / u.s
)
C_stock_PACl = reactor.C_stock()

# Visualize and analyze ProCoDA data
ac.iplot_columns(
    path = "https://raw.githubusercontent.com/AguaClara/team_resources/master/Data/datalog%206-14-2018.xls", 
    columns = [3, 4], 
    x_axis = 0
)
plt.ylabel("Turbidity (NTU)")
plt.xlabel("Time (hr)")
plt.legend(("Influent", "Effluent"))

The package is still undergoing rapid development. As it becomes more stable, a user guide will be written with more detailed tutorials. At the moment, you can find some more examples in specific pages of the API reference.

Contributing

Bug reports, features requests, documentation updates, and any other enhancements are welcome! To suggest a change, make an issue in the aguaclara Github repository.

To contribute to the package as a developer, refer to the Developer Guide.

aide_featurescript's People

Contributors

fletchapin avatar

Watchers

 avatar  avatar

aide_featurescript's Issues

ENH: Add a feature that calculates head loss based off of instances of the Pipeline feature

Use Case

With such a feature, we would be able to use head loss calculations for pipes to:

  1. Validate correctness of designs on the fly
  2. Use head loss calculations for further design calculations in the Part Studio
  3. Maybe something else?

Solution

This would reasonably be implemented with a feature that takes as input a reference to geometry that was drawn by a Pipeline feature, though it may be difficult to do so based off of just the geometry. We could get around this by having the Pipeline output some variables describing the pipes, though this may clog up the context.

@ethan92429 Is there some simple way to do the geometry-based approach that I'm missing?

Alternatives

Our current paradigm is to run HL calculations in the HDF, though this requires duplication of logic (pipes must be specified in both the DPS and the HDF).

TEST: Add tests for failing the range checks of Core FS functions


Describe the Missing Coverage

Many functions check the range of acceptable values before calculating anything, and throw errors as a result. For example, widthWeirRect(0.0025 * meter^3 / second, 0.0 * meter) should return throw Value of Height is 0 which is not within range of GZ. Currently there is no way to test that the correct error occurs.

Expected Behavior

When an error such as throw Value of Height is 0 which is not within range of GZ occurs the Tester feature should be able to parse the error message and check that it matches the expected error.

Recommended Fix

I believe this could be accomplished by catching all errors thrown during testing and converting the error message to a string. Then that string would be compared to an expected error string.

FS for obstacles

  • calculate size of pipe to use for obstacle

  • calculate if obstacles on both sides of baffle needed

Solidify 3-level test plan

The three levels involve:

  1. A "build function" that references the Part Studio to be instantiated
  2. The PS that contains the component to be built, as well as the HDF as a feature instantiated in the PS
  3. A "hydraulic design function" that runs calculations based off of hydraulic inputs and configures the PS's variables

This involves:

  • Creating a graphic demonstrating each of the three levels
  • Well-commented code for the LFOM
  • Intuitive names and definitions for each of the components of this paradigm
  • Validating and testing

Transfer Python Code into FS Pipe Database file

Pipe Database is a core AguaClara file that contains many essential functions to calculate pipe dimensions. This is necessary to implement the Sed tank and possibly other plant components. In python, the file is named pipes.py.

Refactor HDFs to utilize Core FS

Use Case

Ensure HDFs use Core FS as much as possible (and add functionality which is common between HDFs to Core FS).

Solution

Since we now have fully tested Core FS functions it's best to use them as often as possible. If there's functionality that's commonly used that's not in Core FS we should add it (with tests!) to Core FS.

Alternatives

Have separately maintained versions of functions in different HDFs, but that will likely lead to errors.

Support different countries' pipe databases

We have two enums, one which defines the available ND and their associated OD and one which defines which of the diameters are actually available (called ND_ENUM_IS_USED). Since different pipes are available in different locations, ND_ENUM_IS_USED should be defined by the user instead of hardcoded. To accomplish this, a predicate which has a checkbox for each possible pipe in the database should be used, then those boolean values can be assigned to each member of ND_ENUM_IS_USED

ENH: Add a feature that returns a cut list, based on an instantiated Pipeline feature

Use Case

This would be very useful to supplement a BOM, in determining the minimum length of pipe that is required for to construct a set of cut pipes.

Solution

Similarly to #40, this feature could take in a reference to Pipeline geometry and return a list of available pipes that can be cut down to match the Pipeline design.

Alternatives

Eyeballing it? I'm not too sure what is the existing process for this...

kinematic viscosity function error

The kinematic viscosity of 20 degC water should be 1.004e-06 meter ** 2 / second and yet the value calculated in featurescript is about 3 times that value.

ENH: Add moles to FS units and implement density gas equation

Use Case

Monroe attempted to add the molar gas constant to units.

Solution

Figure out how to define Moles in FeatureScript and implement the density gas equation with the Molar constant, R.

Alternatives

We currently don't use gas equations anywhere in AIDE, so this is definitely more of an educational tool instead of a vital feature.

ENH: Integrate new Pipeline feature with existing components

Use Case

Components which have already been completed used an old pipeline feature or hand drawn pipelines. These should be replaced with the improved pipeline feature for easier maintainability.

Solution

Change the references to the old Pipeline feature in components like the sedimentor and flocculator and replace them with references to Ethan's new Pipeline feature.

Alternatives

If the components are working, they could be left as is. However, as more features get added to the new Pipeline feature these components would become more difficult to maintain, so it's better to update them all in advance.

Implement new 1-5 L/s Filter design

I believe this filter will be contained in a single pipe. Before work starts Monroe and other experts need to solidify design logic which can be implemented in FeatureScript

HDF to Onshape Drawing

For the flocculator, create the connection between HDF and Onshape Drawing and verify that it produces designs similar to the Mathcad/AutoCAD designs for 20 and 60 L/s.

Pipeline v9 Bugged Fitting Sockets

Some of the fittings generated by pipeline (when checking "Custom Parts" and selecting the "Fitting" part studio for fittings and the "Pipe" part studio for piping) will have sockets that intersect each other, e.g. in size 1/2 tees and elbows, creating partial sockets.

ENH: Make Test Helper its open-source feature with support from the Onshape forum

Use Case

Test Helpers has a bunch of useful helper functions. We might be able to get support from the Onshape community if we made it open source.

Solution

We could easily move Test Helpers into its own Document and create an open-source feature. Then we could advertise on the Onshape Forums that we made this feature and would appreciate contributions and feedback.

Alternatives

Continue to maintain Test Helpers privately within AguaClara Core FS.

ENH: Replace EI Parts Studio with Extended Inputs Functionality

Use Case

Right now the Expert Inputs parts studio is only used in unpacking of overrides string.

Solution

If we moved that functionality to the Inputs feature the EI parts studio can be removed entirely (and Import EI feature in the DPS replaced w/ Inputs).

Alternatives

The current implementation could be maintained as it works, but it's inefficient and harder to debug.

ENH:

Use Case

Improve the functionality of the Tester feature by testing the test functions

Solution

*1. Create a Part studio and instantiate different cases of the Tester feature
2. Perform simple value checks.
3. Perform unit checks-For eg. checking that 5m not equal to 5 cm.
*

Alternatives

This is a part of #35

Add flow meter to the LFOM

The flow meter zero point is the bottom of the bottom row of orifices. Create code that takes the design flow rate and turns it into a nice ruler with ticks.

Consider making a dual ruler with flow rate on one side and percent of full flow on the other side.

HDF (CDC)

Create a CDC HDF. Add the functions that calculate the diameter, length, and number of dosing tubes to the CDC HDF.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.