Closed tomam28 closed 11 months ago
Can you post the generated script if it doesn't include anything top secret?
Thanks for the fast reply!
The generated script is:
# This file was automatically generated by PDSimGUI on Mo, 28 Aug 2023 07:45:45
# Versions used:
# PDSim: 2.14
# CoolProp: 6.5.0 git revision: bafdea1f39ee873a6bb9833e3a21fe41f90b85e8
#
# To run this file, in a console, type
#
# python this_file_name.py
#
# where this_file_name.py is the name of this file
#
# In python 2.7 make a/b always give the double division even
# if both a and b are integers - thus 2/3 now yields 0.666666666...
# rather than 0
from __future__ import division
# NO PLUGIN (post_import)
# General python imports
import time, sys, os, timeit
# Plotting and numeric things
from math import pi
import numpy as np
from matplotlib import pyplot as plt
# Imports from PDSim that are needed for all families of machines
from PDSim.flow.flow import FlowPath
from PDSim.flow.flow_models import IsentropicNozzleWrapper
from PDSim.core.containers import ControlVolume, Tube
from PDSim.core.motor import Motor
from PDSim.plot.plots import debug_plots
# Imports from CoolProp
from CoolProp import State
from CoolProp import CoolProp as CP
# Add the paths for any additional plugin folders (hard-coded absolute paths)
sys.path.extend([])
# NO PLUGIN (post_import)
def build():
# NO PLUGIN (pre_build)
from PDSim.scroll.core import Scroll
# NO PLUGIN (pre_build_instantiation)
sim = Scroll()
sim.run_index = 6
sim.description = ""
# NO PLUGIN (post_build_instantiation)
#############
# From GeometryPanel
############
# Parameters from the GUI
Vdisp = 0.0001048 #[m^3/rev]
Vratio = 2.2 #[-]
t = 0.004 #[m]
ro = 0.005 #[m]
phi_i0 = 0.0 #[rad]
phi_is = 3.141 #[rad]
phi_os = 0.3 #[rad]
# Set the scroll wrap geometry
sim.set_scroll_geo(Vdisp, # Vdisp [m^3/rev]
Vratio, # Vratio [-]
t, # Thickness [m]
ro, # Orbiting radius [m]
phi_i0 = phi_i0, # [rad]
phi_os = phi_os, # [rad]
phi_is = phi_is) # [rad]
sim.set_disc_geo("2Arc", r2 = 0)
sim.d_discharge = 0.01
sim.geo.delta_flank = 15e-6 # [m]
sim.geo.delta_radial = 15e-6 # [m]
sim.geo.phi_ie_offset = 0
#############
# From StatePanel
############
inletState = State.State("R410A", {'T': 283.15, 'P' : 181.12561991395648 }, phase="gas")
outlet_temperature_guess = -1 # [K]
if outlet_temperature_guess > 0:
# Use the specified guess for outlet temperature
T2s = outlet_temperature_guess
else:
T2s = sim.guess_outlet_temp(inletState,362.25123982791297)
outletState = State.State("R410A", {'T':T2s,'P':362.25123982791297 }, phase="gas")
# The rotational speed (over-written if motor map provided)
sim.omega = 377.0
#############
# From MassFlowPanel
############
# Add all the control volumes
sim.auto_add_CVs(inletState, outletState)
# Get the guess for the mass flow rate
mdot_guess = inletState.rho*sim.Vdisp*sim.omega/(2*pi)
# Add both the inlet and outlet tubes
sim.add_tube(Tube(key1 = 'inlet.1',
key2 = 'inlet.2',
L = 0.3,
ID = 0.02,
mdot = mdot_guess,
State1 = inletState.copy(),
fixed = 1,
TubeFcn = sim.TubeCode))
sim.add_tube(Tube(key1 = 'outlet.1',
key2 = 'outlet.2',
L = 0.3,
ID = 0.02,
mdot = mdot_guess,
State2 = outletState.copy(),
fixed = 2,
TubeFcn = sim.TubeCode))
# Add all the leakage flows
sim.auto_add_leakage(flankFunc = sim.FlankLeakage,
radialFunc = sim.RadialLeakage)
# Add the inlet-to-shell flow with a fixed area
FP = FlowPath(key1='inlet.2',
key2='sa',
MdotFcn=IsentropicNozzleWrapper(),
)
FP.A = pi*0.02**2/4*0.8
sim.add_flow(FP)
# Add the suction-area to suction chambers flows
sim.add_flow(FlowPath(key1='sa',
key2='s1',
MdotFcn=sim.SA_S1,
MdotFcn_kwargs = dict(X_d = 0.8)
)
)
sim.add_flow(FlowPath(key1 = 'sa',
key2 = 's2',
MdotFcn = sim.SA_S2,
MdotFcn_kwargs = dict(X_d = 0.8)
)
)
sim.add_flow(FlowPath(key1 = 'outlet.1',
key2 = 'dd',
MdotFcn = sim.DISC_DD,
MdotFcn_kwargs = dict(X_d = 0.7)
)
)
sim.add_flow(FlowPath(key1 = 'outlet.1',
key2 = 'ddd',
MdotFcn = sim.DISC_DD,
MdotFcn_kwargs = dict(X_d = 0.7)
)
)
sim.add_flow(FlowPath(key1 = 'outlet.1',
key2 = 'd1',
MdotFcn = sim.DISC_D1,
MdotFcn_kwargs = dict(X_d = 0.7)
)
)
sim.add_flow(FlowPath(key1 = 'outlet.1',
key2 = 'ddd',
MdotFcn = sim.DISC_D1,
MdotFcn_kwargs = dict(X_d = 0.7)
)
)
sim.add_flow(FlowPath(key1='d1',
key2='dd',
MdotFcn=sim.D_to_DD,
MdotFcn_kwargs = dict(X_d = 0.8)
)
)
sim.add_flow(FlowPath(key1='d2',
key2='dd',
MdotFcn=sim.D_to_DD,
MdotFcn_kwargs = dict(X_d = 0.8)
)
)
#############
# From MechanicalLossesPanel
############
sim.motor = Motor()
sim.motor.set_eta(0.95)
sim.motor.suction_fraction = 1
from PDSim.core.core import struct
sim.mech = struct()
sim.h_shell = 0.01
sim.A_shell = 0.040536
sim.Tamb = 298.0
sim.HTC = 0.0
sim.mech.scroll_plate_thickness = 0.002
sim.mech.scroll_plate_diameter = 0.014
sim.mech.scroll_added_mass = 0.0
sim.mech.scroll_density = 2700
sim.mech.mu_oil = 0.0086
sim.mech.detailed_analysis = True
sim.mech.journal_tune_factor = 1.0
sim.mech.D_upper_bearing = 0.025
sim.mech.L_upper_bearing = 0.025
sim.mech.c_upper_bearing = 2e-05
sim.mech.D_crank_bearing = 0.025
sim.mech.L_crank_bearing = 0.025
sim.mech.c_crank_bearing = 2e-05
sim.mech.D_lower_bearing = 0.025
sim.mech.L_lower_bearing = 0.025
sim.mech.c_lower_bearing = 2e-05
sim.mech.thrust_friction_coefficient = 0.03
sim.mech.thrust_ID = 0.08
sim.mech.thrust_OD = 0.3
sim.mech.L_ratio_bearings = 3.0
sim.mech.oldham_key_friction_coefficient = 0.01
sim.mech.oldham_ring_radius = 0.06
sim.mech.oldham_key_width = 0.006
sim.mech.oldham_mass = 0.1
sim.mech.oldham_thickness = 0.008
sim.mech.oldham_key_height = 0.006
sim.mech.oldham_rotation_beta = 0
sim.mech.pin1_ybeta_offset = 0.0
sim.mech.pin2_ybeta_offset = 0.0
sim.mech.pin3_xbeta_offset = 0.0
sim.mech.pin4_xbeta_offset = 0.0
m, zcm = sim.calculate_scroll_mass()
sim.mech.orbiting_scroll_mass = m
sim.mech.scroll_zcm__thrust_surface = zcm
#############
# From VirtualSensorsPanel
############
# NO PLUGIN (post_build)
return sim
def run(sim, pipe_abort = None):
# NO PLUGIN (pre_run)
#############
# From SolverInputsPanel
############
t1=timeit.default_timer()
sim.connect_callbacks(step_callback = sim.step_callback,
endcycle_callback = sim.endcycle_callback,
heat_transfer_callback = sim.heat_transfer_callback,
lumps_energy_balance_callback = sim.lump_energy_balance_callback
)
sim.precond_solve(key_inlet = 'inlet.1',
key_outlet = 'outlet.2',
pipe_abort = pipe_abort,
solver_method = "RK45",
OneCycle = False,
plot_every_cycle = False,
hmin = 1e-8, # hard-coded,
timeout = 3600,
eps_energy_balance = 0.05,
eps_cycle = 0.002,
max_number_of_steps = 40000
)
print('time taken',timeit.default_timer()-t1)
#############
# From ParametricPanel
############
# NO PLUGIN (post_run)
if __name__ == '__main__':
sim = build()
run(sim)
And the error log is:
Main Log
---------
Want to run 1 simulations in batch mode; 1 cores available for computation
Adding thread;1 threads active; 0 queued
Didn't get any simulation data
Thread finished; now 0 threads active; 0 queued
Log from thread #1
-------------------
About to run the script file C:\Users\tomam\.pdsim-temp\script_54f950af39ac.py
C:\Users\tomam\PycharmProjects\pythonProject1\pdsim\PDSim\scroll\core.py:382: UserWarning: xport and yport not provided, defaulting back to circular discharge port; should be stored in self.geo.xvec_disc_port and self.geo.yvec_disc_port
warnings.warn('xport and yport not provided, defaulting back to circular discharge port; should be stored in self.geo.xvec_disc_port and self.geo.yvec_disc_port')
caching discharge port blockage, please wait... done
Process Run1-1:
Traceback (most recent call last):
File "C:\Users\tomam\AppData\Local\Programs\Python\Python39\lib\multiprocessing\process.py", line 315, in _bootstrap
self.run()
File "C:\Users\tomam\PycharmProjects\pythonProject1\pdsim\GUI\processes.py", line 77, in run
script_module.run(self.sim, pipe_abort = self.pipe_abort)
File "C:\Users\tomam\.pdsim-temp\script_54f950af39ac.py", line 273, in run
sim.precond_solve(key_inlet = 'inlet.1',
File "C:\Users\tomam\PycharmProjects\pythonProject1\pdsim\PDSim\core\core.py", line 861, in precond_solve
self.solve(**kwargs)
File "C:\Users\tomam\PycharmProjects\pythonProject1\pdsim\PDSim\core\core.py", line 1479, in solve
self.OBJECTIVE_CYCLE(x0, self.x_state,
File "C:\Users\tomam\PycharmProjects\pythonProject1\pdsim\PDSim\core\core.py", line 1137, in OBJECTIVE_CYCLE
self.one_cycle(X,
File "C:\Users\tomam\PycharmProjects\pythonProject1\pdsim\PDSim\core\core.py", line 1040, in one_cycle
aborted = integrator.do_integration(tmin, tmax, eps_allowed=eps_allowed)
File "C:\Users\tomam\PycharmProjects\pythonProject1\pdsim\PDSim\core\integrators.py", line 282, in do_integration
self.xnew1 = self.xold+self.h*(1.0/5.0)*self.f1
TypeError: unsupported operand type(s) for *: 'float' and 'PDSim.misc.datatypes.arraym'
Thread-2: Process is done
Log from thread #2
-------------------
Log from thread #3
-------------------
Log from thread #4
-------------------
Log from thread #5
-------------------
Log from thread #6
-------------------
Log from thread #7
-------------------
Thanks for the help!
I ran that script on the development version of PDSim, no errors, ran fine.
Its all solved now, there was a problem with my conda version! 👍
Hello pdsim community,
I installed all required packages (with the required versions, because newer cpython version have problems with declaring variables with cpdef instead of cdef) and run setup.py sucessfully. The GUI works also fine, but when I want to solve a simulation, then this error appears:
Traceback (most recent call last): File "C:\...\pdsim\examples\simple_example.py", line 204, in <module> Compressor(solver_method = 'Euler') File "C:\...\pdsim\examples\simple_example.py", line 186, in Compressor recip.solve(key_inlet='inlet.1', File "C:\...\pdsim\PDSim\core\core.py", line 1479, in solve self.OBJECTIVE_CYCLE(x0, self.x_state, File "C:\...\pdsim\PDSim\core\core.py", line 1137, in OBJECTIVE_CYCLE self.one_cycle(X, File "C:\...\pdsim\PDSim\core\core.py", line 1030, in one_cycle aborted = integrator.do_integration(N, tmin, tmax) File "C:\...\pdsim\PDSim\core\integrators.py", line 80, in do_integration self.xnew = self.xold + self.h*self.f1 TypeError: unsupported operand type(s) for *: 'float' and 'PDSim.misc.datatypes.arraym'
Thanks for any help! :)