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

fix: change HeatPort to allow changing the guess #347

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading