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

ISAT models #2576

Open
wants to merge 290 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 102 commits
Commits
Show all changes
290 commits
Select commit Hold shift + click to select a range
3028548
fix a few typos and add OpenModelica/compareVars files for ISAT cases
xuhan425 May 29, 2020
e913c4a
fixed formatting
caryfaulkner Jun 12, 2020
047769d
updated formatting
caryfaulkner Jun 12, 2020
fb81df6
fixed formatting
caryfaulkner Jun 12, 2020
72315e6
Fixed formatting
caryfaulkner Jun 12, 2020
0b54f6c
Fixed formatting
caryfaulkner Jun 12, 2020
6f1730f
Fixed formatting
caryfaulkner Jun 12, 2020
8f6962a
Fixed formatting
caryfaulkner Jun 12, 2020
cdaa3fc
Fixed formatting
caryfaulkner Jun 12, 2020
90cf233
updated libraries with latest codes
caryfaulkner Jun 12, 2020
bdf1bee
Added tutorial for using ISAT sensors
caryfaulkner Jun 12, 2020
ac79bd8
Fixed formatting
caryfaulkner Jun 12, 2020
0bc8c5c
Fixed formatting
caryfaulkner Jun 13, 2020
35e4cbb
Merge pull request #9 from caryfaulkner/Jianjun-comments
xuhan425 Jun 30, 2020
5324632
revise isat source codes and add an isat case with exterior walls
xuhan425 Jul 13, 2020
7668a18
fix a few bugs and update isat source codes
xuhan425 Jul 13, 2020
1006b71
Updated 32 bit Windows libraries
caryfaulkner Jul 15, 2020
3f10d9f
Added 64 bit Windows libraries
caryfaulkner Jul 15, 2020
6abb0df
Added documentation for ForcedConvectionWithExteriorWall case
caryfaulkner Jul 15, 2020
60802f1
Updated ISAT library for Linux
caryfaulkner Jul 15, 2020
f40dda7
Updated reference results
caryfaulkner Jul 15, 2020
6b1f94c
Merge remote-tracking branch 'origin/update-codes' into update-codes
caryfaulkner Jul 15, 2020
7445573
Merge pull request #10 from caryfaulkner/update-codes
xuhan425 Jul 16, 2020
5ba070d
Add more explanations for ISAT model and examples
xuhan425 Jul 17, 2020
3ae8197
Merge remote-tracking branch 'origin/update-codes' into update-codes
caryfaulkner Jul 20, 2020
0ad4ec6
Fixed error with ISAT library in Linux
caryfaulkner Jul 20, 2020
b5cf8e0
Merge pull request #11 from caryfaulkner/update-codes
xuhan425 Jul 20, 2020
bfbc7f9
updated libraries using free compilers
caryfaulkner Oct 6, 2020
39aad7d
added license acknowledgements
caryfaulkner Oct 6, 2020
7076d77
moved Linux items to Linux folder
caryfaulkner Oct 6, 2020
b641dba
added folders for specific Linux and MinGW files
caryfaulkner Oct 6, 2020
d7f139c
added error for 32 bit compilation
caryfaulkner Oct 6, 2020
da290dc
Updated makefile
caryfaulkner Oct 6, 2020
5a0c5f9
Updated user guide to add information on compiling
caryfaulkner Oct 7, 2020
a993dbb
Merge pull request #12 from caryfaulkner/cary-compile
xuhan425 Oct 8, 2020
6a6a2aa
Updated CMake input file
caryfaulkner Oct 13, 2020
2c8e13d
removed old 32 bit ISAT libraries
caryfaulkner Oct 13, 2020
c01d95f
Merge pull request #13 from caryfaulkner/cary-compile
xuhan425 Oct 19, 2020
bc6a63f
Updated user guide removing the statement that a Fortran compiler is …
caryfaulkner Nov 3, 2020
4ef1276
removed unnecessary files
caryfaulkner Nov 3, 2020
216939d
updated FFD libraries
caryfaulkner Nov 4, 2020
8d6fb0e
updated FFD libraries
caryfaulkner Nov 4, 2020
50f85f9
updated reference results
caryfaulkner Nov 4, 2020
3bb05f4
Merge remote-tracking branch 'origin/issue1413_isat' into issue1413_i…
caryfaulkner Nov 4, 2020
8a34bcd
Added Release Notes Version 8
caryfaulkner Nov 4, 2020
97d5861
Merge pull request #14 from caryfaulkner/issue1413_isat_cary
xuhan425 Nov 5, 2020
8a15e42
Merge pull request #1950 from xuhan425/issue1413_isat_xuhan
JayHuLBL Nov 5, 2020
4ce2656
merged master [ ci skip]
JayHuLBL Jul 21, 2021
7df3ecf
solved conflicts [ci skip]
JayHuLBL Jul 21, 2021
6cb64b5
reverted reference data [ci skip]
JayHuLBL Jul 22, 2021
1010dc9
updated reference [ci skip]
JayHuLBL Jul 22, 2021
30de536
added release note
JayHuLBL Jul 22, 2021
f800549
corrected html error [ci skip]
JayHuLBL Jul 26, 2021
e95e39f
Merge branch 'master' into issue1413_isat
JayHuLBL Jul 26, 2021
0e65bec
corrected package order
JayHuLBL Jul 26, 2021
182bed6
moved classes out of the package.mo file [ci skip]
JayHuLBL Jul 27, 2021
84a1130
added ISAT model to exclude list for OCT tests
JayHuLBL Jul 27, 2021
1704f04
solved conflict
JayHuLBL Aug 13, 2021
1a128e5
merged master
JayHuLBL Oct 25, 2021
a43cbaa
deleted lat assignment
JayHuLBL Oct 25, 2021
e2ee8ce
updated reference results
JayHuLBL Oct 26, 2021
8de2661
Merge branch 'master' into issue1413_isat
JayHuLBL Oct 26, 2021
4afa44d
Fixed typo
mwetter Oct 28, 2021
1b39c96
Fixed layout
mwetter Oct 28, 2021
8de644d
Removed tab
mwetter Oct 28, 2021
89b741c
Changed message [ci skip]
mwetter Oct 28, 2021
b1c3822
Fixed white-spaces [ci skip]
mwetter Oct 28, 2021
7927917
Updated script [ci skip]
mwetter Oct 28, 2021
b92373f
Updated script
mwetter Oct 28, 2021
94895e8
Deleted misplaced files
mwetter Oct 28, 2021
cd58cad
Fixed typo in comment
mwetter Oct 28, 2021
59c9f35
Reverted change in format
mwetter Oct 28, 2021
b6c2c5a
Removed diagnostic message
mwetter Oct 28, 2021
4c665d8
Made internal functions protected
mwetter Oct 28, 2021
7544e5c
Corrected comment
mwetter Oct 28, 2021
15bc343
Corrected comments
mwetter Oct 29, 2021
116913d
Refactored ISAT and FFD to reduce complexity
mwetter Oct 29, 2021
24f193c
Changed controller to use CDL
mwetter Oct 29, 2021
ba9c081
Removed white space
mwetter Oct 29, 2021
682f95a
Reset mode
mwetter Oct 29, 2021
7d7338d
Merge changes from Head
caryfaulkner Nov 12, 2021
1ea924c
added checks if pointer is NULL for each malloc call
caryfaulkner Nov 12, 2021
89589d8
fix roo.air.heaPorAir.T constant value issue in isat C codes
xuhan425 Dec 28, 2021
bc1e4c5
add pretraining feature in isat C codes
xuhan425 Dec 29, 2021
5738ce0
replace isat forcedconvection cases with a mixedconvection case
xuhan425 Dec 29, 2021
94620e4
add isat mixed convection with exterior wall case
xuhan425 Dec 29, 2021
bb83300
update isat input files for isat cases
xuhan425 Dec 29, 2021
97cc1a8
update documentation for the isat MixedConvectionWithExteriorWall case
xuhan425 Dec 29, 2021
14089a3
update documentation and settings for the isat model and cases
xuhan425 Dec 29, 2021
01a8c42
update scripts for isat cases
xuhan425 Dec 29, 2021
0960648
reformatting initialization of parameter haveSensor for CFD and ISAT …
xuhan425 Dec 29, 2021
23daf75
fix a bug in cosimulation.c
xuhan425 Jan 3, 2022
0fcb1f8
added final declarations and updated annotation
caryfaulkner Jan 5, 2022
b046a88
updated annotation
caryfaulkner Jan 5, 2022
d4d5f5b
added </p>
caryfaulkner Jan 5, 2022
186025e
moved public declaration before protected declarations
caryfaulkner Jan 5, 2022
4472c2d
Merge pull request #3 from xuhan425/issue1413_isat_xuhan
caryfaulkner Jan 5, 2022
484f16d
fix a bug in ffd_isat.c for reading existing data
xuhan425 Jan 6, 2022
d7388bb
Merge pull request #4 from xuhan425/issue1413_isat_xuhan
caryfaulkner Jan 6, 2022
94aca61
fix a bug in allocating memory for isat variables
xuhan425 Jan 10, 2022
8369b4f
Merge pull request #5 from xuhan425/issue1413_isat_xuhan
caryfaulkner Jan 10, 2022
fa0c9f5
merged master
JayHuLBL Jan 11, 2022
073b4df
corrected incorrected text
JayHuLBL Jan 11, 2022
294f758
recompiled ISAT library for linux
caryfaulkner Jan 11, 2022
1d0e37c
Updated reference results
caryfaulkner Jan 11, 2022
fdd54f0
Recompiled isat library for Windows
caryfaulkner Jan 11, 2022
470e35b
Updated reference results
caryfaulkner Jan 11, 2022
f1972d3
merge branch
caryfaulkner Jan 11, 2022
9adb859
Added revision note
caryfaulkner Jan 12, 2022
e263cb3
Added info strings for functions
caryfaulkner Jan 12, 2022
82a6474
Fixed formatting to avoid long lines
caryfaulkner Jan 12, 2022
ce47a6c
Fixed documentation formatting
caryfaulkner Jan 12, 2022
a9420ec
Fixed documentation formatting
caryfaulkner Jan 12, 2022
2252939
Fixed documentation formatting
caryfaulkner Jan 12, 2022
ea5b51b
improved formatting
caryfaulkner Jan 12, 2022
0428842
added comment
caryfaulkner Jan 12, 2022
781363f
improved formatting
caryfaulkner Jan 12, 2022
e351b9d
fixed formatting
caryfaulkner Jan 12, 2022
12ba426
Added return -1 if an error occurs
caryfaulkner Jan 13, 2022
673faef
fetched changes from linux version
caryfaulkner Jan 13, 2022
739b5b3
Added return -1 if an error occurs
caryfaulkner Jan 13, 2022
0060ff6
changed file permission
JayHuLBL Jan 14, 2022
1803d2e
Merge remote-tracking branch 'origin/issue1413_isat' into issue1413_i…
caryfaulkner Jan 14, 2022
7b0f87b
recompiled library in Ubuntu 20.04
caryfaulkner Feb 1, 2022
cdf2365
merged changes
caryfaulkner Mar 11, 2022
3a51872
merged master
JayHuLBL Nov 18, 2022
e246a53
corrected experiment setup
JayHuLBL Nov 18, 2022
2fc3243
Fixed formatting issue
caryfaulkner Nov 21, 2022
2363366
Fixed formatting
caryfaulkner Nov 21, 2022
7df64a9
Added gfortran to makefile
caryfaulkner Nov 21, 2022
808eff5
Fixed formatting
caryfaulkner Nov 21, 2022
8a6243f
Fixed merge conflict
caryfaulkner Nov 21, 2022
661b756
Merge remote-tracking branch 'origin/issue1413_isat_WetterComments' i…
caryfaulkner Nov 21, 2022
5bf2b1d
Fixed merge conflict
caryfaulkner Feb 21, 2023
7237de2
Merge pull request #2855 from caryfaulkner/issue1413_isat_WetterComments
JayHuLBL May 16, 2023
539809c
merged master
JayHuLBL May 16, 2023
66dc93d
resovled conflicts
JayHuLBL May 16, 2023
db36bfb
updated release note
JayHuLBL May 16, 2023
9a44de7
reverted changes
JayHuLBL May 16, 2023
2d46c55
improved html documentation
JayHuLBL May 16, 2023
8f75f31
corrected mos script
JayHuLBL May 16, 2023
ea121d3
merged master
JayHuLBL Oct 20, 2023
a39c753
corrected mos path
JayHuLBL Oct 20, 2023
526a481
corrected syntex [ci skip]
JayHuLBL Oct 20, 2023
1c6877f
corrected html format
JayHuLBL Oct 20, 2023
31e08c3
removed obsolete OMS [ci skip]
JayHuLBL Oct 20, 2023
18742fc
reduced simulation time
JayHuLBL Oct 25, 2023
5df7e33
fixed missing value assignment in ffd code
JayHuLBL Nov 1, 2023
6a7b8c5
merged master
JayHuLBL Nov 1, 2023
c24af07
added indent [ci skip]
JayHuLBL Nov 6, 2023
68ac778
addressed missing initial output value assignment
JayHuLBL Nov 6, 2023
0aad160
corrected missing initial output assignment
JayHuLBL Nov 7, 2023
00b0dd0
changed file permission
JayHuLBL Nov 7, 2023
30f7382
added exceptions to configuration file
JayHuLBL Nov 7, 2023
ae8f0b7
updated BEST results with Dymola 2023x_refresh1
JayHuLBL Nov 8, 2023
f9b5ec8
added FFD.Tutorial.MixedConvectionWithBox to omc exclusion list
JayHuLBL Nov 8, 2023
40f80ad
added FFD.Tutorial.MixedConvectionWithBox to optimica exclusion list
JayHuLBL Nov 8, 2023
1186542
reverted BESTEST changes
JayHuLBL Nov 10, 2023
4ae7004
reverted unnecessary changes
JayHuLBL Nov 10, 2023
29913a4
increased time out to 600 seconds for the FFD models
JayHuLBL Nov 14, 2023
b0293a0
updated isat library
JayHuLBL Nov 14, 2023
9b6488c
changed file permisson
JayHuLBL Nov 14, 2023
7e0db8e
improved html format
JayHuLBL Nov 15, 2023
21d6302
added lapack library installation to travis environment
JayHuLBL Nov 15, 2023
64ddc54
Merge branch 'master' into issue1413_isat
JayHuLBL Nov 21, 2023
8040b67
Merge branch 'master' into issue1413_isat
JayHuLBL Nov 23, 2023
142577e
added sudo
JayHuLBL Nov 23, 2023
0c76417
Merge branch 'master' into issue1413_isat
JayHuLBL Nov 27, 2023
b592cb3
increased timeout
JayHuLBL Nov 27, 2023
4d4ce43
added -pthread flag for compiling isat library
JayHuLBL Nov 29, 2023
78af9c5
changed isat library file permission
JayHuLBL Nov 29, 2023
0b18fe1
changed the -lpthread to -pthread
JayHuLBL Nov 29, 2023
e3a91c7
removed -lpthread flag as glibc 2.34 removed libpthread
JayHuLBL Nov 29, 2023
5586528
merged master [ci skip]
JayHuLBL Dec 21, 2023
b4aaf88
added missing comments
JayHuLBL Dec 22, 2023
a90ad9b
Merge branch 'master' into issue1413_isat
JayHuLBL Dec 22, 2023
088b081
Merge branch 'master' into issue1413_isat
JayHuLBL Jan 5, 2024
535ba6f
added back the -pthread flag, changed back the sampling time
JayHuLBL Jan 5, 2024
c1237ab
changed file permission
JayHuLBL Jan 5, 2024
e511004
Merge branch 'master' into issue1413_isat
JayHuLBL Jan 9, 2024
1ad6c20
removed the libisat.so file, will then add a new .so file [ci skip]
JayHuLBL Jan 9, 2024
d2c961c
added new libista.so file
JayHuLBL Jan 9, 2024
59f5cfb
Merge branch 'master' into issue1413_isat
JayHuLBL Mar 1, 2024
08f3adf
corrected plot size, addressed the extend
JayHuLBL Mar 4, 2024
c069a19
Merge branch 'master' into issue1413_isat
JayHuLBL Mar 12, 2024
c5842b3
Merge branch 'master' into issue1413_isat
JayHuLBL Mar 12, 2024
aad0921
updated the shared library to remove the link to lapack and pthread
JayHuLBL Mar 17, 2024
641d2ff
updated the shared libray: removed blas library, added pthread library
JayHuLBL Mar 18, 2024
5245b28
dummy commit [ci skip]
JayHuLBL Mar 18, 2024
f463ae4
added pthread
JayHuLBL Mar 18, 2024
0ddb729
Merge branch 'master' into issue1413_isat
JayHuLBL Mar 27, 2024
2f6e390
increased optimica time_out
JayHuLBL Mar 27, 2024
a7d973b
Dummy commit [ci skip]
JayHuLBL Mar 28, 2024
c1ec7d5
added pthread installation
JayHuLBL Mar 28, 2024
de0cef2
temporary limited the CI tests only for the ISAT models
JayHuLBL Mar 28, 2024
33a9612
merged master
JayHuLBL Apr 30, 2024
7a8c0f9
updated .so file
JayHuLBL Apr 30, 2024
c25802b
temporary disable other tests
JayHuLBL Apr 30, 2024
d2f8339
test commit, adding dependency installation in test-dymola
JayHuLBL May 1, 2024
6dfc8ef
changed compile flag
JayHuLBL May 2, 2024
1337f86
added blas and labpack library
JayHuLBL May 2, 2024
a9e74bf
error
JayHuLBL May 2, 2024
e3c0add
reverted error change
JayHuLBL May 2, 2024
2afcffa
changed the flag settings
JayHuLBL May 2, 2024
267c4b9
removed unnecessary dependencies installation
JayHuLBL May 2, 2024
01af499
changed function data type
JayHuLBL May 2, 2024
a496e71
dummy commit
JayHuLBL May 2, 2024
8902d25
renew the library file
JayHuLBL May 2, 2024
23469ea
Updated .so file for Ubuntu20
EttoreZ May 3, 2024
e8d1fe7
restored all tests, cleaned make file
JayHuLBL May 3, 2024
c34e141
added natural to exclusion list
JayHuLBL May 3, 2024
d6f9f59
added mixedConvectioWithBox to exclusion list
JayHuLBL May 3, 2024
3700fb0
enabled all the tests
JayHuLBL May 3, 2024
1ad2927
updated lapack lib [ci skip]
JayHuLBL May 3, 2024
699aca1
recompiled so file
EttoreZ May 3, 2024
81d6588
wrong commit
JayHuLBL May 3, 2024
c2a69a1
deleted temp files
JayHuLBL May 3, 2024
447f7d9
improved c code formats
JayHuLBL May 3, 2024
60d421d
enabled all tests
JayHuLBL May 3, 2024
8423416
added check if the memory allocation is successful
JayHuLBL May 3, 2024
4a4687e
added the isat licenses
JayHuLBL May 6, 2024
1d39de6
Updated libisat.so file on ubuntu 20
EttoreZ May 7, 2024
03de3ef
changed .so file permission
JayHuLBL May 7, 2024
6261641
added ISAT temp files to the gitignore list
JayHuLBL May 7, 2024
1c769b3
added isat temp file to the clean file list
JayHuLBL May 7, 2024
f07942b
raised modelica error when memory allocationn failed
JayHuLBL May 7, 2024
7beaac7
Updated libisat.so file on ubuntu 20
EttoreZ May 7, 2024
afdb282
changed file permission
JayHuLBL May 7, 2024
4e22339
added return 0. Without return value, OMC cannot run
JayHuLBL May 9, 2024
caef3a0
improved text format
JayHuLBL May 9, 2024
122adb8
fixed reference format, changed the sampling time
JayHuLBL May 10, 2024
83c0770
changed isat setttings
JayHuLBL May 10, 2024
128fcd5
increased sampling period
JayHuLBL May 10, 2024
7da35c3
Dummy commit [ci skip]
JayHuLBL May 10, 2024
22a2018
merged master [ci skip
JayHuLBL Jun 11, 2024
0ac152c
debug isat results [ci skip]
JayHuLBL Jun 12, 2024
0cf0b4e
debuging the isat results [ci skip]
JayHuLBL Jun 12, 2024
fd9c637
merged master
JayHuLBL Nov 11, 2024
35c2e2a
updated library
JayHuLBL Nov 11, 2024
1bccb6b
deleted extern
JayHuLBL Nov 11, 2024
41bc9e5
updated library [ci skip]
JayHuLBL Nov 11, 2024
2821279
changed file permission [ci skip]
JayHuLBL Nov 11, 2024
c377454
added function in head file
JayHuLBL Nov 11, 2024
be08091
updated library
JayHuLBL Nov 11, 2024
66ae450
changed file permission
JayHuLBL Nov 11, 2024
0f3657f
removed function in head file
JayHuLBL Nov 11, 2024
241fa59
changed permissoin [ci skip]
JayHuLBL Nov 11, 2024
61aebd9
removed section [ci skip]
JayHuLBL Nov 11, 2024
84ab8d9
changed permission [ci skip]
JayHuLBL Nov 11, 2024
6849f13
reverted back
JayHuLBL Nov 11, 2024
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
60 changes: 58 additions & 2 deletions Buildings/Resources/C-Sources/cfdExchangeData.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
* \author Wangda Zuo
* University of Miami
* [email protected]
* Xu Han
* University of Colorado Boulder
* [email protected]
*
* \date 8/3/2013
* \date 4/5/2020
*
*/
#include "cfdCosimulation.h"
Expand All @@ -33,7 +36,53 @@ int cfdExchangeData(double t0, double dt, double *u, size_t nU, size_t nY,

/*check if current modelica time equals to last time*/
/*if yes, it means cfdExchangeData() was called multiple times at one synchronization point, then directly return*/
if(abs(cosim->modelica->lt - t0) < 1E-6){
if(cosim->modelica->lt - t0 < 1E-6 && t0 - cosim->modelica->lt < 1E-6){
/****************************************************************************
| Copy data from CFD
****************************************************************************/
/* Get the temperature/heat flux for solid surface*/
for(i=0; i<cosim->para->nSur; i++) {
y[i] = cosim->ffd->temHea[i];
}

/* Get the averaged room temperature*/
y[i] = cosim->ffd->TRoo;
i++;

/* Get the temperature of shading device if there is a shading device*/
if(cosim->para->sha==1) {
for(j=0; j<cosim->para->nConExtWin; i++, j++) {
y[i] = cosim->ffd->TSha[j];
}
}

/* Get the temperature fluid at the fluid ports*/
for(j=0; j<cosim->para->nPorts; i++, j++) {
y[i] = cosim->ffd->TPor[j];
}

/* Get the mass fraction at fluid ports*/
for(j=0; j<cosim->para->nPorts; j++)
for(k=0; k<cosim->para->nXi; k++, i++) {
y[i] = cosim->ffd->XiPor[j][k];
}

/* Get the trace substance at fluid ports*/
for(j=0; j<cosim->para->nPorts; j++)
for(k=0; k<cosim->para->nC; k++, i++) {
y[i] = cosim->ffd->CPor[j][k];
}

/* Get the sensor data*/
for(j=0; j<cosim->para->nSen; j++, i++) {
y[i] = cosim->ffd->senVal[j];
}

/* Update the data status
cosim->ffd->flag = 0;*/

*t1 = cosim->ffd->t;

return 0;
}

Expand Down Expand Up @@ -75,6 +124,13 @@ int cfdExchangeData(double t0, double dt, double *u, size_t nU, size_t nY,
cosim->modelica->latentHeat = u[i];
i++;

if(cosim->para->nSou>0){
for(j=0; j<cosim->para->nSou; j++) {
cosim->modelica->sourceHeat[j] = u[i+j];
}
}
i = i + cosim->para->nSou;

cosim->modelica->p = u[i];
i++;

Expand Down
12 changes: 11 additions & 1 deletion Buildings/Resources/C-Sources/cfdSendStopCommand.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
void cfdSendStopCommand(void *thread) {

size_t i = 0;
size_t imax = 10000;
size_t imax = 1000000;

/*send stop command to FFD*/
cosim->para->flag = 0;
Expand Down Expand Up @@ -133,6 +133,16 @@ void cfdSendStopCommand(void *thread) {
if (cosim->ffd->temHea != NULL){
free(cosim->ffd->temHea);
}

if(cosim->para->nSou>0){
if (cosim->para->souName != NULL){
free(cosim->para->souName);
}
if (cosim->modelica->sourceHeat != NULL){
free(cosim->modelica->sourceHeat);
}
}

if (cosim->para != NULL){
free(cosim->para);
}
Expand Down
14 changes: 13 additions & 1 deletion Buildings/Resources/C-Sources/cfdStartCosimulation.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
int cfdStartCosimulation(char *cfdFilNam, char **name, double *A, double *til,
int *bouCon, int nPorts, char** portName, int haveSensor,
char **sensorName, int haveShade, size_t nSur, size_t nSen,
size_t nConExtWin, size_t nXi, size_t nC, double rho_start) {
size_t nConExtWin, size_t nXi, size_t nC, int haveSource, size_t nSou, char **sourceName, double rho_start) {
size_t i;
size_t nBou;

Expand All @@ -66,6 +66,18 @@ int cfdStartCosimulation(char *cfdFilNam, char **name, double *A, double *til,
cosim->para->nXi = nXi;
cosim->para->rho_start = rho_start;

cosim->para->Sou = haveSource;
cosim->para->nSou = nSou;

if(cosim->para->nSou>0){
cosim->para->souName = (char**) malloc(nSou*sizeof(char *));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After every call to malloc you need to check if the pointer is NULL, and if so, raise a ModelicaError

cosim->modelica->sourceHeat = (REAL *) malloc(nSou*sizeof(REAL));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for pointer cosim->modelica->sourceHeat to be not NULL

for(i=0; i<nSou; i++) {
cosim->para->souName[i] = (char *)malloc(sizeof(char)*(strlen(sourceName[i])+1));
strcpy(cosim->para->souName[i], sourceName[i]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for pointer cosim->para->souName[i] to be not NULL

}
}

nBou = nSur + nPorts;

cosim->para->name = (char**) malloc(nSur*sizeof(char *));
Expand Down
4 changes: 4 additions & 0 deletions Buildings/Resources/C-Sources/cfdcosim.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ void *cfdcosim() {
cosim->modelica->shaConSig = NULL;
cosim->modelica->shaAbsRad = NULL;
cosim->ffd->TSha = NULL;
cosim->para->Sou = 0;
cosim->para->nSou = 0;
cosim->para->souName = NULL;
cosim->modelica->sourceHeat = NULL;

return (void*) cosim;
} /* End of cfdcosim()*/
42 changes: 42 additions & 0 deletions Buildings/Resources/C-Sources/isatCosimulation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
*
* @file isatCosimulation.h
*
* @brief Header file for coupled simulation with ISAT based on cfdCosimulation.h
*
* @author
* Xu Han
* University of Colorado Boulder
* [email protected]
*
* Wangda Zuo
* University of Miami
* [email protected]
*
* \date 9/21/2019
*
*/

#if defined(_MSC_VER) || defined(__WIN32__) /* Windows */
#include <windows.h>
#else /* Linux*/
#include <dlfcn.h> /*For load shared library*/
#include <unistd.h> /*For Linux function*/
#define Sleep(x) sleep(x/1000)
#endif

#ifndef _MODELICA_FFD_COMMON_H
#define _MODELICA_FFD_COMMON_H
#include "../src/FastFluidDynamics/modelica_ffd_common.h"
#include <stdint.h> /* Needed to detect 32 vs. 64 bit using UINTPTR_MAX*/
#endif

#if UINTPTR_MAX == 0xffffffff
/* 32-bit */
#error "*** ISAT is not yet on Windows 32 bit."
#endif

CosimulationData *cosim;

/*declare the isat_dll function in DLL*/
void *isat_dll(CosimulationData *cosim);
Loading