RunScriptSoftSensorWebApp
Python code for running Dynochem at-line, with realtime updates from the outside world, e.g. your DCS / process monitoring system, to illustrate digital twin creation, soft sensing and elements needed for advanced process control.
To invoke the features in this example, you need to be running Scale-up Suite 2 and to have a RunScript Automation product license.
A free GitHub account is required to access the program code in this repository; send us your GitHub username.
- Install Python using instructions and options we provide here
- Install the following additional Python modules using pip in a DOS window (pip install module-name):
- plotly
- streamlit
Then, to run the app:
- Download the files listed below and place them all in the same folder on your PC:
- Start the web app: type ‘cmd’ to open a DOS window in the current folder, then:
streamlit run soft_sensor_demo.py --server.runOnSave true
- You will see the planned temperature ramp on the left and the resulting concentration profiles on the right, calculated using the rigorous Dynochem mechanistic / kinetic model (the xlsx)
- Start collecting data: simulate data flow from the DCS by opening the xlsm and pressing the button ‘Send Data to data.csv’
- Realtime ‘actual’ temperature profiles (appearing on the Data tab in the CSV) are then imposed as they are collected and the resulting ‘actual’ concentration profiles displayed on the right and and updated continuously as new data arrive; both planned and actual results are shown
- This soft sensor app can display results on any device with a web browser, without installing any software on that device.
Notes:
- In practise, an instrument, historian or automation system (DCS) would send these values to the CSV, or even pass them directly to the RunScript Automation interface. The OPC standard may be used for this and several tools are available to access data using OPC.
- Dynochem is run using RunScript Automation; this allows model predictions to be passed back to the calling program as an array in memory.
- No attempt has been made to optimise this demo. The main purpose is to illustrate how RunScript Automation may be used for this type of application.