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

Binding equations for variables of PartialEffectiveness #1102

Closed
Mathadon opened this issue Feb 21, 2019 · 3 comments
Closed

Binding equations for variables of PartialEffectiveness #1102

Mathadon opened this issue Feb 21, 2019 · 3 comments

Comments

@Mathadon
Copy link
Member

Mathadon commented Feb 21, 2019

The equations in IDEAS.Fluid.HeatExchangers.BaseClasses.PartialEffectiveness are currently defined as

  /////////////////////////////////////////////////////////
  // Definitions for heat transfer effectiveness model
  T_in1 = if allowFlowReversal1 then 
    fra_a1 * Medium1.temperature(state_a1_inflow) + fra_b1 * Medium1.temperature(state_b1_inflow) else 
    Medium1.temperature(state_a1_inflow);
  T_in2 = if allowFlowReversal2 then 
    fra_a2 * Medium2.temperature(state_a2_inflow) + fra_b2 * Medium2.temperature(state_b2_inflow) else 
    Medium2.temperature(state_a2_inflow);

  C1_flow = abs(m1_flow)*
    ( if allowFlowReversal1 then 
           fra_a1 * Medium1.specificHeatCapacityCp(state_a1_inflow) +
           fra_b1 * Medium1.specificHeatCapacityCp(state_b1_inflow) else 
        Medium1.specificHeatCapacityCp(state_a1_inflow));
  C2_flow = abs(m2_flow)*
    ( if allowFlowReversal2 then 
           fra_a2 * Medium2.specificHeatCapacityCp(state_a2_inflow) +
           fra_b2 * Medium2.specificHeatCapacityCp(state_b2_inflow) else 
        Medium2.specificHeatCapacityCp(state_a2_inflow));
  CMin_flow = min(C1_flow, C2_flow);

  // QMax_flow is maximum heat transfer into medium 1
  QMax_flow = CMin_flow*(T_in2 - T_in1);

It's possible to move these equations to the variable declarations:

  Medium1.Temperature T_in1 = if allowFlowReversal1 then 
    fra_a1 * Medium1.temperature(state_a1_inflow) + fra_b1 * Medium1.temperature(state_b1_inflow) else 
    Medium1.temperature(state_a1_inflow); "Inlet temperature medium 1";
  Medium2.Temperature T_in2 = if allowFlowReversal2 then 
    fra_a2 * Medium2.temperature(state_a2_inflow) + fra_b2 * Medium2.temperature(state_b2_inflow) else 
    Medium2.temperature(state_a2_inflow) "Inlet temperature medium 2";
  Modelica.SIunits.ThermalConductance C1_flow = abs(m1_flow)*
    ( if allowFlowReversal1 then 
           fra_a1 * Medium1.specificHeatCapacityCp(state_a1_inflow) +
           fra_b1 * Medium1.specificHeatCapacityCp(state_b1_inflow) else 
        Medium1.specificHeatCapacityCp(state_a1_inflow))
    "Heat capacity flow rate medium 1";
  Modelica.SIunits.ThermalConductance C2_flow = abs(m2_flow)*
    ( if allowFlowReversal2 then 
           fra_a2 * Medium2.specificHeatCapacityCp(state_a2_inflow) +
           fra_b2 * Medium2.specificHeatCapacityCp(state_b2_inflow) else 
        Medium2.specificHeatCapacityCp(state_a2_inflow))
    "Heat capacity flow rate medium 2";
  Modelica.SIunits.ThermalConductance CMin_flow(min=0)= min(C1_flow, C2_flow)
    "Minimum heat capacity flow rate";
  Modelica.SIunits.HeatFlowRate QMax_flow = CMin_flow*(T_in2 - T_in1)
    "Maximum heat flow rate into medium 1";

This allows the developer to overwrite the assignments when extending the model, and I think that the symbolic processing becomes easier since the variable already has an explicit equation.

@icupeiro and I could use this to extend the partial for a fan coil model where we want to modify how C1_flow is computed. Otherwise we'd have to duplicate the partial and modify the equation there. Can we modify the implementation in this way?

@mwetter
Copy link
Contributor

mwetter commented Feb 21, 2019

It is fine to move these equations to the declarations.

In general, I think it would be easier for the user to understand the model if these models were implemented using graphical blocks for the calculations.

Also, if you like to share the fan coil model with IBPSA, we would also have need for such a model.

@Mathadon
Copy link
Member Author

@mwetter, @icupeiro I propose that we finish the model first and then see whether we merge it in IDEAS first or merge it through IBPSA.

Mathadon added a commit that referenced this issue Feb 21, 2019
mwetter added a commit that referenced this issue Feb 22, 2019
revised implementation of PartialEffectivess for #1102
@mwetter
Copy link
Contributor

mwetter commented May 3, 2019

Closed as this has been merged to the master, see above.

@mwetter mwetter closed this as completed May 3, 2019
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

2 participants