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

Update compat and dependencies #77

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
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
36 changes: 0 additions & 36 deletions .github/workflows/CI.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/runtests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- "1.x"
os:
- ubuntu-latest
arch:
- x64

steps:
- uses: actions/checkout@v4

- uses: julia-actions/setup-julia@latest

- uses: julia-actions/cache@v1

- name: Add FuseRegistry
run: |
rm -rf ~/.julia/registries/FuseRegistry
julia -e 'using Pkg; Pkg.Registry.add(RegistrySpec(url="https://github.com/ProjectTorreyPines/FuseRegistry.jl.git")); Pkg.Registry.add("General"); Pkg.Registry.update()'

- name: Replace git@github.com with https in Package.toml files
run: |
find ~/.julia/registries/FuseRegistry -type f -name 'Package.toml' -exec sed -i 's|git@github.com:|https://project-torrey-pines:${{secrets.PTP_READ_TOKEN}}@github.com/|g' {} +

- name: Install dependencies
run: |
julia -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
'

- uses: julia-actions/julia-buildpkg@v1

- uses: julia-actions/julia-runtest@v1
22 changes: 13 additions & 9 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@ OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
XSteam = "95ff35a0-be81-11e9-2ca3-5b4e338e8476"

[compat]
ModelingToolkit = "<9.11,^9.16"
XSteam = "99"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
DifferentialEquations = "7"
GeometryBasics = "0.4"
Graphs = "1"
LayeredLayouts = "0.2"
MetaGraphs = "0.7"
ModelingToolkit = "9 - 9.10, 9.16"
NonlinearSolve = "3"
OrdinaryDiffEq = "6"
Plots = "1"
Statistics = "1"
Symbolics = "5"
Unitful = "1"
XSteam = "0.4.0"
7 changes: 3 additions & 4 deletions docs/docutils.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Pkg
using Revise
using Printf
using DelimitedFiles

Expand All @@ -20,7 +19,7 @@ function extract_docstrings(file_path::AbstractString)

# Extract function names using a regular expression
reg=r"\"\"\"\n\s*(.*)\s*DOCSTRING\n([\s\S]*?)\"\"\"";

matches = [ea.captures for ea in eachmatch(reg,content)];
matches = string.(permutedims(hcat(matches...)))

Expand Down Expand Up @@ -186,7 +185,7 @@ function generate_utiltxt(filename::String,file_path::AbstractString)
touch(txtpath)
write(txtpath,html)
end
"""
"""
buildhtml(filref)


Expand All @@ -196,7 +195,7 @@ end
"""
function buildhtml(fileref)
@printf "Building html file for : %s \n" fileref

# @printf "Active directory : %s \n" splitdir(pwd())[end]

prefixpath = "docs/tmpl/prefix.txt";
Expand Down
20 changes: 10 additions & 10 deletions src/ODE_Systems/01-Incompressible.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# module ThermoIncompressible
using ModelingToolkit, Plots, Revise, Symbolics, Logging
using ModelingToolkit, Plots, Symbolics, Logging
using Printf
using Plots
# NonlinearSolve, DifferentialEquations, #CoolProp,
Expand Down Expand Up @@ -29,7 +29,7 @@ propDict = Dict(Lcpfunc => cppb, Lvfunc => vpb, Lsfunc => spb, Lhfunc => hpb)
IncompressiblePin(; name, Pdef = 50, Tdef = 555, ṁdef = 0.0)

DOCSTRING
Incompresible Fluid pin,
Incompresible Fluid pin,
across_var = @variables P(t) = Pdef T(t) = Tdef s(t) = 1.0 cp(t) = 187 v(t) = 0.001
thru_var = @variables ṁ(t) = ṁdef Φ(t) = 1.0 # mass flow and energy flow
sts = [T, P, ṁ, cp, s, v, Φ]
Expand Down Expand Up @@ -134,7 +134,7 @@ Oneport element for connecting single port components
ELEM TYPE: PORT
EQUATIONS:
LHS ~ p.Φ + n.Φ # conservation of energy
0 ~ p.ṁ + n.ṁ # mass flow
0 ~ p.ṁ + n.ṁ # mass flow
ΔP ~ n.P - p.P # pressure drop
ΔT ~ n.T - p.T # Temerature change
INPUTS
Expand All @@ -148,7 +148,7 @@ function IncompressibleOnePort(; name)

eqs = [
LHS ~ p.Φ + n.Φ # conservation of energy
0 ~ p.ṁ + n.ṁ # mass flow
0 ~ p.ṁ + n.ṁ # mass flow
ΔP ~ n.P - p.P
ΔT ~ n.T - p.T
]
Expand Down Expand Up @@ -391,7 +391,7 @@ Basic heat transfer port. Includes p,n ports for flow, and q which is a heat tra
ELEM TYPE: COMPONENT
EQUATIONS:
0 ~ p.ṁ + n.ṁ # p.ṁ ~ n.ṁ # conservation of mass
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
C ~ p.ṁ * p.cp # duty
0 ~ q.Q̇ - Q̇
n.T ~ p.T + q.Q̇ / C
Expand All @@ -408,7 +408,7 @@ function IncompressibleHeatTransfer(; name)

eqs = [
0 ~ p.ṁ + n.ṁ # p.ṁ ~ n.ṁ # conservation of mass
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
C ~ p.ṁ * p.cp # duty
0 ~ q.Q̇ - Q̇
n.T ~ p.T + q.Q̇ / C
Expand Down Expand Up @@ -442,7 +442,7 @@ EQUATIONS:
ṁ ~ q.Q̇ / ((n.T - p.T) * p.cp) # q = mcp*ΔT
p.ṁ ~ ṁ
0 ~ p.ṁ + n.ṁ # p.ṁ ~ n.ṁ # conservation of mass
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
C ~ ṁ * p.cp # duty
0 ~ q.Q̇ - Q̇
n.P ~ p.P - ΔP
Expand All @@ -463,7 +463,7 @@ function FlowControlIncompressibleHeatTransfer(; name, ΔP = 0.0, Tout = 1000.0)
ṁ ~ q.Q̇ / ((n.T - p.T) * p.cp) # q = mcp*ΔT
p.ṁ ~ ṁ
0 ~ p.ṁ + n.ṁ # p.ṁ ~ n.ṁ # conservation of mass
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
C ~ ṁ * p.cp # duty
0 ~ q.Q̇ - Q̇
n.P ~ p.P - ΔP
Expand Down Expand Up @@ -593,7 +593,7 @@ function IdealCooler(; name)
eqs = [
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
0 ~ p.ṁ + n.ṁ
n.P ~ p.P # no pressure
n.P ~ p.P # no pressure
q.Q̇ ~ p.ṁ * p.cp * (n.T - p.T)
Q̇ ~ q.Q̇
]
Expand Down Expand Up @@ -644,7 +644,7 @@ for pin in pins[2:end]
end

INPUTS
pins..., a set of pins from components in which to apply conservation laws too
pins..., a set of pins from components in which to apply conservation laws too
"""
function incompressible_connect(pins...)

Expand Down
32 changes: 16 additions & 16 deletions src/ODE_Systems/01-MultiPhase.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# module ThermoSteam
using ModelingToolkit, Revise, Unitful, Symbolics, Logging, Printf, XSteam # Unitful
using ModelingToolkit, Unitful, Symbolics, Logging, Printf, XSteam # Unitful
# using DifferentialEquations

@variables t
Expand Down Expand Up @@ -387,8 +387,8 @@ n.P ~ P
p.P ~ P
n.h ~ stm_hsatfunc(P)
p.h ~ n.h
p.Φ ~ 0
0 ~ n.ṁ + p.ṁ
p.Φ ~ 0
0 ~ n.ṁ + p.ṁ
0 ~ n.Φ + p.Φ
INPUTS
- name: Name of the system, symbol. Or use the @named macro when initializing.
Expand Down Expand Up @@ -480,7 +480,7 @@ EQUATIONS:
p.P ~ P
n.P ~ p.P
n.h ~ p.h
0 ~ p.Φ + n.Φ
0 ~ p.Φ + n.Φ
0 ~ p.ṁ + n.ṁ
INPUTS
- name: Name of the system, symbol. Or use the @named macro when initializing.
Expand Down Expand Up @@ -508,7 +508,7 @@ DOCSTRING

ELEM TYPE: SOURCE
EQUATIONS:
0 ~ p.Φ + n.Φ
0 ~ p.Φ + n.Φ
0 ~ p.ṁ + n.ṁ
p.ṁ ~ Ṁ
p.h ~ n.h
Expand Down Expand Up @@ -540,7 +540,7 @@ DOCSTRING

ELEM TYPE: UTILITY
EQUATIONS:
0 ~ p.Φ + n.Φ
0 ~ p.Φ + n.Φ
0 ~ p.ṁ + n.ṁ
p.ṁ ~ Ṁ
p.h ~ n.h
Expand Down Expand Up @@ -571,7 +571,7 @@ DOCSTRING

ELEM TYPE: UTILITY
EQUATIONS:
0 ~ p.Φ + n.Φ
0 ~ p.Φ + n.Φ
0 ~ p.ṁ + n.ṁ
p.ṁ ~ ṁ
p.h ~ n.h
Expand Down Expand Up @@ -608,9 +608,9 @@ ps = @parameters η = η P = Pout

ELEM TYPE: COMPONENT
EQUATIONS:
w.Ẇ ~ p.Φ + n.Φ
w.Ẇ ~ p.Φ + n.Φ
0 ~ p.ṁ + n.ṁ
n.h ~ p.h + p.v * 1e5 * (n.P - p.P) / η
n.h ~ p.h + p.v * 1e5 * (n.P - p.P) / η
w.Ẇ ~ p.ṁ * (n.h - p.h)
INPUTS
- name: Name of the system, symbol. Or use the @named macro when initializing.
Expand Down Expand Up @@ -805,8 +805,8 @@ DOCSTRING

ELEM TYPE: COMPONENT
EQUATIONS:
0 ~ p.ṁ + n.ṁ
q.Q̇ ~ p.Φ + n.Φ
0 ~ p.ṁ + n.ṁ
q.Q̇ ~ p.Φ + n.Φ
C ~ p.ṁ * stm_cphfunc(p.P, p.h) # * 1000
0 ~ q.Q̇ - Q̇
n.h ~ p.h + q.Q̇ / (p.ṁ)
Expand All @@ -821,7 +821,7 @@ function SteamHeatTransfer(; name)
st = @variables Q̇(t) = 1.0 C(t) = 4000
eqs = [
0 ~ p.ṁ + n.ṁ # p.ṁ ~ n.ṁ # conservation of mass
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
C ~ p.ṁ * stm_cphfunc(p.P, p.h) # * 1000 # duty T/h = cp
0 ~ q.Q̇ - Q̇
n.h ~ p.h + q.Q̇ / (p.ṁ)
Expand All @@ -839,7 +839,7 @@ DOCSTRING
ELEM TYPE: COMPONENT
EQUATIONS:
0 ~ p.ṁ + n.ṁ # p.ṁ ~ n.ṁ # conservation of mass
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
C ~ p.ṁ * stm_cphfunc(p.P, p.h) # * 1000 # duty T/h = cp
0 ~ q.Q̇ - Q̇in
n.h ~ p.h + q.Q̇ / (p.ṁ)
Expand All @@ -856,7 +856,7 @@ function TunableSteamHeatTransfer(; name, Q̇in = 150e6)
st = @variables C(t) = 4000
eqs = [
0 ~ p.ṁ + n.ṁ # p.ṁ ~ n.ṁ # conservation of mass
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
q.Q̇ ~ p.Φ + n.Φ # conservation of energy
C ~ p.ṁ * stm_cphfunc(p.P, p.h) # * 1000 # duty T/h = cp
0 ~ q.Q̇ - Q̇in
n.h ~ p.h + q.Q̇ / (p.ṁ)
Expand Down Expand Up @@ -974,8 +974,8 @@ DOCSTRING

ELEM TYPE: COMPONENT
EQUATIONS:
n.ṁ + p.ṁ ~ 0
q.Q̇ ~ p.Φ + n.Φ
n.ṁ + p.ṁ ~ 0
q.Q̇ ~ p.Φ + n.Φ
INPUTS
- name: Name of the system, symbol. Or use the @named macro when initializing.
- `pressurecontrol = false`: DESCRIPTION
Expand Down
Loading
Loading