Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/RWTH-EBC/pyDMPC into issu…
Browse files Browse the repository at this point in the history
…ee61_integrateTrajectory

# Conflicts:
#	pyDMPC/Utilities/mlp_train_modelica.py

#61
  • Loading branch information
MBaranskiEBC committed Jul 29, 2019
2 parents 5653afc + e11e65c commit d6d500c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pyDMPC/Utilities/mlp_train_modelica.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from sklearn.neural_network import MLPClassifier, MLPRegressor
from sklearn.neural_network import MLPRegressor
from sklearn.preprocessing import StandardScaler
import numpy as np
from pyfmi import load_fmu
import random
from joblib import dump, load
from joblib import dump
from matplotlib import pyplot as plt

def main():

module = "cooler"
path = "D:\dymola"
command = [] # The manipulated variable in the model
T_cur = [] # The current inflow temperature

Expand All @@ -28,7 +29,7 @@ def main():
sync_rate = 60 # Synchronisation rate of the FMU

# Load exisiting FMU
model = load_fmu(f"D:\dymola\{module}.fmu")
model = load_fmu(f"{path}\\{module}.fmu")

""" Initialize the FMU """
model.set('valveOpening',0)
Expand Down Expand Up @@ -92,7 +93,7 @@ def main():
plt.show()

""" Save the model and the scaler for later use """
dump(MLPModel, f"C:\TEMP\Dymola\{module}.joblib")
dump(scaler, f"C:\TEMP\Dymola\{module}_scaler.joblib")
dump(MLPModel, f"{path}\\{module}.joblib")
dump(scaler, f"{path}\\{module}_scaler.joblib")

if __name__=="__main__": main()

0 comments on commit d6d500c

Please sign in to comment.