Skip to content

Commit

Permalink
Initial commit (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
David P. Chassin authored Jun 27, 2023
1 parent 2935090 commit 4ead4e5
Show file tree
Hide file tree
Showing 3 changed files with 245 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Simulation

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

jobs:
build:
runs-on: ubuntu-latest
container: lfenergy/arras:develop

steps:
- uses: actions/checkout@v3

- name: Cache IEEE 123 model
id: ieee-123-model
uses: actions/cache@v3
with:
path: 123.glm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('123.glm') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Run simulation
run: gridlabd main.glm

- name: Save results
uses: actions/upload-artifact@v3
with:
name: IEEE 123 voltage profile
path: IEEE-123-voltage-profile.png

76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[![Simulation](../../actions/workflows/main.yml/badge.svg)](../../actions/workflows/main.yml)

# Lesson 7 - Quasi-static Loads

The goal of this lesson is to introduce the various ways of simulating loads that vary in time. The specific learning objectives are the following.

1. How to model buildings.
2. How to model industrial and agricultural loads.
3. How to model public service loads.

## Commercial Buildings

There are many types of commercial buildings that can be modeled in GridLAB-D. The most common are:
- Education
- Grocery
- Healthcare
- Large office
- Restaurant
- Retail
- Small office

Buildings often use schedules to create time-varying properties. In GridLAB-D schedules are defined using the `schedule` directive, which allows you to specify a time window during which a value is used. The specification of a time window is `MINUTES HOURS DAYS MONTHS WEEKDAYS VALUE;`. The `MINUTES`, `HOURS`, `DAYS`, `MONTHS`, and `WEEKDAYS` are specified as comma-separated values or ranges, e.g., `1,2,4-6` or `*` for all allowed values. For example the following schedule specifies a daytype weekday value of 22, and a nighttime weekday and weekend value of 18.

~~~
schedule setpoint
{
* 7-17 * * 1-5 22.0;
* 18-6 * * 1-5 18.0;
* * * * 6-0 18.0;
}
~~~

Commercial building models have many parameters. For details, see the [`building` object documentation](https://docs.gridlabd.us/index.html?owner=arras-energy&project=gridlabd&branch=master&folder=/Module/Powerflow&doc=/Module/Powerflow/Building.md)

## Residential Buildings

There five types of residential buildings:
- Apartment
- Condo
- House
- Lodging
- Townhouse

Residential building models are like commercial buildings in that they can have many parameters. For details, see the [`building` object documentation](https://docs.gridlabd.us/index.html?owner=arras-energy&project=gridlabd&branch=master&folder=/Module/Powerflow&doc=/Module/Powerflow/Building.md)

## Industrial Loads

Industrial loads are identified by their [NAICS code](https://naics.org/). For details on how to model industrial loads, see the [`industrial` object documentation](https://docs.gridlabd.us/index.html?owner=arras-energy&project=gridlabd&branch=master&folder=/Module/Powerflow&doc=/Module/Powerflow/Industrial.md)

## Agricultural Loads

Agricultural loads can be sensitive to different weather variables from buildings. See the [`agricultural` object documentation](https://docs.gridlabd.us/index.html?owner=arras-energy&project=gridlabd&branch=master&folder=/Module/Powerflow&doc=/Module/Powerflow/Agricultural.md) for details.

## Public Services

Public service loads are for street lights and other public services. They are typically sensitive to daylight and rainfall. See [`public_service` object documentation] for details.

## Tasks

1. Add a commercial building to load 1
2. Add 4 residential buildings to load 2
3. Add an industrial load to load 4
4. Add an agricultural load to load 5
5. Add a public service load to load 6
6. Use the weather forecast for Denver Colorado

# Exercices

1. Place meters on all the loads added by tasks 1-5.

# More Information

* [Building loads](https://docs.gridlabd.us/index.html?owner=arras-energy&project=gridlabd&branch=master&folder=/Module/Powerflow&doc=/Module/Powerflow/Building.md)
* [Industrial loads](https://docs.gridlabd.us/index.html?owner=arras-energy&project=gridlabd&branch=master&folder=/Module/Powerflow&doc=/Module/Powerflow/Industrial.md)
* [Agricultural loads](https://docs.gridlabd.us/index.html?owner=arras-energy&project=gridlabd&branch=master&folder=/Module/Powerflow&doc=/Module/Powerflow/Agricultural.md)
* [Public service loads](https://docs.gridlabd.us/index.html?owner=arras-energy&project=gridlabd&branch=master&folder=/Module/Powerflow&doc=/Module/Powerflow/Public_service.md)
133 changes: 133 additions & 0 deletions main.glm
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#ifmissing "123.glm"
#model get IEEE/123
#endif
#include "123.glm"

// Task 1 - Add a commercial building to load 1
schedule setpoint
{
* 7-17 * * 1-5 22.0;
* 18-6 * 10-4 1-5 18.0;
* 18-6 * 5-9 1-5 24.0;
* * * 10-4 6-0 18.0;
* * * 5-9 6-0 24.0;
}
object building
{
parent load_1;
building_type RETAIL;

// inputs
NH 4;
floor_area 150 m^2;
TS setpoint;

temperature_source "forecast.temperature";
electric_heat TRUE;
electrification_fraction 0.5;
electrification_efficiency 2.0;
occupancy 4;
PV 200 sf;
PX 10 kW;
BS 10 kWh;
PG 10 kW;
IC UNITY;
}

// Task 2 - Add 4 residential buildings to load 2
object building:..4
{
parent load_2;
floor_area 1500 sf;
dt 1h;

// thermal parameters
UA random.triangle(200,400) W/K;
CA random.triangle(1.5e6,2.5e6) J/K;
UI random.triangle(5000,7000) W/K;
CM random.triangle(7e6,9.e6) J/K;
UM random.triangle(500,700) W/K;

// design parameters
TH random.triangle(-20,-10) degC;
TC random.triangle(35,45) degC;
//QH 50000.0 W; // 0 to autosize
QE random.triangle(3,9) W/m^2;
QG random.triangle(0,2) W/m^2;
QO random.triangle(800,1600) W/unit;
QV random.triangle(200,600) W/unit;
SA random.triangle(10,20) m^2;

// control parameters
K 1.0;

// inputs
EU random.triangle(0.1,0.2) unit;
NG random.triangle(0.1,0.2) unit;
NH random.triangle(0,4) unit;
TS random.triangle(18,22) degC;

// outputs
PZM 0 pu; // constant impedance HVAC real power (pu.W)
PPM 0.3 pu; // constant power HVAC real power (pu.W)
QPM 0.03 pu; // constant power HVAC reactive power (pu.VAr)
PZE 0.5 pu; // constant impedance end-use real power (W)
PIE 0 pu; // constant current end-use real power (W)
PPE 0.5 pu; // constant power end-use real power (W)
QZE 0.05 pu; // constant impedance end-use reactive power (VAr)
QIE 0 pu; // constant current end-use reactive power (VAr)
QPE 0.5 pu; // constant power end-use reactive power (VAr)
PPH 0.06 pu; // constant power ventilation real power (pu.W/person)
QPH 0.01 pu; // constant power ventilation reactive power (pu.VAr/person)

temperature_source "forecast.temperature";

measured_demand_timestep 1wk;
}

// Task 3 - Add an industrial load to load 4
object industrial
{
parent load_4;
industry_code "MECS_313";
P0 1 MW;
schedule "1-12,0-4,12-23,1,0.5,0.5,0.5,0.5,0.5,0.5,0.99";
schedule "1-12,0-4,0-11,1.0,0.95";
schedule "1-12,5-6,0-11,0.1";
}

// Task 4 - Add an agricultural load to load 5
object agricultural
{
parent load_5;
P0 1 MW;
Mc 1 pu;
schedule "1-12,0-6,0-11,0.5,0.95";
schedule "6-10,0-6,12-23,1.0,0.99";
sensitivity_source "forecast.wind_speed";
sensitivity_base 0;
sensitivity_value -1e5;
}


// Task 5 - Add a public service load to load 6
object public_service
{
parent load_6;
P0 100 kW;
Pi 1 pu;
schedule "1-12,0-6,0-11,0.5,0.95";
schedule "1-12,0-6,12-23,1.0,0.99";
}

// Task 6 - Use weather forecast
#python -m noaa_forecast -p=37.5,-122.4 -c=forecast.csv -n=forecast -g=forecast.glm
#include "forecast.glm"
clock
{
timezone "${NOAA_FORECAST_TIMEZONE}";
starttime "${NOAA_FORECAST_STARTTIME}";
stoptime "${NOAA_FORECAST_STOPTIME}";
}

#output "IEEE-123-voltage-profile.png" -t profile -l 10

0 comments on commit 4ead4e5

Please sign in to comment.