Automated parameter fitting
A free GitHub account is required to access the program code in this repository; send us your GitHub username.
You can use Scale-up Suite 2 to fit process parameters headless and on the fly.
You will need Python installed to run the scripts provided here. That’s because they’re Python scripts :) You will see that these could be written in many other languages and Python is just a good example.
A basic example to get you started
- Download the Dynochem model v3_simple_batch_tilde.xlsx and dc6_auto_fit.py and save them in the same folder.
- Run the python script and watch the parameters fit. On completion, a fitting report will appear in a CSV file in the same folder.
An example in which multiple models are fitted in sequence
- Download several Dynochem models and save them in the same folder fed_batch_solid_liquid.xlsx, fit_gas.xlsx, fit_liquid.xlsx, fit_solid.xlsx, simple_batch_reaction.xlsx, simple_fed_batch_rxn.xlsx
- Download all_read_dc6_auto_fit.py and save it in the same folder as the models
- Run the python script and watch the parameters fit in each model, one after the other. On completion, the models will be fully updated with the fitted parameters and fitting reports will appear in a CSV file in the same folder.
- You can watch a movie preview here.
Listen for a CSV file containing data and then automatically fit UA
- Make a folder for this activity on tour desktop, called e.g. Fit UA
- Tip: Depending on your browser, you may find that right-clicking on the links below is a faster way to save the files
- Save this template model fit-UA.xlsx there. Make sure it is called ‘fit-UA.xlsx’
- Save this script which will fit UA to a fresh solvent test / heat-up / cool-down / cleaning / mock batch run main_dc6_auto_fit.py. Make sure the saved file extension is ‘.py’
- Save this script which will listen in the folder for when new data arrive in CSV format observer.py. Make sure the saved file extension is ‘.py’
- Pip install these modules if you don’t have them already: watchdog
- Close any files that you have open in Excel
- Make a subfolder in your main folder (e.g. Fit UA) called ‘data’
- Run Observer.py by double-clicking the file; a terminal window will open and report that monitoring of the ‘data’ folder has started
- Download this example CSV file and after saving it in your main folder, move it into the data folder scen3.csv.
- The data will be used automatically to create a new model and fit UA to the new data. The model will be saved afterwards. And all without you lifting another finger.
- That’s it. You’re done.
Listen for an xlsx file containing data and then automatically fit filtration characteristics
- Make a folder for this activity, called e.g. Filtration
- Tip: Depending on your browser, you may find that right-clicking on the links below is a faster way to save the files
- Save this template model Cake_Filtration_Toolbox.xlsm there. Make sure it is called ‘Cake_Filtration_Toolbox.xlsm’
- Save this script which will fit medium resistance, cake resistance and compressibility index to a fresh standard set of three pocket filter experiments main_dc6_filter_fit.py. Make sure the saved file extension is ‘.py’
- Save this script which will listen in the folder for when new data arrive (in xlsx format) observer_filter.py. Make sure the saved file extension is ‘.py’
- Pip install these modules if you don’t have them already: watchdog
- Close any files that you have open in Excel
- Make a subfolder in your main folder (e.g. Filtration) called ‘data’
- Run Observer_filter.py by double-clicking the file; a terminal window will open and report that monitoring has started
- Download this example xlsx file and after saving it locally, move it into the data folder Product2_Raw_data.xlsx.
- The data will be used to create a new model and fit filtration parameters to the new data. The model will be saved afterwards. And all without you lifting another finger.
- That’s it. You’re done.
Listen for a CSV file containing data and then automatically refit reaction kinetic parameters
- Make a folder for this activity, called e.g. RxM Fitting
- Tip: Depending on your browser, you may find that right-clicking on the links below is a faster way to save the files
- Save this template model fit_starting.rxm there. Make sure it is called ‘fit_starting.rxm’
- Save this script which will read a CSV file containing new experiments and data and write these into the RxM file; then after fitting, will also write the updated RxL file: read_write_rxm.py. Make sure the saved file extension is ‘.py’
- Save this script which will refit kinetic parameters including a fresh data set just obtained from the lab main_rxl_auto_fit.py. Make sure the saved file extension is ‘.py’
- Save this script which will listen in the folder for when new data arrive (in csv format) observer_rxl_fit.py. Make sure the saved file extension is ‘.py’
- Pip install these modules if you don’t have them already: watchdog, elementtree
- Close any files that you have open in Reaction Lab
- Make a subfolder in your main folder (e.g. RxM Fitting) called ‘data’
- Run observer_rxl_fit.py by double-clicking the file; a terminal window will open and report that monitoring has started
- Download this example csv file combined_tofit.csv. Make sure the saved file extension is ‘.csv’
- To demo the autonomous workflow, move the csv file into the data folder. You will see that the data will be used automatically to create a new model and then refit kinetic parameters including the fresh data set. The model will be saved afterwards. And all without you lifting another finger.
- That’s it. You’re done.