Skip to content

Commit

Permalink
Merge pull request #1141 from GRIDAPPSD/releases/2019.10.0
Browse files Browse the repository at this point in the history
Release of version 2019.10.0
  • Loading branch information
poorva1209 authored Oct 23, 2019
2 parents 428982b + 0c55480 commit 58df170
Show file tree
Hide file tree
Showing 22 changed files with 1,391 additions and 78 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# make use of vm's
sudo: 'required'

dist: trusty

language: java

jdk:
Expand Down
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ RUN cd ${TEMP_DIR} \

# Get the gridappsd-sensor-simulator from the proper repository
RUN cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-sensor-simulator -b develop \
&& git clone https://github.com/GRIDAPPSD/gridappsd-sensor-simulator -b master \
&& cd gridappsd-sensor-simulator \
&& pip3 install -r requirements.txt \
&& mkdir -p /gridappsd/services/gridappsd-sensor-simulator \
&& rm .git -rf \
&& cp * /gridappsd/services/gridappsd-sensor-simulator \
&& cp -r * /gridappsd/services/gridappsd-sensor-simulator \
&& cp /gridappsd/services/gridappsd-sensor-simulator/sensor_simulator.config /gridappsd/services/ \
&& rm -rf /root/.cache/pip/wheels

Expand All @@ -27,9 +27,18 @@ RUN cd ${TEMP_DIR} \
&& cd gridappsd-voltage-violation \
&& mkdir -p /gridappsd/services/gridappsd-voltage-violation \
&& rm .git -rf \
&& cp * /gridappsd/services/gridappsd-voltage-violation \
&& cp -r * /gridappsd/services/gridappsd-voltage-violation \
&& cp /gridappsd/services/gridappsd-voltage-violation/voltage-violation.config /gridappsd/services/

# Get the gridappsd-alarms from the proper repository
RUN cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-alarms -b develop \
&& cd gridappsd-alarms \
&& mkdir -p /gridappsd/services/gridappsd-alarms \
&& rm .git -rf \
&& cp -r * /gridappsd/services/gridappsd-alarms \
&& cp /gridappsd/services/gridappsd-alarms/gridappsd-alarms.config /gridappsd/services/


# Copy initial applications and services into the container.
#
Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
osgi.enroute.base.api,\
org.mockito.mockito-all,\
httpcore,\
blazegraph.cim2glm;version=11.0.0,\
blazegraph.cim2glm;version=12.0.0,\
httpclient,\
com.bigdata.rdf,\
proven-client;version=0.2.3,\
Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/run.bnd.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
httpcore,\
httpclient,\
xml-apis,\
blazegraph.cim2glm;version=11.0.0,\
blazegraph.cim2glm;version=12.0.0,\
org.eclipse.jetty.aggregate.jetty-all-server;version=7.6.9,\
javax.servlet-api,\
com.bigdata.rdf,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Properties;

import org.apache.felix.dm.annotation.api.Component;
Expand Down Expand Up @@ -131,10 +132,13 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces

String simulationId = GridAppsDConstants.getStringProperty(parameters, SIMULATIONID, null);
File configFile = null;
File idFile = null;
if(simulationId!=null){
SimulationContext simulationContext = simulationManager.getSimulationContextForId(simulationId);
if(simulationContext!=null){
configFile = new File(simulationContext.getSimulationDir()+File.separator+DSSBASE_FILENAME);
idFile = new File(simulationContext.getSimulationDir()+File.separator+DSSGUID_FILENAME);

//If the config file already has been created for this simulation then return it
if(configFile.exists()){
printFileToOutput(configFile, out);
Expand Down Expand Up @@ -183,31 +187,30 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces

String buscoords = GridAppsDConstants.getStringProperty(parameters, BUSCOORDS, null);
if(buscoords==null || buscoords.trim().length()==0){
//TODO need to figure out the correct default
//TODO need to figure out the correct default, maybe this?
buscoords = DSSBUSXY_FILENAME;
}
String guids = GridAppsDConstants.getStringProperty(parameters, GUIDS, null);
if(guids==null || guids.trim().length()==0){
//TODO need to figure out the correct default
//TODO need to figure out the correct default, maybe this?
guids = DSSGUID_FILENAME;
}

//TODO write a query handler that uses the built in powergrid model data manager that talks to blazegraph internally
QueryHandler queryHandler = new BlazegraphQueryHandler(bgHost, logManager, processId, username);
queryHandler.addFeederSelection(modelId);

CIMImporter cimImporter = new CIMImporter();
//TODO, this should go in the simiulation context directory or be a separate call or return dir or something
PrintWriter outID = new PrintWriter("outid");

//If the simulation info is available also write to file
if(configFile!=null){
cimImporter.generateDSSFile(queryHandler, new PrintWriter(new FileWriter(configFile)), outID, buscoords, guids, loadScale,
cimImporter.generateDSSFile(queryHandler, new PrintWriter(new FileWriter(configFile)), new PrintWriter(new FileWriter(idFile)), buscoords, guids, loadScale,
bWantSched, null, bWantZip, zFraction, iFraction, pFraction);
} else {
cimImporter.generateDSSFile(queryHandler, out, outID, buscoords, guids, loadScale, bWantSched, null, bWantZip, zFraction, iFraction, pFraction);
}
if(configFile!=null){
//config was written to file, so return that
//config was written to base file, so return that
printFileToOutput(configFile, out);
} else {
PrintWriter idFileWriter = new PrintWriter(new StringWriter());
cimImporter.generateDSSFile(queryHandler, out, idFileWriter, buscoords, guids, loadScale, bWantSched, null, bWantZip, zFraction, iFraction, pFraction);
idFileWriter.close();
}
logRunning("Finished generating DSS Base configuration file.", processId, "", logManager);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public class GLDAllConfigurationHandler extends BaseConfigurationHandler impleme
public static final String CIM2GLM_PREFIX = "model";
public static final String BASE_FILENAME = CIM2GLM_PREFIX+"_base.glm";
public static final String STARTUP_FILENAME = CIM2GLM_PREFIX+"_startup.glm";
public static final String SCHEDULES_FILENAME = CIM2GLM_PREFIX+"_schedules.glm";
public static final String MEASUREMENTOUTPUTS_FILENAME = CIM2GLM_PREFIX+"_outputs.json";
public static final String DICTIONARY_FILENAME = CIM2GLM_PREFIX+"_dict.json";
public static final String WEATHER_FILENAME = CIM2GLM_PREFIX+"_weather.csv";
Expand Down Expand Up @@ -151,27 +152,18 @@ public void start(){

@Override
public void generateConfig(Properties parameters, PrintWriter out, String processId, String username) throws Exception {
boolean bWantZip = false;
boolean bWantZip = true;
boolean bWantSched = false;

logRunning("Generating all GridLAB-D configuration files using parameters: "+parameters, processId, username, logManager);

double zFraction = GridAppsDConstants.getDoubleProperty(parameters, ZFRACTION, 0);
if(zFraction==0) {
zFraction = 0;
bWantZip = true;
}
double iFraction = GridAppsDConstants.getDoubleProperty(parameters, IFRACTION, 0);
if(iFraction==0){
iFraction = 1;
bWantZip = true;
}
double pFraction = GridAppsDConstants.getDoubleProperty(parameters, PFRACTION, 0);
if(pFraction==0){
pFraction = 0;
bWantZip = true;
}


if(zFraction == 0 && iFraction == 0 && pFraction == 0)
bWantZip = false;

boolean bWantRandomFractions = GridAppsDConstants.getBooleanProperty(parameters, RANDOMIZEFRACTIONS, false);

double loadScale = GridAppsDConstants.getDoubleProperty(parameters, LOADSCALINGFACTOR, 1);
Expand Down Expand Up @@ -242,7 +234,7 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces
RequestTimeseriesData weatherRequest = new RequestTimeseriesData();
weatherRequest.setQueryMeasurement("weather");
weatherRequest.setResponseFormat(ProvenWeatherToGridlabdWeatherConverter.OUTPUT_FORMAT);
Map<String, String> queryFilter = new HashMap<String, String>();
Map<String, Object> queryFilter = new HashMap<String, Object>();

Calendar c = Calendar.getInstance();
//For both the start and end time, set the year to the one that currently has data in the database
Expand Down Expand Up @@ -277,7 +269,11 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces
logRunning(e.getMessage(),
processId, username, logManager, LogLevel.WARN);
}


//Generate zip load profile player file
GLDZiploadScheduleConfigurationHandler ziploadScheduleConfigurationHandler = new GLDZiploadScheduleConfigurationHandler(logManager, dataManager);
ziploadScheduleConfigurationHandler.generateConfig(parameters, null, processId, username);

//Generate startup file
File startupFile = new File(tempDataPath+File.separator+STARTUP_FILENAME);
PrintWriter startupFileWriter = new PrintWriter(startupFile);
Expand Down Expand Up @@ -358,6 +354,8 @@ protected void generateStartupFile(Properties parameters, String tempDataPath, P
}
//add an include reference to the base glm
String baseGLM = tempDataPath+File.separator+BASE_FILENAME;
String schedulesFile = tempDataPath+File.separator+SCHEDULES_FILENAME;

String brokerLocation = simulationBrokerHost;
String brokerPort = String.valueOf(simulationBrokerPort);

Expand Down Expand Up @@ -455,13 +453,13 @@ protected void generateStartupFile(Properties parameters, String tempDataPath, P
}
startupFileWriter.println("#define VSOURCE="+nominalv);
startupFileWriter.println("#include \""+baseGLM+"\"");
startupFileWriter.println("#include \""+schedulesFile+"\"");

startupFileWriter.flush();
startupFileWriter.close();

logRunning("Finished generating startup file for GridLAB-D configuration.", processId, username, logManager);

}



}
Loading

0 comments on commit 58df170

Please sign in to comment.