Code covered by the BSD License  

Highlights from
CheckMate demos

image thumbnail
from CheckMate demos by Zhi Han
Demos for checkmate hybrid system verification tool.

testcheckmate(point)
function status = testcheckmate(point)
% TCHECKMATE Test checkmate basis functionalities.
status = 'unknown';

if nargin ==0
    point = 'all';
end

status = check_install();
if strcmpi(status, 'failed')
    return;
end

if strcmpi(point, 'all') || strcmpi(point, 'tboing_verify')
    status = tboing_verify();
    if strcmpi(status, 'failed')
        return;
    end
end

if strcmpi(point, 'all') || strcmpi(point, 'tboing_explore')
    status = tboing_explore();
    if strcmpi(status, 'failed')
        return;
    end
end

if strcmpi(point, 'all') || strcmpi(point, 'tetc5d_explore')
    status = tetc5d_explore();
    if strcmpi(status, 'failed')
        return;
    end
end

if strcmpi(point, 'all') || strcmpi(point, 'tetc2d_verify')
    status = tetc2d_verify();
    if strcmpi(status, 'failed')
        return;
    end
end
if strcmpi(point, 'all') || strcmpi(point, 'tph_verify')
    status = tph_verify();
    if strcmpi(status, 'failed')
        return;
    end
end

if strcmpi(point, 'all') || strcmpi(point, 'tph_explore')
    status = tph_explore();
    if strcmpi(status, 'failed')
        return;
    end
end

if strcmpi(point, 'all') || strcmpi(point, 'tacc_explore')
    status = tacc_explore();
    if strcmpi(status, 'failed')
        return;
    end
end

end

function status = check_install()
a = which('verify.m');
if ~isempty(a)
    status = 'success';
else
    status = 'failed';
end
end

function status = tboing_verify()
oldDir = pwd;
dir = 'boing';

cd(dir);
mdl = 'boing';
setup_boing;
load_system(mdl);
try
    verify;
    bdclose(mdl);
    status = 'success';
catch
    disp(lasterr);
    status = 'failed';
end
cd(oldDir);

end

function status = tboing_explore()
oldDir = pwd;
dir = 'boing';

cd(dir);
mdl = 'boing';
setup_boing;
load_system(mdl);
try
    explore;
    bdclose('all');
    status = 'success';
catch
    disp(lasterr);
    status = 'failed';
end
cd(oldDir);
end

function status = tetc5d_explore()
oldDir = pwd;
dir = 'etc5d';

cd(dir);
mdl = 'etc5d';
setup5d;
load_system(mdl);
try
    explore;
    bdclose('all');
    status = 'success';
catch
    disp(lasterr);
    status = 'failed';
end
cd(oldDir);
end

function status = tetc2d_verify()
oldDir = pwd;
dir = 'etc_reg';

cd(dir);
mdl = 'etc_reg';
setup_reg;
load_system(mdl);
try
    verify;
    bdclose('all');
    status = 'success';
catch
    disp(lasterr);
    status = 'failed';
end
cd(oldDir);
end

function status = tph_verify()
oldDir = pwd;
dir = 'ph_plant';

cd(dir);
mdl = 'ph_plant';
setup_ph;
load_system(mdl);
try
    verify;
    bdclose('all');
    status = 'success';
catch
    disp(lasterr);
    status = 'failed';
end
cd(oldDir);
end

function status = tph_explore()
oldDir = pwd;
dir = 'ph_plant';

cd(dir);
mdl = 'ph_plant';
setup_ph;
load_system(mdl);
try
    explore;
    bdclose('all');
    status = 'success';
catch
    disp(lasterr);
    status = 'failed';
end
cd(oldDir);
end

function status = tacc_explore()
oldDir = pwd;
dir = 'V2V';

cd(dir);
mdl = 'acc';

load_system(mdl);
try
    acc_setup;
    explore;
    bdclose('all');
    status = 'success';
catch
    disp(lasterr);
    status = 'failed';
end
cd(oldDir);
end

Contact us at files@mathworks.com