diff --git a/.github/workflows/development_VARIAMOS-WEB.yml b/.github/workflows/development_VARIAMOS-WEB.yml
new file mode 100644
index 00000000..87c3e38d
--- /dev/null
+++ b/.github/workflows/development_VARIAMOS-WEB.yml
@@ -0,0 +1,32 @@
+# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
+# More GitHub Actions for Azure: https://github.com/Azure/actions
+
+name: Build and deploy container app to Azure Web App - variamosweb
+
+on:
+ push:
+ branches:
+ - development
+
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: 'ubuntu-latest'
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Login to ACR
+ uses: docker/login-action@v1
+ with:
+ registry: variamos.azurecr.io
+ username: ${{secrets.ACRUSERNAME}}
+ password: ${{secrets.ACRUSERPASSWORD}}
+
+ - name: Build and push container image to registry
+ uses: docker/build-push-action@v2
+ with:
+ push: true
+ tags: variamos.azurecr.io/${{secrets.ACRUSERNAME}}/variamosweb:latest
+ file: ./Dockerfile
diff --git a/public/images/models/adaptation_binding_state_hardware/customAction.png b/public/images/models/adaptation_binding_state_hardware/customAction.png
new file mode 100644
index 00000000..0fd03616
Binary files /dev/null and b/public/images/models/adaptation_binding_state_hardware/customAction.png differ
diff --git a/public/xml/MX/adaptation_behavior_hardware/custom_shapes.xml b/public/xml/MX/adaptation_behavior_hardware/custom_shapes.xml
index 8514cda2..20af6dc7 100644
--- a/public/xml/MX/adaptation_behavior_hardware/custom_shapes.xml
+++ b/public/xml/MX/adaptation_behavior_hardware/custom_shapes.xml
@@ -461,11 +461,30 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/public/xml/MX/adaptation_hardware/custom_shapes.xml b/public/xml/MX/adaptation_hardware/custom_shapes.xml
index b56222d1..0c7bfa14 100644
--- a/public/xml/MX/adaptation_hardware/custom_shapes.xml
+++ b/public/xml/MX/adaptation_hardware/custom_shapes.xml
@@ -191,18 +191,18 @@
-
+
-
+
-
+
-
-
+
+
diff --git a/src/assets/images/grid - copia.gif b/src/assets/images/grid - copia.gif
new file mode 100644
index 00000000..a82a20d0
Binary files /dev/null and b/src/assets/images/grid - copia.gif differ
diff --git a/src/assets/images/grid.gif b/src/assets/images/grid.gif
index a82a20d0..8a7bbc9a 100644
Binary files a/src/assets/images/grid.gif and b/src/assets/images/grid.gif differ
diff --git a/src/assets/js/common/organizers/adaptation_behavior_hardwareOrganizer.js b/src/assets/js/common/organizers/adaptation_behavior_hardwareOrganizer.js
index 9ff484a1..766437f9 100644
--- a/src/assets/js/common/organizers/adaptation_behavior_hardwareOrganizer.js
+++ b/src/assets/js/common/organizers/adaptation_behavior_hardwareOrganizer.js
@@ -46,7 +46,7 @@ Adaptation_behavior_hardwareOrganizer.prototype.organizeActions = function () {
let deviceGeometry = device.getGeometry();
deviceGeometry.x = this.deviceX;
deviceGeometry.y = this.deviceY;
- let relations = grapUtil.getRelationsFromSource(this.graph, this.modelName, device, ["readAction", "writeAction", "controlAction"]);
+ let relations = grapUtil.getRelationsFromSource(this.graph, this.modelName, device, ["readAction", "writeAction", "customAction", "controlAction"]);
relations.forEach((relation) => {
let source = relation.target;
let sourceGeometry = source.getGeometry();
@@ -62,6 +62,7 @@ Adaptation_behavior_hardwareOrganizer.prototype.organizeActions = function () {
}
});
+ this.organizeCustomActions();
this.organizeControlActions();
};
@@ -84,6 +85,22 @@ Adaptation_behavior_hardwareOrganizer.prototype.organizeAction = function (actio
};
+Adaptation_behavior_hardwareOrganizer.prototype.organizeCustomActions = function () {
+ let grapUtil = new GraphUtil();
+ let y = 15;
+ let x = 15;
+ let dx = 15;
+ let dy = 15;
+ var controlActions = grapUtil.getElementsByType(this.graph, this.modelName, "customAction");
+ controlActions.forEach((controlAction) => {
+ let controlActionGeometry = controlAction.getGeometry();
+ controlActionGeometry.x = this.actionX;
+ controlActionGeometry.y = this.actionY;
+ this.actionX += controlActionGeometry.width + dx ;
+ });
+};
+
+
Adaptation_behavior_hardwareOrganizer.prototype.organizeControlActions = function () {
let grapUtil = new GraphUtil();
let y = 15;
diff --git a/src/assets/js/common/organizers/adaptation_behavior_statesOrganizer.js b/src/assets/js/common/organizers/adaptation_behavior_statesOrganizer.js
index 6b3fa1dc..37f2bcc6 100644
--- a/src/assets/js/common/organizers/adaptation_behavior_statesOrganizer.js
+++ b/src/assets/js/common/organizers/adaptation_behavior_statesOrganizer.js
@@ -2,6 +2,8 @@ import { GraphUtil } from "@/assets/js/common/graphutil";
export function Adaptation_behavior_statesOrganizer(graph) {
this.graph = graph;
+ this.minActivityll=1000000;
+ this.maxActivityll=-1000000;
}
Adaptation_behavior_statesOrganizer.prototype.organizeComponents = function() {
@@ -18,24 +20,35 @@ Adaptation_behavior_statesOrganizer.prototype.organizeComponents = function() {
"activity",
"readAction",
"writeAction",
+ "customAction",
"controAction",
];
types.forEach((type) => {
- var arr = grapUtil.getElementsByType(graph, modelName, type);
+ var arr = grapUtil.getElementsByType(graph, modelName, type);
arr.forEach((component) => {
- components.push(component);
+ let inserted=false;
+ for (let i = 0; i < components.length; i++) {
+ if (component.getGeometry().y {
let child = relation.target;
- let type = child.getAttribute("type");
-
+ let type = child.getAttribute("type");
let childGeometry = child.getGeometry();
- childGeometry.x = x + geometry.width / 2 - childGeometry.width / 2;
- childGeometry.y = lly + llys[type] + dy;
- llys[type] += childGeometry.height + dy;
+ childGeometry.height=15;
+ childGeometry.y = y + geometry.height / 2 - childGeometry.height / 2;
+ childGeometry.x = llx + llxs[type] + dx;
+ childGeometry.width = dx*2;
+ llxs[type] += childGeometry.width + dx;
+
+ if(type=="activityLifeLine"){
+ this.minActivityll=Math.min(this.minActivityll, childGeometry.x);
+ this.maxActivityll=Math.max(this.maxActivityll, childGeometry.x+childGeometry.width);
+ }
});
-
- x += geometry.width + dx;
+
+ y += geometry.height + 5;
}
this.organizeLifeLines("activityLifeLine",["stateLifeLine"]);
@@ -97,8 +117,22 @@ Adaptation_behavior_statesOrganizer.prototype.organizeLifeLines = function(
}
});
if(maxY>-1){
- targetGeometry.height=maxY-minY;
- targetGeometry.y = minY;
+ //targetGeometry.y = minY;
+ //targetGeometry.height=maxY-minY;
+ //targetGeometry.height=15;
+ }
+ if(target.getAttribute("type")=="actionLifeLine"){
+ //targetGeometry.y = this.minActivityll;
+ //targetGeometry.height=this.maxActivityll-this.minActivityll;
+ //targetGeometry.height=15;
}
+ if(target.getAttribute("type")=="activityLifeLine"){
+ targetGeometry.x=125;
+ targetGeometry.width=1000;
+ }
+ if(target.getAttribute("type")=="actionLifeLine"){
+ targetGeometry.x=125;
+ targetGeometry.width=1000;
+ }
});
};
diff --git a/src/assets/js/common/organizers/adaptation_behavior_states_horizontalOrganizer.js b/src/assets/js/common/organizers/adaptation_behavior_states_horizontalOrganizer.js
new file mode 100644
index 00000000..046e5c85
--- /dev/null
+++ b/src/assets/js/common/organizers/adaptation_behavior_states_horizontalOrganizer.js
@@ -0,0 +1,125 @@
+import { GraphUtil } from "@/assets/js/common/graphutil";
+
+export function Adaptation_behavior_states_horizontalOrganizer(graph) {
+ this.graph = graph;
+ this.minActivityll=1000000;
+ this.maxActivityll=-1000000;
+}
+
+Adaptation_behavior_states_horizontalOrganizer.prototype.organizeComponents = function() {
+ let graph = this.graph;
+ let modelName = "adaptation_behavior_states";
+ let modelCell = graph.getModel().getCell(modelName);
+
+ let grapUtil = new GraphUtil();
+
+ var components = [];
+ var types = [
+ "initialState",
+ "state",
+ "activity",
+ "readAction",
+ "writeAction",
+ "customAction",
+ "controAction",
+ ];
+ types.forEach((type) => {
+ var arr = grapUtil.getElementsByType(graph, modelName, type);
+ arr.forEach((component) => {
+ let inserted=false;
+ for (let i = 0; i < components.length; i++) {
+ if (component.getGeometry().x {
+ let child = relation.target;
+ let type = child.getAttribute("type");
+ let childGeometry = child.getGeometry();
+ childGeometry.x = x + geometry.width / 2 - childGeometry.width / 2;
+ childGeometry.y = lly + llys[type] + dy;
+ llys[type] += childGeometry.height + dy;
+
+ if(type=="activityLifeLine"){
+ this.minActivityll=Math.min(this.minActivityll, childGeometry.y);
+ this.maxActivityll=Math.max(this.maxActivityll, childGeometry.y+childGeometry.height);
+ }
+ });
+
+ x += geometry.width + dx;
+ }
+
+ this.organizeLifeLines("activityLifeLine",["stateLifeLine"]);
+ this.organizeLifeLines("actionLifeLine",["activityLifeLine"]);
+
+ graph.refresh();
+};
+
+Adaptation_behavior_states_horizontalOrganizer.prototype.organizeLifeLines = function(
+ targetType,
+ sourceTypes
+) {
+ let graph = this.graph;
+ let modelName = "adaptation_behavior_states";
+ let modelCell = graph.getModel().getCell(modelName);
+ let grapUtil = new GraphUtil();
+
+ var targets = grapUtil.getElementsByType(graph, modelName, targetType);
+ targets.forEach((target) => {
+ let targetGeometry = target.getGeometry();
+ let targetLabel=target.getAttribute("label");
+ let minY=10000000;
+ let maxY=-1;
+ let relations = grapUtil.getRelationsToTarget(graph, modelName, target, sourceTypes);
+ relations.forEach((relation) => {
+ let source = relation.source;
+ let sourceGeometry = source.getGeometry();
+ if(minY > sourceGeometry.y){
+ minY = sourceGeometry.y;
+ }
+ if(maxY < sourceGeometry.y + sourceGeometry.height){
+ maxY = sourceGeometry.y + sourceGeometry.height;
+ }
+ });
+ if(maxY>-1){
+ targetGeometry.y = minY;
+ targetGeometry.height=maxY-minY;
+ }
+ if(target.getAttribute("type")=="actionLifeLine"){
+ targetGeometry.y = this.minActivityll;
+ targetGeometry.height=this.maxActivityll-this.minActivityll;
+ }
+ });
+};
diff --git a/src/assets/js/models/actions/domain_implementation/adaptation_state_actions.js b/src/assets/js/models/actions/domain_implementation/adaptation_state_actions.js
index 937a84fd..a951cd1d 100644
--- a/src/assets/js/models/actions/domain_implementation/adaptation_state_actions.js
+++ b/src/assets/js/models/actions/domain_implementation/adaptation_state_actions.js
@@ -131,6 +131,7 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
var vertices = graphModel.getChildVertices(mainCell);
var edges = graphModel.getChildEdges(mainCell);
+
for (var i = 0; i < vertices.length; i++) {
var vertice = vertices[i];
var type = vertice.getAttribute("type");
@@ -144,6 +145,10 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
dicElements.add("machine", "state", label, state);
}
else if (type == "state") {
+ var required = vertice.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
var state = {
id: 0,
type: type,
@@ -158,19 +163,53 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
var graphModel = graph.getModel();
var mainCell = graphModel.getCell("adaptation_state");
var vertices = graphModel.getChildVertices(mainCell);
- var edges = graphModel.getChildEdges(mainCell);
+ var edges = graphModel.getChildEdges(mainCell);
- var dicTransitions = {};
+ var dicTransitions = {};
+
+ let noSource=[];
+ let noTarget=[];
for (var i = 0; i < edges.length; i++) {
var source = edges[i].source;
var target = edges[i].target;
var sourceType = source.getAttribute("type");
- var targetType = target.getAttribute("type");
+ var targetType = target.getAttribute("type");
+
+ if (sourceType == "state" && targetType == "transition") {
+ var required = source.getAttribute("required");
+ if (required != "true") {
+ noSource.push(target);
+ continue;
+ }
+ }
+ else if (sourceType == "transition" && targetType == "state") {
+ var required = target.getAttribute("required");
+ if (required != "true") {
+ noTarget.push(source);
+ continue;
+ }
+ }
+ }
+
+
+
+ for (var i = 0; i < edges.length; i++) {
+ var source = edges[i].source;
+ var target = edges[i].target;
+ var sourceType = source.getAttribute("type");
+ var targetType = target.getAttribute("type");
if ((sourceType == "initialState" || sourceType == "state") && targetType == "transition") {
var labelState = source.getAttribute("label");
var labelTransition = target.getAttribute("label");
+ var required = target.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+ if (noSource.includes(target) || noTarget.includes(target)) {
+ continue;
+ }
var transition = dicTransitions[labelTransition];
if (!transition) {
transition = {
@@ -186,6 +225,13 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
else if (sourceType == "transition" && (targetType == "initialState" || targetType == "state")) {
var labelState = target.getAttribute("label");
var labelTransition = source.getAttribute("label");
+ var required = source.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+ if (noSource.includes(source) || noTarget.includes(source)) {
+ continue;
+ }
var transition = dicTransitions[labelTransition];
if (!transition) {
transition = {
@@ -243,6 +289,10 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
let vertice = vertices[i];
var label = vertice.getAttribute("label");
var type = vertice.getAttribute("type");
+ var required = vertice.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
var device = {
id: "",
label: label,
@@ -287,6 +337,10 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
let parentSource = source.parent;
let parentTarget = target.parent;
+ var required = parentSource.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
let pinDevice = null;
let pinBoard = null;
@@ -470,6 +524,16 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
let vertice = vertices[i];
var label = vertice.getAttribute("label");
var type = vertice.getAttribute("type");
+ var required = vertice.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+ var device=getActionDeviceParent(graph, vertice);
+ required = device.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+
var action = {
id: "",
label: label,
@@ -501,6 +565,15 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
let vertice = vertices[i];
var label = vertice.getAttribute("label");
var type = vertice.getAttribute("type");
+ var required = vertice.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+ var device=getActionDeviceParent(graph,vertice);
+ required = device.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
var action = {
id: "",
label: label,
@@ -532,6 +605,10 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
let vertice = vertices[i];
var label = vertice.getAttribute("label");
var type = vertice.getAttribute("type");
+ var required = vertice.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
var controlType = vertice.getAttribute("controlType");
if (!controlType) {
controlType = "continuous";
@@ -549,13 +626,13 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
if (children) {
for (let i = 0; i < children.length; i++) {
let child = children[i];
- let al=child.getAttribute("label");
- let alabel=al;
- if(["s","sp"].includes(alabel)){
- alabel="setPoint";
+ let al = child.getAttribute("label");
+ let alabel = al;
+ if (["s", "sp"].includes(alabel)) {
+ alabel = "setPoint";
}
- else if(["m"].includes(alabel)){
- alabel="measurement";
+ else if (["m"].includes(alabel)) {
+ alabel = "measurement";
}
var argument = {
id: "",
@@ -570,48 +647,52 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
vertices = getElements(graph, "control", "controller");
for (var i = 0; i < vertices.length; i++) {
- let vertice = vertices[i];
+ let vertice = vertices[i];
var item = {
id: "",
label: "proportional",
dataType: "double",
- value:vertice.getAttribute("Proportional")
+ value: vertice.getAttribute("Proportional")
};
- item.id = dicElements.add("dummy", "control_configuration", action.label + "_" + "proportional", item);
+ item.id = dicElements.add("dummy", "control_configuration", action.label + "_" + "proportional", item);
action.configuration.push(item);
var item = {
id: "",
label: "Integral",
dataType: "double",
- value:vertice.getAttribute("Integral")
+ value: vertice.getAttribute("Integral")
};
- item.id = dicElements.add("dummy", "control_configuration", action.label + "_" + "integral", item);
+ item.id = dicElements.add("dummy", "control_configuration", action.label + "_" + "integral", item);
action.configuration.push(item);
var item = {
id: "",
label: "derivate",
dataType: "double",
- value:vertice.getAttribute("Derivate")
+ value: vertice.getAttribute("Derivate")
};
item.id = dicElements.add("dummy", "control_configuration", action.label + "_" + "derivate", item);
action.configuration.push(item);
- }
- }
+ }
+ }
}
function serializeHardwareRelationshipsAction_Result(graph, dicElements) {
var dicKey = "relationship_action_result";
dicElements.createType("binding", dicKey);
- let relations = getRelationsFromTypes(graph, "adaptation_behavior_hardware", ["readAction","controlAction"], ["variable"]);
+ let relations = getRelationsFromTypes(graph, "adaptation_behavior_hardware", ["readAction", "controlAction"], ["variable"]);
for (var i = 0; i < relations.length; i++) {
var relation = relations[i];
var source = relation.source;
var target = relation.target;
var sourceType = source.getAttribute("type");
var targetType = target.getAttribute("type");
+ var required = source.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
let relName = source.getAttribute("label") + "_" + target.getAttribute("label");
var item = dicElements.items["binding"][dicKey][relName];
@@ -619,7 +700,7 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
var aid = "";
if (sourceType == "readAction") {
aid = dicElements.getId("binding", "readAction", source.getAttribute("label"));
- }else{
+ } else {
aid = dicElements.getId("binding", "controlAction", source.getAttribute("label"));
}
item = {
@@ -644,7 +725,12 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
var sourceType = source.getAttribute("type");
var targetType = target.getAttribute("type");
+ let parentSource = source.parent;
let parentTarget = target.parent;
+ var required = parentTarget.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
let variable = source;
let pinAction = null;
@@ -688,6 +774,14 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
var relName = source.getAttribute("label") + "_activities";
let phase = target.getAttribute("phase");
+ if (sourceType=="state") {
+ let originalState=getOriginalElement(graph, "adaptation_state", source);
+ let required=originalState.getAttribute("required");
+ if (required!="true") {
+ continue;
+ }
+ }
+
var item = dicElements.items["binding"][dicKey][relName];
if (!item) {
item = {
@@ -734,6 +828,11 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
var targetType = target.getAttribute("type");
var relName = source.getAttribute("label") + "_" + target.getAttribute("label");
+ var required = source.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+
var item = dicElements.items["binding"][dicKey][relName];
if (!item) {
item = {
@@ -753,6 +852,23 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
let relationsActionLifeLine_Action = getRelationsToTarget(graph, "adaptation_behavior_states", actionLifeLine, ["readAction", "writeAction", "controlAction"]);
if (relationsActionLifeLine_Action.length > 0) {
let action = relationsActionLifeLine_Action[0].source;
+ required = action.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+ if (["readAction", "writeAction"].includes(action.getAttribute("type"))) {
+ var originalAction = getOriginalElement(graph, "adaptation_behavior_hardware", action);
+ let relationDevice_Action = getRelationsToTarget(graph, "adaptation_behavior_hardware", originalAction, ["device"]);
+ if (relationDevice_Action.length > 0) {
+ let device = relationDevice_Action[0].source;
+ var originalDevice = getOriginalElement(graph, "adaptation_hardware", device);
+ required = originalDevice.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+ }
+ }
+
let relActivityAction = {};
relActivityAction["action"] = dicElements.getId("binding", action.getAttribute("type"), action.getAttribute("label"));
relActivityAction["actionType"] = action.getAttribute("type");
@@ -777,6 +893,16 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
var targetType = target.getAttribute("type");
var relName = source.getAttribute("label") + "_" + target.getAttribute("label");
+ var required = source.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+
+ required = target.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+
var item = dicElements.items["binding"][dicKey][relName];
if (!item) {
item = {
@@ -861,6 +987,86 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
return ret;
}
+ function getElementsByLabel(graph, modelName, elementType, label) {
+ let ret = [];
+ var graphModel = graph.getModel();
+ var mainCell = graphModel.getCell(modelName);
+ var vertices = graphModel.getChildVertices(mainCell);
+ for (var i = 0; i < vertices.length; i++) {
+ var vertice = vertices[i];
+ var type = vertice.getAttribute("type");
+ if (type == elementType) {
+ var vlabel = vertice.getAttribute("label");
+ if (label == vlabel) {
+ ret.push(vertice);
+ }
+ }
+ }
+ return ret;
+ }
+
+ function getOriginalElement(graph, modelName, clonElement) {
+ var graphModel = graph.getModel();
+ var mainCell = graphModel.getCell(modelName);
+ var vertices = graphModel.getChildVertices(mainCell);
+ for (var i = 0; i < vertices.length; i++) {
+ var vertice = vertices[i];
+ if (clonElement.getAttribute("type") == vertice.getAttribute("type")) {
+ if (clonElement.getAttribute("label") == vertice.getAttribute("label")) {
+ return vertice;
+ }
+ }
+ }
+ return null;
+ }
+
+ function getTransitionSourceState(graph, transition) {
+ var graphModel = graph.getModel();
+ var mainCell = graphModel.getCell("adaptation_state");
+ var vertices = graphModel.getChildVertices(mainCell);
+ var edges = graphModel.getChildEdges(mainCell);
+ for (var i = 0; i < edges.length; i++) {
+ var source = edges[i].source;
+ var target = edges[i].target;
+ if (target==transition) {
+ var sourceType = source.getAttribute("type");
+ var targetType = target.getAttribute("type");
+ if (sourceType == "state" || sourceType == "initialState") {
+ return source;
+ }
+ }
+ }
+ }
+
+ function getTransitionTargetState(graph, transition) {
+ var graphModel = graph.getModel();
+ var mainCell = graphModel.getCell("adaptation_state");
+ var vertices = graphModel.getChildVertices(mainCell);
+ var edges = graphModel.getChildEdges(mainCell);
+ for (var i = 0; i < edges.length; i++) {
+ var source = edges[i].source;
+ var target = edges[i].target;
+ if (source==transition) {
+ var sourceType = source.getAttribute("type");
+ var targetType = target.getAttribute("type");
+ if (targetType == "state" || targetType == "initialState") {
+ return target;
+ }
+ }
+ }
+ }
+
+
+ function getActionDeviceParent(graph, action) {
+ let relationDevice_Action = getRelationsToTarget(graph, "adaptation_behavior_hardware", action, ["device"]);
+ if (relationDevice_Action.length > 0) {
+ let device = relationDevice_Action[0].source;
+ let originalDevice = getOriginalElement(graph, "adaptation_hardware", device);
+ return originalDevice;
+ }
+ }
+
+
function serializeBindingRelationshipsActivity_WriteAction(graph, dicElements) {
var graphModel = graph.getModel();
var mainCell = graphModel.getCell("adaptation_binding_state_hardware");
@@ -1062,6 +1268,29 @@ var adaptation_state_actions = function adaptation_state_actions(graph, selected
var relName = source.getAttribute("label") + "_" + target.getAttribute("label");
if (sourceType == "logicalOperator" && targetType == "transition") {
var activity = source.getAttribute("label");
+
+ var transition=getOriginalElement(graph, "adaptation_state", target);
+ var required = transition.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+
+ var state=getTransitionSourceState(graph, transition);
+ if (state.getAttribute("type")=="state") {
+ required = state.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+ }
+
+ state=getTransitionTargetState(graph, transition);
+ if (state.getAttribute("type")=="state") {
+ required = state.getAttribute("required");
+ if (required != "true") {
+ continue;
+ }
+ }
+
var item = dicElements.items["binding"][dicKey][relName];
if (!item) {
item = {
diff --git a/src/assets/js/models/custom/adaptation_behavior_hardware.js b/src/assets/js/models/custom/adaptation_behavior_hardware.js
index 7c0bcad6..e0e513ec 100644
--- a/src/assets/js/models/custom/adaptation_behavior_hardware.js
+++ b/src/assets/js/models/custom/adaptation_behavior_hardware.js
@@ -67,20 +67,10 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
}
function adaptation_behavior_hardware_elements() {
- let activity = { src: projectPath + "images/models/adaptation_binding_state_hardware/activity.png", wd: 100, hg: 35, type: "activity", style: "shape=activity", pname: "Activity" };
let variable = { src: projectPath + "images/models/adaptation_binding_state_hardware/analogVariable.png", wd: 100, hg: 35, type: "variable", style: "shape=analogVariable", pname: "Variable" };
- //let digitalVariable = { src: projectPath + "images/models/adaptation_binding_state_hardware/digitalVariable.png", wd: 100, hg: 35, type: "digitalVariable", style: "shape=digitalVariable", pname: "Digital variable" };
- //let analogVariable = { src: projectPath + "images/models/adaptation_binding_state_hardware/analogVariable.png", wd: 100, hg: 35, type: "analogVariable", style: "shape=analogVariable", pname: "Analog variable" };
- //let stringVariable = { src: projectPath + "images/models/adaptation_binding_state_hardware/stringVariable.png", wd: 100, hg: 35, type: "stringVariable", style: "shape=stringVariable", pname: "String variable" };
- //let timer = { src: projectPath + "images/models/adaptation_binding_state_hardware/timer.png", wd: 100, hg: 35, type: "timer", style: "shape=timer", pname: "Timer" };
- let readAction = { src: projectPath + "images/models/adaptation_binding_state_hardware/readAction.png", wd: 100, hg: 35, type: "readAction", style: "shape=readAction", pname: "Read action" };
- let writeAction = { src: projectPath + "images/models/adaptation_binding_state_hardware/writeAction.png", wd: 100, hg: 35, type: "writeAction", style: "shape=writeAction", pname: "Write action" };
let controlAction = { src: projectPath + "images/models/adaptation_binding_state_hardware/controlAction.png", wd: 100, hg: 35, type: "controlAction", style: "shape=controlAction", pname: "Control action" };
- let delayAction = { src: projectPath + "images/models/adaptation_binding_state_hardware/delayAction.png", wd: 100, hg: 35, type: "delayAction", style: "strokeWidth=2", pname: "Delay action" };
- let customAction = { src: projectPath + "images/models/adaptation_binding_state_hardware/customAction.png", wd: 100, hg: 35, type: "customAction", style: "strokeWidth=2", pname: "Custom action" };
- let logicalOperator = { src: projectPath + "images/models/adaptation_binding_state_hardware/logicalOperator.png", wd: 100, hg: 35, type: "logicalOperator", style: "shape=ellipse", pname: "Logical operator" };
- let predicate = { src: projectPath + "images/models/adaptation_binding_state_hardware/predicate.png", wd: 100, hg: 35, type: "predicate", style: "shape=predicate", pname: "Predicate" };
-
+ let customAction = { src: projectPath + "images/models/adaptation_binding_state_hardware/customAction.png", wd: 100, hg: 35, type: "customAction", style: "shape=customAction", pname: "Custom action" };
+
let elements = [];
let index = 0;
@@ -89,6 +79,7 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
//elements[index++] = analogVariable;
//elements[index++] = stringVariable;
elements[index++] = controlAction;
+ elements[index++] = customAction;
//elements[index++] = timer;
//elements[index++] = writeAction;
//elements[index++] = readAction;
@@ -212,6 +203,9 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
"custom_attributes": [{
"name": "initialValue",
"def_value": "0"
+ },{
+ "name": "required",
+ "def_value": "true"
},{
"name": "promptName",
"def_value": true
@@ -256,11 +250,41 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
"custom_attributes": [{
"name": "controlType",
"def_value": "continuous"
+ },{
+ "name": "required",
+ "def_value": "true"
+ },{
+ "name": "promptName",
+ "def_value": true
+ }]
+ };
+ attributes[12] = {
+ "types": ["customAction"],
+ "custom_attributes": [{
+ "name": "code",
+ "def_value": ""
+ },{
+ "name": "required",
+ "def_value": "true"
},{
"name": "promptName",
"def_value": true
}]
};
+ attributes[13] = {
+ "types": ["readAction"],
+ "custom_attributes": [{
+ "name": "required",
+ "def_value": "true"
+ }]
+ };
+ attributes[14] = {
+ "types": ["writeAction"],
+ "custom_attributes": [{
+ "name": "required",
+ "def_value": "true"
+ }]
+ };
return attributes;
}
@@ -334,6 +358,9 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
{
"attribute": "device",
"input_type": "disabled"
+ },{
+ "attribute": "required",
+ "input_type": "checkbox"
}
],
"readAction": [
@@ -348,6 +375,9 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
{
"attribute": "device",
"input_type": "disabled"
+ },{
+ "attribute": "required",
+ "input_type": "checkbox"
}
],
"controlAction": [
@@ -359,6 +389,18 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
{
"attribute": "promptName",
"input_type": "none"
+ },{
+ "attribute": "required",
+ "input_type": "checkbox"
+ }
+ ],
+ "customAction": [
+ {
+ "attribute": "promptName",
+ "input_type": "none"
+ },{
+ "attribute": "required",
+ "input_type": "checkbox"
}
],
"actionArgument": [
@@ -370,6 +412,12 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
"attribute": "dataType",
"input_type": "disabled"
}
+ ],
+ "timer": [
+ {
+ "attribute": "required",
+ "input_type": "checkbox"
+ }
]
}
@@ -443,6 +491,7 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
let clons = {};
clons = {
"controlAction": "control",
+ "customAction": "adaptation_behavior_states",
"readAction": "adaptation_behavior_states",
"writeAction": "adaptation_behavior_states",
"variable": "adaptation_behavior_transitions",
@@ -479,11 +528,11 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
relations[0] = {
"source": ["variable", "digitalVariable", "analogVariable", "timer", "analogActuator", "digitalActuator", "analogSensor", "digitalSensor"],
"rel_source_target": "and",
- "target": ["readAction", "writeAction", "controlAction"],
+ "target": ["readAction", "writeAction", "controlAction", "customAction"],
"style": "strokeColor=#333333;strokeWidth=2;dashed=1;endFill=0;"
}
relations[1] = {
- "source": ["readAction", "writeAction", "controlAction"],
+ "source": ["readAction", "writeAction", "controlAction", "customAction"],
"rel_source_target": "and",
"target": ["variable", "digitalVariable", "analogVariable", "timer", "analogActuator", "digitalActuator", "analogSensor", "digitalSensor"],
"style": "strokeColor=#333333;strokeWidth=2;dashed=1;endFill=1"
@@ -491,7 +540,7 @@ let adaptation_behavior_hardware_main = function adaptation_behavior_hardware_ma
relations[2] = {
"source": ["device"],
"rel_source_target": "and",
- "target": ["readAction", "writeAction", "controlAction"],
+ "target": ["readAction", "writeAction", "controlAction", "customAction"],
"style": "strokeColor=#333333;strokeWidth=2;"
}
relations[3] = {
diff --git a/src/assets/js/models/custom/adaptation_behavior_hardware/setup_elements.js b/src/assets/js/models/custom/adaptation_behavior_hardware/setup_elements.js
index 119ecc44..fab3001d 100644
--- a/src/assets/js/models/custom/adaptation_behavior_hardware/setup_elements.js
+++ b/src/assets/js/models/custom/adaptation_behavior_hardware/setup_elements.js
@@ -367,7 +367,7 @@ let setup_elements = function setup_elements(
let importedCells=graph.importCells([vertex2], 0, 0, parent2);
graph.getModel().prefix = ""; //restart prefix
- if (type == "controlAction" || type == "writeAction" || type == "readAction") {
+ if (type == "controlAction" || type == "customAction" ||type == "writeAction" || type == "readAction") {
let graphUtil = new GraphUtil();
let modelName = "adaptation_behavior_states";
let actionLifeLine = new ActionLifeLine();
diff --git a/src/assets/js/models/custom/adaptation_behavior_states.js b/src/assets/js/models/custom/adaptation_behavior_states.js
index f2edfd1e..6dd3ef6c 100644
--- a/src/assets/js/models/custom/adaptation_behavior_states.js
+++ b/src/assets/js/models/custom/adaptation_behavior_states.js
@@ -218,6 +218,13 @@ let adaptation_behavior_states_main = function adaptation_behavior_states_main(g
"def_value": "anll"
}]
};
+ attributes[13] = {
+ "types": ["activity"],
+ "custom_attributes": [{
+ "name": "required",
+ "def_value": "true"
+ }]
+ };
return attributes;
}
@@ -295,6 +302,12 @@ let adaptation_behavior_states_main = function adaptation_behavior_states_main(g
"input_values": ["=", ">", "<", ">=", "<=", "!="]
}
],
+ "activity": [
+ {
+ "attribute": "required",
+ "input_type": "checkbox"
+ }
+ ],
"stateLifeLine": [{
"attribute": "label",
"input_type": "disabled"
diff --git a/src/assets/js/models/custom/adaptation_behavior_states/components/activity.js b/src/assets/js/models/custom/adaptation_behavior_states/components/activity.js
index d590a6c0..3f9b34b4 100644
--- a/src/assets/js/models/custom/adaptation_behavior_states/components/activity.js
+++ b/src/assets/js/models/custom/adaptation_behavior_states/components/activity.js
@@ -8,7 +8,13 @@ export function Activity() {
"shape=activity",
100,
35,
- []
+ [
+ {
+ "name": "required",
+ "def_value": "true",
+ input_type: "checkbox"
+ }
+ ]
);
}
diff --git a/src/assets/js/models/custom/adaptation_behavior_transitions.js b/src/assets/js/models/custom/adaptation_behavior_transitions.js
index 2ff769bf..26d12e09 100644
--- a/src/assets/js/models/custom/adaptation_behavior_transitions.js
+++ b/src/assets/js/models/custom/adaptation_behavior_transitions.js
@@ -21,10 +21,10 @@ let adaptation_behavior_transitions_main = function adaptation_behavior_transiti
true, "logicalOperator", null, null, 0, 1, ["transition", "logicalOperator"],
"Only one connection allowed",
"The logicalOperator only can be associated to transition"));
- graph.multiplicities.push(new mxMultiplicity(
- true, "predicate", null, null, 0, 1, ["logicalOperator"],
- "Only one connection allowed",
- "The predicate only can be assigned to one logicalOperator"));
+ // graph.multiplicities.push(new mxMultiplicity(
+ // true, "predicate", null, null, 0, 1, ["logicalOperator"],
+ // "Only one connection allowed",
+ // "The predicate only can be assigned to one logicalOperator"));
// graph.multiplicities.push(new mxMultiplicity(
// true, "variable", null, null, 0, 1000000, ["predicate"],
// "Only one connection allowed",
diff --git a/src/assets/js/models/custom/adaptation_hardware.js b/src/assets/js/models/custom/adaptation_hardware.js
index 558ad39d..87aa6a3e 100644
--- a/src/assets/js/models/custom/adaptation_hardware.js
+++ b/src/assets/js/models/custom/adaptation_hardware.js
@@ -74,8 +74,8 @@ let adaptation_hardware_main = function adaptation_hardware_main(graph) {
let boardComposition = {
src: shapeImagePath,
- wd: 280,
- hg: 180,
+ wd: 150,
+ hg: 100,
type: "board",
subtype: board.name,
style: "shape=board", // + board.name.toLowerCase(),
@@ -149,6 +149,13 @@ let adaptation_hardware_main = function adaptation_hardware_main(graph) {
"def_value": "ArduinoUNO"
}]
};
+ attributes[index++] = {
+ "types": ["device"],
+ "custom_attributes": [{
+ "name": "required",
+ "def_value": "true"
+ }]
+ };
// attributes[index++]={
// "types":["device"],
// "custom_attributes":[{
@@ -301,6 +308,9 @@ let adaptation_hardware_main = function adaptation_hardware_main(graph) {
{
"attribute": "promptName",
"input_type": "none"
+ },{
+ "attribute": "required",
+ "input_type": "checkbox"
}
],
"digital": [{
diff --git a/src/assets/js/models/custom/adaptation_hardware/setup_elements.js b/src/assets/js/models/custom/adaptation_hardware/setup_elements.js
index 01f3711b..92208d95 100644
--- a/src/assets/js/models/custom/adaptation_hardware/setup_elements.js
+++ b/src/assets/js/models/custom/adaptation_hardware/setup_elements.js
@@ -321,9 +321,18 @@ let setup_elements = function setup_elements(graph, elements, custom_attributes,
pwmPins = device.pwmPins;
}
+ let w=element.geometry.width;
+
let x = 10;
- let y = 24;
+ let y = 10;
+ let ypwm=10;
+
+ if(type=="device"){
+ y+=14;
+ x=(w/2)-5;
+ }
+
if (digitalPins) {
//x = 10;
//y += 20;
@@ -346,10 +355,18 @@ let setup_elements = function setup_elements(graph, elements, custom_attributes,
connector.setVertex(true);
graph.addCell(connector, element);
- x += 15;
+ y += 15;
+ ypwm=y;
}
}
-
+
+ if(type=="device"){
+ y+=14;
+ x=(w/2)-5;
+ }else{
+ y = 10;
+ x=w-20;
+ }
if (analogPins) {
//x = 10;
//y += 20;
@@ -371,10 +388,16 @@ let setup_elements = function setup_elements(graph, elements, custom_attributes,
connector.setVertex(true);
graph.addCell(connector, element);
- x += 15;
+ y += 15;
}
}
+ x=10;
+ y=ypwm;
+ if(type=="device"){
+ y+=14;
+ x=(w/2)-5;
+ }
if (pwmPins) {
//x = 10;
//y += 20;
@@ -397,7 +420,7 @@ let setup_elements = function setup_elements(graph, elements, custom_attributes,
connector.setVertex(true);
graph.addCell(connector, element);
- x += 15;
+ y += 15;
}
}
diff --git a/src/assets/js/models/custom/adaptation_state.js b/src/assets/js/models/custom/adaptation_state.js
index a97f14c7..814af584 100644
--- a/src/assets/js/models/custom/adaptation_state.js
+++ b/src/assets/js/models/custom/adaptation_state.js
@@ -53,6 +53,9 @@ let adaptation_state_main = function adaptation_state_main(graph) {
"custom_attributes": [{
"name": "acceptance",
"def_value": "false"
+ },{
+ "name": "required",
+ "def_value": "true"
},{
"name": "promptName",
"def_value": true
@@ -69,6 +72,14 @@ let adaptation_state_main = function adaptation_state_main(graph) {
"def_value": true
}]
+ };
+ attributes[2] = {
+ "types": ["transition"],
+ "custom_attributes": [{
+ "name": "required",
+ "def_value": "true"
+ }]
+
};
return attributes;
}
@@ -104,6 +115,9 @@ let adaptation_state_main = function adaptation_state_main(graph) {
"state": [{
"attribute": "acceptance",
"input_type": "checkbox"
+ },{
+ "attribute": "required",
+ "input_type": "checkbox"
},
{
"attribute": "promptName",
@@ -123,6 +137,9 @@ let adaptation_state_main = function adaptation_state_main(graph) {
{
"attribute": "sourceState",
"input_type": "disabled"
+ },{
+ "attribute": "required",
+ "input_type": "checkbox"
},
{
"attribute": "targetState",
diff --git a/src/assets/js/models/custom/adaptation_state/components/transition.js b/src/assets/js/models/custom/adaptation_state/components/transition.js
index 80137311..dcf9e370 100644
--- a/src/assets/js/models/custom/adaptation_state/components/transition.js
+++ b/src/assets/js/models/custom/adaptation_state/components/transition.js
@@ -8,7 +8,13 @@ export function Transition() {
"shape=transition",
100,
35,
- []
+ [
+ {
+ "name": "required",
+ "def_value": "true",
+ input_type: "checkbox"
+ }
+ ]
);
}
diff --git a/src/components/model_actions/ApplicationMenu.vue b/src/components/model_actions/ApplicationMenu.vue
index d749af36..1c64359e 100644
--- a/src/components/model_actions/ApplicationMenu.vue
+++ b/src/components/model_actions/ApplicationMenu.vue
@@ -537,6 +537,7 @@ export default {
let vm = this;
///let serverUrl = localStorage["domain_implementation_main_path"] + "AdaptationStateImplementation/generateSourceCode";
let serverUrl = localStorage["domain_implementation_main_path"];
+ serverUrl = "http://209.126.10.31:8080/"
if(serverUrl == undefined) {
vm.$snotify.error("Please set backend URL", "Error");
@@ -559,7 +560,7 @@ export default {
var strModelJson = JSON.stringify(modelJson);
// alert(strModelJson);
- // downloadFile("BindingStateHardwareModel.json", strModelJson);
+ //downloadFile("BindingStateHardwareModel.json", strModelJson);
var createCORSRequest = function(method, url) {
var xhr = new XMLHttpRequest();
diff --git a/src/locales/en.json b/src/locales/en.json
index 13c9a022..4ca56b2c 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -42,7 +42,7 @@
"about_team_past_authors2": "Raul Mazo, Diego Quiroz, Sebastian Monsalve, David Lopez, Jose Lopez",
"about_team_past_authors3": "Raul Mazo",
"home_welcome": "Welcome to VariaMos web",
- "home_variamos": "VariaMos 2.0.1 beta version",
+ "home_variamos": "VariaMos 2.22.05.20.17",
"reports_title": "Reports",
"app_variamos": "VariaMos",
"app_search": "Search",