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

Master release beauharnois-11 #744

Merged
merged 12 commits into from
Sep 28, 2020
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
33 changes: 33 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: develop

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:

runs-on: ubuntu-latest
container: slacgismo/gridlabd_dockerhub_base:latest

steps:
- uses: actions/checkout@v2
- name: Run autoconf
run: autoreconf -isf
- name: Configure build
run: ./configure
- name: Build gridlabd
run: make -j10 system
- name: Validate build
run: |
gridlabd -D keep_progress=TRUE -T 0 --validate
utilities/save_validation_errors || true
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: validate-result
path: |
validate.txt
validate.tar.gz
33 changes: 33 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: master

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
container: slacgismo/gridlabd_dockerhub_base:latest

steps:
- uses: actions/checkout@v2
- name: Run autoconf
run: autoreconf -isf
- name: Configure build
run: ./configure
- name: Build gridlabd
run: make -j10 system
- name: Validate build
run: |
gridlabd -D keep_progress=TRUE -T 0 --validate
utilities/save_validation_errors || true
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: validate-result
path: |
validate.txt
validate.tar.gz
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ reconfigure: distclean
autoreconf -isf && ./configure

reconfigure-debug: distclean
autoreconf -isf && ./configure 'CXXFLAGS=-O0 -g'
autoreconf -isf && ./configure 'CXXFLAGS=-O0 -g $(CXXFLAGS)'

docker: $(PREFIX)/docker.img

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![master](https://github.com/dchassin/gridlabd/workflows/master/badge.svg) ![develop](https://github.com/dchassin/gridlabd/workflows/develop/badge.svg)

The main documentation page for this project is located at http://docs.gridlabd.us/.

## Important Note
Expand Down
56 changes: 56 additions & 0 deletions docs/GLM/Property/Python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[[/GLM/Property/Python]] -- Python property

# Synopsis

GLM:

~~~
class <class-name> {
python <property-name>;
}
object <class-name> {
<property-name> <type(<value>);
}
~~~

# Description

The `python` property type support general python objects. Although any type of object is supported, only those that implement the python `str` method as useful because GridLAB-D require the `str()` to generate the values for data exchange.

# Examples

~~~
class test
{
python py_object;
}
object test
{
py_object None;
}
object test
{
py_object int(1);
}
object test
{
py_object float(0.0);
}
object test
{
py_object float(1.23);
}
object test
{
py_object str('text');
}
object test
{
py_object list([1,2,3]);
}
object test
{
py_object dict(a=1,b=2,c=3);
}
~~~

2 changes: 1 addition & 1 deletion docs/Global/Glm_save_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ This is the minimum loadable GLM model. It is a combination of `NOINTERNALS`, `N
# Example

~~~
bash$ gridlabd -D gld_save_options=MINIMAL model.glm -o model_single_file.glm
bash$ gridlabd -D glm_save_options=MINIMAL model.glm -o model_single_file.glm
~~~

# See also
Expand Down
20 changes: 20 additions & 0 deletions docs/Global/Rusage_data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[/Global/Rusage_data]] -- Resource usage data

# Synopsis

Python:

~~~
import gridlabd
gridlabd.get_global("rusage_data")
~~~

# Description

Hold the `rusage` data in JSON format.

# See also

* [[/Command/Rusage]]
* [[/Global/Rusage_rate]]
* [[/Global/Rusage_file]]
1 change: 1 addition & 0 deletions docs/Global/Rusage_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ Specifies the file in which system resource usage data is collected
# See also

* [[/Command/Rusage]]
* [[/Global/Rusage_data]]
* [[/Global/Rusage_rate]]
1 change: 1 addition & 0 deletions docs/Global/Rusage_rate.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ Specifies the rate at which system resource usage data is collected. The default

* [[/Command/Rusage]]
* [[/Global/Clock]]
* [[/Global/Rusage_data]]
* [[/Global/Rusage_file]]
21 changes: 21 additions & 0 deletions docs/Module/Optimize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[[/Module/Optimize.md]] -- Module optimize

# Synopsis

GLM:

~~~
module optimize;
~~~

# Description

The `optimize` module provides general-purpose optimization strategies to iteratively find an extremum for an abritary object property based on constrained changes to one or more other object properties.

## `simple`

The [[/Module/Optimize/Simple]] optimizer using a simple linear search starting from the current state to achieve the desired objective. This simple optimizer is one-dimensional and it can be extremely slow but it is guaranteed to find a local solution if one exists.

# See also

* [[/Module/Optimize/Simple]]
57 changes: 57 additions & 0 deletions docs/Module/Optimize/Simple.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[[/Module/Optimize/Simple]] -- Simple optimizers

# Synopsis

GLM:

~~~
object simple
{
objective "<object>.<property>";
variable "<object>.<property>";
constraint "<object>.<property> <relation> <value>";
delta <real>;
epsilon <real>;
trials <integer>;
goal [EXTREMUM|MINIMUM|MAXIMUM];
}
~~~

# Description

The `simple` optimizer performs a linear one-dimensional search from the current state to bring the value of `objective` to within `epsilon` of the extremum, by changing `variable` in increments of `delta`.

# Example

The following example find the minimum value of `object_1.output` to within `0.001` of the minimum by changing `object_1.input` in increments of `0.01`.

~~~
class example
{
double input;
double output;
intrinsic sync(TIMESTAMP t0, TIMESTAMP t1)
{
output = input*input + input + 1;
return TS_NEVER;
};
}
object example
{
name "object_1";
input 0;
}
object simple
{
goal MINIMUM;
objective "object_1.output";
variable "object_1.input";
delta 0.01;
epsilon 0.001;
}

~~~

# See also

* [[/Module/Optimize]]
90 changes: 90 additions & 0 deletions docs/Module/Python/Property.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
[[/Module/Python/Property]] -- Direct property access python objects

# Synopsis

Python:

~~~
import gridlabd
gridlabd.property.__init__(object=<int>, property=<str>)
gridlabd.property.__init__(object=<str>, property=<str>)
gridlabd.property.__eq__(<gridlabd.property>)
gridlabd.property.__ne__(<gridlabd.property>)
gridlabd.property.convert_unit(<str>)
gridlabd.property.get_initial()
gridlabd.property.get_name()
gridlabd.property.get_unit()
gridlabd.property.get_value()
gridlabd.property.rlock()
gridlabd.property.set_name(<str>)
gridlabd.property.set_object(<int>)
gridlabd.property.set_object(<str>)
gridlabd.property.set_value(<str>)
gridlabd.property.set_value(<long>)
gridlabd.property.set_value(<float>)
gridlabd.property.set_value(<complex>)
gridlabd.property.set_value(<object>)
gridlabd.property.unlock()
gridlabd.property.wlock()
~~~

# Description

The `property` object provides direct high-performance access to GridLAB-D object properties. Access is provided through strong-typed accessors that are tied to the GridLAB-D property types.

Objects can be identified by number (int) or name (str). Properties may only be identified by name (str).

Values can be provided either as a string or a value that is compatible with the internal property in GridLAB-D. When the value is provided as a string, it is parsed in the same manner as a GLM value.

Values can be retrieved only as the python type associated with the GridLAB-D property type. To retrieve the value as a string, you must use the `str()` method. In this case, the value is converted using GridLAB-D's output conversion methods for the property type.

# Example

The following example illustrates access to various object property types.

`example.glm`:

~~~
module example;
#set savefile=gridlabd.json
clock
{
starttime "2000-01-01 00:00:00";
stoptime "2000-02-01 00:00:00";
}
class example_class
{
python my_list;
complex my_value;
char32 my_string;
double my_real[m/s];
}
object example_class
{
name "my_example";
my_list list(['test',12.34,dict(a=123,b=456)]);
my_value 1.234+5.6789j;
my_string "this is a short string";
my_real 100 ft/s;
}
~~~

`example.py`:

~~~
import gridlabd
def on_init(t):
for name in ['my_list','my_value','my_string','my_real']:
prop = gridlabd.property('my_example',name)
print(f"{repr(prop)}={str(prop)}")
return True
~~~

`output`:

~~~
<gridlabd.property:my_example.my_list>=['test', 12.34, {'a': 123, 'b': 456}]
<gridlabd.property:my_example.my_value>=+1.234+5.6789j
<gridlabd.property:my_example.my_string>="this is a short string"
<gridlabd.property:my_example.my_real>=+30.48 m/s
~~~
Loading