Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
eb4e4a1
generalcontrol
markgarnold Jun 19, 2023
03aa24c
gencon2
markgarnold Jun 19, 2023
cc6cc49
Implement v1.0.0 of Shared Memory
shivangvijay Jun 22, 2023
964855f
commented not required print
shivangvijay Jun 22, 2023
ab4f0d5
docker, params, maxtime made accesible from concore-editor
Rahuljagwani Jun 22, 2023
05dbeee
makedocker.bat added
Rahuljagwani Jun 23, 2023
d15e9e0
Merge pull request #76 from shivangvijay/rasp
pradeeban Jun 23, 2023
3a6c7cf
exec error solved for posix
Rahuljagwani Jun 24, 2023
705ea42
Implemented multiple shared memory based on edge name
shivangvijay Jun 25, 2023
213fb52
octave made active
Rahuljagwani Jun 25, 2023
38c4f65
Merge pull request #79 from shivangvijay/rasp
pradeeban Jun 26, 2023
fb6255d
Merge pull request #80 from Rahuljagwani/docker
pradeeban Jun 26, 2023
ca35be9
Merge branch 'ControlCore-Project:main' into octave
Rahuljagwani Jun 29, 2023
6b5812a
deletion of octave in windows
Rahuljagwani Jun 29, 2023
e0625ad
Create README.md for ratc2
pradeeban Jun 29, 2023
b86cac8
Merge branch 'ControlCore-Project:main' into octave
Rahuljagwani Jun 30, 2023
58d86d2
Merge pull request #81 from Rahuljagwani/octave
pradeeban Jun 30, 2023
bb12482
octave implementation for windows
Rahuljagwani Jul 1, 2023
ac171b2
Merge branch 'octave' of https://github.com/Rahuljagwani/concore into…
Rahuljagwani Jul 1, 2023
1b37499
Merge branch 'ControlCore-Project:main' into octave
Rahuljagwani Jul 1, 2023
55d2ba8
Merge pull request #83 from Rahuljagwani/octave
pradeeban Jul 1, 2023
434e506
implemented Shared memory based on initial positive integer of edge
shivangvijay Jul 1, 2023
2b204fb
Added comments in the concore.hpp file to help developer
shivangvijay Jul 1, 2023
c5c3432
Merge pull request #84 from shivangvijay/rasp
pradeeban Jul 4, 2023
33a38c4
c2 pm2 ratc2
markgarnold Jul 5, 2023
33bac9e
Create README.md
Olusanmi-A Jul 5, 2023
80b5330
execute permissions removed from whole repo
Rahuljagwani Jul 7, 2023
f67cca1
Merge branch 'octave' of https://github.com/Rahuljagwani/concore into…
Rahuljagwani Jul 7, 2023
1cb3219
Merge pull request #87 from Rahuljagwani/octave
pradeeban Jul 7, 2023
4d72c18
fix the permission problem Mac Casadi MPCtools
yuy516 Jul 12, 2023
b9a7465
initial C3
yuy516 Jul 12, 2023
d8caba4
Merge pull request #88 from ControlCore-Project/raspberry
pradeeban Jul 14, 2023
234aad9
test cases for shared memory
shivangvijay Jul 14, 2023
4d1e687
Merge pull request #89 from shivangvijay/rasp
pradeeban Jul 14, 2023
397a2ca
Merge pull request #90 from ControlCore-Project/raspberry
pradeeban Jul 14, 2023
0199e5d
symbolic link "tool library" test
markgarnold Jul 15, 2023
242c382
Merge branch 'main' of https://github.com/ControlCore-Project/concore
markgarnold Jul 15, 2023
739d9e3
update pm3 and c3 with disturbance rejection function
yuy516 Jul 20, 2023
e058682
Create library
markgarnold Jul 23, 2023
7e56bc2
Create plotymlag.py
markgarnold Jul 24, 2023
2634130
Create library.bat
markgarnold Jul 24, 2023
02b4ba3
logs added
Rahuljagwani Jul 25, 2023
a1d7477
Merge pull request #93 from Rahuljagwani/octave
pradeeban Jul 25, 2023
d031e3d
library api created
Rahuljagwani Jul 30, 2023
d744a46
library modified
Rahuljagwani Jul 31, 2023
1091829
Merge pull request #94 from Rahuljagwani/octave
pradeeban Jul 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
347 changes: 336 additions & 11 deletions concore.hpp

Large diffs are not rendered by default.

964 changes: 964 additions & 0 deletions demo/gencon2.graphml

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions demo/gencontrol.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import numpy as np
import concore

ysp = 3.0

# controller function
def controller(ym):
if ym[0] < ysp:
return 1.01 * ym
else:
return 0.9 * ym

# main
concore.default_maxtime(150)
concore.delay = 0.02

# initial values -- transforms to string including the simtime as the 0th entry in the list
init_simtime_u = "[0.0, 0.0]"
init_simtime_ym = "[0.0, 0.0]"

u = np.array([concore.initval(init_simtime_u)]).T
while(concore.simtime<10):
while concore.unchanged():
ym = concore.read(concore.iport['SYM'],"ym",init_simtime_ym)
ym = np.array([ym]).T
#####
u = controller(ym)
#####
print("****"+str(concore.simtime) + ". u="+str(u) + "ym="+str(ym))
concore.write(concore.oport['SU'],"u",list(u.T[0]),delta=0)

concore.write(concore.oport['CU'],"u",list(u.T[0]),delta=0)

while(concore.simtime<concore.maxtime):
while concore.unchanged():
ym = concore.read(concore.iport['PYM'],"ym",init_simtime_ym)
ym = np.array([ym]).T
#####
u = controller(ym)
#####
print(str(concore.simtime) + ". u="+str(u) + "ym="+str(ym))
concore.write(concore.oport['CU'],"u",list(u.T[0]),delta=0)

concore.write(concore.oport['SU'],"u",list(u.T[0]),delta=0)
print("retry="+str(concore.retrycount))
699 changes: 699 additions & 0 deletions demo/generalcontrol.graphml

Large diffs are not rendered by default.

723 changes: 723 additions & 0 deletions demo/generalcontroler.graphml

Large diffs are not rendered by default.

177 changes: 163 additions & 14 deletions fri/server/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from flask import Flask, request, jsonify, send_file, send_from_directory
from werkzeug.utils import secure_filename
import xml.etree.ElementTree as ET
import os
import subprocess
from subprocess import call
Expand All @@ -18,6 +19,17 @@
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'

def check_node_labels(graphml_file):
tree = ET.parse(graphml_file)
root = tree.getroot()
namespace = {'y': 'http://www.yworks.com/xml/graphml'}
node_labels = root.findall('.//y:NodeLabel', namespace)
for node_label in node_labels:
label = node_label.text
if label.endswith('.m'):
return True
return False

# To upload multiple file. For example, /upload/test?apikey=xyz
@app.route('/upload/<dir>', methods=['POST'])
def upload(dir):
Expand Down Expand Up @@ -65,9 +77,14 @@ def upload(dir):
# to download /build/<dir>?fetch=<graphml>. For example, /build/test?fetch=sample1&apikey=xyz
@app.route('/build/<dir>', methods=['POST'])
def build(dir):
graphml_file = request.args.get('fetch')
graphml_file = request.args.get('fetch')
params = request.args.get('params')
docker = request.args.get('docker')
octave = request.args.get('octave')
maxtime = request.args.get('maxtime')
apikey = request.args.get('apikey')
out_dir = request.args.get('outdir')
output_str = ""
if(apikey == None):
dirname = secure_filename(dir)
else:
Expand All @@ -77,35 +94,132 @@ def build(dir):
dir_path = os.path.abspath(os.path.join(concore_path, graphml_file)) #path for ./build
else:
dir_path = os.path.abspath(os.path.join(concore_path, out_dir)) #path for ./build

dotMCheck = check_node_labels(os.path.abspath(os.path.join(concore_path, makestudy_dir)) + '.graphml')
if((dotMCheck == False or octave == 'false') and os.path.isfile(os.path.abspath(os.path.join(concore_path, 'concore.octave')))):
if(platform.uname()[0]!='Windows'):
proc= call(["rm", "concore.octave"], cwd=concore_path)
else:
proc= call(["del", "concore.octave"], shell=True, cwd=concore_path)

if(octave == 'true' and dotMCheck):
if(platform.uname()[0]!='Windows'):
proc= call(["touch", "concore.octave"], cwd=concore_path)
else:
proc= open(os.path.abspath(os.path.join(concore_path, 'concore.octave')), 'x')


if not os.path.exists(dir_path):
if(platform.uname()[0]=='Windows'):
if(out_dir == None or out_dir == ""):
proc= call(["makestudy", makestudy_dir], shell=True, cwd=concore_path)
if(docker == 'true'):
try:
output_bytes = subprocess.check_output(["makedocker", makestudy_dir], cwd=concore_path, shell=True)
output_str = output_bytes.decode("utf-8")
proc = 0
except subprocess.CalledProcessError as e:
output_str = f"Docker study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
else:
try:
output_bytes = subprocess.check_output(["makestudy", makestudy_dir], cwd=concore_path, shell=True)
output_str = output_bytes.decode("utf-8")
proc = 0
except subprocess.CalledProcessError as e:
output_str = f"Study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
else:
proc= call(["makestudy", makestudy_dir, out_dir], shell=True, cwd=concore_path)
if(docker == 'true'):
try:
output_bytes = subprocess.check_output(["makedocker", makestudy_dir, out_dir], cwd=concore_path, shell=True)
output_str = output_bytes.decode("utf-8")
proc = 0
except subprocess.CalledProcessError as e:
output_str = f"Docker study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
else:
try:
output_bytes = subprocess.check_output(["makestudy", makestudy_dir, out_dir], cwd=concore_path, shell=True)
output_str = output_bytes.decode("utf-8")
proc = 0
except subprocess.CalledProcessError as e:
output_str = f"Study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
else:
if(out_dir == None or out_dir == ""):
proc= call(["./makestudy", makestudy_dir], cwd=concore_path)
if(docker == 'true'):
try:
output_bytes = subprocess.check_output(["./makedocker", makestudy_dir], cwd=concore_path)
output_str = output_bytes.decode("utf-8")
proc = 0
except subprocess.CalledProcessError as e:
output_str = f"Docker study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
else:
try:
output_bytes = subprocess.check_output(["./makestudy", makestudy_dir], cwd=concore_path)
output_str = output_bytes.decode("utf-8")
proc = 0
except subprocess.CalledProcessError as e:
output_str = f"Study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
else:
proc= call(["./makestudy", makestudy_dir, out_dir], cwd=concore_path)
if(docker == 'true'):
try:
output_bytes = subprocess.check_output(["./makedocker", makestudy_dir, out_dir], cwd=concore_path)
output_str = output_bytes.decode("utf-8")
proc = 0
except subprocess.CalledProcessError as e:
output_str = f"Docker study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
else:
try:
output_bytes = subprocess.check_output(["./makestudy", makestudy_dir, out_dir], cwd=concore_path)
output_str = output_bytes.decode("utf-8")
proc = 0
except subprocess.CalledProcessError as e:
output_str = f"Study creation failed with return code {e.returncode} (check duplicate directory)"
proc = 1
if(proc == 0):
resp = jsonify({'message': 'Directory successfully created'})
resp.status_code = 201
else:
resp = jsonify({'message': 'There is an Error'})
resp.status_code = 500
resp.status_code = 500
if(platform.uname()[0]=='Windows'):
call(["build"], cwd=dir_path, shell=True)
try:
output_bytes = subprocess.check_output("build", cwd=dir_path, shell=True)
output_str = output_str + output_bytes.decode("utf-8")
resp = jsonify({'message': 'Directory successfully created', 'output': output_str})
except subprocess.CalledProcessError as e:
output_str = f"Build failed with return code {e.returncode}"
resp = jsonify({'message': 'Build Failed', 'output': output_str})
resp.status_code = 500
if(maxtime != None and maxtime != ''):
proc=call(["maxtime", maxtime],shell=True, cwd=dir_path)
if(params != None and params != ''):
proc=call(["params", params],shell=True, cwd=dir_path)
else:
call(["./build"], cwd=dir_path)
try:
output_bytes = subprocess.check_output("./build", cwd=dir_path)
output_str = output_str + output_bytes.decode("utf-8")
resp = jsonify({'message': 'Directory successfully created', 'output': output_str})
except subprocess.CalledProcessError as e:
output_str = f"Build failed with return code {e.returncode}"
resp = jsonify({'message': 'Build Failed', 'output': output_str})
resp.status_code = 500
if(maxtime != None and maxtime != ''):
proc=call(["./maxtime", maxtime], cwd=dir_path)
if(params != None and params != ''):
proc=call(["./params", params], cwd=dir_path)
return resp

@app.route('/debug/<dir>', methods=['POST'])
def debug(dir):
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
if(platform.uname()[0]=='Windows'):
proc=call(["debug"],shell=True, cwd=dir_path)
proc = call(["debug"],shell=True, cwd=dir_path)
else:
proc = call(["./debug"], cwd=dir_path)
if(proc == 0):
Expand All @@ -122,7 +236,7 @@ def run(dir):
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
if(platform.uname()[0]=='Windows'):
proc=call(["run"],shell=True, cwd=dir_path)
proc = call(["run"],shell=True, cwd=dir_path)
else:
proc = call(["./run"], cwd=dir_path)
if(proc == 0):
Expand All @@ -139,7 +253,7 @@ def stop(dir):
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
if(platform.uname()[0]=='Windows'):
proc=call(["stop"],shell=True, cwd=dir_path)
proc = call(["stop"],shell=True, cwd=dir_path)
else:
proc = call(["./stop"], cwd=dir_path)
if(proc == 0):
Expand All @@ -154,12 +268,23 @@ def stop(dir):

@app.route('/clear/<dir>', methods=['POST'])
def clear(dir):
unlock = request.args.get('unlock')
params = request.args.get('params')
maxtime = request.args.get('maxtime')
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
if(platform.uname()[0]=='Windows'):
proc=call(["clear"],shell=True, cwd=dir_path)
proc = call(["clear"],shell=True, cwd=dir_path)
if(maxtime != None and maxtime != ''):
proc = call(["maxtime", maxtime],shell=True, cwd=dir_path)
if(params != None and params != ''):
proc = call(["params", params],shell=True, cwd=dir_path)
else:
proc = call(["./clear"], cwd=dir_path)
if(maxtime != None and maxtime != ''):
proc = call(["./maxtime", maxtime], cwd=dir_path)
if(params != None and params != ''):
proc = call(["./params", params], cwd=dir_path)
if(proc == 0):
resp = jsonify({'message': 'result deleted'})
resp.status_code = 201
Expand Down Expand Up @@ -191,7 +316,7 @@ def download(dir):
def destroy(dir):
dir = secure_filename(dir)
if(platform.uname()[0]=='Windows'):
proc=call(["destroy", dir],shell=True, cwd=concore_path)
proc = call(["destroy", dir],shell=True, cwd=concore_path)
else:
proc = call(["./destroy", dir], cwd=concore_path)
if(proc == 0):
Expand All @@ -201,7 +326,31 @@ def destroy(dir):
else:
resp = jsonify({'message': 'There is an Error'})
resp.status_code = 500
return resp
return resp

@app.route('/library/<dir>', methods=['POST'])
def library(dir):
dir_name = secure_filename(dir)
dir_path = os.path.abspath(os.path.join(concore_path, dir_name))
filename = request.args.get('filename')
library_path = request.args.get('path')
proc = 0
if (library_path == None or library_path == ''):
library_path = "../tools"
if(platform.uname()[0]=='Windows'):
proc = subprocess.check_output(["..\library", library_path, filename],shell=True, cwd=dir_path)
else:
proc = subprocess.check_output(["../library", library_path, filename], cwd=dir_path)
if(proc != 0):
resp = jsonify({'message': proc.decode("utf-8")})
resp.status_code = 201
return resp
else:
resp = jsonify({'message': 'There is an Error'})
resp.status_code = 500
return resp



@app.route('/getFilesList/<dir>', methods=['POST'])
def getFilesList(dir):
Expand Down
1 change: 1 addition & 0 deletions humanc/dummy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Human cardiac (humanc) models
36 changes: 36 additions & 0 deletions library
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
if [ $# = 0 ]
then
echo "library -- create a link that references "library" program or dir"
else
tooldir="../tools"
if [ $# = 1 ]
then
filename=$1
elif [ $# = 2 ]
then
tooldir=$1
filename=$2
else
echo "too many args"
exit
fi
if [ -e $filename ]
then
echo "cannot create library link over existing file"
exit
fi
if [ -d $tooldir ]
then
if [ -e $tooldir/$filename ]
then
ln -s $tooldir/$filename $filename
echo "library link created"
else
echo "$filename does not exist in $tooldir"
fi
else
echo "$tooldir does not exist"
fi
fi

25 changes: 25 additions & 0 deletions library.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@echo off
if "%2" == "" (
if exist "..\tools\%1" (
if exist "%1" (
echo "cannot create library link over existing file"
) else (
echo "mklink %1 ..\tools\%1"
mklink "%1" "..\tools\%1"
)
) else (
echo "..\tools\%1 does not exist"
)
) else (
if exist "%1\%2" (
if exist "%2" (
echo "cannot create library link over existing file"
) else (
echo "mklink %2 %1\%2"
mklink "%2" "%1\%2"
)
) else (
echo "%1\%2 does not exist"
)
)

Loading