Skip to content

Commit

Permalink
Fixed CoCoSpec mapping file not being generated during export.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaskatis authored and anmavrid committed Aug 28, 2023
1 parent f8442a9 commit 20f6bae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fret-electron/model/FretModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {leveldbDB, modelDB, system_DBkeys} from '../app/main.dev'
import {removeVariablesInBulk, removeVariables } from './modelDbSupport/deleteVariables_main'
import {removeReqsInBulk} from './fretDbSupport/deleteRequirements_main'
import { app, dialog} from 'electron'
import {getContractInfo, getPropertyInfo, getDelayInfo,
import {getContractInfo, getPropertyInfo, getDelayInfo, getMappingInfo,
synchFRETvariables} from './modelDbSupport/variableMappingSupports'
//import FretSemantics from './../app/parser/FretSemantics'
import {export_to_md} from "../app/utils/utilityFunctions";
Expand Down
27 changes: 27 additions & 0 deletions fret-electron/model/modelDbSupport/variableMappingSupports.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export {
getContractInfo as getContractInfo,
getPropertyInfo as getPropertyInfo,
getDelayInfo as getDelayInfo,
getMappingInfo as getMappingInfo,
synchFRETvariables as synchFRETvariables,
variableIdentifierReplacement as variableIdentifierReplacement
}
Expand Down Expand Up @@ -166,6 +167,32 @@ async function synchModelVariablesAndComponents(componentModel,selectedProject)
return delays;
}

function getMappingInfo(result, contractName) {
var mapping = {};
var componentMapping = {};
var componentInputs = [];
var componentOutputs = [];
componentMapping.contract_name = contractName;
componentMapping.model_path = '';
result.docs.forEach(function(doc){
if (doc.idType === 'Input' || doc.idType === 'Output'){
if (componentMapping.model_path === ''){
componentMapping.model_path = doc.modelComponent;
}
var variable = {};
//Variable name in FRETish
variable.variable_name = utils.replace_special_chars(doc.variable_name);
//Signal path in Simulink model
variable.variable_path = componentMapping.model_path+'/'+doc.modeldoc_id;
(doc.idType === 'Input') ? componentInputs.push(variable) : componentOutputs.push(variable);
}
})
componentMapping.Inputs = componentInputs;
componentMapping.Outputs = componentOutputs;
mapping[contractName] = componentMapping;
return mapping;
}

function getContractInfo(result) {
function getCoCoSpecDataType(dataType){
if (dataType === 'boolean'){
Expand Down

0 comments on commit 20f6bae

Please sign in to comment.