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

Add load model fitting #1032

Merged
merged 60 commits into from
Dec 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
4e3fccf
Add load model fitting
dchassin Nov 15, 2021
f4ba004
Update load_model.py
Nov 15, 2021
e917c0a
Update load_model.py
Nov 16, 2021
4486c35
Create load_model_config.py
Nov 16, 2021
c291e7b
Update load_model.py
Nov 17, 2021
bbc36ed
Create load_model.glm
Nov 17, 2021
172c5e2
Increase filter model order limits
Nov 19, 2021
59acfce
Update load_model.glm
Nov 19, 2021
7a47db9
Update load_model.py
Nov 19, 2021
0171d6e
Work progress
Nov 19, 2021
14643f2
Update transform.cpp
dchassin Nov 20, 2021
cbb4f6d
Update transform.cpp
Nov 30, 2021
bfd88b3
Update fit_filter.py
Nov 30, 2021
e7b536c
Update load_model.glm
Nov 30, 2021
e06e49e
Stub support for initial conditions in filter
Dec 1, 2021
d5c72b2
Update transform.cpp
Dec 1, 2021
2efccd6
Update .gitignore
Dec 2, 2021
f1514c6
Update Output_message_context.md
Dec 2, 2021
b641b94
Update Output_message_context.md
Dec 2, 2021
7188a1e
Update load.cpp
Dec 3, 2021
97a3aa9
Update transform.cpp
Dec 3, 2021
4c2b626
Update load_model.glm
Dec 3, 2021
2519897
Update transform.cpp
dchassin Dec 3, 2021
f0d0aaa
Update load_model.glm
dchassin Dec 3, 2021
bc98710
Update transform.cpp
Dec 3, 2021
7a51b78
Update fit_filter.py
Dec 3, 2021
89aee1f
Update transform.cpp
Dec 3, 2021
ebc6398
Update transform.cpp
Dec 3, 2021
55a7f06
Update load_model.glm
Dec 3, 2021
82cb572
Update fit_filter.py
Dec 3, 2021
c7d0466
Update fit_filter.py
Dec 4, 2021
bbdc9f9
Update fit_filter.py
Dec 4, 2021
a6a7543
Update fit_filter.py
Dec 4, 2021
6493298
Work progress
dchassin Dec 6, 2021
38b62ac
Update load.cpp
Dec 7, 2021
549abde
Update transform.cpp
Dec 7, 2021
20fff66
Update fit_filter.py
Dec 7, 2021
b8f5946
Update transform.cpp
Dec 9, 2021
bc5c922
Update load_model.glm
Dec 9, 2021
3db9dee
Update fit_filter.py
Dec 9, 2021
7622c39
Update test_loadshape_analog.glm
dchassin Dec 9, 2021
bb0504b
Update transform.cpp
dchassin Dec 9, 2021
35f28e5
Update fit_filter.py
dchassin Dec 9, 2021
34d71d6
Update transform.cpp
dchassin Dec 9, 2021
e749595
Fix to allow summing transforms to outputs
dchassin Dec 9, 2021
30f49e6
Update transform.cpp
Dec 10, 2021
021186a
Add support for clock runtime parameter
Dec 10, 2021
a4a9797
Update Filter.md
Dec 10, 2021
3a85bc9
Update transform.cpp
Dec 10, 2021
e6de134
Update load_model.glm
Dec 10, 2021
952122a
Update test_filter_delay.glm
Dec 10, 2021
41d3283
Update test_filter_constraint.glm
Dec 10, 2021
17cab06
Update test_filter_constraint.glm
Dec 10, 2021
77f5d86
Update test_filter_constraint.glm
Dec 11, 2021
be7fed1
Update test_filter_delay.glm
Dec 11, 2021
ccdfa4e
Update test_filter_constraint.glm
dchassin Dec 11, 2021
fd5310e
Finalize example of load model fitting
dchassin Dec 12, 2021
e7b1d0b
Update fit_filter.py
Dec 12, 2021
b8aea38
Update load_model.glm
Dec 12, 2021
704e074
Merge branch 'develop' into develop-add-load-model-fit
aivanova5 Dec 23, 2021
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,5 @@ gldcore/converters/autotest/table2glm_input.glm
gldcore/geodata/docs/geodata.conf
gldcore/gridlabd.in
geodata.conf
gldcore/autotest/output.csv
python_extras/example/output.csv
11 changes: 10 additions & 1 deletion docs/GLM/Directive/Clock.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ clock
timezone "<specification>";
starttime "<datetime>";
stoptime "<datetime>";
runtime "<deltatime>";
}
~~~

Expand All @@ -21,9 +22,17 @@ The `clock` directive specifies how the internal clock will operate while a simu

The `timezone` property sets the time zone for the simulation. The time zone may be specified either as a ISO timezone, e.g., `PST+8PDT`, or a locale, e.g., `US/CA/San Francisco`. If the time zone is not specified the simulation will use `UTC`.

## `runtime`

The `runtime` property sets the duration of the simulation run. This will always be relative to the `starttime` and set the `stoptime` accordingly. Valid units are `s`, `m`, `h`, `d`, and `w` for seconds, minutes, hours, days, and weeks, respectively.

Note that runtime units of months and years are not supported because they are not well-defined units.

## `starttime`

The `starttime` property specifies when the simulation start. If no time zone is specified, the current time zone is used if it has been specified. Otherwise `UTC` is assumed. If no start time is specified, the current wall clock time is used. Note, `ISO8601` is supported.
The `starttime` property specifies when the simulation start. If no time zone is specified, the current time zone is used if it has been specified. Otherwise `UTC` is assumed. If no start time is specified, the current wall clock time is used. Note, `ISO8601` is supported.

Note that the parameter `timestamp` is a synonym for `starttime`.

## `stoptime`

Expand Down
16 changes: 15 additions & 1 deletion docs/GLM/Directive/Filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ filter <name>(<domain>[,<timestep>[,<timeskew>[,<option>=<value>]]]) = <polynomi

The filter directive defines a filter that can be used to connect a signal source property to a output signal property.

Filter may be used to output values to an object property of type `double`. Outputs are summed so that multiple filter may output to a single property, e.g.,

~~~
object example
{
output1 filter11(input1);
output1 filter21(input2);
output2 filter12(input1);
output2 filter22(input2);
}
~~~

Would represent a MIMO system with two inputs going to two outputs through 4 different filters with outputs summed.

## Name

Any unique alphabetic name may be used.
Expand Down Expand Up @@ -46,7 +60,7 @@ The numerator and denominator are specified as a polynomial of the form $a_n z^n
an z^n + ... + a1 z + a0
~~~

The order of the numerator must be strictly less than the order of the denominator.
The order of the numerator must be less than or equal to the order of the denominator.

# Example

Expand Down
57 changes: 56 additions & 1 deletion docs/Global/Output_message_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,62 @@ bash$ gridlabd --define output_message_context=ALL

# Description

Control context from which debug messages are allowed
Control context from which core debug messages are allowed. Valid message contexts are

- `AGGREGATE`: aggregation debug messages only
- `ALL`: all debug messages allowed
- `CLASS`: class debug messages only
- `CMDARG`: command line subsystem debug messages only
- `COMPARE`: compare debug messages only
- `CONVERT`: converter debug messages only
- `CREATE`: create debug messages only
- `DELTAMODE`: deltamode debug messages only
- `ENDUSE`: enduse debug messages only
- `ENVIRONMENT`: environment debug messages only
- `EXCEPTION`: exception handling debug messages only
- `EXEC`: exec debug messages only
- `FIND`: find subsystem debug messages only
- `GLOBALS`: globals debug messages only
- `GUI`: graphical user interface debug messages only
- `HTTP`: HTTP server debug messages only
- `HTTPCLIENT`: HTTP client debug messages only
- `INDEX`: index debug messages only
- `INSTANCE`: instance manager debug messages only
- `INTERPOLATE`: interpolation debug messages only
- `JOB`: job control debug messages only
- `KML`: KML interface debug messages only
- `LEGAL`: legal debug messages only
- `LINK`: link debug messages only
- `LIST`: list debug messages only
- `LOAD`: loader debug messages only
- `LOADSHAPE`: loadshape debug messages only
- `LOCALE`: locale debug messages only
- `LOCK`: memory locking debug messages only
- `MAIN`: main module debug messages only
- `MATCH`: match subsystem debug messages only
- `MATLAB`: Matlab interface debug messages only
- `MODULE`: module debug messages only
- `NONE`: no debug messages allowed
- `OBJECT`: object debug messages only
- `PROPERTY`: property debug messages only
- `PYTHON`: python module debug messages only
- `RANDOM`: random variable debug messages only
- `REALTIME`: realtime subsystem debug messages only
- `SANITIZE`: model sanitizer subsystem debug messages only
- `SAVE`: save debug messages only
- `SCHEDULE`: schedule debug messages only
- `SERVER`: server subsystem debug messages only
- `SETUP`: setup debug messages only
- `STREAM`: streaming data debug messages only
- `TEST`: testing subsystem debug messages only
- `THREADPOOL`: thread pool debug messages only
- `TIME`: time subsystem debug messages only
- `TRANSFORM`: transform subsystem debug messages only
- `UNIT`: unit manager subsystem debug messages only
- `VALIDATE`: validation subsystem debug messages only
- `VERSION`: version debug messages only
- `XCORE`: X11 core debug messages only
- `XML`: XML interface debug messages only

# Example

Expand Down
29 changes: 26 additions & 3 deletions gldcore/autotest/test_filter_constraint.glm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
clock {
timezone PST+8PDT;
starttime '2000-01-01 00:00:00 PST';
stoptime '2000-01-01 01:00:00 PST';
stoptime '2000-01-02 00:00:00 PST';
}

#set randomseed=1
filter delay(z,5min,10s,resolution=8,minimum=-2.5,maximum=2.5) = 1/z;
class from {
randomvar value;
Expand All @@ -27,5 +27,28 @@ object multi_recorder {
file output.csv;
interval -1;
property "from:value,to:value";
#warning no assert in autotest
}

module assert;
object assert {
parent to;
start '2000-01-01 00:00:00 PST';
stop '2000-01-01 00:05:09 PST';
target value;
relation ==;
value 0.0;
within 1e-4;
}
object assert {
parent to;
start '2000-01-01 00:05:10 PST';
stop '2000-01-01 00:10:09 PST';
target value;
relation ==;
value +0.443108;
within 1e-4;
}

#set debug=TRUE
#set output_message_context=TRANSFORM
#set suppress_repeat_messages=FALSE
29 changes: 27 additions & 2 deletions gldcore/autotest/test_filter_delay.glm
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
clock {
timezone PST+8PDT;
starttime '2000-01-01 00:00:00 PST';
stoptime '2000-01-01 01:00:00 PST';
stoptime '2000-01-02 00:00:00 PST';
}
filter delay(z,5min,10s) = 1/z;
#set randomseed=1
filter delay(z,5min) = 1/z;
class from {
randomvar value;
}
Expand All @@ -27,5 +28,29 @@ object multi_recorder {
property "from:value,to:value";
}

module assert;
object assert {
parent to;
start '2000-01-01 00:00:00 PST';
stop '2000-01-01 00:04:59 PST';
target value;
relation ==;
value 0.0;
within 1e-4;
}
object assert {
parent to;
start '2000-01-01 00:05:00 PST';
stop '2000-01-01 00:09:59 PST';
target value;
relation ==;
value +0.443108;
within 1e-4;
}

#set glm_save_options=MINIMAL
#set savefile=gridlabd.glm

#set output_message_context=TRANSFORM
#set suppress_repeat_messages=FALSE
#set debug=TRUE
6 changes: 5 additions & 1 deletion gldcore/autotest/test_loadshape_analog.glm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
clock {
timezone "PST+8PDT";
starttime "2020-01-01 00:00:00 PST";
stoptime "2021-01-01 00:00:00 PST";
stoptime "2020-01-02 00:00:00 PST";
}

module tape;
Expand Down Expand Up @@ -82,6 +82,7 @@ object test_loadshape
relation "==";
value 1.0;
within 0.00001;
hold 3600s;
};
}

Expand All @@ -95,6 +96,7 @@ object test_loadshape
relation "==";
value 0.5;
within 0.00001;
hold 3600s;
};
}

Expand All @@ -108,6 +110,7 @@ object test_loadshape
relation "==";
value 0.04167;
within 0.00001;
hold 3600s;
};
}

Expand All @@ -121,6 +124,7 @@ object test_loadshape
relation "==";
value 0.04167;
within 0.00001;
hold 3600s;
};
}

Loading