Skip to content

Commit

Permalink
Merge pull request #1030 from GRIDAPPSD/releases/2019.07.0
Browse files Browse the repository at this point in the history
Release of version 2019.07.0
  • Loading branch information
craig8 authored Jul 25, 2019
2 parents 5697e13 + f4b8c97 commit 658e1bf
Show file tree
Hide file tree
Showing 38 changed files with 1,462 additions and 697 deletions.
16 changes: 0 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,6 @@ FROM gridappsd/gridappsd_base${GRIDAPPSD_BASE_VERSION}

ARG TIMESTAMP

# Update to use python 3.6 as default for python3.
RUN sudo apt-get update && sudo apt-get install -y software-properties-common \
&& sudo add-apt-repository ppa:deadsnakes/ppa \
&& sudo apt-get update && sudo apt-get install -y python3.6 python3.6-dev \
&& sudo /usr/bin/update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 \
&& sudo /usr/bin/update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1 \
&& sudo sudo /usr/bin/update-alternatives --set python /usr/bin/python3.6 \
&& sudo sudo /usr/bin/update-alternatives --set python3 /usr/bin/python3.6 \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /root/.cache/pip/wheels

# TODO remove after we modify the base container to do this properly
RUN mkdir -p /usr/local/lib/python3.6/dist-packages/fncs
RUN cp /usr/local/lib/python3.5/dist-packages/fncs/fncs.py /usr/local/lib/python3.6/dist-packages/fncs/fncs.py


# Get the gridappsd-python from the proper repository
RUN cd ${TEMP_DIR} \
&& git clone https://github.com/GRIDAPPSD/gridappsd-python -b develop \
Expand Down
2 changes: 1 addition & 1 deletion build-gridappsd-container
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
rm -rf gov.pnnl.goss/gridappsd/generated
./gradlew export

docker build --no-cache --network=host -t gridappsd .
docker build --no-cache --network=host -t gridappsd:local .
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ if [ "$1" = "gridappsd" ]; then
# Install application python requirements
for reqfile in `ls /gridappsd/services/*/requirements.txt 2>/dev/null`; do
echo "[Entrypoint] Installing requirements $reqfile"
pip install -q --disable-pip-version-check -r $reqfile
sudo pip install -q --disable-pip-version-check -r $reqfile
done
for reqfile in `ls /gridappsd/applications/*/requirements.txt 2>/dev/null`; do
echo "[Entrypoint] Installing requirements $reqfile"
pip install -q --disable-pip-version-check -r $reqfile
sudo pip install -q --disable-pip-version-check -r $reqfile
done

# Run tail -f /dev/null to keep the container running and waiting for connection
Expand Down
4 changes: 2 additions & 2 deletions gov.pnnl.goss.gridappsd/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
blazegraph.cim2glm;version=10.0.3,\
httpclient,\
com.bigdata.rdf,\
proven-client;version=0.2.1,\
proven-message;version=0.3
proven-client;version=0.2.2,\
proven-message;version=0.4

-plugin org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin;log=debug

Expand Down
2 changes: 1 addition & 1 deletion gov.pnnl.goss.gridappsd/conf/pnnl.goss.gridappsd.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fncs.bridge.path = ./scripts/goss_fncs_bridge.py
applications.path = /gridappsd/applications
services.path = /gridappsd/services
# Requires no /
blazegraph.ns.path = http://localhost:8889/bigdata/sparql
blazegraph.ns.path = http://localhost:8889/bigdata/namespace/kb/sparql

# Uses docker composed blazegraph host here. Note this is not the
# external address, but from inside one of the containers on the
Expand Down
4 changes: 2 additions & 2 deletions gov.pnnl.goss.gridappsd/run.bnd.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
org.eclipse.jetty.aggregate.jetty-all-server;version=7.6.9,\
javax.servlet-api,\
com.bigdata.rdf,\
proven-message;version=0.3,\
proven-client;version=0.2.1,\
proven-message;version=0.4,\
proven-client;version=0.2.2,\
javax.ws.rs-api,\
org.apache.commons.codec,\
shacl,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ public interface AppManager {
*/
AppInfo getApp(String appId); //Would return through message bus appInfo object

/**
* Returns application id for the application instance id.
* @param appInstanceId Instance id of the application
* @return Application id
*/
String getAppIdForInstance(String appInstanceId);

/**
* Unregisters app with the requested id
* @param appId Registered ID of the app to de-register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ public enum ResultFormat {
String queryModelNamesAndIds(String resultFormat, String processId, String username);
ResultSet queryModelNamesAndIdsResultSet(String processId, String username);

String queryObjectIds(String resultFormat, String modelId, String objectType, String processId, String username);
List<String> queryObjectIdsList(String modelId, String objectType, String processId, String username);

String queryObjectDictByType(String resultFormat, String modelId, String objectType, String objectId, String processId, String username) throws Exception ;
ResultSet queryObjectDictByTypeResultSet(String modelId, String objectType, String objectId, String processId, String username);

String queryMeasurementDictByObject(String resultFormat, String modelId, String objectType, String objectId, String processId, String username) throws Exception ;
ResultSet queryMeasurementDictByObjectResultSet(String modelId, String objectType, String objectId, String processId, String username);


void putModel(String modelId, String model, String inputFormat, String processId, String username);

//Also will need putObject and deleteObject (will need to support the right security permissions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ public interface ServiceManager {
*/
ServiceInfo getService(String service_id); //Would return through message bus appInfo object

/**
* Returns service id for a service instance id.
* @param serviceInstanceId Instance id of a running or ran service
* @return Service Id for the passed instance id.
*/
String getServiceIdForInstance(String serviceInstanceId);

/**
* Unregisters service with the requested id
* @param service_id Registered ID of the service to de-register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.Serializable;

import gov.pnnl.goss.gridappsd.dto.RequestTimeseriesData;
import gov.pnnl.goss.gridappsd.dto.SimulationContext;

public interface TimeseriesDataManager {
// public enum ResultFormat {
Expand All @@ -11,8 +12,22 @@ public interface TimeseriesDataManager {

Serializable query(RequestTimeseriesData requestTimeseriesData) throws Exception;

void storeSimulationOutput(Serializable simulationOutput) throws Exception;
void storeSimulationOutput(String simulationId) throws Exception;

void storeSimulationInput(Serializable simulationIput) throws Exception;
void storeSimulationInput(String simulationId) throws Exception;

void storeServiceOutput(String simulationId, String serviceId,
String instanceId) throws Exception;

void storeServiceInput(String simulationId, String serviceId,
String instanceId) throws Exception;

void storeAppOutput(String simulationId, String appId, String instanceId)
throws Exception;

void storeAppInput(String simulationId, String appId, String instanceId)
throws Exception;

void storeAllData(SimulationContext simulationContext) throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,12 @@ public AppInfo getApp(String appId) {
appId = appId.trim();
return apps.get(appId);
}

@Override
public String getAppIdForInstance(String appInstanceId) {
appInstanceId = appInstanceId.trim();
return appInstances.get(appInstanceId).getApp_info().getId();
}

@Override
public void deRegisterApp(String appId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
import gov.pnnl.goss.gridappsd.data.handlers.BlazegraphQueryHandler;
import gov.pnnl.goss.gridappsd.dto.RequestTimeseriesData;
import gov.pnnl.goss.gridappsd.dto.LogMessage.LogLevel;
import gov.pnnl.goss.gridappsd.dto.RequestTimeseriesData.RequestType;
import gov.pnnl.goss.gridappsd.utils.GridAppsDConstants;
import pnnl.goss.core.Client;
import pnnl.goss.core.DataResponse;
Expand Down Expand Up @@ -242,7 +241,7 @@ public void generateConfig(Properties parameters, PrintWriter out, String proces
try {
if(useClimate){
RequestTimeseriesData weatherRequest = new RequestTimeseriesData();
weatherRequest.setQueryMeasurement(RequestType.weather);
weatherRequest.setQueryMeasurement("weather");
weatherRequest.setResponseFormat(ProvenWeatherToGridlabdWeatherConverter.OUTPUT_FORMAT);
Map<String, String> queryFilter = new HashMap<String, String>();

Expand Down Expand Up @@ -393,7 +392,9 @@ protected void generateStartupFile(Properties parameters, String tempDataPath, P
if(useClimate) {
startupFileWriter.println("module climate;");
}
startupFileWriter.println("module reliability;");


startupFileWriter.println("object fncs_msg {");
startupFileWriter.println(" name "+simulationID+";");
startupFileWriter.println(" message_type JSON;");
Expand All @@ -414,6 +415,17 @@ protected void generateStartupFile(Properties parameters, String tempDataPath, P
startupFileWriter.println(" limit 120;");
startupFileWriter.println("}");*/

startupFileWriter.println("object fault_check {");
startupFileWriter.println(" name fault_check_object;");
startupFileWriter.println(" check_mode ONCHANGE;");
startupFileWriter.println(" eventgen_object external_event_handler;");
startupFileWriter.println(" output_filename fault_check_output.txt;");
startupFileWriter.println("}");
startupFileWriter.println("object eventgen {");
startupFileWriter.println(" name external_event_handler;");
startupFileWriter.println(" use_external_faults TRUE;");
startupFileWriter.println("}");

if(useClimate) {
startupFileWriter.println("object csv_reader {");
startupFileWriter.println(" name CSVREADER;");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,6 @@ void parseMeasurement(Map<String, JsonArray> measurements, JsonObject measuremen
} else if (measurementType.equals("Pos")) {
objectName = conductingEquipmentName;
propertyName = "tap_" + phases;
} else if (measurementType.equals("PNV")) {
objectName = connectivityNode;
propertyName = "voltage_"+phases;
} else if (measurementType.equals("A")) {
objectName = conductingEquipmentName;
propertyName = "current_out_" + phases;
} else {
throw new JsonParseException(String.format("CimMeasurementsToGldPubs::parseMeasurement: The value of measurementType is not a valid type.\nValid types for RatioTapChanger are VA, PNV, A, and Pos.\nmeasurementType = %s.",measurementType));
}
Expand Down Expand Up @@ -345,7 +339,7 @@ void parseMeasurement(Map<String, JsonArray> measurements, JsonObject measuremen
} else if (measurementType.equals("PNV")) {
objectName = connectivityNode;
propertyName = "voltage_" + phases;
} else if (measurementType.equals("POS")) {
} else if (measurementType.equals("Pos")) {
objectName = conductingEquipmentName;
propertyName = "phase_" + phases + "_state";
} else if (measurementType.equals("A")) {
Expand Down Expand Up @@ -394,6 +388,19 @@ void parseMeasurement(Map<String, JsonArray> measurements, JsonObject measuremen
} else {
throw new JsonParseException(String.format("CimMeasurementsToGldPubs::parseMeasurement: The value of measurementType is not a valid type.\nValid types for PowerElectronicsConnection are VA, A, and PNV.\nmeasurementType = %s.",measurementType));
}
} else if (conductingEquipmentType.contains("SynchronousMachine")) {
if(measurementType.equals("VA")) {
objectName = conductingEquipmentName;
propertyName = "power_out_" + phases;
} else if (measurementType.equals("PNV")) {
objectName = connectivityNode;
propertyName = "voltage_" + phases;
} else if (measurementType.equals("A")) {
objectName = conductingEquipmentName;
propertyName = "current_out_" + phases;
} else {
throw new JsonParseException(String.format("CimMeasurementsToGldPubs::parseMeasurement: The value of measurementType is not a valid type.\nValid types for SynchronousMachine are VA, A, and PNV.\nmeasurementType = %s.",measurementType));
}
} else {
throw new JsonParseException(String.format("CimMeasurementsToGldPubs::parseMeasurement: The value of ConductingEquipment_type is not a recognized object type.\nValid types are ACLineSegment, LinearShuntCompesator, RatioTapChanger, LoadBreakSwitch, EnergyConsumer, PowerElectronicsConnection, and PowerTransformer.\nConductingEquipment_type = %s.",conductingEquipmentType));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,22 @@ public Serializable handle(Serializable requestContent, String processId, String
//TODO send error
}
return dataManager.queryObjectTypes(pgDataRequest.getModelId(), pgDataRequest.getResultFormat(), processId, username);
} else {
} else if(PowergridModelDataRequest.RequestType.QUERY_OBJECT_IDS.toString().equals(pgDataRequest.requestType)){
if (pgDataRequest.getModelId()==null || !verifyResultFormat(pgDataRequest.getResultFormat())){
//TODO send error
}
return dataManager.queryObjectIds(pgDataRequest.getResultFormat(), pgDataRequest.getModelId(), pgDataRequest.getObjectType(), processId, username);
} else if(PowergridModelDataRequest.RequestType.QUERY_OBJECT_DICT.toString().equals(pgDataRequest.requestType)){
if (pgDataRequest.getModelId()==null || !verifyResultFormat(pgDataRequest.getResultFormat())){
//TODO send error
}
return dataManager.queryObjectDictByType(pgDataRequest.getResultFormat(), pgDataRequest.getModelId(), pgDataRequest.getObjectType(), pgDataRequest.getObjectId(), processId, username);
} else if(PowergridModelDataRequest.RequestType.QUERY_OBJECT_MEASUREMENTS.toString().equals(pgDataRequest.requestType)){
if (pgDataRequest.getModelId()==null || !verifyResultFormat(pgDataRequest.getResultFormat())){
//TODO send error
}
return dataManager.queryMeasurementDictByObject(pgDataRequest.getResultFormat(), pgDataRequest.getModelId(), pgDataRequest.getObjectType(), pgDataRequest.getObjectId(), processId, username);
} else {
//TODO report error, request type not recognized
System.out.println("DOESNT RECOGNIZE REQUEST TYPE "+pgDataRequest.requestType);
}
Expand Down
Loading

0 comments on commit 658e1bf

Please sign in to comment.