Open adlcalle opened 2 years ago
I want to use CoPylot for parametric simulations, same as SolarPILOT GUI I've tried to call this module like that:
cp.data_set_matrix(r,"parametric.0.user_par_values",set_matrix)
where set_matrix gets the input for parametric values, for instance (flux_solar_az_in, flux_solar_el_in) (azimuth, elevation) I was wondering if you could get me some advice about the input structure I need.
Best regards,
CoPylot can be used directly in MATLAB through the MATLAB API for Python which is embedded in the software since version R2014b. If you are accessing from Windows, you will need to acquire a Python interpreter which has to be compatible with your version of MATLAB. The easiest way to do that is to download the installer from python.org. The Mathworks website is full of information about that. If you are on a Linux® or Mac platform, you already have Python installed but you should be careful to have the MATLAB compatible version. Once Python is installed, you can check which version of Python MATLAB has selected to use. In your MATLAB shell type:
If you already have several copies of Python on your computer, then you can tell MATLAB which one you want it to use by passing the absolute path to the python executable or the version you want to pyenv. For example:
Depending on your Python installation, you may need to install some additional Python libraries from the PYPI package index such as for example Pandas. The easiest way to do it is through the Python pip program. Type in your MATLAB shell:
Now, you are ready to use CoPylot. In MATLAB shell, the only thing you need is call it through py. operator:
This instruction works when the copylot.py and solarpilot.dll are in the current working folder. If this is not the case, you have to tell Python and CoPylot where these files are located. For example:
After this, we can use CoPylot exactly in the same way as we would in Python. Note that the minimum example requires the TMY file to be passed.
You must remember that you are running Python code in MATLAB so the inputs and outputs are Python variables. Floats and strings are the same variables on both platforms, but everything else must be converted if you want to use it. There are numerous examples of how to do this in test_script.m