Loading GUI.m +14 −27 Original line number Diff line number Diff line Loading @@ -252,27 +252,7 @@ classdef GUI < handle end function [] = set_block_display(object) if (object.mode == 1) %if object.pvs_checked == 1 mask_string = []; code_block = sprintf('%s/code',getfullname(object.block_handle)); in_handles=find_system(code_block, 'SearchDepth',1,'FindAll','On','FollowLinks','On','LookUnderMasks','All','BlockType','Inport'); for i = 1:size(in_handles,1) mask_string = [mask_string 'port_label(''input'',' int2str(i) ',''' get_param(in_handles(i),'Name') ''');' ]; end mask_string = [mask_string 'text(0.5, 0.6, ''Tabular Expression'', ''horizontalAlignment'', ''center'')']; if object.pvs_checked == 0 mask_string = [mask_string 'color(''red'')text(0.5, 0.4, ''Not Checked'', ''horizontalAlignment'', ''center'')']; else mask_string = [mask_string 'color(''green'')text(0.5, 0.4, ''Checked'', ''horizontalAlignment'', ''center'')']; end set_param(getfullname(object.block_handle),'MaskDisplay',mask_string); end end function [] = update_Statusbar(object) Loading Loading @@ -411,8 +391,10 @@ classdef GUI < handle end object.pvs_checked = check; object.update_Statusbar; object.set_block_display if (object.mode == 1) set_block_display(object.block_handle,object.pvs_checked) end end end Loading Loading @@ -590,7 +572,7 @@ classdef GUI < handle % First loop through all the inport blocks, if there does not % exists an inport in the code block of the same name then % delete the inport block inports = find_system(getfullname(object.block_handle),'BlockType','Inport'); inports = find_system(getfullname(object.block_handle),'LookUnderMasks','all','SearchDepth',1,'FindAll','On','BlockType','Inport'); for i=1:size(inports,1) found = 0; in_handles=find_system(code_block, 'SearchDepth',1,'FindAll','On','FollowLinks','On','LookUnderMasks','All','BlockType','Inport'); Loading Loading @@ -642,7 +624,7 @@ classdef GUI < handle % Next we do the same thing with the outputs outports = find_system(getfullname(object.block_handle),'BlockType','Outport'); outports = find_system(getfullname(object.block_handle),'LookUnderMasks','all','SearchDepth',1,'FindAll','On','BlockType','Outport'); for i=1:size(outports,1) found = 0; out_handles=find_system(code_block, 'SearchDepth',1,'FindAll','On','FollowLinks','On','LookUnderMasks','All','BlockType','Outport'); Loading Loading @@ -715,8 +697,10 @@ classdef GUI < handle object.function_name_text = get(object.function_name_control,'String'); object.function_inputs_text = get(object.function_inputs_control,'String'); if (object.mode == 1) object.set_block_display; set_block_display(object.block_handle,object.pvs_checked); end end end Loading Loading @@ -1828,7 +1812,10 @@ classdef GUI < handle if object.pvs_checked == 1 object.pvs_checked = 0; object.update_Statusbar object.set_block_display; if (object.mode == 1) set_block_display(object.block_handle,object.pvs_checked); end end end Loading PVS_checker.m +11 −11 Original line number Diff line number Diff line Loading @@ -208,7 +208,7 @@ classdef PVS_checker < handle code = [code sprintf('COND\n')]; elsecell = []; for i=1:size(g1.cells,2) g1cond = get(g1.cells(i).cond,'String'); g1cond = g1.cells(i).cond_text; % condition string of otherwise corresponds to an else % statement, we allow this statement to be in any order % in the cells of the grid, so we need to find where it Loading @@ -218,10 +218,10 @@ classdef PVS_checker < handle found = 1; continue end code = [code sprintf('%s->',obj.matlab_to_pvs_syntax_translation(strtrim(char(get(g1.cells(i).cond,'String')))))]; code = [code sprintf('%s->',obj.matlab_to_pvs_syntax_translation(strtrim(char(g1.cells(i).cond_text))))]; resultcell = obj.data.Grid0.search_return(g1.cells(i),g2_cell); if(~isempty(resultcell)) code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(get(resultcell.result,'String'))))]; code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(resultcell.result_text)))]; if(isempty(elsecell)) if(i~= size(g1.cells,2)) Loading @@ -237,7 +237,7 @@ classdef PVS_checker < handle end if(~isempty(elsecell)) resultcell = obj.data.Grid0.search_return(elsecell,g2_cell); code = [code sprintf('ELSE->%s\n',obj.matlab_to_pvs_syntax_translation(strtrim(char(get(resultcell.result,'String')))))]; code = [code sprintf('ELSE->%s\n',obj.matlab_to_pvs_syntax_translation(strtrim(char(resultcell.result_text))))]; end code = [code sprintf('ENDCOND')]; Loading @@ -249,8 +249,8 @@ classdef PVS_checker < handle %% genereate_pvs function code = generate_pvs(obj,g1,g2,depth) g1cond1 = get(g1.cells(1).cond,'String'); g2cond1 = get(g2.cells(1).cond,'String'); g1cond1 = g1.cells(1).cond_text; g2cond1 = g2.cells(1).cond_text; code = []; %1D horizontal if(~isempty(g1cond1) && isempty(g2cond1)) Loading @@ -261,7 +261,7 @@ classdef PVS_checker < handle code = [code sprintf('COND\n')]; elsecell = []; for i=1:size(g2.cells,2) g2cond = get(g2.cells(i).cond,'String'); g2cond = g2.cells(i).cond_text; % condition string of otherwise corresponds to an else % statement, we allow this statement to be in any order % in the cells of the grid, so we need to find where it Loading @@ -271,7 +271,7 @@ classdef PVS_checker < handle found = 1; continue end code = [code sprintf('%s->',obj.matlab_to_pvs_syntax_translation(strtrim(char(get(g2.cells(i).cond,'String')))))]; code = [code sprintf('%s->',obj.matlab_to_pvs_syntax_translation(strtrim(char(g2.cells(i).cond_text))))]; if(~isempty(g2.cells(i).subgrid)) code = [code obj.generate_pvs(g1,g2.cells(i).subgrid,depth)]; Loading @@ -282,7 +282,7 @@ classdef PVS_checker < handle resultcell = obj.data.Grid0.search_return(g1.cells(1),g2.cells(i)); if(~isempty(resultcell)) code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(get(resultcell.result,'String'))))]; code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(resultcell.result_text)))]; else Loading Loading @@ -315,7 +315,7 @@ classdef PVS_checker < handle resultcell = obj.data.Grid0.search_return(g1.cells(1),elsecell); if(~isempty(resultcell)) code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(get(resultcell.result,'String')))) sprintf('\n')]; code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(resultcell.result_text))) sprintf('\n')]; Loading Loading @@ -349,7 +349,7 @@ classdef PVS_checker < handle if (~isempty(grid.cells(i).subgrid)) string = [string obj.pvs_check_for_imports_g(grid.cells(i).subgrid)]; end text = char(get(grid.cells(i).cond,'String')); text = char(grid.cells(i).cond_text); vars = regexp(text,'([a-zA-Z][a-zA-Z0-9_]*)','match'); Loading TableLibrary.mdl +69 −42 Original line number Diff line number Diff line Loading @@ -15,9 +15,9 @@ Library { ModifiedByFormat "%<Auto>" LastModifiedBy "colin" ModifiedDateFormat "%<Auto>" LastModifiedDate "Wed Jul 14 11:27:12 2010" RTWModifiedTimeStamp 201007625 ModelVersionFormat "1.%<AutoIncrement:7>" LastModifiedDate "Wed Jul 14 13:23:15 2010" RTWModifiedTimeStamp 201014591 ModelVersionFormat "1.%<AutoIncrement:10>" ConfigurationManager "None" SampleTimeColors off SampleTimeAnnotations off Loading Loading @@ -567,29 +567,24 @@ Library { } BlockParameterDefaults { Block { BlockType Inport Port "1" UseBusObject off BusObject "BusObject" BusOutputAsStruct off PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" BlockType Constant Value "1" VectorParams1D on SamplingMode "Sample based" OutMin "[]" OutMax "[]" DataType "auto" OutDataTypeMode "Inherit from 'Constant value'" OutDataType "fixdt(1,16,0)" ConRadixGroup "Use specified scaling" OutScaling "[]" OutDataTypeStr "Inherit: auto" OutDataTypeStr "Inherit: Inherit from 'Constant value'" LockScale off SignalType "auto" SamplingMode "auto" LatchByDelayingOutsideSignal off LatchInputForFeedbackSignals off Interpolate on SampleTime "inf" FramePeriod "inf" PreserveConstantTs off } Block { BlockType Outport BlockType Inport Port "1" UseBusObject off BusObject "BusObject" Loading @@ -606,9 +601,9 @@ Library { LockScale off SignalType "auto" SamplingMode "auto" SourceOfInitialOutputValue "Dialog" OutputWhenDisabled "held" InitialOutput "[]" LatchByDelayingOutsideSignal off LatchInputForFeedbackSignals off Interpolate on } Block { BlockType SubSystem Loading @@ -632,7 +627,7 @@ Library { } System { Name "TableLibrary" Location [210, 265, 790, 525] Location [210, 331, 790, 591] Open on ModelBrowserVisibility off ModelBrowserWidth 200 Loading @@ -646,13 +641,60 @@ Library { ShowPageBoundaries off ZoomFactor "100" ReportName "simulink-default.rpt" SIDHighWatermark 3 SIDHighWatermark 8 Block { BlockType SubSystem Name "System Check" SID 4 Ports [] Position [85, 149, 219, 207] LibraryVersion "1.216" OpenFcn "check_system(get_param(gcb,'Parent'))" MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off RequestExecContextInheritance off MaskHideContents off MaskDescription "Check System" MaskDisplay "text(0.5,0.6,'Check System', 'horizontalAlignment', 'center')\n" MaskIconFrame on MaskIconOpaque on MaskIconRotate "none" MaskPortRotate "default" MaskIconUnits "normalized" System { Name "System Check" Location [433, 469, 931, 769] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" Block { BlockType Constant Name "Constant" SID 8 Position [110, 105, 140, 135] OutDataType "fixdt(1, 16)" OutScaling "2^0" } } } Block { BlockType SubSystem Name "Tabular Expression" SID 1 Ports [1, 1] Position [70, 72, 235, 138] Ports [1] Position [70, 32, 235, 98] CopyFcn "TTdiag Copy" OpenFcn "TTdiag Open Simulink" MinAlgLoopOccurrences off Loading @@ -672,7 +714,7 @@ Library { MaskIconUnits "normalized" System { Name "Tabular Expression" Location [433, 403, 931, 703] Location [433, 447, 931, 747] Open off ModelBrowserVisibility off ModelBrowserWidth 200 Loading @@ -694,21 +736,6 @@ Library { OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Outport Name "Out1" SID 3 Position [360, 103, 390, 117] IconDisplay "Port number" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Line { SrcBlock "In1" SrcPort 1 DstBlock "Out1" DstPort 1 } } } } Loading check_system.m 0 → 100644 +27 −0 Original line number Diff line number Diff line function [ output_args ] = check_system(system) %UNTITLED Summary of this function goes here % Detailed explanation goes here blocks = find_system(system,'MaskDescription','Table Block') msg = []; for i = 1:size(blocks,1) if ~strncmp(blocks(i),'TableLibrary',12) block_data = get_param(char(blocks(i)),'UserData'); if ~isempty(block_data) PVS = PVS_checker(block_data); [check,result] = PVS.pvs_check; if (check == 1) msg = [msg char(blocks(i)) 'is valid' sprintf('\n')] else msg = [msg char(blocks(i)) 'is not valid' sprintf('\n')] end block_data.checked = check; set_block_display(char(blocks(i)),block_data.checked) end end end msgbox(msg); end set_block_display.m 0 → 100644 +20 −0 Original line number Diff line number Diff line function [] = set_block_display(block_handle,checked) %if object.pvs_checked == 1 mask_string = []; code_block = sprintf('%s/code',getfullname(block_handle)); in_handles=find_system(code_block, 'SearchDepth',1,'FindAll','On','FollowLinks','On','LookUnderMasks','All','BlockType','Inport'); for i = 1:size(in_handles,1) mask_string = [mask_string 'port_label(''input'',' int2str(i) ',''' get_param(in_handles(i),'Name') ''');' ]; end mask_string = [mask_string 'text(0.5, 0.6, ''Tabular Expression'', ''horizontalAlignment'', ''center'')']; if checked == 0 mask_string = [mask_string 'color(''red'')text(0.5, 0.4, ''Not Checked'', ''horizontalAlignment'', ''center'')']; else mask_string = [mask_string 'color(''green'')text(0.5, 0.4, ''Checked'', ''horizontalAlignment'', ''center'')']; end set_param(getfullname(block_handle),'MaskDisplay',mask_string); end No newline at end of file Loading
GUI.m +14 −27 Original line number Diff line number Diff line Loading @@ -252,27 +252,7 @@ classdef GUI < handle end function [] = set_block_display(object) if (object.mode == 1) %if object.pvs_checked == 1 mask_string = []; code_block = sprintf('%s/code',getfullname(object.block_handle)); in_handles=find_system(code_block, 'SearchDepth',1,'FindAll','On','FollowLinks','On','LookUnderMasks','All','BlockType','Inport'); for i = 1:size(in_handles,1) mask_string = [mask_string 'port_label(''input'',' int2str(i) ',''' get_param(in_handles(i),'Name') ''');' ]; end mask_string = [mask_string 'text(0.5, 0.6, ''Tabular Expression'', ''horizontalAlignment'', ''center'')']; if object.pvs_checked == 0 mask_string = [mask_string 'color(''red'')text(0.5, 0.4, ''Not Checked'', ''horizontalAlignment'', ''center'')']; else mask_string = [mask_string 'color(''green'')text(0.5, 0.4, ''Checked'', ''horizontalAlignment'', ''center'')']; end set_param(getfullname(object.block_handle),'MaskDisplay',mask_string); end end function [] = update_Statusbar(object) Loading Loading @@ -411,8 +391,10 @@ classdef GUI < handle end object.pvs_checked = check; object.update_Statusbar; object.set_block_display if (object.mode == 1) set_block_display(object.block_handle,object.pvs_checked) end end end Loading Loading @@ -590,7 +572,7 @@ classdef GUI < handle % First loop through all the inport blocks, if there does not % exists an inport in the code block of the same name then % delete the inport block inports = find_system(getfullname(object.block_handle),'BlockType','Inport'); inports = find_system(getfullname(object.block_handle),'LookUnderMasks','all','SearchDepth',1,'FindAll','On','BlockType','Inport'); for i=1:size(inports,1) found = 0; in_handles=find_system(code_block, 'SearchDepth',1,'FindAll','On','FollowLinks','On','LookUnderMasks','All','BlockType','Inport'); Loading Loading @@ -642,7 +624,7 @@ classdef GUI < handle % Next we do the same thing with the outputs outports = find_system(getfullname(object.block_handle),'BlockType','Outport'); outports = find_system(getfullname(object.block_handle),'LookUnderMasks','all','SearchDepth',1,'FindAll','On','BlockType','Outport'); for i=1:size(outports,1) found = 0; out_handles=find_system(code_block, 'SearchDepth',1,'FindAll','On','FollowLinks','On','LookUnderMasks','All','BlockType','Outport'); Loading Loading @@ -715,8 +697,10 @@ classdef GUI < handle object.function_name_text = get(object.function_name_control,'String'); object.function_inputs_text = get(object.function_inputs_control,'String'); if (object.mode == 1) object.set_block_display; set_block_display(object.block_handle,object.pvs_checked); end end end Loading Loading @@ -1828,7 +1812,10 @@ classdef GUI < handle if object.pvs_checked == 1 object.pvs_checked = 0; object.update_Statusbar object.set_block_display; if (object.mode == 1) set_block_display(object.block_handle,object.pvs_checked); end end end Loading
PVS_checker.m +11 −11 Original line number Diff line number Diff line Loading @@ -208,7 +208,7 @@ classdef PVS_checker < handle code = [code sprintf('COND\n')]; elsecell = []; for i=1:size(g1.cells,2) g1cond = get(g1.cells(i).cond,'String'); g1cond = g1.cells(i).cond_text; % condition string of otherwise corresponds to an else % statement, we allow this statement to be in any order % in the cells of the grid, so we need to find where it Loading @@ -218,10 +218,10 @@ classdef PVS_checker < handle found = 1; continue end code = [code sprintf('%s->',obj.matlab_to_pvs_syntax_translation(strtrim(char(get(g1.cells(i).cond,'String')))))]; code = [code sprintf('%s->',obj.matlab_to_pvs_syntax_translation(strtrim(char(g1.cells(i).cond_text))))]; resultcell = obj.data.Grid0.search_return(g1.cells(i),g2_cell); if(~isempty(resultcell)) code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(get(resultcell.result,'String'))))]; code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(resultcell.result_text)))]; if(isempty(elsecell)) if(i~= size(g1.cells,2)) Loading @@ -237,7 +237,7 @@ classdef PVS_checker < handle end if(~isempty(elsecell)) resultcell = obj.data.Grid0.search_return(elsecell,g2_cell); code = [code sprintf('ELSE->%s\n',obj.matlab_to_pvs_syntax_translation(strtrim(char(get(resultcell.result,'String')))))]; code = [code sprintf('ELSE->%s\n',obj.matlab_to_pvs_syntax_translation(strtrim(char(resultcell.result_text))))]; end code = [code sprintf('ENDCOND')]; Loading @@ -249,8 +249,8 @@ classdef PVS_checker < handle %% genereate_pvs function code = generate_pvs(obj,g1,g2,depth) g1cond1 = get(g1.cells(1).cond,'String'); g2cond1 = get(g2.cells(1).cond,'String'); g1cond1 = g1.cells(1).cond_text; g2cond1 = g2.cells(1).cond_text; code = []; %1D horizontal if(~isempty(g1cond1) && isempty(g2cond1)) Loading @@ -261,7 +261,7 @@ classdef PVS_checker < handle code = [code sprintf('COND\n')]; elsecell = []; for i=1:size(g2.cells,2) g2cond = get(g2.cells(i).cond,'String'); g2cond = g2.cells(i).cond_text; % condition string of otherwise corresponds to an else % statement, we allow this statement to be in any order % in the cells of the grid, so we need to find where it Loading @@ -271,7 +271,7 @@ classdef PVS_checker < handle found = 1; continue end code = [code sprintf('%s->',obj.matlab_to_pvs_syntax_translation(strtrim(char(get(g2.cells(i).cond,'String')))))]; code = [code sprintf('%s->',obj.matlab_to_pvs_syntax_translation(strtrim(char(g2.cells(i).cond_text))))]; if(~isempty(g2.cells(i).subgrid)) code = [code obj.generate_pvs(g1,g2.cells(i).subgrid,depth)]; Loading @@ -282,7 +282,7 @@ classdef PVS_checker < handle resultcell = obj.data.Grid0.search_return(g1.cells(1),g2.cells(i)); if(~isempty(resultcell)) code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(get(resultcell.result,'String'))))]; code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(resultcell.result_text)))]; else Loading Loading @@ -315,7 +315,7 @@ classdef PVS_checker < handle resultcell = obj.data.Grid0.search_return(g1.cells(1),elsecell); if(~isempty(resultcell)) code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(get(resultcell.result,'String')))) sprintf('\n')]; code = [code obj.matlab_to_pvs_syntax_translation(strtrim(char(resultcell.result_text))) sprintf('\n')]; Loading Loading @@ -349,7 +349,7 @@ classdef PVS_checker < handle if (~isempty(grid.cells(i).subgrid)) string = [string obj.pvs_check_for_imports_g(grid.cells(i).subgrid)]; end text = char(get(grid.cells(i).cond,'String')); text = char(grid.cells(i).cond_text); vars = regexp(text,'([a-zA-Z][a-zA-Z0-9_]*)','match'); Loading
TableLibrary.mdl +69 −42 Original line number Diff line number Diff line Loading @@ -15,9 +15,9 @@ Library { ModifiedByFormat "%<Auto>" LastModifiedBy "colin" ModifiedDateFormat "%<Auto>" LastModifiedDate "Wed Jul 14 11:27:12 2010" RTWModifiedTimeStamp 201007625 ModelVersionFormat "1.%<AutoIncrement:7>" LastModifiedDate "Wed Jul 14 13:23:15 2010" RTWModifiedTimeStamp 201014591 ModelVersionFormat "1.%<AutoIncrement:10>" ConfigurationManager "None" SampleTimeColors off SampleTimeAnnotations off Loading Loading @@ -567,29 +567,24 @@ Library { } BlockParameterDefaults { Block { BlockType Inport Port "1" UseBusObject off BusObject "BusObject" BusOutputAsStruct off PortDimensions "-1" VarSizeSig "Inherit" SampleTime "-1" BlockType Constant Value "1" VectorParams1D on SamplingMode "Sample based" OutMin "[]" OutMax "[]" DataType "auto" OutDataTypeMode "Inherit from 'Constant value'" OutDataType "fixdt(1,16,0)" ConRadixGroup "Use specified scaling" OutScaling "[]" OutDataTypeStr "Inherit: auto" OutDataTypeStr "Inherit: Inherit from 'Constant value'" LockScale off SignalType "auto" SamplingMode "auto" LatchByDelayingOutsideSignal off LatchInputForFeedbackSignals off Interpolate on SampleTime "inf" FramePeriod "inf" PreserveConstantTs off } Block { BlockType Outport BlockType Inport Port "1" UseBusObject off BusObject "BusObject" Loading @@ -606,9 +601,9 @@ Library { LockScale off SignalType "auto" SamplingMode "auto" SourceOfInitialOutputValue "Dialog" OutputWhenDisabled "held" InitialOutput "[]" LatchByDelayingOutsideSignal off LatchInputForFeedbackSignals off Interpolate on } Block { BlockType SubSystem Loading @@ -632,7 +627,7 @@ Library { } System { Name "TableLibrary" Location [210, 265, 790, 525] Location [210, 331, 790, 591] Open on ModelBrowserVisibility off ModelBrowserWidth 200 Loading @@ -646,13 +641,60 @@ Library { ShowPageBoundaries off ZoomFactor "100" ReportName "simulink-default.rpt" SIDHighWatermark 3 SIDHighWatermark 8 Block { BlockType SubSystem Name "System Check" SID 4 Ports [] Position [85, 149, 219, 207] LibraryVersion "1.216" OpenFcn "check_system(get_param(gcb,'Parent'))" MinAlgLoopOccurrences off PropExecContextOutsideSubsystem off RTWSystemCode "Auto" FunctionWithSeparateData off Opaque off RequestExecContextInheritance off MaskHideContents off MaskDescription "Check System" MaskDisplay "text(0.5,0.6,'Check System', 'horizontalAlignment', 'center')\n" MaskIconFrame on MaskIconOpaque on MaskIconRotate "none" MaskPortRotate "default" MaskIconUnits "normalized" System { Name "System Check" Location [433, 469, 931, 769] Open off ModelBrowserVisibility off ModelBrowserWidth 200 ScreenColor "white" PaperOrientation "landscape" PaperPositionMode "auto" PaperType "usletter" PaperUnits "inches" TiledPaperMargins [0.500000, 0.500000, 0.500000, 0.500000] TiledPageScale 1 ShowPageBoundaries off ZoomFactor "100" Block { BlockType Constant Name "Constant" SID 8 Position [110, 105, 140, 135] OutDataType "fixdt(1, 16)" OutScaling "2^0" } } } Block { BlockType SubSystem Name "Tabular Expression" SID 1 Ports [1, 1] Position [70, 72, 235, 138] Ports [1] Position [70, 32, 235, 98] CopyFcn "TTdiag Copy" OpenFcn "TTdiag Open Simulink" MinAlgLoopOccurrences off Loading @@ -672,7 +714,7 @@ Library { MaskIconUnits "normalized" System { Name "Tabular Expression" Location [433, 403, 931, 703] Location [433, 447, 931, 747] Open off ModelBrowserVisibility off ModelBrowserWidth 200 Loading @@ -694,21 +736,6 @@ Library { OutDataType "fixdt(1, 16)" OutScaling "2^0" } Block { BlockType Outport Name "Out1" SID 3 Position [360, 103, 390, 117] IconDisplay "Port number" OutDataType "fixdt(1, 16)" OutScaling "2^0" } Line { SrcBlock "In1" SrcPort 1 DstBlock "Out1" DstPort 1 } } } } Loading
check_system.m 0 → 100644 +27 −0 Original line number Diff line number Diff line function [ output_args ] = check_system(system) %UNTITLED Summary of this function goes here % Detailed explanation goes here blocks = find_system(system,'MaskDescription','Table Block') msg = []; for i = 1:size(blocks,1) if ~strncmp(blocks(i),'TableLibrary',12) block_data = get_param(char(blocks(i)),'UserData'); if ~isempty(block_data) PVS = PVS_checker(block_data); [check,result] = PVS.pvs_check; if (check == 1) msg = [msg char(blocks(i)) 'is valid' sprintf('\n')] else msg = [msg char(blocks(i)) 'is not valid' sprintf('\n')] end block_data.checked = check; set_block_display(char(blocks(i)),block_data.checked) end end end msgbox(msg); end
set_block_display.m 0 → 100644 +20 −0 Original line number Diff line number Diff line function [] = set_block_display(block_handle,checked) %if object.pvs_checked == 1 mask_string = []; code_block = sprintf('%s/code',getfullname(block_handle)); in_handles=find_system(code_block, 'SearchDepth',1,'FindAll','On','FollowLinks','On','LookUnderMasks','All','BlockType','Inport'); for i = 1:size(in_handles,1) mask_string = [mask_string 'port_label(''input'',' int2str(i) ',''' get_param(in_handles(i),'Name') ''');' ]; end mask_string = [mask_string 'text(0.5, 0.6, ''Tabular Expression'', ''horizontalAlignment'', ''center'')']; if checked == 0 mask_string = [mask_string 'color(''red'')text(0.5, 0.4, ''Not Checked'', ''horizontalAlignment'', ''center'')']; else mask_string = [mask_string 'color(''green'')text(0.5, 0.4, ''Checked'', ''horizontalAlignment'', ''center'')']; end set_param(getfullname(block_handle),'MaskDisplay',mask_string); end No newline at end of file