How to make a fabricator run on gas or electricity

Updated top post with new functions, graphs and zip file.