Zenmo / zero-web

0 stars 0 forks source link

Zenmo Zero

Table of Contents

About

Zenmo Zero is a tool to simulate local energy systems.

This repository contains a web-based application to help bootstrap the Zenmo Zero simulation model with external data.

Works together with:

Components

Frontend

Graphical user interface. The company survey forms are here (try one here!) and its web interface for administrators (screenshot).

It is hosted at zero.zenmo.com.

This can also build a front-end library to include the survey in external websites.

Ztor

This is the REST backend built on Ktor framework. Like AnyLogic it leans on the Java ecosystem.

Vallum

Client for Ztor. This is a library to access the REST API from AnyLogic. Artifacts are published to GitHub packages

Zummon

Contains code to share between the front-end and other components. Builds to both an NPM package and JVM artifact.

Zorm

Object-relational mapper for the core domain. This is to store surveys of companies in modelled business parks.

A library to access the domain entities from AnyLogic can be downloaded from GitHub Packages

This contains:

Data transfer objects class diagram:

(generated using Intellij)

Database relations:

(generated using Intellij)

Planned database relations:

(created using draw.io)

Migrations

This contains database migrations for PostgreSQL. This intends to include ALL tables used by the web application and data import tools.

The SQL schema is generated by the Ktor application. The migrations are created manually by diffing the generated schema with the previous version. Datagrip or pgAdmin can help create such a diff.

The migrations are applied by Flyway.

EP Online

This is a script to import the national dataset of energielabels to a PostgreSQL database.

Kleinverbruik

Stedin, Liander and Enexis publish usage data of natural gas and electricity anually. This is a small webservice which wraps this data so the frontend can request small parts of the data.

(this is partly defunct and this approach will be discontinued in favor of a database import).

Excel-read-named

Library to read the Excel format filled out by [Energieke Regio] (https://energiekeregio.nl) and Zenmo.

v5 uses the latest version of Apache POI, v3 uses an older version compatible with AnyLogic but it has issues with memory usage.

Fudura-client

Gets metering data from Fudura.

Running locally

Local environment can be set up and run using Docker Compose

1. Copy *.example.env files in ./docker and fill in the variables.

2. Install dependencies

docker compose run --rm gradle-base zummon:jsBrowserProductionLibraryDistribution
docker compose run --rm npm install --include dev

3. Start frontend

docker compose up -d frontend

The frontend should now be working. Validate this at http://localhost:1234.

4. Start database

docker compose up postgres

4. Initialize database schema

docker compose run --rm ztor-gradle-with-db ztor:run --args=create-schema

5. Start backend

docker compose up -d ztor-run

It should be working. Validate this at http://localhost:8082. It should say "Ztor application".

6. To fully use the application you need to add your Keycloak user to the table user, and add entries to the table project anduser_project.