Skip to content

Commit

Permalink
Removed .pyc files, merged small arbitrage selection change.
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-marshall committed May 26, 2019
2 parents 1bd64e6 + 9ba3321 commit b8e11f5
Show file tree
Hide file tree
Showing 196 changed files with 263 additions and 53 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ Flask/dist
Flask/application/dist
Flask/build
Flask/application/modelling/data/luomi/output/*
Electron/app/model
Electron/app/model
Flask/*.pyc
*.pyc
2 changes: 1 addition & 1 deletion Electron/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ app.on('ready', function () {
setTimeout(function () {
// win.loadURL('http://localhost:8080'); //this one for the hot-loading dev server run via npm run serve in the vue directory
win.loadURL('http://localhost:5000'); //this one for production, post-build, from the python directory.
}, 5000);
}, 10000);

// Remove window once app is closed
win.on('closed', function () {
Expand Down
3 changes: 0 additions & 3 deletions EnergySharing

This file was deleted.

Binary file removed Flask/__pycache__/run-dev.cpython-37.pyc
Binary file not shown.
Binary file removed Flask/__pycache__/test.cpython-37.pyc
Binary file not shown.
Binary file removed Flask/application/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file removed Flask/application/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed Flask/application/__pycache__/api.cpython-36.pyc
Binary file not shown.
Binary file removed Flask/application/__pycache__/api.cpython-37.pyc
Binary file not shown.
Empty file modified Flask/application/modelling/LICENSE
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/README.md
100755 → 100644
Empty file.
Binary file not shown.
Binary file not shown.
Empty file.
Empty file modified Flask/application/modelling/data/luomi/defaults/duos.csv
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/data/luomi/defaults/nuos.csv
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified Flask/application/modelling/data/luomi/defaults/tuos.csv
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/data/luomi/defaults/ui_tariffs.csv
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified Flask/application/modelling/data/mike/pv_profiles/C_max_pv.csv
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified Flask/application/modelling/data/mike/pv_profiles/K_max_pv.csv
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified Flask/application/modelling/data/mike/pv_profiles/T_max_pv.csv
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified Flask/application/modelling/data/mike/pv_profiles/W_max_pv.csv
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified Flask/application/modelling/data/mike/reference/dst_lookup.csv
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Binary file modified Flask/application/modelling/data/shared/load/.DS_Store
Binary file not shown.
Empty file modified Flask/application/modelling/data/shared/load/load_profiles.csv
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified Flask/application/modelling/data/ui_tariffs_eg.csv
100755 → 100644
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file modified Flask/application/modelling/luomi_model/battery.py
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/luomi_model/energy_sim.py
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/luomi_model/financial_sim.py
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/luomi_model/network.py
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/luomi_model/participant.py
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/luomi_model/results.py
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/luomi_model/tariffs.py
100755 → 100644
Empty file.
Empty file modified Flask/application/modelling/luomi_model/util.py
100755 → 100644
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions Flask/application/services/file_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def valid_file(self, new_file):
return False, "timestamp column not found"
if line['timestamp'].isspace() or line['timestamp'] == '':
return False, "Blank timestamp found - check end of file perhaps?"
if re.compile("^[0-9]+/[0-9]+/[0-9]+ [0-9]+:[0-9][0-9]$").match(line['timestamp']):
return False, "Incorrectly formatted timestamp found. Must follow DD/MM/YYYY HH:mm"
if not re.compile("^[0-9]+/[0-9]+/[0-9]+ [0-9]+:[0-9][0-9]$").match(line['timestamp']):
return False, " Incorrectly formatted timestamp found: "+str(line['timestamp'])+"- Must follow DD/MM/YYYY HH:mm: "
# except:
# return False, "Could not parse CSV file - check formatting."

Expand Down
Binary file removed Flask/hooks/__pycache__/hook-pendulum.cpython-37.pyc
Binary file not shown.
10 changes: 10 additions & 0 deletions Flask/out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Collecting pendulum
Using cached https://files.pythonhosted.org/packages/5b/57/71fc910edcd937b72aa0ef51c8f5734fbd8c011fa1480fce881433847ec8/pendulum-2.0.4.tar.gz
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Installing backend dependencies: started
Installing backend dependencies: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,54 @@ This software is designed to model emerging business models, based on the concep

It is based on the work of Mike Roberts, Luke Marshall and Naomi Stringer at the Center for Energy and Environmental Markets, UNSW. Additional software development has been completed by David Martin.

![Screenshot 2019-05-17 12 04 13](https://user-images.githubusercontent.com/7201209/57900484-f52ad600-789b-11e9-98eb-91410324fad5.png)
![Screenshot 2019-05-17 12 03 19](https://user-images.githubusercontent.com/7201209/57900486-f5c36c80-789b-11e9-9a06-bd73106e7aa4.png)
![Screenshot 2019-05-17 12 03 01](https://user-images.githubusercontent.com/7201209/57900487-f5c36c80-789b-11e9-920c-e6515eea7915.png)
![Screenshot 2019-05-17 12 02 41](https://user-images.githubusercontent.com/7201209/57900488-f5c36c80-789b-11e9-9d8c-e53861a14708.png)
![Screenshot 2019-05-17 12 02 15](https://user-images.githubusercontent.com/7201209/57900489-f65c0300-789b-11e9-84e0-7fd8d3416ce7.png)

# Downloading
The current standalone release can be downloaded from the Releases page [here](https://github.com/luke-marshall/energy-sharing/releases).

# Running
1. Download and unzip the app.
2. Double-Click the EnergySharing.command file. This will open a terminal window (the 'backend' calculator doing all the hard work) and the user interface.
3. When you're finished, please quit both the user interface and the terminal app.

# Packaging

# Running from source
The application can also be run directly from the source code - this will be useful if there does not exist a packaged binary for your operating system, or if other issues are encountered running packaged versions. Running from source is relatively straightforward with basic knowledge of the terminal and common terminal apps.

## Requirements:
node.js and npm
python 3 and pipenv
electron (for standalone)

## Steps
1. Navigate to Vue/app folder and run:
`npm install`
`npm run serve`
This serves the frontend portion of the app reactively, such that changes to the source code are reflected instantly in the browser / UI.

2. Navigate to Flask folder. Run:
`pipenv install`
`pipenv run python run-dev.py`

At this point, the frontend should be available by opening the Chrome browser and navigating to localhost:8080 in the address bar. localhost:5000 may also provide a version of the UI but this will not be in sync with the code in Vue/app, so this is not recommended.


## Packaging
Packaging consistes of three rather unintuitive steps. The first is to package the vue frontend, and place it in the Flask section of the app. The second is to take the Flask section (the backend model and webserver that serves the frontend ) and package these into a system-dependent executable using pyinstaller - to be places in the Electron section. Electron, on start, fires up this server (the model and the UI) and displays it in a nice electron window.

## Vue
The absic packaging steps for osx are captured in the 'deploy.sh' shell script. This requires that pyinstaller, plus all of the python dependencies for the app, are installed on a local python3 instance, as pyinstaller has pipenv conflicts.

1. Vue
To build the package, go to the Vue/app folder and run:
`npm run build`
This will package the entire web frontend and place it into the Flask/app/application/dist directory.
From this directory, the FLASK server will serve the final version of the frontend.

## Python
2. Python
All python packages must be installed on system python (due to a bug with pipenv / pyinstaller - this may be fixed in the future.)

Run the script found in package.sh, ie.
Expand All @@ -25,7 +60,7 @@ This will create a folder 'dist' in the Flask section, with an executable called

Copy the generated relevant files into the 'app/model' folder in Electron.

## Electron
3. Electron

Electron packaging can be done manually with instructions from the official electron documentation.

Expand Down
53 changes: 17 additions & 36 deletions Vue/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Vue/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"typeface-russo-one": "0.0.72",
"typeface-ubuntu": "0.0.65",
"uws": "^99.0.0",
"vue": "^2.5.17",
"vue": "^2.6.10",
"vue-chartjs": "^3.4.0",
"vue-js-modal": "^1.3.27",
"vue-router": "^3.0.1",
Expand All @@ -56,7 +56,7 @@
"sass-loader": "^7.1.0",
"serve-static": "^1.13.2",
"style-loader": "^0.23.1",
"vue-template-compiler": "^2.5.17"
"vue-template-compiler": "^2.6.10"
},
"postcss": {
"plugins": {
Expand Down
3 changes: 2 additions & 1 deletion Vue/app/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Vue.use(Vuelidate);
import socketio from 'socket.io-client';
import VueSocketIO from 'vue-socket.io';

export const SocketInstance = socketio('http://0.0.0.0:5000/'); //when with gunicorn
export const SocketInstance = socketio('http://localhost:5000/'); //when with gunicorn
//export const SocketInstance = socketio('http://0.0.0.0:5000/'); //when with gunicorn
// export const SocketInstance = socketio('http://localhost:8000/');
// export const SocketInstance = socketio('https://localenergysim.herokuapp.com/');
SocketInstance.on('connect', () => {
Expand Down
10 changes: 10 additions & 0 deletions Vue/app/src/mixins/SaveLoad.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
}
}else{
// Check that each participant has a load / solar / tariff
for( var i = 0; i<this.parsed_parameters['model_participants'].length; i++){
var participant_row = this.parsed_parameters['model_participants'][i];
for(var j = 0; j < participant_row.row_inputs.length; j++){
if(participant_row.row_inputs[j].value == ""){
return {ready:false, message:'Participants are not configured - at least one participant does not have a tariff, solar or load profile selected. Please navigate to the Arrangement page and update participant profiles.'}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Vue/app/src/pages/inputs/ModelParticipants.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</table>


<div class="add-participant-button" @click="add_row()">Add Participant</div>
<div class="add-participant-button" @click="add_row()">Add New Participant</div>

<!-- <div class="file-buttons-container">
<button @click="load_participants_config(input_data.selected_config_file)">Load User Config</button>
Expand All @@ -60,7 +60,7 @@

</div>

<modal width="80%" name="data-files">
<modal width="80%" height="70%" name="data-files">
<div class="modal-container">
<div class="modal-header">
Select Solar and Load Files
Expand Down
4 changes: 3 additions & 1 deletion Vue/app/src/pages/inputs/ModelParticipantsMike.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@

</tr>
</table>

<div class="add-participant-button" @click="add_row()">Add New Participant</div>

</div>

Expand All @@ -122,7 +124,7 @@
</div>
</modal>

<modal width="80%" name="data-files">
<modal width="80%" height="70%" name="data-files">
<div class="modal-container">
<div class="modal-header">
Select Solar and Load Files
Expand Down
1 change: 1 addition & 0 deletions Vue/app/src/pages/inputs/SaveConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
var params = JSON.parse(e.target.result);
// console.log(params)
self.$store.commit('load_config', params)
self.$store.commit('model', params.model_selection.selected_model)
self.$modal.show('load-success')
}
Expand Down
Loading

0 comments on commit b8e11f5

Please sign in to comment.