public String convertDeltaModel(String path, String deltaModelName) { if (matlab.isDisconnected()) { matlab.connect(); } DeltaMontiArcModelBuilder builder = new DeltaMontiArcModelBuilder(); matlab.loadModel(path, deltaModelName); // create delta head String aoc = getApplicationOrderCondition(deltaModelName); builder.startCreateDelta(deltaModelName, aoc); // create modify blocks at top lvl convertDeltaSubSystems(deltaModelName, builder); builder.closeBody(); return builder.getConvertedModel(); }
/** * Creates a modify subsystem block * * @param builder builder to use * @param subSys qualified subsystem name * @param simpleName simple name */ protected void modifySubSystemBlock( DeltaMontiArcModelBuilder builder, String subSys, String simpleName) { String toModify = simpleName; int index = toModify.indexOf(DeltaSimulinkKeyWords.AOC); if (index != -1) { toModify = toModify.substring(0, index); } if (toModify.startsWith(DeltaSimulinkKeyWords.MODIFY_MODEL)) { toModify = toModify.substring(DeltaSimulinkKeyWords.MODIFY_MODEL.length()).trim(); // add package for models toModify = MontiArcStringBuilder.EXPORT_PACKAGE + "." + toModify.trim(); } else if (toModify.startsWith(DeltaSimulinkKeyWords.MODIFY)) { toModify = toModify.substring(DeltaSimulinkKeyWords.MODIFY.length()).trim(); } else { handler.addError("Unable to parse modify statement!", subSys); return; } currentComponentName.push(toModify); builder.startCreateModifyComponent(toModify); convertDeltaAddPorts(subSys, builder); convertDeltaSubSystems(subSys, builder); convertDeltaModelBlocks(subSys, builder); convertDeltaConnectors(subSys, builder); convertDeltaRemovePorts(subSys, builder); convertDeltaRemoveSubSystems(subSys, builder); convertDeltaRemoveModelBlocks(subSys, builder); builder.closeBody(); currentComponentName.pop(); }