Skip to main content

Collimator

Link to all documents regarding BSM2 model and wastewater treatment plant

  • Collimator to TDEngine notebook
    • To displace collimator's result and matlab's result on Grafana.
    • matlab_output_cross_reference.csv (old filename: matlab_output_column_name.csv) contains the names of column in the matlab output file that are corresponding to the 16 variables of each submodel.
    • collimator_cross_reference_2022_12_08.csv (old filename: collimator_output_column_name_xxxx_xx_xx) contains the names of column in the colimator output file that created on 2022-12-08 or after that are corresponding to the 16 variables of each submodel.
    • The cross reference csv for different timestamp was created to match the column name of the 16 variables from the collimator output files that were created before 2022-12-08 because the blocks were renamed.
  • Compare the physical model results with hybrid model (bioreactor_1 AI) results

Model descriptions inside BSM2 project

NameTypeDescription
BSM2_DevelopModelBSM2 developing model. The current working version is the BSM2 physical model that uses python script block for flow combiner and Bioreactor_with_Integrator_as_a_Delay_Block submodels are used for bioreactor 1, 2 ,3 ,4, and 5 in the activated sludge.
BSM2_with_Bioreact_1_AIModelBSM2 with activated sludge (AS) bioreactor 1 is replaced with a time series AI model.
BSM2_Physical_ModelModelBSM2 model created based on BSM2 Matlab model.  Bioreactor_with_Integrator_as_a_Delay_Block submodels were used for bioreactors 1, 2, 3, 4, and 5 in the activated sludge
outdatedBSM2_with_the_First_Bioreactor_Block(incorrect)ModelBSM2 model with the old bioreactor submodels for bioreactor 1, 2, 3, 4, and 5 in the activated sludge.
Test_PyTorch_Model_LoadingModelTesting pytorch model loading
Test_Delay_BlockModelTesting the unit delay block by inputting different pulse width and period.
Test_Delay_Block_for_TSModelTesting the delay block for time series model
Test_Bioreactor_1_AIModelTesting time series bioreactor 1 AI model
Test_Mux_BlockModelTesting the mux block
Test_Bioreactor_with_Integrator_as_a_Delay_Block_SubmodelModelTesting the Bioreactor with Integrator as a delay block submodel
Test_Bioreactor_with_Integrator_as_a_Delay_Block_and_So_Control_SubmodelsModelTesting the Bioreactor with Integrator as a Delay Block and So Control submodels
Bioreactor_with_Unit_Delay_as_a_Delay_BlockSubmodelPhysical model of the bioreactor in the activated sludge. The unit delay block is used to break the algebraic loop when reading the Kla value back from the So control submodel.
Bioreactor_with_Integrator_as_a_Delay_BlockSubmodelPhysical model of the bioreactor in the activated sludge. The integrator block is used to break the algebraic loop when reading the Kla value back from the So control submodel.
Bioreactor_1_pySubmodelTime series model trained with bioreactor 1 input and output values.
T_Model_BlockSubmodelTemperature model block. User can choose between using ODE to get the temperature output or setting the output temperature to be equal to the input temperature. Declare Tmodel value to be more than 0.5 to use the ODE to get the output temperature.
ODE_Mass_Balance_BlockSubmodelGeneric ODE equation block for BSM2 variables. The block can be used to get soluble and particulate concentrations of different sub-processes.
TS_12_TimestepsSubmodelCreating an input array for time series model. The array contains the current and the previous 11-time steps value. If the current time step is less than 11, the variable's initial value will be used instead.
So_ControlSubmodelOxygen concentration control block

Different Saved versions inside BSM2 project

  • To access different saved version history of the model
    • click on the version history tab on the upper right corner version_history
Version HistoryModel/SubmodelDescription
pH_solver_ODE_for_7variablesBSM2_DevelopThe simulation was aborted due to time out. Unlike the previous version, all 7 variables inside pH solver block were solved using ODE.
pH_solver_for_ODE_only_one_variableBSM2_Develop The simulation was able to be completed. However, the outputs were different from Matlab outputs. In attempt to work around algebraic loop found in BSM2_model_problem_with_AlgebraicLoop, I converted the Sh2_solver and pH_solver from DAE to ODE. In this version, only Sh2 and H_ion ( 1 out of 7 variables) in pH ODE were solved. The other 6 variables were solved based on the H_ion.
completed_model_old_SO4_control_blockBSM2_DevelopFirst version of the completed BSM2 model with an old SO4 control block for bioreactor 4 and the first version of the bioreactor submodel.
new_SO4_control_block_new_bioreactor_1BSM2_DevelopModified bioreactor 1 block and SO4 control block.
replace_all_bioreactors_with_new_oneBSM2_DevelopReplaced bioreactor 1,2, 3, 4, and 5 with the modified bioreactors from the previous version (second version of bioreactor)
version_before_replacing_bioreactor_submodelBSM2_Developbioreactor 1, 2, 3, 4, and 5 with modified bioreactor models using the old submodel block
version_after_replacing_new_bioreactor_submodelsBSM2_DevelopReplaced bioreactor 1, 2, and 3 with Bioreactor_with_Unit_Delay_as_a_Delay_Block submodel (third version of bioreactor)
bioreactor_without_delay_block_for_1,2,3,and5BSM2_DevelopReplaced bioreactor 1, 2, 3, and 5 with Bioreactor_without_delay_block. Only bioreactor 4 contains the unit delay
bioreactor_with_intergrator_delayBSM2_DevelopReplaced bioreactor 1, 2, 3, 4, and 5 with Bioreactor_with_Integrator_as_a_Delay_Block submodels
bioreactor_with_intergrator_delay_new_flowcombinerBSM2_DevelopPrevious version with modified flowcombiner blocks
first_physical_modelBSM2_DevelopThe first version of the physical model before replacing the bioreactor 1 with AI model
with_Bioreactor_1_AIBSM2_DevelopReplaced  bioreactor 1 block with Bioreactor_1_py submodel. The bioreactor_1_py block has a  'soluble-particulate-t-TSTPlus-01-11-23 version.
Physical modelBSM2_DevelopThe most up to date version of the physical model
soluble-particulate-t-TSTPlus-01-11-23Bioreactor_1_pyUse this version to load soluble-particulate-t-TSTPlus-01-11-23.pkl model
soluble-particulate-t-inceptionTimePlus-01-11-23Bioreactor_1_pyUse this version to load soluble-particulate-t-inceptionTimePlus-01-11-23.pkl model

Input files

  • We use the dryinfluent dataset from MATLAB as our input to the model. They are the same input dataset to the MATLAB model.
  • The data has the time step of 15 min (0.0104 day).

Initialization Script

  • We can import py script to install certain python package to be used in python script block before starting the simulation runs. For an example, if we need pip install ipython tsai torch ipykernel before running BSM2_with_Bioreactor_1_AI model.