Skip to main content
Version: 3.2.0

Overview

The EWB Server is the primary server that supplies APIs to access network and time series data, as well as provides web apps that provide visualisations and other high level functionality related to the data from the APIs.

This document describes how to configure and run the energy workbench server.


Configuration

Configuration for the energy workbench server is specified in a JSON file.

KeyDescriptionRequired
httpObject that holds http related config.
Refer http config options below.
Yes
ewbDataObject that holds the ewb data related config.
Refer ewb data config options below.
Yes
authObject that holds the auth related config.
Refer auth config options below.
No
syslogObject that holds system log related config for Nix based systems
Refer system log options below.
No
geoViewObject that holds map tile related config
Refer geo view options below.
No
publicGeoViewObject that holds map tile related config for the public map tile endpoint
Refer geo view options below.
No
debugObject that holds results cache related config
Refer debug options below.
No
scadaObject that holds SCADA related config
Refer SCADA options below.
No
currentStateObject that holds current state processing related config
Refer current state processing options below.
No
voltageLevelObject that holds voltage level related config
Refer voltage level options below.
No
graphQlObject that holds GraphQL related config
Refer GraphQL options below.
No

HTTP Config

OptionDescriptionRequiredDefault
portThe port for the server to listen on for REST/GraphQL requests.Yes
grpcPortThe port for the server to listen on for gRPC requests.Yes
webrootThe path to the directory holding the application website.Nowebroot
mapSymbolsPathThe path to the directory holding the map symbol SVG's.Nowebroot/images/map-symbols
staticAssetCachingFlag to indicate whether static caching is enabled.Notrue
corsAllows you to specify hosts to add to the CORS (cross origin resource sharing) white list.NoNone
compressionThe type of compression to use for gRPC.Noidentity
isTlsEnabledEnable HTTPS on the web server.Nofalse
keyPathThe path to the PEM private key file.No
certPathThe path to the PEM certificate for the provided private key.No
caPathThe path to a PEM CA chain for client authentication.No
clientAuthWhether client authentication should be enabled. One of request, required, or none, meaning client auth is optional (client can request), required (client must present a signed certificate by a CA in caPath), or no client auth is available respectively.Nonone

EWB Data Config

OptionDescriptionRequiredDefault
pathThe path to the ewb data directory. When AWS related keys are specified, this is the path where EWB downloads the files from S3.Yes
timezoneThe timezone which the data belongs to.Yes
loadDatabaseConfigures connection to the database holding load data for customers.
Refer DB config options below.
Yes, if inputDatabase is defined
inputDatabaseConfigures connection to the database holding, among other things, PV/EV/BESS profiles.
Refer DB config options below.
No
loadIntervalLengthMinutesThe length of a load interval in minutes. This should match the interval length used in the loadDatabase. Supported values: 15, 30No30M
previousDaysToSearchForNetworkNumber of days to search the network back from the current date.No0
previousDaysToSearchForDiagramNumber of days number of days prior to the date of the network-model database being loaded to search for a diagrams database, if an exact match did not exist.No0
previousDaysToSearchForCustomerNumber of days number of days prior to the date of the network-model database being loaded to search for a customer database, if an exact match did not exist.No0
cachePeriodLimits the amount of load data available in the server.
Specified in days unless a units character is appended.
Valid unit characters: 'd' (days), 'm' (months), 'y' (years).
NoAll
resultsCacheTtlSecondsThe time to live for the results cache.No0
connectionPointIdentifierThe name of the identifier used for connection points.StringNMI
excludeCustomersIndicates that customers should be excluded from the EWB database load. Must be set to true if you do not have a customer database.Booleanfalse
networkDateWhen set EWB will only attempt to load a network-model database of this date.No
awsRegionWhen set EWB will use this value as part of the AWS S3 URI of database files.Yes, if awsBucket is defined
awsBucketWhen set EWB will use this value as part of the AWS S3 URI of database files.Yes, if awsRegion is defined
azureStorageAccountNameWhen set EWB will use this value as part of the Azure Blob Storage URI of database files.Yes, if azureStorageContainerName is defined
azureStorageContainerNameWhen set EWB will use this value as part of the Azure Blob Storage URI of database files.Yes, if azureStorageAccountName is defined
shouldInferPhasesIndicates if de-energised phases should be inferred when possible.Nofalse
changeSetsConfigures the loading and applying of change sets.
Refer Change Set Config below.
No
tip

DB Config

The following options can be used to configure a connection to a PostgreSQL database:

OptionDescriptionRequiredDefault
hostThe hostname of the PostgreSQL server.Yes
portThe port of the PostgreSQL server.No5432
nameThe name of the PostgreSQL database.Yes
usernameThe username to use to connect to the PostgreSQL server.Yes
passwordThe password to use to connect to the PostgreSQL server.Yes

Change Set Config

OptionDescriptionRequiredDefault
enabledControls if change set processing is enabled or not. When disabled, no change set processing will be performed even if configured.Nofalse
applyToBaseA list of change set names that should be applied to the base model.Nonone
failOnMissingIndicates if the server should fail to start if a specified change set can't be found, rather than ignoring it.Notrue

Auth Config

OptionDescriptionRequiredDefault
authTypeAuth method to be used
Valid values: AUTH0, EntraID,NONE
AUTH0 and EntraId use Auth0 or EntraId OAuth2 implementation respectively.
NONE to disable auth.
Yes, if auth definedNONE
trustedIssuersList of domain URL's for token issuers to be trusted by EWB.Yes, if type is not NONE""
audienceAPI audience for the server.Yes, if type is not NONE""
allowAllPermissionsBoolean flag to disable Authorisation - all claims will be accepted when authorising. Not recommended for production use cases.Nofalse
verifyCertificatesVerify server certificates when fetching JWKS keys from each issuer in the trustedIssuers list.Notrue
grpcScopesObject that holds the gRPC scopes.
Refer gRPC scopes config options below.
No

Note: Auth claims must have the read:ewb role/permission when authentication is enabled

{
"auth": {
"authType": "entraid",
"trustedIssuers": [
"https://login.microsoftonline.com/<tenant>/v2.0"
],
"audience": "982374979-23492837492-23423874987289asjdf"
}
}
info

For EntraId, you must use the URL as shown in the example; otherwise, it won’t function correctly.

gRPC Scopes Config

When using any of the token based authentication methods, the following options configure the scopes that must be found in the token in order to access the service. These should be configured to match the scopes you have defined in the external auth workflow (i.e. Auth0 or EntraID).

OptionDescriptionRequiredDefault
zepben.protobuf.nc.NetworkConsumerThe scope required to access the network consumer service.Noread:ewb
zepben.protobuf.dc.DiagramConsumerThe scope required to access the diagram consumer service.Noread:diagram
zepben.protobuf.cc.CustomerConsumerThe scope required to access the customer consumer service.Noread:customer
zepben.protobuf.ns.UpdateNetworkStateServiceThe scope required to access the update network state service.Nowrite:ewb

Example:

{
"auth": {
...
"grpcScopes": {
"zepben.protobuf.nc.NetworkConsumer": "my-network-read-access",
"zepben.protobuf.dc.DiagramConsumer": "my-diagram-read-access",
"zepben.protobuf.cc.CustomerConsumer": "my-customer-read-access",
"zepben.protobuf.ns.UpdateNetworkStateService": "my-network-write-access"
}
}
}

System Log Config

OptionDescriptionRequiredDefault
facilityThe facility code to specify the type of program logging the message.
Valid Values : SYSLOG, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7
No
tagThe tag for the log message.With facility

Geographic View Config

OptionDescriptionRequiredDefault
tileSizeThe size of the tiles to produce.No4096
maxZoomThe maximum supported zoom level.No20
mapboxApiTokenThe API token required to render MapBox tiles.Noinvalid token
keepLevelSpecThe keep level specification to be used for vector tiles.Nonull
maxCacheSizeThe maximum size in MB for tiles in the memory tile cache.No512
cacheWritePeriodThe time period in seconds between batch writes of the MVTs in memory to be written to disk.
A value of 0 will disable disk writes.
No10
minPointsToWriteThe minimum number of points on a tile for it to be written to the disk cache.No1000
switchNamePatternA regex pattern with a maximum of one group to extract switch names for visualisation on the map. If a single regex grouping is provided the group will be returned as the switch name. If the pattern doesn't match the switch name will not be included. Default is no switch names in the map tiles.Nonull

Debug Config

OptionDescriptionRequiredDefault
logRoutesIndicates if the server should print all registered routes on start-upNofalse
logExceptionsEnable stacktrace loggin when the server response with a 500Notrue
logRequestsIndicates if the server should print all requests receivedNotrue
logRequestBodyToFileSpecifies a file to save the last received request bodyNo
suppressZeroLengthSuppress the logging of zero length energy profile warningsNofalse
caution

If any paths in the configuration are given as relative paths, they will be relative to the working directory of the JVM.

SCADA Config

OptionDescriptionRequiredDefault
hostThe host name of the server hosting the SCADA GetPowerData service.Yes
portThe port number of the server hosting the SCADA GetPowerData service.Yes
basePathAny base path being used to proxy the SCADA GetPowerData service. Must include any leading /.Yes

Current State Processing Config

The following options can be used to customise the current state processing:

OptionDescriptionRequiredDefault
fromSystemTagThe system tag used to identify the id's passed to the current state processor. To use the mRID of the network objects set this to "EWB".NoGIS
backlogOptional configuration to enable pulling of a backlog of current state events at start-up. If not specified, backlog processing is disabled.
Refer Backlog Configuration below.
Nonull
debugWhether to enable extra debug logging on current state events. Will add reporting for number of EnergyConsumers possibly impacted by changes to the dynamic state. There is a small performance impact to state changes by enabling this setting.Nofalse

Example:

{
"currentState": {
"fromSystemTag": "GIS",
"backlog": {
"grpcChannelMode": "Insecure",
"host": "ewb.zepben.com",
"port": 50051,
"sinceDays": 30,
"verifyCertificates": false
},
"debug": true
},
}

Current State Backlog Config

OptionDescriptionRequiredDefault
hostThe host name of the service used to retrieve the backlog of current state events.Yes
portThe port of the service used to retrieve the backlog of current state events. Must be between 1 and 65535.Yes
sinceDaysThe amount of days before the until date to be considered as backlog events.No30
untilThe final time point to be considered as backlog events.NoCurrent Time
grpcChannelModeThe gRPC channel mode specifying how the connection to the service is secured or authenticated. One of Insecure, Tls, SecretAuthorIdentityAuth`.NoInsecure
clientIdThe client ID used for authentication when grpcChannelMode is set to SecretAuth.For SecretAuth""
clientSecretThe client secret used for authentication when grpcChannelMode is set to SecretAuth.For SecretAuth""
audienceThe audience used for authentication when grpcChannelMode is set to SecretAuth.For SecretAuth""
issuerThe issuer URL used for authentication when grpcChannelMode is set to SecretAuth.For SecretAuth""
authMethodThe authentication method used for securing the connection. One of NONE, OAUTH, or ENTRAID.For SecretAuthNONE
identityUrlThe identity provider URL required when grpcChannelMode is set to IdentityAuth.For IdentityAuth""
authCAFilenameThe filename of the certificate authority file for authentication. If provided, the file must exist.Nonull
caFilenameThe filename of the certificate authority file used to validate the server's certificate. If provided, the file must exist.Nonull
verifyCertificatesEnable (true) or disable (false) certificate verification in the backlog client connection.Notrue

Voltage Level Config

The following options can be used to customise the network voltage level assignment in the mapbox vector tiles:

OptionDescriptionRequiredDefault
unknownLevelLvLimitThe upper voltage (in volts) of items to assign to the LV voltage level if the level can't be determined by the containers of the item. Items above this voltage will be processed with [unknownLevelHvLimit].No1000
unknownLevelHvLimitThe upper voltage (in volts) of items to assign to the HV voltage level if the level can't be determined by the containers of the item. Items above this voltage will be assigned to the EHV level.No22000
ehvPoleClassificationA set of classifications that indicate a pole carries equipment at the EHV level.No[]
hvPoleClassificationA set of classifications that indicate a pole carries equipment at the HV level.No[]
lvPoleClassificationA set of classifications that indicate a pole carries equipment at the LV level.No[]

GraphQL Config

The following options can be used to customise the GraphQL processing:

OptionDescriptionRequiredDefault
maxIdentifiedObjectsThe maximum number of identified objects that can be returned by the getIdentifiedObjects GraphQL query.No100
numWorkerThreadsThe number of GraphQL worker threads to add to the pool for handling GraphQL requests.No4

Sample Configuration File

The following is a sample configuration file:

{
"http": {
"port": 9000,
"webroot": "/Users/zepben/Desktop/Zepben/Client/web-client/dist",
"staticCachingEnabled": false,
"cors": ".*"
},
"ewbData": {
"path": "/Users/zepben/Desktop/Zepben/Server/EnergyWorkbench/ewb",
"previousDaysToSearchForNetwork": 365,
"timezone": "Australia/Melbourne",
"cachePeriod": "1m",
"resultsCacheTtlSeconds": 90000
},
"syslog": {
"facility": "SYSLOG",
"tag": "EWB"
},
"graphQl": {
"maxIdentifiedObjects": 1000,
"numWorkerThreads": 10
}
}

Run

Command Line Arguments

FlagValid ValuesRequiredDefault
-c, --confPath to the configuration fileNoenergy-workbench-server-conf.json

To run the server, execute the following command at a terminal where <heap size> is the desired size of the heap (e.g. 16g):

java -Xmx<heap size> -Xms<heap size> -jar <path to energy-workbench-server-jar> --conf <path to config file>

Heap Size Estimation

Because you are running up a server with large network models and a lot of load profiles, you will need to increase the heap size for the JVM instance

using the appropriate JVM flags:

A network with 500,000 HV assets requires around 8GB.
Load points for around 100,000 distribution transformers require 20GB/year.
Weather Data from 100 weather stations would require around 512MB/year.
Depending on the API usage the JVM would require more than 8GB.

ewb_server.sh

As the server runs as a server (that is generally as a background process but at the very least as a process that does not just finish after a task is done) a script is provided to more easily start and stop the server. The script will make sure if there is a EWB server instance already running it will not start a second instance.

The script can be found at EWB_RELEASE_DIR/bin/ewb_server.sh.

The underlying java command that starts the server can be configured in the ewb.conf configuration file. See the deployment documentation for more information on ewb.conf.

To start the EWB server using this script:

EWB_RELEASE_DIR/bin/ewb_server.sh start

To stop the EWB server using this script:

EWB_RELEASE_DIR/bin/ewb_server.sh stop

note

The ewb_daily.sh script relies on the ewb_server.sh script to stop and start the server.