README.txt 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. This package provides a Go implementation of the coding challenge described in https://github.com/gem-spaas/powerplant-coding-challenge. It implements a slightly less-than-naive solution to the optimal production plan problem, so does not guarantee to find the global optimum. It provides a docker container spec for easy deployment.
  2. Installation
  3. ------------
  4. Simply use go tools:
  5. cd $GOPATH/src
  6. git clone https://gogs.reverservices.eu/temp/gem-spaas-coding-challenge
  7. cd gem-spaas-coding-challenge
  8. go get -d ./cmd/spaas-server
  9. go install ./cmd/spaas-server
  10. Or docker:
  11. git clone https://gogs.reverservices.eu/temp/gem-spaas-coding-challenge
  12. cd gem-spaas-coding-challenge
  13. docker build -t gem-spaas .
  14. Usage
  15. -----
  16. Run the server with the spaas-server binary:
  17. $GOPATH/bin/spaas-server --port 8888
  18. $GOPATH/bin/spaas-server --help # See other options and arguments
  19. Or the docker container:
  20. docker run -p 8888:8888 gem-spaas
  21. Testing
  22. -------
  23. Once the server is up and running, you can test it with the following curl commands:
  24. - payload1: curl -X POST --header 'Content-Type: application/json' -d '{"load": 480, "fuels": {"wind(%)": 60, "kerosine(euro/MWh)": 50.8, "gas(euro/MWh)": 13.4, "co2(euro/ton)": 20}, "powerplants": [{"pmin": 100, "efficiency": 0.53, "type": "gasfired", "name": "gasfiredbig1", "pmax": 460}, {"pmin": 100, "efficiency": 0.53, "type": "gasfired", "name": "gasfiredbig2", "pmax": 460}, {"pmin": 40, "efficiency": 0.37, "type": "gasfired", "name": "gasfiredsomewhatsmaller", "pmax": 210}, {"pmin": 0, "efficiency": 0.3, "type": "turbojet", "name": "tj1", "pmax": 16}, {"pmin": 0, "efficiency": 1, "type": "windturbine", "name": "windpark1", "pmax": 150}, {"pmin": 0, "efficiency": 1, "type": "windturbine", "name": "windpark2", "pmax": 36}]}' http://localhost:8888/productionplan
  25. - payload2: curl -X POST --header 'Content-Type: application/json' -d '{"load": 480, "fuels": {"wind(%)": 0, "kerosine(euro/MWh)": 50.8, "gas(euro/MWh)": 13.4, "co2(euro/ton)": 20}, "powerplants": [{"pmin": 100, "efficiency": 0.53, "type": "gasfired", "name": "gasfiredbig1", "pmax": 460}, {"pmin": 100, "efficiency": 0.53, "type": "gasfired", "name": "gasfiredbig2", "pmax": 460}, {"pmin": 40, "efficiency": 0.37, "type": "gasfired", "name": "gasfiredsomewhatsmaller", "pmax": 210}, {"pmin": 0, "efficiency": 0.3, "type": "turbojet", "name": "tj1", "pmax": 16}, {"pmin": 0, "efficiency": 1, "type": "windturbine", "name": "windpark1", "pmax": 150}, {"pmin": 0, "efficiency": 1, "type": "windturbine", "name": "windpark2", "pmax": 36}]}' http://localhost:8888/productionplan
  26. - payload3: curl -X POST --header 'Content-Type: application/json' -d '{"load": 910, "fuels": {"wind(%)": 60, "kerosine(euro/MWh)": 50.8, "gas(euro/MWh)": 13.4, "co2(euro/ton)": 20}, "powerplants": [{"pmin": 100, "efficiency": 0.53, "type": "gasfired", "name": "gasfiredbig1", "pmax": 460}, {"pmin": 100, "efficiency": 0.53, "type": "gasfired", "name": "gasfiredbig2", "pmax": 460}, {"pmin": 40, "efficiency": 0.37, "type": "gasfired", "name": "gasfiredsomewhatsmaller", "pmax": 210}, {"pmin": 0, "efficiency": 0.3, "type": "turbojet", "name": "tj1", "pmax": 16}, {"pmin": 0, "efficiency": 1, "type": "windturbine", "name": "windpark1", "pmax": 150}, {"pmin": 0, "efficiency": 1, "type": "windturbine", "name": "windpark2", "pmax": 36}]}' http://localhost:8888/productionplan
  27. Roadmap
  28. -------
  29. The project should be enhanced with:
  30. - the usage of a proper interior point optimizer
  31. - taking into account CO2 prices in the production plan
  32. - add a websocket server that pushes production plans each time the http server computed a response
  33. Pull requests are welcome.