Skip to content

Commit

Permalink
fixes and revision history for #1891
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathadon committed Jun 15, 2024
1 parent feb1c64 commit f24c66a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
20 changes: 20 additions & 0 deletions IBPSA/Resources/C-Sources/WeeklySchedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
This code implements a weekly schedule.
Changelog:
June 15, 2024 by Filip Jorissen, Builtwins
Revisions for #1891: compliance with Modelica include annotation rules.
April 9, 2024 by Filip Jorissen, Builtwins
Revisions for #1869 to remove a header requirement that contains the number of rows/columns.
March 30, 2024 by Filip Jorissen, Builtwins
Expand Down Expand Up @@ -416,4 +418,22 @@ void* weeklyScheduleInit(const int tableOnFile, const char* name, const double t
return (void*) scheduleID;
}


void weeklyScheduleFreeInit(void * ID) {
WeeklySchedule* scheduleID = (WeeklySchedule*)ID;

if (scheduleID->lastData != NULL)
free(scheduleID->lastData);

if (scheduleID->token != NULL)
free(scheduleID->token);

if (scheduleID->fp != NULL)
fclose(scheduleID->fp);

if (scheduleID->buff2 != NULL)
free(scheduleID->buff2);

}

#endif
12 changes: 2 additions & 10 deletions IBPSA/Resources/C-Sources/WeeklyScheduleFree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@
This code implements a weekly schedule.
Changelog:
April 9, 2024 by Filip Jorissen, Builtwins
Revisions for #1869 to remove a header requirement that contains the number of rows/columns.
March 30, 2024 by Filip Jorissen, Builtwins
Revisions for #1860 to avoid memory leaks when calling ModelicaFormatError.
May 25, 2022 by Michael Wetter, LBNL
Refactored to comply with C89.
March 9, 2022 by Filip Jorissen, KU Leuven
Initial version.
April 10, 2022 by Filip Jorissen, KU Leuven
Added tableOnFile option.
June 15, 2024 by Filip Jorissen, Builtwins
Initial version for #1891: compliance with Modelica include annotation rules.
*/

Expand Down
13 changes: 3 additions & 10 deletions IBPSA/Resources/C-Sources/WeeklyScheduleGetValue.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,12 @@
This code implements a weekly schedule.
Changelog:
April 9, 2024 by Filip Jorissen, Builtwins
Revisions for #1869 to remove a header requirement that contains the number of rows/columns.
March 30, 2024 by Filip Jorissen, Builtwins
Revisions for #1860 to avoid memory leaks when calling ModelicaFormatError.
May 25, 2022 by Michael Wetter, LBNL
Refactored to comply with C89.
March 9, 2022 by Filip Jorissen, KU Leuven
Initial version.
April 10, 2022 by Filip Jorissen, KU Leuven
Added tableOnFile option.
June 15, 2024 by Filip Jorissen, Builtwins
Initial version for #1891: compliance with Modelica include annotation rules.
*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion IBPSA/Utilities/IO/Files/WeeklySchedule.mo
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected
input Real timeIn "Time for look-up";
output Real y "Schedule value";
external "C" y=getScheduleValue(ID, iCol, timeIn)
annotation(Include="#include <WeeklyScheduleGet.c>",
annotation(Include="#include <WeeklyScheduleGetValue.c>",
IncludeDirectory="modelica://IBPSA/Resources/C-Sources");
end getCalendarValue;

Expand Down

0 comments on commit f24c66a

Please sign in to comment.