Commit cd6e1d0e authored by Elias Barbers's avatar Elias Barbers
Browse files

version 2.21.2

parent 794e88d1
Version 2.21.2
===========
- Fix a bug in the simulink converter that leads to incorrect voltages over rmphn elements
Version 2.21.1
===========
- Move RC.xml from scenarios to the unittests folder
......
......@@ -6,7 +6,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
cmake_policy(SET CMP0009 NEW)
set(ISEAFrameVERSION_MAJOR 2)
set(ISEAFrameVERSION_MINOR 21)
set(ISEAFramePATCH_LEVEL 1)
set(ISEAFramePATCH_LEVEL 2)
set(ISEAFrameNAME "Refactor")
set(ARCH_TYPE
"64"
......
function [symbolicString] = InsertApproximations(symbolicString)
% Replace operators that cannot be inserted directly with their
% approximations. Currently this means replacing TANH.
matches = strfind(symbolicString, 'TANH');
% go from end to start so the matches aren't invalidated by replacements
for startIndex = flip(matches)
% find the closing paranthesis that matches TANH
depth = 0;
endIndex = startIndex;
for i = startIndex:size(symbolicString, 2)
if symbolicString(i) == '('
depth = depth + 1;
elseif symbolicString(i) == ')'
depth = depth - 1;
if depth == 0
endIndex = i;
break;
end
end
end
argument = symbolicString(startIndex + 5:endIndex - 1);
approximation = ['SUB(1,DIV(2,ADD(POW(2.718,MUL(2,' argument ')),1)))'];
symbolicString = replaceBetween(symbolicString, startIndex, endIndex, approximation);
end
end
......@@ -26,7 +26,6 @@ add_block('Component/Component', destination, 'Position', position);
set_param([destination '/RowConst'], 'Value', num2str(row));
set_param([destination '/ColConst'], 'Value', num2str(col));
component.(origsystemstr) = component.(origsystemstr) +1;
symbolicString = InsertApproximations(symbolicString);
totalDepth = GetTotalDepth(symbolicString);
global posVector;
posVector = ones(1, totalDepth);
......
......@@ -16,6 +16,11 @@ set_param([system '/InitialSoC'], 'GotoTag', gotoInitialSoC);
for i = 1:size(allBlocks, 1)
add_line(system, 'Temperature/1', strcat(allBlocks(i,:), '/1'), 'autorouting', 'on');
add_line(system, 'SoC/1', strcat(allBlocks(i,:), '/2'), 'autorouting', 'on');
if startsWith(allBlocks(i,:), 'Rmphn')
rmphnSystem = [system '/' strtrim(allBlocks(i,:))];
add_line(rmphnSystem, 'T/1', 'ParallelRC_Elem1/1');
add_line(rmphnSystem, 'SoC/1', 'ParallelRC_Elem1/2');
end
end
end
function[destination] = MatrixCreateRMPHN(destination, iD ...
, rObjRowPoints, rObjColPoints, rObjMatrix ...
, tauObjRowPoints, tauObjColPoints, tauObjMatrix)
, tauObjRowPoints, tauObjColPoints, tauObjMatrix ...
, rObjRowPoints, rObjColPoints, rObjMatrix)
[position, number] = GetPosition(destination);
destination = SetElemNoToDestination(destination, number);
......
......@@ -11,10 +11,14 @@ end
posVector(depth) = posVector(depth) + 1;
currentDepth = 0;
argStart = 0;
splitPoint = size(symbolicString, 2);
for i = 1:size(symbolicString, 2)
if symbolicString(i) == '('
currentDepth = currentDepth + 1;
if argStart == 0
argStart = i + 1;
end
elseif symbolicString(i) == ')'
currentDepth = currentDepth - 1;
elseif currentDepth == 1 && symbolicString(i) == ','
......@@ -22,8 +26,11 @@ for i = 1:size(symbolicString, 2)
break;
end
end
splitString1 = symbolicString(5:(splitPoint - 1));
splitString2 = symbolicString((splitPoint + 1):(size(symbolicString, 2) - 1));
if argStart > 0
splitString1 = symbolicString(argStart:(splitPoint - 1));
splitString2 = symbolicString((splitPoint + 1):(size(symbolicString, 2) - 1));
end
if(IsOperator(symbolicString, 'NEG'))
blockName = ['Neg' num2str(depth) '_' num2str(height)];
......@@ -68,6 +75,12 @@ elseif(IsOperator(symbolicString, 'POW'))
set_param([destination '/' blockName], 'Operator', 'pow');
PlaceSymbol(destination, splitString1, depth - 1, [blockName '/1']);
PlaceSymbol(destination, splitString2, depth - 1, [blockName '/2']);
elseif(IsOperator(symbolicString, 'TANH'))
blockName = ['Tanh' num2str(depth) '_' num2str(height)];
add_block('simulink/Math Operations/Trigonometric Function', [destination '/' blockName], 'Position', position);
add_line(destination, [blockName '/1'], connectTo, 'autorouting', 'on');
set_param([destination '/' blockName], 'Operator', 'tanh');
PlaceSymbol(destination, splitString1, depth - 1, [blockName '/1']);
elseif(IsValidDouble(symbolicString))
blockName = ['Const' num2str(depth) '_' num2str(height)];
add_block('simulink/Sources/Constant', [destination '/' blockName], 'Position', position);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment