PyConZA 2017 1
Mixing Metals with Snakes
Moving an Industry Forward
Johan Zietsman
6 October 2017
PyConZA 2017
+ =
ΔG
Slide 2
Slide 2 text
PyConZA 2017 2
Purpose
Demonstrate how Python is used as part of
software developed to
– improve our understanding of complex high-
temperature processes;
– develop new process technologies.
Get some feedback and ideas.
Slide 3
Slide 3 text
PyConZA 2017 3
Content
●
South African economy
●
South African mining and metals industry
●
Ex Mente
●
Thermochemistry
●
Modelling and simulation software
– History
– Current status
– Future plans
●
Conclusion
Slide 4
Slide 4 text
PyConZA 2017 4
The South African Economy
Slide 5
Slide 5 text
PyConZA 2017 5
South Africa Needs Development and
Growth
●
Education
●
Health care
●
Infrastructure
●
Research and
development
●
Social upliftment
●
Poverty reduction
●
Who will pay the bill?
Slide 6
Slide 6 text
PyConZA 2017 6
The South African Mining and
Metals Industry
Slide 7
Slide 7 text
PyConZA 2017 7
SA Mining and Metals Industry
Slide 8
Slide 8 text
PyConZA 2017 8
SA Mining and Metals Industry
Slide 9
Slide 9 text
PyConZA 2017 9
SA Mining and Metals Industry
●
Several challenges:
– Rising electricity cost
– Labour unrest, increasing cost,
productivity
– Declining ore quality
– Brain drain
●
Chrome specifically
– Difficult to compete
– SA chromite mineralogy (low
Cr:Fe ratio)
– Volatile chrome market
– Competition
●
Current status:
– Smelters closing down
– Less value add
– Increasing ore exports
– We are getting less from
our minerals
Slide 10
Slide 10 text
PyConZA 2017 10
Slide 11
Slide 11 text
PyConZA 2017 11
Ex Mente
●
What does it mean?
– “From the Mind”
●
Who are we?
– Metallurgical and chemical
engineers
– Software engineers
●
What do we do?
– Consulting
– Modelling and simulation
– Process control
– Information systems
●
What do we like?
– Real understanding
– Deep insight
– Solving difficult problems
– Hot stuff
●
How do we do it?
– Building relationships
– R&D
– Software
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
PyConZA 2017 13
Slide 14
Slide 14 text
PyConZA 2017 14
Slide 15
Slide 15 text
PyConZA 2017 15
Slide 16
Slide 16 text
PyConZA 2017 16
Thermochemistry
Slide 17
Slide 17 text
PyConZA 2017 17
Thermochemistry
●
Also called: chemical thermodynamics
●
The good:
– Incredibly powerful for high-temperature processes
– Provides really good estimates of what happens
●
The not so good:
– Quite abstract
– Many people find it difficult
– Often misunderstood, poorly used
Slide 18
Slide 18 text
PyConZA 2017 18
J.W. Gibbs (1839 – 1903)
The father of thermochemistry.
"Only one man lived who could understand Gibbs's
papers. That was Maxwell, and now he is dead."
(Rukeyser 251)
Slide 19
Slide 19 text
PyConZA 2017 19
Thermochemistry
●
How do we get the benefits of thermochemistry to
industry?
●
Sell them specialist software (limited success so
far)
●
Do everything for them (modelling, simulation,
investgation) (not enough capacity)
●
Put thermochemistry into their hands in a way that
they can use it (let’s try)
Slide 20
Slide 20 text
PyConZA 2017 20
Modelling and Simulation Software
History
Slide 21
Slide 21 text
PyConZA 2017 21
A Long Journey
●
1993 – 1998
– Gibbs energy miniser in C++
– Painful!!!
– Flow charts in Gensym G2
(ThermoLab)
– Expensive!!!
●
1999 – 2004
– Buy ChemApp Gibbs energy
minimiser
– Integrate with Excel, VBA, VB
(ThermoLab)
– Great strides
●
2005 – 2012
– Integrate ChemApp with
.Net (C#)
– UI with WPF (EMSIM)
●
2013 – current
– Big move to open source
– Integrate ChemApp with
Python
– UI becomes web-based
(EMSIM)
– Cloud servers
Slide 22
Slide 22 text
PyConZA 2017 22
Modelling and Simulation Software
Current Status
auxi
Slide 23
Slide 23 text
PyConZA 2017 23
auxi Motivation
●
Name derived from Latin
– auxilio (help)
– auxillium (helper)
●
Provide some help to the metallurgical industry
●
University of Pretoria engineering faculty
– Teach Python in second year
●
Put tools in the hands of process engineers to be
more productive
Slide 24
Slide 24 text
PyConZA 2017 24
auxi Functionality
●
Tools
– Chemistry
– Material physical properties
– Transport phenomena
●
Modelling
– Metallurgical processes
– Financial
– Business
PyConZA 2017 27
Modelling and Simulation Software
Current Status
ChemAppPy
Slide 28
Slide 28 text
PyConZA 2017 28
ChemAppPy Background
●
auxi can do quite a bit
●
It cannot describe detailed thermochemistry
●
We need quite a bit more
– Complex, multi-phase equilibria
– Phase diagrams
– Etc.
Slide 29
Slide 29 text
PyConZA 2017 29
ChemAppPy Background
●
FactSage (commercial)
– Interactive UI
– Fantastic tool
– Difficult for high work loads
●
ChemApp (commercial)
– C and Fortran API
– Flexible and powerful
– Difficult to master and use
– Cryptic API
●
ChemAppPy raw
– ChemApp in Python
– Direct API port
– Cryptic API
●
ChemAppPy friendly
– Friendly API
– Complete flexibility
– Rapid development
– Rich, productive environment
– Quick to master
Slide 30
Slide 30 text
PyConZA 2017 30
ChemAppPy Friendly
Core Concepts
●
Calculations
– ChemAppPy high-level commands (a little code does a lot)
– Parallel execution
●
Storage
– Thermochemical systems (all details)
– Equilibrium calculation results (all details)
– Package in json format
– Store in mongodb (roughly 512 kB per calculation)
●
Visualisation
– ChemAppPy high-level commands
– Matplotlib
Slide 31
Slide 31 text
PyConZA 2017 31
ChemAppPy Case Study
Chrome Ore Reduction Behaviour – Open System
●
Add carbon to reduce the ore
●
Progressively increase temperature
Slide 32
Slide 32 text
PyConZA 2017 32
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 800 °C
Slide 33
Slide 33 text
PyConZA 2017 33
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 900 °C
Slide 34
Slide 34 text
PyConZA 2017 34
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 1000 °C
Slide 35
Slide 35 text
PyConZA 2017 35
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 1100 °C
Slide 36
Slide 36 text
PyConZA 2017 36
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 1200 °C
Slide 37
Slide 37 text
PyConZA 2017 37
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 1300 °C
Slide 38
Slide 38 text
PyConZA 2017 38
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 1400 °C
Slide 39
Slide 39 text
PyConZA 2017 39
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 1500 °C
Slide 40
Slide 40 text
PyConZA 2017 40
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 1600 °C
Slide 41
Slide 41 text
PyConZA 2017 41
ChemAppPy Case Study
Reduction: Phase vs. reductant addition – 1700 °C
Slide 42
Slide 42 text
PyConZA 2017 42
ChemAppPy Case Study
Summary
Investigation 1 2 3
Number of calcs 22,982 28,393 10,663
Storage space 4.2 GB 4.8 GB 3.54 GB
Number of graphs 2,204 ~2,000 1,500
Number of reports 7 5 6
Slide 43
Slide 43 text
PyConZA 2017 43
ChemAppPy Case Study
Summary
●
Imagine
– Please do it for these new ores
– Sorry, I gave you the wrong assay
– Oops, I made a mistake
●
Visualisation important for understanding
●
Optimisation now becomes feasible
Slide 44
Slide 44 text
PyConZA 2017 44
Modelling and Simulation Software
Current Status
EMSIM
Slide 45
Slide 45 text
PyConZA 2017 45
EMSIM
Requirements
●
Model processes quickly and easily
●
Minimise the amount of programming
●
Minimise IT impact
●
Models must be
– easy to understand;
– well documented;
– easily accessible to co-workers and customers;
– re-usable.
●
It must be easy to run large numbers of scenarios
Slide 46
Slide 46 text
PyConZA 2017 46
EMSIM
Core Concepts
●
Calculations
– Steady-state mass and energy balances
– Detailed thermochemistry in the background (ChemAppPy Friendly)
– Python modelling and material frameworks
●
Storage
– Model configuration (all details)
– Calculation results (all details)
– Package in json format
– Store in PostgreSQL
●
Stack
– Django app (via Nginx and Gunicorn)
– Celery for background work
– HTML, Javascript, CSS
Slide 47
Slide 47 text
PyConZA 2017 47
EMSIM
Demonstration
Slide 48
Slide 48 text
PyConZA 2017 48
Conclusion
●
Python is an important enabling technology
●
Large-scale thermochemical investigations are
feasible
●
Many possible applications:
– New process development
– Optimisation
– Etc.
●
We can get thermochemistry in the hands of more
people to grow the industry, and SA
Slide 49
Slide 49 text
PyConZA 2017 49
We are hiring!
●
Have a look: http://ex-mente.co.za/careers/
●
Contact us: [email protected]
Thank You