Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated mako templates #25

Open
pfannkuch3n opened this issue Mar 11, 2025 · 0 comments
Open

Deprecated mako templates #25

pfannkuch3n opened this issue Mar 11, 2025 · 0 comments

Comments

@pfannkuch3n
Copy link

Problem description

For some time uesgraphs template generation couldnt handle duplicates as well as boolean outputs. This resulted in templates like:

`AixLib.Fluid.DistrictHeatingCooling.Pipes.StaticPipe pipe${str(name)}(
redeclare package Medium = Medium,
%if use_zeta is not None:
use_zeta = ${str(round(use_zeta, 4))},
%endif
%if from_dp is not None:
from_dp = ${str(round(from_dp, 4))},
%endif
%if dh is not None:
dh = ${str(round(dh, 4))},
%endif
%if v_nominal is not None:
v_nominal = ${str(round(v_nominal, 4))},
%endif
%if ReC is not None:
ReC = ${str(round(ReC, 4))},
%endif
%if roughness is not None:
roughness = ${str(round(roughness, 4))},
%endif
%if m_flow_nominal is not None:
m_flow_nominal = ${str(round(m_flow_nominal, 4))},
%endif
%if m_flow_small is not None:
m_flow_small = ${str(round(m_flow_small, 4))},
%endif
%if cPip is not None:
cPip = ${str(round(cPip, 4))},
%endif
%if rhoPip is not None:
rhoPip = ${str(round(rhoPip, 4))},
%endif
%if thickness is not None:
thickness = ${str(round(thickness, 4))},
%endif
%if T_start_in is not None:
T_start_in = ${str(round(T_start_in, 4))},
%endif
%if T_start_out is not None:
T_start_out = ${str(round(T_start_out, 4))},
%endif
%if initDelay is not None:
initDelay = ${str(round(initDelay, 4))},
%endif
%if m_flow_start is not None:
m_flow_start = ${str(round(m_flow_start, 4))},
%endif
%if R is not None:
R = ${str(round(R, 4))},
%endif
%if fac is not None:
fac = ${str(round(fac, 4))},
%endif
%if sum_zetas is not None:
sum_zetas = ${str(round(sum_zetas, 4))},
%endif
%if linearized is not None:
linearized = ${str(round(linearized, 4))},
%endif
%if CPip is not None:
CPip = ${str(round(CPip, 4))},
%endif
%if VEqu is not None:
VEqu = ${str(round(VEqu, 4))},
%endif
%if sta_default is not None:
sta_default = ${str(round(sta_default, 4))},
%endif
%if cp_default is not None:
cp_default = ${str(round(cp_default, 4))},
%endif
%if C is not None:
C = ${str(round(C, 4))},
%endif
%if rho_default is not None:
rho_default = ${str(round(rho_default, 4))},
%endif
%if m_flow_nominal is not None:
m_flow_nominal = ${str(round(m_flow_nominal, 4))},
%endif
%if m_flow_small is not None:
m_flow_small = ${str(round(m_flow_small, 4))},
%endif
%if show_T is not None:
show_T = ${str(round(show_T, 4))},
%endif
%if _m_flow_start is not None:
_m_flow_start = ${str(round(_m_flow_start, 4))},
%endif
%if _dp_start is not None:
_dp_start = ${str(round(_dp_start, 4))},
%endif
%if allowFlowReversal is not None:
allowFlowReversal = ${str(round(allowFlowReversal, 4))},
%endif
length = ${str(round(length, 4))},
dIns = ${str(round(dIns, 4))},
kIns = ${str(round(kIns, 4))}
)
annotation(Placement(transformation(
extent={{-2,-2},{2,2}},
rotation=0,
origin={${str(round(x, 4))},${str(round(y, 4))}})));
<%def name="get_main_parameters()">
length dIns kIns
</%def><%def name="get_aux_parameters()">
use_zeta from_dp dh v_nominal ReC roughness m_flow_nominal m_flow_small cPip rhoPip thickness T_start_in T_start_out initDelay m_flow_start R fac sum_zetas linearized CPip VEqu sta_default cp_default C rho_default m_flow_nominal m_flow_small show_T _m_flow_start _dp_start allowFlowReversal
</%def><%def name="get_connector_names()">

</%def>'

Big bug about it is that m_flow_nominal is in there twice and allowFlowReversal is of boolean type resulting in at least 2 errors:

  1. Dymola cant process m_flow_nominal since there is a duplicant
  2. Dymola will throw an error about wrong type of alloFlowReversal since python casts its to either 0 or 1 with the mako above

Possible solution

Replace templates with new version that can be created with the new version of uesgraphs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant