Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop' into develop-add-aws-install
Browse files Browse the repository at this point in the history
  • Loading branch information
David P. Chassin committed Jul 13, 2022
2 parents 2a1bc45 + 61a4b67 commit b7c02d4
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 740 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,5 @@ module/powerflow/autotest/switch_1.csv
module/powerflow/autotest/switch_2.csv
module/powerflow/autotest/switch_3.csv
module/powerflow/autotest/switch_4.csv
tools/autotest/test_meteostat_opt.csv
tools/autotest/test_meteostat_opt.glm
31 changes: 31 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Updating latest `master` docker image

To build and post the `master` docker image, run the following command:

~~~
sh$ docker build docker -t hipas/gridlabd:latest
sh$ docker push hipas/gridlabd:latest
~~~

# Updating `develop` docker image

To build and post the `develop` docker image, run the following command:

~~~
sh$ docker build docker --build-arg BRANCH=develop -t hipas/gridlabd:develop
sh$ docker push hipas/gridlabd:develop
~~~

# Updating a personal branch docker image

To build and post the `develop` docker image, run the following command:

~~~
sh$ docker build docker --build-arg BRANCH=BRANCHNAME -t USERNAME/gridlabd:BUILDID
sh$ docker push USERNAME/gridlabd:BUILDID
~~~

where
- `BRANCHNAME` is the branch you wish to build
- `USERNAME` is your Dockerhub user id
- `BUILDID` is a unique/sequential build identifier
31 changes: 0 additions & 31 deletions docs/GLM/Property/Datetime.md

This file was deleted.

31 changes: 31 additions & 0 deletions docs/GLM/Property/Timestamp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[[/GLM/Property/Timestamp]] -- Timestamp property

# Synopsis

GLM:

~~~
class <class-name> {
Timestamp <property-name>;
}
object <class-name> {
<property-name> "<date-value>";
}
~~~

# Description

Timestamp properties can be specified in US, EU, ISO, and ISO 8601 formats, as indicated by the [[/Global/Dateformat]] variable.

## ISO8601

The following ISO 8601 date/time formats are now supported for all timestamp value inputs:

* `yyyy-mm-ddTHH:MM:SS[.SSSSSSSSS]Z`
* `yyyy-mm-ddTHH:MM:SS[.SSSSSSSSS]{+,-}HH:MM`

GridLAB-D does not currently support output in ISO 8601 format

# See also

* [[/Global/Dateformat]]
46 changes: 45 additions & 1 deletion source/load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,48 @@ int GldLoader::expanded_value(const char *text, char *result, int size, const ch
else
strcpy(value,"");
}
else if (strcmp(varname,"groupid")==0)
{
if (current_object)
snprintf(value,sizeof(value)-1,"%s",(const char *)current_object->groupid);
else
strcpy(value,"");
}
else if (strcmp(varname,"rank")==0)
{
if (current_object)
snprintf(value,sizeof(value)-1,"%d",current_object->rank);
else
strcpy(value,"");
}
else if (strcmp(varname,"rng_state")==0)
{
if (current_object)
snprintf(value,sizeof(value)-1,"%d",current_object->rng_state);
else
strcpy(value,"");
}
else if (strcmp(varname,"latitude")==0)
{
if (current_object)
snprintf(value,sizeof(value)-1,"%.6lf",current_object->latitude);
else
strcpy(value,"");
}
else if (strcmp(varname,"longitude")==0)
{
if (current_object)
snprintf(value,sizeof(value)-1,"%.6lf",current_object->longitude);
else
strcpy(value,"");
}
else if (strcmp(varname,"guid")==0)
{
if (current_object)
snprintf(value,sizeof(value)-1,"%llx%llx",current_object->guid[0],current_object->guid[1]);
else
strcpy(value,"");
}
else if ( object_get_value_by_name(current_object,varname,value,sizeof(value)))
{
/* value is ok */
Expand Down Expand Up @@ -7714,6 +7756,8 @@ int GldLoader::process_macro(char *line, int size, char *_filename, int linenum)
/* C include file */
IN_MYCONTEXT output_verbose("executing include shell \"%s\"", value);
my_instance->subcommand("%s",value);
// TODO: insert stdout here
strcpy(line,"\n");
return TRUE;
}
else
Expand Down Expand Up @@ -7932,7 +7976,7 @@ int GldLoader::process_macro(char *line, int size, char *_filename, int linenum)
}
else if (strncmp(line,"#debug",6)==0)
{
char *term = strchr(line+8,' ');
char *term = strchr(line+6,' ');
char value[1024];
if (term==NULL)
{
Expand Down
10 changes: 7 additions & 3 deletions source/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ int object_set_value_by_addr(OBJECT *obj, /**< the object to alter */
return result;
}

static int set_header_value(OBJECT *obj, const char *name, const char *value)
static int set_header_value(OBJECT *obj, const char *name, const char *value,bool nofail=true)
{
unsigned int temp_microseconds;
TIMESTAMP tval;
Expand Down Expand Up @@ -1268,15 +1268,19 @@ static int set_header_value(OBJECT *obj, const char *name, const char *value)
{
return sscanf(value,"%08llX%08llX",obj->guid,obj->guid+1) != 2 ? SUCCESS : FAILED;
}
else {
else if ( ! nofail )
{
output_error("object %s:%d called set_header_value() for invalid field '%s'", obj->oclass->name, obj->id, name);
/* TROUBLESHOOT
The valid header fields are "name", "parent", "rank", "clock", "valid_to", "latitude",
"longitude", "in_svc", "out_svc", "heartbeat", and "flags".
*/
return FAILED;
}
/* should never get here */
else
{
return SUCCESS;
}
}

const char *object_get_header_string(OBJECT *obj, const char *item, char *buffer, size_t len)
Expand Down
11 changes: 7 additions & 4 deletions subcommands/gridlabd-template
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fi

# configurable parameters
GITHUB="https://github.com"
GITAPI="https://api.github.com"
GITHUBUSERCONTENT="https://raw.githubusercontent.com"
if [ "${ORGANIZATION}" == "" ]; then
export ORGANIZATION="US/CA/SLAC"
Expand Down Expand Up @@ -113,11 +114,12 @@ function config()
fi
elif [ "$1" == "reset" ]; then
debug "resetting config"
rm -f $CONFIGFILE $INDEX || error 1 "unable to reset $CONFIGFILE"
rm -rf "$CONFIGFILE" || error 1 "unable to delete '$CONFIGFILE'"
rm -rf "${INDEX}" || error 1 "unable to delete template '${INDEX}'"
elif [ "$1" == "set" -a $# == 3 ]; then
debug "updating config: $2 = '$3'"
echo "$2=\"$3\"" >> $CONFIGFILE
rm -f ${INDEX}
echo "$2=\"$3\"" >> "$CONFIGFILE"
rm -rf "${INDEX}" || error 1 "unable to delete template '${INDEX}'"
elif [ "$1" == "get" -a $# == 2 ]; then
if [ ! -r $CONFIGFILE ]; then
value=$(config show | grep $2)
Expand Down Expand Up @@ -486,7 +488,8 @@ done
CACHEDIR="$DATADIR/.gridlabd-template"
GITPROJ="$GITHUB/$GITUSER/$GITREPO"
GITFILE="$GITHUBUSERCONTENT/$GITUSER/$GITREPO/$GITBRANCH"
COMMIT_ID=$(git ls-remote "$GITPROJ" | grep "$GITBRANCH" | head -n 1 | cut -f1)
COMMIT_INFO=$(curl -sL "$GITAPI/repos/$GITUSER/$GITREPO/branches/$GITBRANCH")
COMMIT_ID=$(echo $COMMIT_INFO | gridlabd json-get commit sha || error 1 $(echo $COMMIT_INFO | gridlabd json-get message))
INDEX=$CACHEDIR/$COMMIT_ID

# process command
Expand Down
16 changes: 6 additions & 10 deletions tools/autotest/test_meteostat.csv
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@
2020-01-15 01:00:00 PST,+50,+39.6,+67,+1.5
2020-01-15 02:00:00 PST,+50,+39.6,+67,+0
2020-01-15 03:00:00 PST,+48.2,+41,+76,+0
2020-01-15 05:00:00 PST,+46.4,+41.2,+82,+0
2020-01-15 06:00:00 PST,+44.6,+41,+87,+0
2020-01-15 05:00:00 PST,+44.6,+41,+87,+0
2020-01-15 07:00:00 PST,+44.6,+39.2,+81,+0
2020-01-15 08:00:00 PST,+42.8,+39.2,+87,+0
2020-01-15 09:00:00 PST,+41,+37.4,+87,+0
Expand Down Expand Up @@ -312,8 +311,7 @@
2020-01-21 02:00:00 PST,+50,+46.2,+87,+0
2020-01-21 03:00:00 PST,+50,+44.8,+82,+0
2020-01-21 04:00:00 PST,+50,+46.2,+87,+0
2020-01-21 05:00:00 PST,+48.2,+44.6,+87,+0
2020-01-21 06:00:00 PST,+50,+44.8,+82,+0
2020-01-21 05:00:00 PST,+50,+44.8,+82,+0
2020-01-21 07:00:00 PST,+51.8,+42.6,+71,+0
2020-01-21 08:00:00 PST,+53.6,+44.8,+72,+0
2020-01-21 09:00:00 PST,+50,+44.8,+82,+0
Expand All @@ -333,8 +331,6 @@
2020-01-22 01:00:00 PST,+55.4,+50,+82,+8.6
2020-01-22 02:00:00 PST,+55.4,+50,+82,+0
2020-01-22 03:00:00 PST,+55.4,+52,+88,+0
2020-01-22 05:00:00 PST,+55.4,+50,+82,+0
2020-01-22 06:00:00 PST,+55.4,+52,+88,+0
2020-01-22 11:00:00 PST,+53.6,+52,+94,+0
2020-01-22 12:00:00 PST,+53.6,+53.6,+100,+0
2020-01-22 13:00:00 PST,+51.8,+51.8,+100,+0
Expand All @@ -351,8 +347,7 @@
2020-01-23 01:00:00 PST,+57.2,+50,+77,+9.9
2020-01-23 02:00:00 PST,+55.4,+50,+82,+0
2020-01-23 03:00:00 PST,+53.6,+50.2,+88,+0
2020-01-23 05:00:00 PST,+51.8,+48.4,+88,+0
2020-01-23 06:00:00 PST,+50,+48.4,+94,+0
2020-01-23 05:00:00 PST,+50,+48.4,+94,+0
2020-01-23 07:00:00 PST,+50,+46.2,+87,+0
2020-01-23 08:00:00 PST,+48.2,+46.6,+94,+0
2020-01-23 10:00:00 PST,+46.4,+44.4,+93,+0
Expand Down Expand Up @@ -396,7 +391,7 @@
2020-01-25 16:00:00 PST,+53.6,+53.6,+100,+34.4
2020-01-25 17:00:00 PST,+55.4,+53.8,+94,+69.4
2020-01-25 18:00:00 PST,+55.4,+55.4,+100,+81.4
2020-01-25 19:00:00 PST,+55.4,+55.4,+100,+86.5
2020-01-25 19:00:00 PST,+57.2,+55.4,+94,+86.5
2020-01-25 20:00:00 PST,+55.4,+55.4,+100,+88.4
2020-01-25 21:00:00 PST,+57.2,+57.2,+100,+88.1
2020-01-25 22:00:00 PST,+59,+57.2,+94,+85.5
Expand Down Expand Up @@ -480,7 +475,8 @@
2020-01-30 01:00:00 PST,+57.2,+46.4,+67,+20.2
2020-01-30 02:00:00 PST,+55.4,+46.6,+72,+0
2020-01-30 04:00:00 PST,+53.6,+44.8,+72,+0
2020-01-30 05:00:00 PST,+50,+44.8,+82,+0
2020-01-30 05:00:00 PST,+53.6,+46.6,+77,+0
2020-01-30 06:00:00 PST,+50,+44.8,+82,+0
2020-01-30 08:00:00 PST,+48.2,+44.6,+87,+0
2020-01-30 09:00:00 PST,+50,+44.8,+82,+0
2020-01-30 10:00:00 PST,+53.6,+50.2,+88,+0
Expand Down
9 changes: 6 additions & 3 deletions tools/autotest/test_meteostat.glm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ object recorder
property "temperature,dewpoint,humidity,solar_direct";
}

#ifexist ../test_meteostat.csv
#on_exit 0 diff -I "^//" ../test_meteostat.csv test_meteostat.csv
#endif
//
// DPC: Removed the diff check until meteostat is stable (7/22)
//
// #ifexist ../test_meteostat.csv
// #on_exit 0 diff -I "^//" ../test_meteostat.csv test_meteostat.csv > gridlabd.diff
// #endif
Loading

0 comments on commit b7c02d4

Please sign in to comment.