Skip to content

Commit

Permalink
Added build utility files
Browse files Browse the repository at this point in the history
  • Loading branch information
ai-republic committed Jan 1, 2024
1 parent e57f52f commit b3ecc3b
Show file tree
Hide file tree
Showing 4 changed files with 334 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cleanrepo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

cd ~/bms-to-inverter
git restore *
git pull
cp ~/pom.xml.mine ~/bms-to-inverter/bms-to-inverter-main/pom.xml
cp ~/config.properties.mine ~/bms-to-inverter/bms-to-inverter-main/src/main/resources/config.properties
cp ~/log4j2.xml.mine ~/bms-to-inverter/bms-to-inverter-main/src/main/resources/log4j2.xml

mvn clean package -DskipTests
rm -R ~/final
mkdir ~/final
unzip ~/bms-to-inverter/bms-to-inverter-main/target/bms-to-inverter-main-0.0.1-SNAPSHOT.zip -d ~/final
cd ~/final/bms-to-inverter-main-0.0.1-SNAPSHOT
java -jar bms-to-inverter-main-0.0.1-SNAPSHOT.jar
91 changes: 91 additions & 0 deletions config.properties.mine
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
###################################################################
### System specific settings ###
###################################################################

# The number of battery packs (not cells) of the system
numBatteryPacks=1


###################################################################
### Protocol specific settings ###
###################################################################

# RS485 properties
RS485.baudrate=9600
RS485.startFlag=165
RS485.frameLength=13


# ModBus properties
ModBus.baudrate=9600


###################################################################
### BMS settings ###
###################################################################

#### Simple single port configuration ####
# BMS port protocol (CAN/RS485/ModBus)
bms.portProtocol=RS485
#bms.portProtocol=CAN

# The port name/device to use to communicate to the BMS
#bms.portLocator=com3
#bms.portLocator=can0
#bms.portLocator=/dev/ttyS0
bms.portLocator=/dev/ttyUSB0

#### Or for multiple BMSes connected to multiple ports ####
#bms.0.portProtocol=CAN
#bms.0.portLocator=can0
#bms.1.portProtocol=CAN
#bms.1.portLocator=can1
#bms.2.portProtocol=CAN
#bms.2.portLocator=can2
#etc...

# Interval to request BMS data (in seconds)
bms.pollInterval=60


###################################################################
### Inverter settings ###
###################################################################

# The port name/device to use to communicate to the inverter
inverter.portLocator=can1
# Interval to send data to the inverter (in seconds)
inverter.sendInterval=1


###################################################################
### Optional services settings ###
###################################################################

#### MQTT properties ####
# The URL to of the MQTT broker
mqtt.locator=tcp://127.0.0.1:61616
# The topic name on the MQTT broker
mqtt.topic=energystorage


#### Email properties ####
mail.out.debug=false
# SMTP or IMAP address of the outgoing server
mail.out.host=smtp.gmail.com
# The port of the outgoing server
mail.out.port=587
# smtp for TLS, smtps for SSL
mail.out.type=smtp
# User name to authenticate at the outgoing server
mail.out.username=
# Password to authenticate at the outgoing server
mail.out.password=
# Disable if using TLS
mail.out.sslEnable=false
# Disable if using SSL
mail.out.tlsEnable=true
# The email address to use when sending emails
mail.out.defaultEmail=
# A (comma separated) list of pre-configured email recipients
mail.recipients=
32 changes: 32 additions & 0 deletions log4j2.xml.mine
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>

<properties>
<property name="name">BMS-to-Inverter</property>
<property name="pattern">%d{yyyy-MM-dd HH:mm:ss.SSS} | %-5.5p | %-10.10t | %-20.20C:%-5.5L | %msg%n</property>
</properties>

<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="${pattern}"/>
</Console>
<RollingFile name="RollingFile" fileName="logs/${name}.log"
filePattern="logs/$${date:yyyy-MM}/${name}-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<pattern>${pattern}</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy /><!-- Rotated everyday -->
<SizeBasedTriggeringPolicy size="100 MB"/> <!-- Or every 100 MB -->
</Policies>
</RollingFile>
</appenders>
<loggers>
<root level="info"> <!-- We log everything -->
<appender-ref ref="Console"/> <!-- To console -->
<appender-ref ref="RollingFile"/> <!-- And to a rotated file -->
</root>
</loggers>

</Configuration>

196 changes: 196 additions & 0 deletions pom.xml.mine
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>bms-to-inverter-main</artifactId>

<parent>
<groupId>com.ai-republic.bms-to-inverter</groupId>
<artifactId>bms-to-inverter-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<name>${project.artifactId}-${project.version}</name>
<description>Application to communicate between a BMS and inverter</description>

<properties>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>
com.airepublic.bmstoinverter.BmsToInverter</mainClass>
</manifest>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-distribution</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly/zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


<dependencies>
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-shaded</artifactId>
<version>5.1.1.Final</version>
</dependency>


<!-- #################### !!!!!!!! Choose BMS !!!!!!!! ###################### -->

<!-- #################### DALY(CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>bms-daly-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<!-- #################### DALY (RS485) ################### -->
<dependency>
<groupId>com.ai-republic.bms-to-inverter</groupId>
<artifactId>bms-daly-rs485</artifactId>
<version>${project.version}</version>
</dependency>

<!-- #################### PYLONTECH (CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>bms-pylon-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<!-- #################### JK (CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>bms-jk-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<!-- #################### SEPLOS (CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>bms-seplos-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->


<!-- #################### !!!!!!!! Choose Inverter !!!!!!!! ###################### -->

<!-- #################### Dummy inverter ################### -->
<dependency>
<groupId>com.ai-republic.bms-to-inverter</groupId>
<artifactId>inverter-dummy</artifactId>
<version>${project.version}</version>
</dependency>

<!-- #################### SMA Sunny Island (CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>inverter-sma-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<!-- #################### GROWATT (CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>inverter-growatt-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<!-- #################### DEYE (CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>inverter-deye-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<!-- #################### SOLARK (CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>inverter-solark-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<dependency>
<groupId>com.ai-republic.email</groupId>
<artifactId>email-api</artifactId>
<version>1.0.5</version>
</dependency>


<!-- #################### !!!!!!!! Choose optional services !!!!!!!! ###################### -->

<!-- optionally add MQTT services -->
<dependency>
<groupId>com.ai-republic.bms-to-inverter</groupId>
<artifactId>service-mqtt-broker</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.ai-republic.bms-to-inverter</groupId>
<artifactId>service-mqtt-client</artifactId>
<version>${project.version}</version>
</dependency>


<!-- optionally add Email service -->
<!-- <dependency> -->
<!-- <groupId>com.ai-republic.email</groupId> -->
<!-- <artifactId>email-javamail</artifactId> -->
<!-- <version>1.0.5</version> -->
<!-- </dependency> -->
</dependencies>
</project>

0 comments on commit b3ecc3b

Please sign in to comment.