rl-institut / multi-vector-simulator

Multi-vector Simulation Tool assessing and optimizing Local Energy Systems (LES) for the E-LAND project
GNU General Public License v2.0
21 stars 10 forks source link

[Feature request] MVS API does not have the option to export the lp file of a scenario #907

Closed FredericHirschmueller closed 2 years ago

FredericHirschmueller commented 3 years ago

I modelled an energy system with the web based MVS interface and the csv-file interface but I have different results even though it's suposed to be the same energy system. I wanted to take a look at the lp file of the web based simulation but I couldn't find an option to download the lp file.

smartie2076 commented 3 years ago

Hi @FredericHirschmueller! Thank you for letting us know of this issue - it is actually two. If the results are not the same, it is a bug, and that the results are not downloadable might be a feature request.

Regarding the bug, please consider using the bug report template grafik

With following checklist:

Checklist to make sure that the bug report ist complete:

  • [ ] OS: your_operating_system, your_distribution
  • [ ] Branch: branch_name, updated on update_date
  • [ ] If applicable: Attach full error message
  • [ ] If applicable: Share screenshots/images of your problem
  • [ ] If applicable: Share used input data

As otherwise it is difficult to asses if we would also get to the same result (and whether a later release might have solved the issue already). Also let us know which function you used that produced different online results.

I am not sure that it is a public reprository, but the feature request is more related to the MVS API: https://mvs-eland.rl-institut.de/ (you should also mention that version number in your bug report).

FredericHirschmueller commented 3 years ago

Thank you @smartie2076 for your answer.

I'm not sure if it is a bug. I wanted to check if the energy systems are equal through the lp file. If the lp files are equal and I still get different results it is a bug, but I wanted to check the lp files of both energy systems first. Maybe I just wait until the feature to download the lp file is implemented before I open a new issue to report the bug.

smartie2076 commented 3 years ago

Hi @FredericHirschmueller sadly, as @Bachibouzouk is not working right now, the feature will not be integrated in the months to come. He did write a function to compare json MVS files, though, so that could also be a lead. In general, the MVS online is exactly the one that is in the repo (master branch) - so there should be no difference. It is a bug.

If your data is open, it would be great if you could post the two differing json output files!

FredericHirschmueller commented 3 years ago

The model is open so I can share it with you. The only part that is not open is the demand profile but I think you can't see this data in the json MVS file, right?

I have the json file of the model that I created with the csv-file interface but I don't know how to access the json file of the model that I created with MVS online. Is there a possibility to download the file?

smartie2076 commented 3 years ago

The model is open so I can share it with you. The only part that is not open is the demand profile but I think you can't see this data in the json MVS file, right?

Hmhm, I am not sure if you see that in the json file sent to the MVS API (definitly in the results file, though)... Maybe replace your demand profile with one from the benchmark tests in your csv inputs and then post it?

I have the json file of the model that I created with the csv-file interface but I don't know how to access the json file of the model that I created with MVS online. Is there a possibility to download the file?

Yes, you can. At the bottom there is a "check status..." message, which you can click on (see below). It will also display the json sent/received from the MVS API.

....now, this is assuming you actually mean the MVS API (https://mvs-eland.rl-institut.de) and not the EPA (https://epa-eland.rl-institut.de)

grafik

FredericHirschmueller commented 3 years ago

I am using the EPA interface. I wasn't aware that there also is an MVS API. Sorry for the confusion.

Is there a possibility to access the json file from the EPA interface?

smartie2076 commented 3 years ago

Aha! Good to know. Yes, there is, and it is not too hard :)

1) Click Strg+Shift+i to open the interactive box in your browser, in the scenario view. 2) Click simulate for your scenario 3) In the interactive box, you can find the mvs_token: grafik By the way, the mvs_request_json is your input data, so if your simulation terminates you can copy that and debug locally. 4) Use that token to check the MVS API process: https://mvs-eland.rl-institut.de/check/3211a485-c74f-41ab-9bb0-a293c685fc8c (token right after /check/) 5) You then get the current status of the simulation. This may be pending, an error message, or the simulation results: grafik 6) Click on raw data (Rohdaten) and save to JSON: grafik 7) Open JSON file and remove excess information, ie. {"id":"3211a485-c74f-41ab-9bb0-a293c685fc8c","status":"DONE","results":" at the beginning and the appropriate number of } and " at the end of the file (probably just }"}).

The JSON is in EPA format now.

If you want to debug a simulation, you would need to run this script on your EPA-output.json

import json
from multi_vector_simulator.utils.data_parser import (
    convert_epa_params_to_mvs,
)

from multi_vector_simulator.B0_data_input_json import load_json

with open("EPA-output.json", "r") as jf:
    epa_dict = json.load(jf)

from multi_vector_simulator.server import run_simulation as mvs_simulation
dict_values = convert_epa_params_to_mvs(epa_dict)
mvs_simulation(dict_values, display_output="debug")
Bachibouzouk commented 3 years ago

Hello everyone,

I think a good solution is to provide the option to return the LP file on the MVS API (then the EPA could also access it, just setting an option to True)

I looked at it and should not take much time to implement :)

I will link the PR to this issue when I push it