diff --git a/Buildings/Resources/C-Sources/cfdSendStopCommand.c b/Buildings/Resources/C-Sources/cfdSendStopCommand.c index 9e973ea0bab..39cb3c510e2 100644 --- a/Buildings/Resources/C-Sources/cfdSendStopCommand.c +++ b/Buildings/Resources/C-Sources/cfdSendStopCommand.c @@ -29,7 +29,7 @@ void cfdSendStopCommand(void *thread) { cosim->para->flag = 0; /* Wait for the feedback from FFD*/ - while(cosim->para->flag==0 && istarted==1 && cosim->para->flag==0 && ipara->ffdError==1) { ModelicaError(cosim->ffd->msg); } @@ -43,7 +43,7 @@ void cfdSendStopCommand(void *thread) { if(cosim->para->ffdError==1) { ModelicaError(cosim->ffd->msg); } - else { + else if (cosim->started==1) { ModelicaMessage("Successfully stopped the FFD simulation.\n"); } } diff --git a/Buildings/Resources/C-Sources/cfdStartCosimulation.c b/Buildings/Resources/C-Sources/cfdStartCosimulation.c index 2b7371bc9e8..f952d9aab3a 100644 --- a/Buildings/Resources/C-Sources/cfdStartCosimulation.c +++ b/Buildings/Resources/C-Sources/cfdStartCosimulation.c @@ -230,6 +230,7 @@ int cfdStartCosimulation(const char *cfdFilNam, const char **name, const double | Implicitly launch DLL module. ****************************************************************************/ ffd_dll(cosim); + cosim->started = 1; return 0; } /* End of cfdStartCosimulation()*/ diff --git a/Buildings/Resources/C-Sources/cfdcosim.c b/Buildings/Resources/C-Sources/cfdcosim.c index 705ef535190..4f1d8f93efb 100644 --- a/Buildings/Resources/C-Sources/cfdcosim.c +++ b/Buildings/Resources/C-Sources/cfdcosim.c @@ -98,6 +98,7 @@ void *cfdcosim() { cosim->modelica->shaConSig = NULL; cosim->modelica->shaAbsRad = NULL; cosim->ffd->TSha = NULL; + cosim->started = 0; return (void*) cosim; } /* End of cfdcosim()*/ diff --git a/Buildings/Resources/Library/linux64/libffd.so b/Buildings/Resources/Library/linux64/libffd.so index d8b4d460c7d..47dd36b6af4 100644 Binary files a/Buildings/Resources/Library/linux64/libffd.so and b/Buildings/Resources/Library/linux64/libffd.so differ diff --git a/Buildings/Resources/src/FastFluidDynamics/modelica_ffd_common.h b/Buildings/Resources/src/FastFluidDynamics/modelica_ffd_common.h index b6e7bac3937..3ba30e1980b 100644 --- a/Buildings/Resources/src/FastFluidDynamics/modelica_ffd_common.h +++ b/Buildings/Resources/src/FastFluidDynamics/modelica_ffd_common.h @@ -72,6 +72,7 @@ typedef struct { }ffdSharedData; typedef struct{ + int started; /* Flag to indicate if the Co-simulation has started or not. */ ParameterSharedData *para; ffdSharedData *ffd; ModelicaSharedData *modelica;