[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TRNSYS-users] TRNSYS v18: Type 169 - problem with Python Script because of libraries to import



Maria -

You cannot import any libraries in your script for Type169. 

Regards,

Tim

 

---
Timothy P. McDowell Executive Vice President Thermal Energy System Specialists, LLC 3 N Pinckney St, Suite 202 Madison, WI 53703 office: 608-274-2577 cell: 608-225-5250

On 2021-04-16 05:23, María Herrando via TRNSYS-users wrote:

Hi everyone,

I am encountering another error when trying to run Type 169.

In the code I am trying to solve in Python, I need to import a couple of libraries to solve some equations, which I believe are the reason for the error I am getting when trying to run the model. To double check that this is the problem for not running, I tried in the simple example provided in the Examples of TRNSYS, adding the libraries to import, after importing TRNSYSpy, as follows:

import TRNSYSpy as trn
import numpy as np
from scipy import optimize

and I get the following error: "The Python script failed to load". If I remove the numpy and optimize from scipy, the TRNSYS model runs... Is there a way to solve this or are there equivalent libraries that I can use?

I am using numpy to calculate an angle in radians and the cos of the angle, and I use optimize from scipy to solve an equation with one unknown inside a function "sol = optimize.root(resta, 10, args=pars, method='hybr', jac=None, tol=None, callback=None, options=None)"

Thank you very much in advance,

Best Regards,
María

-- 

_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@lists.onebuilding.org
http://lists.onebuilding.org/listinfo.cgi/trnsys-users-onebuilding.org