Skip to content

Commit

Permalink
Merge pull request #347 from avinashresearch1/avi/heatport_function_c…
Browse files Browse the repository at this point in the history
…onstructor

fix: change HeatPort to allow changing the guess
  • Loading branch information
ChrisRackauckas authored Nov 26, 2024
2 parents e41dcfc + cd12a18 commit c351837
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/Thermal/utils.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
@connector HeatPort begin
T(t), [guess = 273.15 + 20.0]
Q_flow(t), [guess = 0.0, connect = Flow]
@connector function HeatPort(; T = nothing, T_guess = 273.15 + 20, Q_flow = nothing, Q_flow_guess = 0.0, name)
pars = @parameters begin
T_guess = T_guess
Q_flow_guess = Q_flow_guess
end
vars = @variables begin
T(t) = T, [guess = T_guess]
Q_flow(t) = Q_flow, [guess = Q_flow_guess, connect = Flow]
end
return ODESystem(Equation[], t, vars, pars; name)
end
Base.@doc """
HeatPort(; name, T = 273.15 + 20.0, Q_flow = 0.0)
HeatPort(; T = nothing, T_guess = 273.15 + 20, Q_flow = nothing, Q_flow_guess = 0.0, name)
Port for a thermal system.
# Parameters:
- `T_guess`: [K] Initial guess for the temperature of the port (set to 273.15 + 20).
- `Q_flow_guess`: [W] Initial guess for the heat flow rate at the port (set to 0.0).
# States:
- `T`: [K] Temperature of the port. It accepts an initial value, which defaults to 273.15 + 20.
- `Q_flow`: [W] Heat flow rate at the port. It accepts an initial value, which defaults to 0.0.
- `T`: [K] Temperature of the port. Guess set to `T_guess`. Passing a value for `T` will set its default.
- `Q_flow`: [W] Heat flow rate at the port. Guess set to `Q_flow_guess`. Passing a value for `Q_flow` will set its default.
""" HeatPort

"""
Expand Down

0 comments on commit c351837

Please sign in to comment.