sb120: #i111200# disabled failing tests for now

#111102# -o xmloff.Chart.XMLContentExporter
#111102# -o xmloff.Chart.XMLContentImporter
#111102# -o xmloff.Chart.XMLExporter
#111102# -o xmloff.Chart.XMLImporter
#111102# -o xmloff.Chart.XMLStylesExporter
#111102# -o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
#i111200 -o xmloff.Draw.XMLMetaImporter
-o xmloff.Draw.XMLSettingsExporter
-o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
-o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
#i111111# -o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
-o xmloff.Impress.XMLSettingsExporter
-o xmloff.Impress.XMLSettingsImporter
#i87695 -o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter

#111102# -o xmloff.Chart.XMLContentExporter
#111102# -o xmloff.Chart.XMLContentImporter
#111102# -o xmloff.Chart.XMLExporter
#111102# -o xmloff.Chart.XMLImporter
#111102# -o xmloff.Chart.XMLStylesExporter
#111102# -o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
-o xmloff.Draw.XMLMetaImporter
-o xmloff.Draw.XMLSettingsExporter
-o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
-o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
#i111111# -o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
-o xmloff.Impress.XMLSettingsExporter
-o xmloff.Impress.XMLSettingsImporter
#i87695 -o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter


sb123: #i113306# disabled sfx.DocumentTemplates for now

-o sfx.AppDispatchProvider
#i113306 -o sfx.DocumentTemplates
-o sfx.FrameLoader
-o sfx.SfxMacroLoader
#i111283 -o sfx.StandaloneDocumentInfo

-o sfx.AppDispatchProvider
-o sfx.DocumentTemplates
-o sfx.FrameLoader
-o sfx.SfxMacroLoader
#i111283 -o sfx.StandaloneDocumentInfo


sb120: #i111283# disabled failing tests for now

-o sfx.AppDispatchProvider
-o sfx.DocumentTemplates
-o sfx.FrameLoader
-o sfx.SfxMacroLoader
#i111283 -o sfx.StandaloneDocumentInfo

-o sfx.AppDispatchProvider
-o sfx.DocumentTemplates
-o sfx.FrameLoader
-o sfx.SfxMacroLoader
-o sfx.StandaloneDocumentInfo


INTEGRATION: CWS pagefields (1.3.12); FILE MERGED 2004/04/08 09:55:23 sw 1.3.12.2: #i26830# 2004/04/07 12:27:26 sw 1.3.12.1: #i26830#

### 114242 ### -o sc.ScPageObj
### 111147 ### -o sc.AccessibleEditableTextPara_PreviewNote
-o sc.ScIndexEnumeration_DataPilotItemsEnumeration
-o sc.ScDataPilotItemsObj
-o sc.ScDataPilotItemObj
-o sc.ScSpreadsheetSettings
-o sc.ScTabViewObj
-o sc.ScAccessibleCell
-o sc.ScSpreadsheetSettingsObj
-o sc.ScShapeObj
-o sc.ScDocumentConfiguration
-o sc.ScCellCursorObj
-o sc.ScCellRangeObj
-o sc.ScCellRangesObj
-o sc.ScTableSheetObj
-o sc.AccessibleEditableTextPara_HeaderFooter
-o sc.AccessibleEditableTextPara_PreviewCell
-o sc.ScAccessibleDocumentPagePreview
-o sc.ScAccessiblePageHeader
-o sc.ScAccessiblePageHeaderArea
-o sc.ScAccessiblePreviewCell
-o sc.ScAccessiblePreviewHeaderCell
-o sc.ScAccessiblePreviewTable
-o sc.ScAnnotationObj
-o sc.ScAnnotationsObj
-o sc.ScAreaLinkObj
-o sc.ScAreaLinksObj
-o sc.ScAutoFormatFieldObj
-o sc.ScAutoFormatObj
-o sc.ScAutoFormatsObj
-o sc.ScCellFieldObj
-o sc.ScCellFieldsObj
-o sc.ScCellFormatsEnumeration
-o sc.ScCellFormatsObj
-o sc.ScCellObj
-o sc.ScCellSearchObj
-o sc.ScCellTextCursor
-o sc.ScCellsEnumeration
-o sc.ScCellsObj
-o sc.ScChartObj
-o sc.ScChartsObj
-o sc.ScConsolidationDescriptor
-o sc.ScDDELinkObj
-o sc.ScDDELinksObj
-o sc.ScDataPilotFieldObj
-o sc.ScDataPilotFieldsObj
-o sc.ScDataPilotTableObj
-o sc.ScDataPilotTablesObj
-o sc.ScDatabaseRangeObj
-o sc.ScDatabaseRangesObj
-o sc.ScDrawPageObj
-o sc.ScDrawPagesObj
-o sc.ScFilterDescriptorBase
-o sc.ScFunctionListObj
-o sc.ScHeaderFieldObj
-o sc.ScHeaderFieldsObj
-o sc.ScHeaderFooterContentObj
-o sc.ScHeaderFooterTextCursor
-o sc.ScHeaderFooterTextObj
-o sc.ScIndexEnumeration_CellAnnotationsEnumeration
-o sc.ScIndexEnumeration_CellAreaLinksEnumeration
-o sc.ScIndexEnumeration_DDELinksEnumeration
-o sc.ScIndexEnumeration_DataPilotFieldsEnumeration
-o sc.ScIndexEnumeration_DataPilotTablesEnumeration
-o sc.ScIndexEnumeration_DatabaseRangesEnumeration
-o sc.ScIndexEnumeration_FunctionDescriptionEnumeration
-o sc.ScIndexEnumeration_LabelRangesEnumeration
-o sc.ScIndexEnumeration_NamedRangesEnumeration
-o sc.ScIndexEnumeration_ScenariosEnumeration
-o sc.ScIndexEnumeration_SheetCellRangesEnumeration
-o sc.ScIndexEnumeration_SheetLinksEnumeration
-o sc.ScIndexEnumeration_SpreadsheetViewPanesEnumeration
-o sc.ScIndexEnumeration_SpreadsheetsEnumeration
-o sc.ScIndexEnumeration_SubTotalFieldsEnumeration
-o sc.ScIndexEnumeration_TableAutoFormatEnumeration
-o sc.ScIndexEnumeration_TableChartsEnumeration
-o sc.ScIndexEnumeration_TableColumnsEnumeration
-o sc.ScIndexEnumeration_TableConditionalEntryEnumeration
-o sc.ScIndexEnumeration_TableRowsEnumeration
-o sc.ScIndexEnumeration_TextFieldEnumeration
-o sc.ScLabelRangeObj
-o sc.ScLabelRangesObj
-o sc.ScModelObj
-o sc.ScNamedRangeObj
-o sc.ScNamedRangesObj
-o sc.ScRecentFunctionsObj
-o sc.ScScenariosObj
-o sc.ScSheetLinkObj
-o sc.ScSheetLinksObj
-o sc.ScStyleFamiliesObj
-o sc.ScStyleFamilyObj
-o sc.ScStyleObj
-o sc.ScSubTotalDescriptorBase
-o sc.ScSubTotalFieldObj
-o sc.ScTableColumnObj
-o sc.ScTableColumnsObj
-o sc.ScTableConditionalEntry
-o sc.ScTableConditionalFormat
-o sc.ScTableRowObj
-o sc.ScTableRowsObj
-o sc.ScTableSheetsObj
-o sc.ScTableValidationObj
-o sc.ScViewPaneObj
-o sc.XMLContentExporter
-o sc.XMLContentImporter
-o sc.XMLExporter
-o sc.XMLImporter
-o sc.XMLMetaExporter
-o sc.XMLMetaImporter
-o sc.XMLSettingsExporter
-o sc.XMLSettingsImporter
-o sc.XMLStylesExporter
-o sc.XMLStylesImporter
-o sc.ScAccessibleSpreadsheet
-o sc.ScAccessibleCsvGrid
-o sc.ScAccessibleCsvCell
-o sc.ScAccessibleCsvRuler
-o sc.ScAccessibleDocument

### 114242 ### -o sc.ScPageObj
### 111147 ### -o sc.AccessibleEditableTextPara_PreviewNote
-o sc.ScSpreadsheetSettings
-o sc.ScTabViewObj
-o sc.ScAccessibleCell
-o sc.ScSpreadsheetSettingsObj
-o sc.ScShapeObj
-o sc.ScDocumentConfiguration
-o sc.ScCellCursorObj
-o sc.ScCellRangeObj
-o sc.ScCellRangesObj
-o sc.ScTableSheetObj
-o sc.AccessibleEditableTextPara_HeaderFooter
-o sc.AccessibleEditableTextPara_PreviewCell
-o sc.ScAccessibleDocumentPagePreview
-o sc.ScAccessiblePageHeader
-o sc.ScAccessiblePageHeaderArea
-o sc.ScAccessiblePreviewCell
-o sc.ScAccessiblePreviewHeaderCell
-o sc.ScAccessiblePreviewTable
-o sc.ScAnnotationObj
-o sc.ScAnnotationsObj
-o sc.ScAreaLinkObj
-o sc.ScAreaLinksObj
-o sc.ScAutoFormatFieldObj
-o sc.ScAutoFormatObj
-o sc.ScAutoFormatsObj
-o sc.ScCellFieldObj
-o sc.ScCellFieldsObj
-o sc.ScCellFormatsEnumeration
-o sc.ScCellFormatsObj
-o sc.ScCellObj
-o sc.ScCellSearchObj
-o sc.ScCellTextCursor
-o sc.ScCellsEnumeration
-o sc.ScCellsObj
-o sc.ScChartObj
-o sc.ScChartsObj
-o sc.ScConsolidationDescriptor
-o sc.ScDDELinkObj
-o sc.ScDDELinksObj
-o sc.ScDataPilotFieldObj
-o sc.ScDataPilotFieldsObj
-o sc.ScDataPilotTableObj
-o sc.ScDataPilotTablesObj
-o sc.ScDatabaseRangeObj
-o sc.ScDatabaseRangesObj
-o sc.ScDrawPageObj
-o sc.ScDrawPagesObj
-o sc.ScFilterDescriptorBase
-o sc.ScFunctionListObj
-o sc.ScHeaderFieldObj
-o sc.ScHeaderFieldsObj
-o sc.ScHeaderFooterContentObj
-o sc.ScHeaderFooterTextCursor
-o sc.ScHeaderFooterTextObj
-o sc.ScIndexEnumeration_CellAnnotationsEnumeration
-o sc.ScIndexEnumeration_CellAreaLinksEnumeration
-o sc.ScIndexEnumeration_DDELinksEnumeration
-o sc.ScIndexEnumeration_DataPilotFieldsEnumeration
-o sc.ScIndexEnumeration_DataPilotTablesEnumeration
-o sc.ScIndexEnumeration_DatabaseRangesEnumeration
-o sc.ScIndexEnumeration_FunctionDescriptionEnumeration
-o sc.ScIndexEnumeration_LabelRangesEnumeration
-o sc.ScIndexEnumeration_NamedRangesEnumeration
-o sc.ScIndexEnumeration_ScenariosEnumeration
-o sc.ScIndexEnumeration_SheetCellRangesEnumeration
-o sc.ScIndexEnumeration_SheetLinksEnumeration
-o sc.ScIndexEnumeration_SpreadsheetViewPanesEnumeration
-o sc.ScIndexEnumeration_SpreadsheetsEnumeration
-o sc.ScIndexEnumeration_SubTotalFieldsEnumeration
-o sc.ScIndexEnumeration_TableAutoFormatEnumeration
-o sc.ScIndexEnumeration_TableChartsEnumeration
-o sc.ScIndexEnumeration_TableColumnsEnumeration
-o sc.ScIndexEnumeration_TableConditionalEntryEnumeration
-o sc.ScIndexEnumeration_TableRowsEnumeration
-o sc.ScIndexEnumeration_TextFieldEnumeration
-o sc.ScLabelRangeObj
-o sc.ScLabelRangesObj
-o sc.ScModelObj
-o sc.ScNamedRangeObj
-o sc.ScNamedRangesObj
-o sc.ScRecentFunctionsObj
-o sc.ScScenariosObj
-o sc.ScSheetLinkObj
-o sc.ScSheetLinksObj
-o sc.ScStyleFamiliesObj
-o sc.ScStyleFamilyObj
-o sc.ScStyleObj
-o sc.ScSubTotalDescriptorBase
-o sc.ScSubTotalFieldObj
-o sc.ScTableColumnObj
-o sc.ScTableColumnsObj
-o sc.ScTableConditionalEntry
-o sc.ScTableConditionalFormat
-o sc.ScTableRowObj
-o sc.ScTableRowsObj
-o sc.ScTableSheetsObj
-o sc.ScTableValidationObj
-o sc.ScViewPaneObj
-o sc.XMLContentExporter
-o sc.XMLContentImporter
-o sc.XMLExporter
-o sc.XMLImporter
-o sc.XMLMetaExporter
-o sc.XMLMetaImporter
-o sc.XMLSettingsExporter
-o sc.XMLSettingsImporter
-o sc.XMLStylesExporter
-o sc.XMLStylesImporter
-o sc.ScAccessibleSpreadsheet
-o sc.ScAccessibleCsvGrid
-o sc.ScAccessibleCsvCell
-o sc.ScAccessibleCsvRuler
-o sc.ScAccessibleDocument


Function usage when no or wrong parameter provided

function mdaq_set_ip(mdaq_ip)

    ip_config_file_path = mdaq_toolbox_path() + "etc"+filesep()+"mlink"+filesep()+"ip_config.txt";
    if argn(2) > 1 | argn(2) < 1 then
        mprintf("Description:\n");
        mprintf("\tSet IP address\n");
        mprintf("Usage:\n");
        mprintf("\tmdaq_set_ip(ip_address);\n")
        mprintf("\tip_address - MicroDAQ IP address (string)\n");
        return;
    end

    if mdaq_ip == [] | mdaq_ip == "" then
        disp("Wrong input argument - provide valid MicroDAQ IP address")
    end

    [f,err] = mopen(ip_config_file_path,'w');
    if err == 0 then
        mputl(string(mdaq_ip),f)
        mclose(f)
        global %microdaq
        %microdaq.ip_address = mdaq_ip;
    else
        disp("ERROR: Unable to set IP address!")
    end
endfunction

function mdaq_set_ip(mdaq_ip)
    ip_config_file_path = mdaq_toolbox_path() + "etc"+filesep()+"mlink"+filesep()+"ip_config.txt";

    [f,err] = mopen(ip_config_file_path,'w');
    if err == 0 then
        mputl(string(mdaq_ip),f)
        mclose(f)
        global %microdaq
        %microdaq.ip_address = mdaq_ip;
    else
        disp("ERROR: Unable to set IP address!")
    end
endfunction


INTEGRATION: CWS unoapi1 (1.3.508); FILE MERGED 2007/08/15 13:44:01 cn 1.3.508.1: #i79479# update files

#-o dbaccess.ConnectionLineAccessibility
-o dbaccess.DBContentLoader
#-o dbaccess.JoinViewAccessibility
-o dbaccess.OCommandDefinition
-o dbaccess.ODatabaseContext
-o dbaccess.ODatabaseSource
-o dbaccess.ODatasourceAdministrationDialog
-o dbaccess.ODatasourceBrowser
-o dbaccess.OInteractionHandler
#-o dbaccess.OQueryDesign
-o dbaccess.ORowSet
-o dbaccess.OSQLMessageDialog
-o dbaccess.OSingleSelectQueryComposer
#-o dbaccess.SbaXGridControl
#-o dbaccess.TableWindowAccessibility

-o dbaccess.SbaXGridControl
-o dbaccess.ORowSet
-o dbaccess.ConnectionLineAccessibility
-o dbaccess.DBContentLoader
-o dbaccess.OCommandDefinition
-o dbaccess.ODatabaseContext
-o dbaccess.ODatabaseSource
-o dbaccess.ODatasourceAdministrationDialog
-o dbaccess.ODatasourceBrowser
-o dbaccess.OInteractionHandler
-o dbaccess.OSQLMessageDialog
-o dbaccess.TableWindowAccessibility
-o dbaccess.JoinViewAccessibility
-o dbaccess.OQueryDesign


Fix simulation mode in pwm block

Fix simulation mode in pwm block

function block=mdaq_pwm_sim(block,flag)
    global %microdaq;
    if %microdaq.dsp_loaded == %F then

        select flag
        case -5 // Error
        case 0 // Derivative State Update
        case 1 // Output Update
            if %microdaq.private.connection_id > -1 then
                mdaqPWMWrite(%microdaq.private.connection_id,..
                               block.ipar(1),..
                               block.inptr(1),..
                               block.inptr(2));
            end
        case 2 // State Update
        case 3 // OutputEventTiming
        case 4 // Initialization
            if %microdaq.private.connection_id > -1 then
                mdaqPWMInit(%microdaq.private.connection_id,..
                              block.ipar(1),..
                              block.ipar(2),..
                              block.ipar(3),..
                              block.inptr(1),..
                              block.inptr(2));
            end

        case 5 // Ending
            if %microdaq.private.connection_id > -1 then
                mdaqPWMWrite(%microdaq.private.connection_id,..
                               block.ipar(1), 0, 0);
            end
        case 6 // Re-Initialisation
        case 9 // ZeroCrossing
        else // Unknown flag
        end
    end
endfunction

function block=mdaq_pwm_sim(block,flag)
    global %microdaq;
    if %microdaq.dsp_loaded == %F then

        select flag
        case -5 // Error
        case 0 // Derivative State Update
        case 1 // Output Update
            if %microdaq.private.connection_id > -1 then
                mdaqPWMWrite(%microdaq.private.connection_id,..
                               block.ipar(1),..
                               block.inptr(1),..
                               block.inptr(2));
            end
        case 2 // State Update
        case 3 // OutputEventTiming
        case 4 // Initialization
            if %microdaq.private.connection_id > -1 then
                mdaqPWMInit(%microdaq.private.connection_id,..
                              block.ipar(1),..
                              block.ipar(2),..
                              block.ipar(3));
            end

        case 5 // Ending
            if %microdaq.private.connection_id > -1 then
                mdaqPWMWrite(%microdaq.private.connection_id,..
                               block.ipar(1), 0, 0);
            end
        case 6 // Re-Initialisation
        case 9 // ZeroCrossing
        else // Unknown flag
        end
    end
endfunction


Silly typo fix

Silly typo fix

function [x,y,typ] = mdaq_mem_read(job,arg1,arg2)
    mem_write_desc = ["This block reads data from MicroDAQ memory.";
    "Block with mdaq_mem_set function can be used to";
    "change Standalone and Ext model parameters. ";
    "Mode parameter sets block read behaviour.";
    "If Trigger input is enabled, rising";
    "edge on trigger input will reset data ";
    "index to index 0. ";
    "";
    "Start index:";
    " points to beginning of memory area, range 0-4000000";
    "";
    "Size:";
    "size of memory area, range 0-4000000";
    "";
    "Vector size:";
    "size of input vector.";
    "";
    "Init value:";
    "Initializes memory with provided value";
    "";
    "Mode:";
    "0 - single read, ignore init value";
    "1 - circular read, use init value";
    "2 - signle read, use init value";
    "3 - circular read, ignore init value";
    "";
    "Trigger input:";
    "0 - disabled";
    "1 - enabled";
    "";
    "Set block parameters:"];
    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try

                [ok,start_idx, data_size, vec_size,init_value,read_mode,trigger_input,exprs]=..
                                scicos_getvalue(mem_write_desc,..
                                ['Start index:';
                                'Size:';
                                'Vector size:';
                                'Init value:';
                                'Mode:';
                                'Trigger input:'],..
                                list('vec',1,'vec',1,'vec',1,'vec',-1,'vec',1,'vec',1),exprs)
            catch
                [ok,start_idx, data_size, vec_size,init_value,read_mode,trigger_input,exprs]=..
                scicos_getvalue(mem_write_desc,..
                                ['Start index:';
                                'Size:';
                                'Vector size:';
                                'Init value:';
                                'Mode:';
                                'Trigger input:'],..
                                list('vec',1,'vec',1,'vec',1,'vec',-1,'vec',1,'vec',1),exprs)
            end;

            if ~ok then
                break
            end

            //~4MB = 1 000 000 floats
            max_index = 1000000;

            if  start_idx < 1 | start_idx > max_index then
                ok = %f;
                message("Incorrect memory start index - use index from 1 to "+string(max_index));
            end

            if vec_size > 10000 | vec_size < 1 then
                ok = %f;
                message("Wrong vector size - use 10000 max!");
            end

            size_mod = modulo(data_size, vec_size)
            if size_mod <> 0  then
                ok = %f;
                message("Incorrect size. Size is not multiple of array size!");
            end

            if data_size < 1 | data_size > (max_index-start_idx) then
                ok = %f;
                message("Incorrect size (max "+string(max_index-start_idx)+")");
            end

            if read_mode > 3 | read_mode < 0 then
                ok = %f;
                message("Use 0-3 to setup read mode.");
            end

            if ok then
                init_data_size = size(init_value, '*');
                if  init_data_size > 1 then
                    if  init_data_size <> vec_size  then
                        message('Initial values don''t mach vector data!')
                        ok = %f;
                    end
                    init_value = init_value';
                end
            end

            trigger_input_size = 1;
            if trigger_input <> 1 then
                trigger_input_size = [];
                trigger_input = 0
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, trigger_input_size, vec_size, 1, []);
                graphics.exprs = exprs;
                model.rpar = init_value;
                model.ipar = [(start_idx-1);vec_size;read_mode;data_size;0;init_data_size;trigger_input];
                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break
            end
        end

case 'define' then
        start_idx = 1;
        vec_size = 1;
        init_value = 0;
        data_size = 1;
        read_mode = 1;
        init_data_size = 1;
        trigger_input = 0;
        model=scicos_model()
        model.sim=list('mdaq_mem_read_sim',5)
        model.in =[]
        model.out=vec_size
        model.out2=1
        model.outtyp=1
        model.evtin=1
        model.rpar=[];
        model.ipar=[(start_idx-1);vec_size;read_mode;data_size;0;init_data_size;0]
        model.dstate=[];
        model.blocktype='d'
        model.dep_ut=[%t %f]
        exprs=[sci2exp(start_idx);sci2exp(data_size);sci2exp(vec_size);sci2exp(init_value);sci2exp(read_mode);sci2exp(trigger_input)]
        gr_i=['xstringb(orig(1),orig(2),['''' ; ],sz(1),sz(2),''fill'');']
        x=standard_define([4 3],model,exprs,gr_i)
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
    end
endfunction

function [x,y,typ] = mdaq_mem_read(job,arg1,arg2)
    mem_write_desc = ["This block reads data from MicroDAQ memory.";
    "Block with mdaq_mem_set function can be used to";
    "change Standalone and Ext model parameters. ";
    "Mode parameter sets block read behaviour.";
    "If Trigger input is enabled, rising";
    "edge on trigger input will reset data ";
    "index to index 0. ";
    "";
    "Start index:";
    " points to beginning of memory area, range 0-4000000";
    "";
    "Size:";
    "size of memory area, range 0-4000000";
    "";
    "Vector size:";
    "size of input vector.";
    "";
    "Init value:";
    "Initializes memory with provided value";
    "";
    "Mode:";
    "0 - single read, ignore init value";
    "1 - circular read, use init value";
    "2 - signle read, use init value";
    "3 - circular read, ignore init value";
    "";
    "Trigger input:";
    "0 - disbaled";
    "1 - enabled";
    "";
    "Set block parameters:"];
    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try

                [ok,start_idx, data_size, vec_size,init_value,read_mode,trigger_input,exprs]=..
                                scicos_getvalue(mem_write_desc,..
                                ['Start index:';
                                'Size:';
                                'Vector size:';
                                'Init value:';
                                'Mode:';
                                'Trigger input:'],..
                                list('vec',1,'vec',1,'vec',1,'vec',-1,'vec',1,'vec',1),exprs)
            catch
                [ok,start_idx, data_size, vec_size,init_value,read_mode,trigger_input,exprs]=..
                scicos_getvalue(mem_write_desc,..
                                ['Start index:';
                                'Size:';
                                'Vector size:';
                                'Init value:';
                                'Mode:';
                                'Trigger input:'],..
                                list('vec',1,'vec',1,'vec',1,'vec',-1,'vec',1,'vec',1),exprs)
            end;

            if ~ok then
                break
            end

            //~4MB = 1 000 000 floats
            max_index = 1000000;

            if  start_idx < 1 | start_idx > max_index then
                ok = %f;
                message("Incorrect memory start index - use index from 1 to "+string(max_index));
            end

            if vec_size > 10000 | vec_size < 1 then
                ok = %f;
                message("Wrong vector size - use 10000 max!");
            end

            size_mod = modulo(data_size, vec_size)
            if size_mod <> 0  then
                ok = %f;
                message("Incorrect size. Size is not multiple of array size!");
            end

            if data_size < 1 | data_size > (max_index-start_idx) then
                ok = %f;
                message("Incorrect size (max "+string(max_index-start_idx)+")");
            end

            if read_mode > 3 | read_mode < 0 then
                ok = %f;
                message("Use 0-3 to setup read mode.");
            end

            if ok then
                init_data_size = size(init_value, '*');
                if  init_data_size > 1 then
                    if  init_data_size <> vec_size  then
                        message('Initial values don''t mach vector data!')
                        ok = %f;
                    end
                    init_value = init_value';
                end
            end

            trigger_input_size = 1;
            if trigger_input <> 1 then
                trigger_input_size = [];
                trigger_input = 0
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, trigger_input_size, vec_size, 1, []);
                graphics.exprs = exprs;
                model.rpar = init_value;
                model.ipar = [(start_idx-1);vec_size;read_mode;data_size;0;init_data_size;trigger_input];
                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break
            end
        end

case 'define' then
        start_idx = 1;
        vec_size = 1;
        init_value = 0;
        data_size = 1;
        read_mode = 1;
        init_data_size = 1;
        trigger_input = 0;
        model=scicos_model()
        model.sim=list('mdaq_mem_read_sim',5)
        model.in =[]
        model.out=vec_size
        model.out2=1
        model.outtyp=1
        model.evtin=1
        model.rpar=[];
        model.ipar=[(start_idx-1);vec_size;read_mode;data_size;0;init_data_size;0]
        model.dstate=[];
        model.blocktype='d'
        model.dep_ut=[%t %f]
        exprs=[sci2exp(start_idx);sci2exp(data_size);sci2exp(vec_size);sci2exp(init_value);sci2exp(read_mode);sci2exp(trigger_input)]
        gr_i=['xstringb(orig(1),orig(2),['''' ; ],sz(1),sz(2),''fill'');']
        x=standard_define([4 3],model,exprs,gr_i)
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
    end
endfunction


Start simulation minor fix

Start simulation minor fix

function continueSimulation=pre_xcos_simulate(scs_m, needcompile)
    global %microdaq;
    %microdaq.private.has_mdaq_block = %F;
    continueSimulation = %T;
    look_for_mdaq_blocks = %T;

    for i = 1:size(scs_m.objs)
        curObj= scs_m.objs(i);
        if (typeof(curObj) == "Block" & curObj.gui == "mdaq_setup")

            if scs_m.objs(i).model.rpar(1) == (-1) then
                scs_m.props.tf= 1.000D+12;
            else
                scs_m.props.tf=scs_m.objs(i).model.rpar(1);
            end

            // if model has microdaq block set real-time scaling to 1
            tmp = scs_m;
            scan_mdaq_blocks(tmp);
            if %microdaq.private.has_mdaq_block then
                scs_m.props.tol(5) = 1;
            end

            if %microdaq.dsp_loaded == %T then
                look_for_mdaq_blocks = %F;
                // if dsp is loaded set real-time scaling to 1
                scs_m.props.tol(5) = 1;

                [mdaq_ip_addr, result] = mdaq_get_ip();
                if result < 0 then
                    disp("Unable to get MicroDAQ IP address - run microdaq_setup!");
                    continueSimulation = %F;
                    %microdaq.dsp_loaded = %F;
                    break;
                end

                result = client_connect(mdaq_ip_addr, 4344);
                if result < 0 then
                    con = mdaq_open();
                    result = mlink_set_obj(con, "ext_mode", 1);
                    mdaq_close(con);
                    if result == -25 then
                        message("ERROR: Unable to connect - your are running model in Standalone mode!");
                    else
                        message("ERROR: Unable to connect to MicroDAQ - reboot device!")
                        %microdaq.dsp_loaded = %F;
                    end
                    continueSimulation = %F;
                    break;
                end
                disp('### Starting model in Ext mode...');
            end
        end
    end

    if look_for_mdaq_blocks then
        tmp = scs_m;
        scan_mdaq_blocks(tmp);
        if %microdaq.private.has_mdaq_block then
            disp("### Running model in simulation mode... ")
            result = mdaq_open();
            if result > -1 then
                %microdaq.private.connection_id = result;
            else
                message("ERROR: Unable to connect to MicroDAQ device!");
                continueSimulation = %F;
                %microdaq.private.connection_id = -1;
            end
        end
        %microdaq.private.mem_write_idx = 0;
        %microdaq.private.mem_read_idx = 0;
        %microdaq.private.mdaq_signal_id = 0;
    end

    scs_m=resume(scs_m)
endfunction

function continueSimulation=pre_xcos_simulate(scs_m, needcompile)
    global %microdaq;
    continueSimulation = %T;
    look_for_mdaq_blocks = %T;

    for i = 1:size(scs_m.objs)
        curObj= scs_m.objs(i);
        if (typeof(curObj) == "Block" & curObj.gui == "mdaq_setup")

            if scs_m.objs(i).model.rpar(1) == (-1) then
                scs_m.props.tf= 1.000D+12;
            else
                scs_m.props.tf=scs_m.objs(i).model.rpar(1);
            end

            // if model has microdaq block set real-time scaling to 1
            tmp = scs_m;
            scan_mdaq_blocks(tmp);
            if %microdaq.private.has_mdaq_block then
                scs_m.props.tol(5) = 1;
            end

            if %microdaq.dsp_loaded == %T then
                look_for_mdaq_blocks = %F;
                // if dsp is loaded set real-time scaling to 1
                scs_m.props.tol(5) = 1;

                [mdaq_ip_addr, result] = mdaq_get_ip();
                if result < 0 then
                    disp("Unable to get MicroDAQ IP address - run microdaq_setup!");
                    continueSimulation = %F;
                    %microdaq.dsp_loaded = %F;
                    break;
                end

                result = client_connect(mdaq_ip_addr, 4344);
                if result < 0 then
                    con = mdaq_open();
                    result = mlink_set_obj(con, "ext_mode", 1);
                    mdaq_close(con);
                    if result == -25 then
                        message("ERROR: Unable to connect - your are running model in Standalone mode!");
                    else
                        message("ERROR: Unable to connect to MicroDAQ - reboot device!")
                        %microdaq.dsp_loaded = %F;
                    end
                    continueSimulation = %F;
                    break;
                end
                disp('### Starting model in Ext mode...');
            end
        end
    end

    if look_for_mdaq_blocks then
        disp("### Running model in simulation mode... ")
        tmp = scs_m;
        scan_mdaq_blocks(tmp);
        if %microdaq.private.has_mdaq_block then
            result = mdaq_open();
            if result > -1 then
                %microdaq.private.connection_id = result;
            else
                message("ERROR: Unable to connect to MicroDAQ device!");
                continueSimulation = %F;
                %microdaq.private.connection_id = -1;
            end
        end
        %microdaq.private.mem_write_idx = 0;
        %microdaq.private.mem_read_idx = 0;
        %microdaq.private.mdaq_signal_id = 0;
    end

    scs_m=resume(scs_m)
endfunction


Fix wrong adc hwid index in mdaq_dac

Fix wrong adc hwid index in mdaq_dac

function [x,y,typ] = mdaq_dac(job,arg1,arg2)
    global %microdaq;
    dac_desc = ["This block writes data to MicroDAQ analog output module (AO).";
    "Block detects MicroDAQ analog output type and allows";
    "setting output range, initial and termination voltage.";
    "The Range value can be a scalar or a vector that must ";
    "be the same length as the channel vector. If scalar value";
    "is specified, that setting is replicated over the channel vector.";
    "Different ranges can be set for each channel if ADC supports ";
    "more then one output range.";
    "The Initial and Termination property can be a scalar or a vector";
    "";
    "Use Init/Term parameter allows to enable or disable setting";
    "initial or/and termination voltage values. User can provide";
    "scalar or vector with following values:";
    "0 - Initial and termination voltage value is ignored";
    "1 - Initial voltage value is used";
    "2 - Termination voltage value is used";
    "3 - Initial and termination voltage value is used";
    "";
    "Use mdaq_hwinfo to get DAC parameters"
    "";
    "input - value in volts"
    "";
    "Set block parameters:"];

    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try
                getversion('scilab');
                [ok,channels,dac_range,init_value,term_value,use_init_term,exprs]=..
                    scicos_getvalue(dac_desc,..
                                    ['Channels:';
                                    'Range:';
                                    'Initial value:';
                                    'Termination value:';
                                    'Use Init/Term:'],..
                                    list('vec',-1,'mat',[-1,-1],'vec',-1,'vec',-1,'vec',-1),exprs)
            catch
                [ok,channels,dac_range,init_value,term_value,use_init_term,exprs]=..
                    scicos_getvalue(dac_desc,..
                                    ['Channels:';
                                    'Range:';
                                    'Initial value:';
                                    'Termination value:';
                                    'Use Init/Term:'],..
                                    list('vec',-1,'mat',[-1,-1],'vec',-1,'vec',-1,'vec',-1),exprs)
            end;

            if ~ok then
                break
            end

            if %microdaq.private.mdaq_hwid <> [] then
                dac_id = %microdaq.private.mdaq_hwid(3);
                if find(dac_id == get_dac_list()) == [] then
                    ok = %f;
                    message("Configuration not detected - run mdaq_hwinfo and try again!");
                end

                n_channels = size(channels, 'c');
                if ok & size(channels, 'r') > 1 then
                    message("Single row channel vector expected!")
                    ok = %f;
                end

                // check Range parameter
                if ok & size(dac_range, 'c') <> 2 then
                    message("Vector range [low,high;low,high;...] expected!")
                    ok = %f;
                end

                dac_range_size = size(dac_range, 'r');
                if ok & (dac_range_size > 1) & (dac_range_size <> n_channels) then
                    ok = %f;
                    error_msg = 'Wrong range vector - size should match channel vector!';
                    message(error_msg);
                end

                // check Init value parameter
                if ok & (size(init_value, 'r') > 1) then
                    ok = %f;
                    error_msg = 'Wrong Init value vector - single row vector expected!';
                    message(error_msg);
                end

                init_value_size = size(init_value, 'c');
                if ok & (init_value_size > 1) & (init_value_size <> n_channels) then
                    ok = %f;
                    error_msg = 'Wrong init value vector - scalar or vector for selected channels expected!';
                    message(error_msg);
                end

                // check Termination value parameter
                if ok & (size(term_value, 'r') > 1) then
                    ok = %f;
                    error_msg = 'Wrong termination value vector - single row vector expected!';
                    message(error_msg);
                end

                term_value_size = size(term_value, 'c');
                if ok & (term_value_size > 1) & (term_value_size <> n_channels) then
                    ok = %f;
                    error_msg = 'Wrong termination value vector - scalar or vector for selected channels expected!';
                    message(error_msg);
                end

                // check init term enable
                if ok & (find(use_init_term > 3) <> []) | (find(use_init_term < 0) <> []) then
                    ok = %f;
                    error_msg = 'Wrong Use init/term paremeter value!';
                    message(error_msg);
                end

                if ok & (size(use_init_term, 'r') > 1) then
                    ok = %f;
                    error_msg = 'Wrong Use init/term paremeter vector - single row vector expected!';
                    message(error_msg);
                end

                use_init_term_size = size(use_init_term, 'c');
                if ok & (use_init_term_size > 1) & (use_init_term_size <> n_channels) then
                    ok = %f;
                    error_msg = 'Wrong Use init/term paremeter vector - scalar or vector for selected channels expected!';
                    message(error_msg);
                end

                if dac_range_size == 1 & ok then
                    range_tmp = dac_range;
                    dac_range = ones(n_channels,2);
                    dac_range(:,1) = range_tmp(1);
                    dac_range(:,2) = range_tmp(2);
                end

                if ok & ~exists("%scicos_prob") then
                    result = dac_check_params(channels, dac_range);
                    if result < 0 then
                        message(mdaq_error2(result));
                        ok = %f;
                    end
                end
            else
                ok = %f;
                error_msg = 'Unable to detect MicroDAQ analog outputs - run mdaq_hwinfo and try again!';
                message(error_msg);
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, n_channels, [], 1, []);
                graphics.exprs = exprs;

                // init value
                if init_value_size == 1 then
                    init_value = ones(n_channels, 1) * init_value;
                else
                    init_value = init_value';
                end

                // termination value
                if term_value_size == 1 then
                    term_value = ones(n_channels, 1) * term_value;
                else
                    term_value = term_value';
                end

                // init term enable value
                if use_init_term_size == 1 then
                    use_init_term = ones(n_channels, 1) * use_init_term;
                else
                    use_init_term = use_init_term';
                end

                // set IPAR and RPAR
                model.ipar = [n_channels; channels'; use_init_term];
                model.rpar = [init_value; term_value; matrix(dac_range', 1, n_channels*2)'];

                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break
            end
        end
    case 'define' then
        channels=1
        dac_range = [0,5];
        init_value = 0;
        term_value = 0;
        use_init_term = 2;
        n_channels = 1;
        model=scicos_model();
        model.sim=list('mdaq_dac_sim',5);
        model.in =1;
        model.in2=1;
        model.intyp=1;
        model.out=[];
        model.evtin=1;
        model.ipar = [n_channels; channels'; use_init_term];
        model.rpar = [init_value; term_value; dac_range'];
        model.dstate=[];
        model.blocktype='d';
        model.dep_ut=[%t %f];
        exprs=[sci2exp(channels);sci2exp(dac_range);sci2exp(init_value);sci2exp(term_value);sci2exp(use_init_term)];
        gr_i=['xstringb(orig(1),orig(2),[''CH:'' ; string(channels)],sz(1),sz(2),''fill'');'];
        x=standard_define([4 3],model,exprs,gr_i);
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
        x.graphics.style=["blockWithLabel;verticalLabelPosition=center;displayedLabel=CH:%1$s;fontColor=#5f5f5f"]
    end
endfunction

function [x,y,typ] = mdaq_dac(job,arg1,arg2)
    global %microdaq;
    dac_desc = ["This block writes data to MicroDAQ analog output module (AO).";
    "Block detects MicroDAQ analog output type and allows";
    "setting output range, initial and termination voltage.";
    "The Range value can be a scalar or a vector that must ";
    "be the same length as the channel vector. If scalar value";
    "is specified, that setting is replicated over the channel vector.";
    "Different ranges can be set for each channel if ADC supports ";
    "more then one output range.";
    "The Initial and Termination property can be a scalar or a vector";
    "";
    "Use Init/Term parameter allows to enable or disable setting";
    "initial or/and termination voltage values. User can provide";
    "scalar or vector with following values:";
    "0 - Initial and termination voltage value is ignored";
    "1 - Initial voltage value is used";
    "2 - Termination voltage value is used";
    "3 - Initial and termination voltage value is used";
    "";
    "Use mdaq_hwinfo to get DAC parameters"
    "";
    "input - value in volts"
    "";
    "Set block parameters:"];

    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try
                getversion('scilab');
                [ok,channels,dac_range,init_value,term_value,use_init_term,exprs]=..
                    scicos_getvalue(dac_desc,..
                                    ['Channels:';
                                    'Range:';
                                    'Initial value:';
                                    'Termination value:';
                                    'Use Init/Term:'],..
                                    list('vec',-1,'mat',[-1,-1],'vec',-1,'vec',-1,'vec',-1),exprs)
            catch
                [ok,channels,dac_range,init_value,term_value,use_init_term,exprs]=..
                    scicos_getvalue(dac_desc,..
                                    ['Channels:';
                                    'Range:';
                                    'Initial value:';
                                    'Termination value:';
                                    'Use Init/Term:'],..
                                    list('vec',-1,'mat',[-1,-1],'vec',-1,'vec',-1,'vec',-1),exprs)
            end;

            if ~ok then
                break
            end

            if %microdaq.private.mdaq_hwid <> [] then
                dac_id = %microdaq.private.mdaq_hwid(2);
                if find(dac_id == get_dac_list()) == [] then
                    ok = %f;
                    message("Configuration not detected - run mdaq_hwinfo and try again!");
                end

                n_channels = size(channels, 'c');
                if ok & size(channels, 'r') > 1 then
                    message("Single row channel vector expected!")
                    ok = %f;
                end

                // check Range parameter
                if ok & size(dac_range, 'c') <> 2 then
                    message("Vector range [low,high;low,high;...] expected!")
                    ok = %f;
                end

                dac_range_size = size(dac_range, 'r');
                if ok & (dac_range_size > 1) & (dac_range_size <> n_channels) then
                    ok = %f;
                    error_msg = 'Wrong range vector - size should match channel vector!';
                    message(error_msg);
                end

                // check Init value parameter
                if ok & (size(init_value, 'r') > 1) then
                    ok = %f;
                    error_msg = 'Wrong Init value vector - single row vector expected!';
                    message(error_msg);
                end

                init_value_size = size(init_value, 'c');
                if ok & (init_value_size > 1) & (init_value_size <> n_channels) then
                    ok = %f;
                    error_msg = 'Wrong init value vector - scalar or vector for selected channels expected!';
                    message(error_msg);
                end

                // check Termination value parameter
                if ok & (size(term_value, 'r') > 1) then
                    ok = %f;
                    error_msg = 'Wrong termination value vector - single row vector expected!';
                    message(error_msg);
                end

                term_value_size = size(term_value, 'c');
                if ok & (term_value_size > 1) & (term_value_size <> n_channels) then
                    ok = %f;
                    error_msg = 'Wrong termination value vector - scalar or vector for selected channels expected!';
                    message(error_msg);
                end

                // check init term enable
                if ok & (find(use_init_term > 3) <> []) | (find(use_init_term < 0) <> []) then
                    ok = %f;
                    error_msg = 'Wrong Use init/term paremeter value!';
                    message(error_msg);
                end

                if ok & (size(use_init_term, 'r') > 1) then
                    ok = %f;
                    error_msg = 'Wrong Use init/term paremeter vector - single row vector expected!';
                    message(error_msg);
                end

                use_init_term_size = size(use_init_term, 'c');
                if ok & (use_init_term_size > 1) & (use_init_term_size <> n_channels) then
                    ok = %f;
                    error_msg = 'Wrong Use init/term paremeter vector - scalar or vector for selected channels expected!';
                    message(error_msg);
                end

                if dac_range_size == 1 & ok then
                    range_tmp = dac_range;
                    dac_range = ones(n_channels,2);
                    dac_range(:,1) = range_tmp(1);
                    dac_range(:,2) = range_tmp(2);
                end

                if ok & ~exists("%scicos_prob") then
                    result = dac_check_params(channels, dac_range);
                    if result < 0 then
                        message(mdaq_error2(result));
                        ok = %f;
                    end
                end
            else
                ok = %f;
                error_msg = 'Unable to detect MicroDAQ analog outputs - run mdaq_hwinfo and try again!';
                message(error_msg);
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, n_channels, [], 1, []);
                graphics.exprs = exprs;

                // init value
                if init_value_size == 1 then
                    init_value = ones(n_channels, 1) * init_value;
                else
                    init_value = init_value';
                end

                // termination value
                if term_value_size == 1 then
                    term_value = ones(n_channels, 1) * term_value;
                else
                    term_value = term_value';
                end

                // init term enable value
                if use_init_term_size == 1 then
                    use_init_term = ones(n_channels, 1) * use_init_term;
                else
                    use_init_term = use_init_term';
                end

                // set IPAR and RPAR
                model.ipar = [n_channels; channels'; use_init_term];
                model.rpar = [init_value; term_value; matrix(dac_range', 1, n_channels*2)'];

                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break
            end
        end
    case 'define' then
        channels=1
        dac_range = [0,5];
        init_value = 0;
        term_value = 0;
        use_init_term = 2;
        n_channels = 1;
        model=scicos_model();
        model.sim=list('mdaq_dac_sim',5);
        model.in =1;
        model.in2=1;
        model.intyp=1;
        model.out=[];
        model.evtin=1;
        model.ipar = [n_channels; channels'; use_init_term];
        model.rpar = [init_value; term_value; dac_range'];
        model.dstate=[];
        model.blocktype='d';
        model.dep_ut=[%t %f];
        exprs=[sci2exp(channels);sci2exp(dac_range);sci2exp(init_value);sci2exp(term_value);sci2exp(use_init_term)];
        gr_i=['xstringb(orig(1),orig(2),[''CH:'' ; string(channels)],sz(1),sz(2),''fill'');'];
        x=standard_define([4 3],model,exprs,gr_i);
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
        x.graphics.style=["blockWithLabel;verticalLabelPosition=center;displayedLabel=CH:%1$s;fontColor=#5f5f5f"]
    end
endfunction


fix for SCHEDULING-1331

fix for SCHEDULING-1331

git-svn-id: 27916816d6cfa57849e9a885196bf7392b80e1ac@20413 28e8926c-6b08-0410-baaa-805c5e19b8d6

function val=PAResult_PAwaitFor(R,timeout)
    global ('PAResult_DB');
    //disp('PAResult_PAwaitFor : init')
    jimport org.objectweb.proactive.api.PAFuture;
    errormessage=[];
    ff = R.future;
    if argn(2) == 2

        RaL = PAFuture.getFutureValue(ff,timeout);
    else
        RaL = PAFuture.getFutureValue(ff);
    end
    if jinvoke(RaL,'isOK')
        //disp('PAResult_PAwaitFor : isOK')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            jinvoke(R.logs,'append',logs);
            jinvoke(R.logsPrinted,'set',%t);
            if ~isempty(logs) then
                printf('%s',logs);
            end
        end

        if jinvoke(R.resultSet,'get')
            //disp('PAResult_PAwaitFor : Result get')
            val=PAResult_DB(R.rid);
            //disp(val)
        else
            //disp('PAResult_PAwaitFor : Result set')
            load(R.outFile);
            val = out;
            PAResult_DB(R.rid) = out;
            //disp(val)
            jinvoke(R.resultSet,'set',%t);
        end

    elseif jinvoke(RaL,'isMatSciError');
        //disp('PAResult_PAwaitFor : isMatSciError')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            jinvoke(R.logs,'append',logs);
            jinvoke(R.logsPrinted,'set',%t);
            if ~isempty(logs) then
                printf('%s',logs);
            end
            //System.err.println(logs);
        end
        jinvoke(R.iserror,'set',%t);
        errormessage = 'PAResult:PAwaitFor Error during remote script execution';
    else
        //disp('PAResult_PAwaitFor : internalError')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            if ~isempty(logs) then
                jinvoke(R.logs,'append',logs);
                jinvoke(R.logsPrinted,'set',%t);
                printf('%s',logs);
            end

        end
        e = jinvoke(RaL,'getException');
        jimport org.ow2.proactive.scheduler.ext.scilab.client.ScilabSolver;
        exstr = ScilabSolver.getStackTrace(e);
        printf('%s',exstr);
        //err = java.lang.System.err;
        //jinvoke(e.printStackTrace(err);
        jinvoke(R.iserror,'set',%t);
        errormessage = 'PAResult:PAwaitFor Internal Error';
    end
    PAResult_clean(R);
    if errormessage ~= [] then
        val = [];
        error(errormessage)
    end
endfunction

function val=PAResult_PAwaitFor(R,timeout)
    global ('PAResult_DB');
    //disp('PAResult_PAwaitFor : init')
    jimport org.objectweb.proactive.api.PAFuture;
    errormessage=[];
    ff = R.future;
    if argn(2) == 2

        RaL = PAFuture.getFutureValue(ff,timeout);
    else
        RaL = PAFuture.getFutureValue(ff);
    end
    if jinvoke(RaL,'isOK')
        //disp('PAResult_PAwaitFor : isOK')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            jinvoke(R.logs,'append',logs);
            jinvoke(R.logsPrinted,'set',%t);
            if ~isempty(logs) then
                printf('%s',logs);
            end
        end

        if jinvoke(R.resultSet,'get')
            //disp('PAResult_PAwaitFor : Result get')
            val=PAResult_DB(R.rid);
            //disp(val)
        else
            //disp('PAResult_PAwaitFor : Result set')
            load(R.outFile);
            val = out;
            PAResult_DB(R.rid) = out;
            //disp(val)
            jinvoke(R.resultSet,'set',%t);
        end

    elseif jinvoke(RaL,'isMatSciError');
        //disp('PAResult_PAwaitFor : isMatSciError')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            jinvoke(R.logs,'append',logs);
            jinvoke(R.logsPrinted,'set',%t);
            if ~isempty(logs) then
                printf('%s',logs);
            end
            //System.err.println(logs);
        end
        jinvoke(R.iserror,'set',%t);
        errormessage = 'PAResult:PAwaitFor Error during remote script execution';
    else
        //disp('PAResult_PAwaitFor : internalError')
        if ~jinvoke(R.logsPrinted,'get')
            logs = jinvoke(RaL,'getLogs');
            if ~isempty(logs) then
                jinvoke(R.logs,'append',logs);
                jinvoke(R.logsPrinted,'set',%t);
                printf('%s',logs);
            end

        end
        e = jinvoke(RaL,'getException');
        jimport org.ow2.proactive.scheduler.ext.scilab.client.ScilabSolver;
        exstr = ScilabSolver.getStackTrace(ex);
        printf('%s',exstr);
        //err = java.lang.System.err;
        //jinvoke(e.printStackTrace(err);
        jinvoke(R.iserror,'set',%t);
        errormessage = 'PAResult:PAwaitFor Internal Error';
    end
    PAResult_clean(R);
    if errormessage ~= [] then
        val = [];
        error(errormessage)
    end
endfunction


Fix mdaq_signal_sim macro

Fix mdaq_signal_sim macro

cdfunction block=mdaq_signal_sim(block,flag)
    select flag
    case -5 // Error
    case 0 // Derivative State Update

    case 1 // Output Update
        global %microdaq;
        if %microdaq.dsp_loaded == %T then
                if %microdaq.private.signal_buffer_index(block.ipar(1)) < 1 then
                    try
                    %microdaq.private.signal_buffer(block.ipar(1)) = mdaqDSPTaskRead(block.ipar(1), block.insz(1), %microdaq.private.signal_buffer_size(block.ipar(1)), 5000);

                    %microdaq.private.signal_buffer_index(block.ipar(1)) = %microdaq.private.signal_buffer_size(block.ipar(1));
                    catch
                        warning("Unable to receive DSP data from MicroDAQ device");
                        return;
                    end

                end
                block.outptr(1) = %microdaq.private.signal_buffer(block.ipar(1))(%microdaq.private.signal_buffer_size(block.ipar(1)) + 1 - %microdaq.private.signal_buffer_index(block.ipar(1)),:);
                %microdaq.private.signal_buffer_index(block.ipar(1)) = %microdaq.private.signal_buffer_index(block.ipar(1)) - 1;
        else
            // Simply copy input to output
            block.outptr(1) = block.inptr(1);
        end
    case 2 // State Update
    case 3 // OutputEventTiming
    case 4 // Initialization
        global %microdaq;
        update_rate = 25;

        if %microdaq.private.model_tsamp < 1/update_rate*2 then
            %microdaq.private.signal_buffer_size(block.ipar(1)) = (1/update_rate)/%microdaq.private.model_tsamp ;
        else
            %microdaq.private.signal_buffer_size(block.ipar(1)) = 1;
        end

        %microdaq.private.signal_buffer(block.ipar(1)) = zeros(%microdaq.private.signal_buffer_size(block.ipar(1)), block.insz(1));
        %microdaq.private.signal_buffer_index(block.ipar(1)) = 0;
    case 5 // Ending
    case 6 // Re-Initialisation
    case 9 // ZeroCrossing
    else // Unknown flag
    end
endfunction


INTEGRATION: CWS os30 (1.3.106); FILE MERGED 2004/06/09 10:29:17 sw 1.3.106.1: #i26146#

-o sw.SwAccessibleDocumentPageView
-o sw.SwAccessibleDocumentView
-o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
-o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
-o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
-o sw.SwAccessibleTableView
-o sw.SwAccessibleTextEmbeddedObject
-o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
-o sw.SwXAutoTextEntry
-o sw.SwXAutoTextGroup
-o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
-o sw.SwXDocumentIndex
-o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
-o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
-o sw.SwXFootnote
-o sw.SwXFootnoteProperties
-o sw.SwXFootnoteText
-o sw.SwXFootnotes
-o sw.SwXFrames
-o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
-o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
-o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
-o sw.SwXShape
-o sw.SwXStyle
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
-o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
-o sw.SwXTextDefaults
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrameText
-o sw.SwXTextGraphicObjects
-o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
-o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
-o sw.XMLContentImporter
-o sw.XMLExporter
-o sw.XMLImporter
-o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
-o sw.XMLStylesImporter
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextFrame
-o sw.SwXTextGraphicObject
-o sw.SwXTextDocument
-o sw.ParagraphStyle
-o sw.PageStyle
-o sw.ConditionalParagraphStyle
-o sw.CharacterStyle

-o sw.SwAccessibleDocumentPageView
-o sw.SwAccessibleDocumentView
-o sw.SwAccessibleEndnoteView
-o sw.SwAccessibleFooterView
-o sw.SwAccessibleFootnoteView
-o sw.SwAccessibleHeaderView
-o sw.SwAccessiblePageView
-o sw.SwAccessibleParagraphView
-o sw.SwAccessibleTableCellView
-o sw.SwAccessibleTableView
-o sw.SwAccessibleTextEmbeddedObject
-o sw.SwAccessibleTextFrameView
-o sw.SwAccessibleTextGraphicObject
-o sw.SwXAutoTextContainer
#i26146#-o sw.SwXAutoTextEntry
#i26146#-o sw.SwXAutoTextGroup
-o sw.SwXBodyText
-o sw.SwXBookmark
-o sw.SwXBookmarks
-o sw.SwXCell
-o sw.SwXCellRange
-o sw.SwXChapterNumbering
-o sw.SwXDocumentIndex
-o sw.SwXDocumentIndexMark
-o sw.SwXDocumentIndexes
-o sw.SwXDrawPage
-o sw.SwXEndnoteProperties
-o sw.SwXFieldEnumeration
-o sw.SwXFieldMaster
-o sw.SwXFootnote
-o sw.SwXFootnoteProperties
-o sw.SwXFootnoteText
-o sw.SwXFootnotes
-o sw.SwXFrames
-o sw.SwXHeadFootText
-o sw.SwXLineNumberingProperties
-o sw.SwXMailMerge
-o sw.SwXModule
-o sw.SwXNumberingRules
-o sw.SwXParagraph
-o sw.SwXParagraphEnumeration
-o sw.SwXPrintSettings
-o sw.SwXPropertySet
-o sw.SwXPropertySetInfo
-o sw.SwXReferenceMark
-o sw.SwXReferenceMarks
-o sw.SwXShape
-o sw.SwXStyle
-o sw.SwXStyleFamilies
-o sw.SwXStyleFamily
-o sw.SwXTableCellText
-o sw.SwXTableColumns
-o sw.SwXTableRows
-o sw.SwXTextColumns
-o sw.SwXTextCursor
-o sw.SwXTextDefaults
-o sw.SwXTextField
-o sw.SwXTextFieldMasters
-o sw.SwXTextFieldTypes
-o sw.SwXTextFrameText
-o sw.SwXTextGraphicObjects
-o sw.SwXTextPortion
-o sw.SwXTextPortionEnumeration
-o sw.SwXTextRange
-o sw.SwXTextRanges
-o sw.SwXTextSearch
-o sw.SwXTextSection
-o sw.SwXTextSections
-o sw.SwXTextTable
-o sw.SwXTextTableCursor
-o sw.SwXTextTableRow
-o sw.SwXTextTables
-o sw.SwXTextView
-o sw.SwXTextViewCursor
-o sw.SwXViewSettings
-o sw.XMLContentExporter
-o sw.XMLContentImporter
-o sw.XMLExporter
-o sw.XMLImporter
-o sw.XMLMetaExporter
-o sw.XMLMetaImporter
-o sw.XMLSettingsExporter
-o sw.XMLSettingsImporter
-o sw.XMLStylesExporter
-o sw.XMLStylesImporter
-o sw.SwXTextEmbeddedObject
-o sw.SwXTextEmbeddedObjects
-o sw.SwXTextFrame
-o sw.SwXTextGraphicObject
-o sw.SwXTextDocument
-o sw.ParagraphStyle
-o sw.PageStyle
-o sw.ConditionalParagraphStyle
-o sw.CharacterStyle


Remove calculation from herz to period

Remove calculation from herz to period

function mdaqDSPTaskInit( arg1, arg2, arg3, arg4 )
     // Check version compatibility
    [is_supp vers] = mdaq_is_working('mdaqDSPTaskInit');
    if is_supp == %F then
        error('ERROR: ' + vers)
        return;
    end

    global %microdaq;
    result = -1;

    if argn(2) == 3 then
        dsp_firmware = pathconvert(arg1, %F);
        rate = arg2;
        duration = arg3;
    end

    if argn(2) == 4 then
        link_id = arg1;
        dsp_firmware = pathconvert(arg2, %F);
        rate = arg3;
        duration = arg4;
        if link_id < 0 then
            disp("ERROR: Invalid link ID!")
            return;
        end
    end

    if argn(2) > 4 | argn(2) < 3 then
        mprintf("Description:\n");
        mprintf("\tInitializes DSP task\n");
        mprintf("Usage:\n");
        mprintf("\tmdaqDSPTaskInit(linkId, path, rate, duration);\n")
        mprintf("\tlinkId - connection id returned by mdaqOpen() (OPTIONAL)\n");
        mprintf("\tpath - XCos generated DSP application path\n");
        mprintf("\trate - DSP application step per second rate (-1 - keep Xcos settings)\n");
        mprintf("\tduration - task duration in seconds (-1 - infinity)\n");
        return;
    end

    if rate < 0 then
        rate = -1;
    end

    if argn(2) == 3 then
        link_id = mdaqOpen();
        if link_id < 0  then
            error(mdaq_error2(link_id), 10000 + abs(link_id));
        end
    end

    result = call("sci_mlink_dsp_init",..
            link_id, 1, "i",..
            dsp_firmware, 2, "c",..
            rate, 3, "d",...
            duration, 4, "d",...
        "out",..
            [1,1], 5, "i");

    if argn(2) == 3 then
        mdaqClose(link_id);
    end

    if result < 0  then
        error(mdaq_error2(result), 10000 + abs(result));
    end
endfunction

function mdaqDSPTaskInit( arg1, arg2, arg3, arg4 )
     // Check version compatibility
    [is_supp vers] = mdaq_is_working('mdaqDSPTaskInit');
    if is_supp == %F then
        error('ERROR: ' + vers)
        return;
    end

    global %microdaq;
    result = -1;

    if argn(2) == 3 then
        dsp_firmware = pathconvert(arg1, %F);
        rate = arg2;
        duration = arg3;
    end

    if argn(2) == 4 then
        link_id = arg1;
        dsp_firmware = pathconvert(arg2, %F);
        rate = arg3;
        duration = arg4;
        if link_id < 0 then
            disp("ERROR: Invalid link ID!")
            return;
        end
    end

    if argn(2) > 4 | argn(2) < 3 then
        mprintf("Description:\n");
        mprintf("\tInitializes DSP task\n");
        mprintf("Usage:\n");
        mprintf("\tmdaqDSPTaskInit(linkId, path, rate, duration);\n")
        mprintf("\tlinkId - connection id returned by mdaqOpen() (OPTIONAL)\n");
        mprintf("\tpath - XCos generated DSP application path\n");
        mprintf("\trate - DSP application step per second rate (-1 - keep Xcos settings)\n");
        mprintf("\tduration - task duration in seconds (-1 - infinity)\n");
        return;
    end

    if rate < 0 then
        rate = -1;
    elseif rate >= 0 & rate < 0.1 then
        error("Wrong rate parameter")
    else
        rate = 1/rate;
    end

    if argn(2) == 3 then
        link_id = mdaqOpen();
        if link_id < 0  then
            error(mdaq_error2(link_id), 10000 + abs(link_id));
        end
    end

    result = call("sci_mlink_dsp_init",..
            link_id, 1, "i",..
            dsp_firmware, 2, "c",..
            rate, 3, "d",...
            duration, 4, "d",...
        "out",..
            [1,1], 5, "i");

    if argn(2) == 3 then
        mdaqClose(link_id);
    end

    if result < 0  then
        error(mdaq_error2(result), 10000 + abs(result));
    end
endfunction


Support for PARAM block

Support for PARAM block

function []=post_xcos_simulate(%cpr, scs_m, needcompile)
    global %microdaq;

    for i = 1:size(scs_m.objs)
        curObj= scs_m.objs(i);
        if (typeof(curObj) == "Block" & curObj.gui == "mdaq_setup")
            if  %microdaq.dsp_loaded == %T then
                client_disconnect(1);
                %microdaq.dsp_loaded = %F;

                connection_id = mdaq_open();
                if connection_id < 0 then
                    return;
                end

                if connection_id > -1 then
                    mlink_set_obj(connection_id, 'model_stop_flag', 1 );
                    mlink_set_obj(connection_id, 'terminate_signal_task', 1 );

                    // save dsp profiling data
                    if curObj.model.ipar(3) == 1 then
                        //get number of records
                        [nr_records, result] = mlink_profile_data_get(connection_id, 1);
                        if nr_records > 0 & nr_records < 250000 & result > -1 then
                            [profile_data, result] = mlink_profile_data_get(connection_id, nr_records + 1);
                            if result > -1 then
                                if %microdaq.private.mdaq_hwid(4) == 0 then
                                    cpu_clock = 300000000;
                                else
                                    cpu_clock = 456000000;
                                end
                                profile_data = profile_data / (cpu_clock / 1000000);
                                dsp_exec_profile = tlist(["listtype","init","step","end"], [], []);
                                dsp_exec_profile.init = profile_data(3);
                                dsp_exec_profile.step = profile_data(4:nr_records);
                            dsp_exec_profile.end = profile_data(2);
                            save(TMPDIR + filesep() + "profiling_data", "dsp_exec_profile");
                            clear dsp_exec_profile;
                        end
                    end

                    // make scope nicer
                    list_fig=winsid();
                    for i=1:length(list_fig)
                        h=get_figure_handle(list_fig(i));
                        if h.children.type == "Axes" then
                            axes = h.children;
                            axes.grid = [1,1];
                            axes.grid_style = [9,10];
                            poliline = axes.children;
                            if isempty(poliline.children) then
                                poliline.polyline_style = 2;
                            end
                        end
                    end
                end
                mdaq_close(connection_id);
            end
        end
    end
end

if %microdaq.private.connection_id > -1 & %microdaq.private.has_mdaq_param_sim then
    mdaq_close(%microdaq.private.connection_id);
    %microdaq.private.connection_id = -1;
    %microdaq.private.has_mdaq_param_sim = %F;
end

if %microdaq.private.connection_id > -1 & %microdaq.private.has_mdaq_block then
    mdaq_close(%microdaq.private.connection_id);
    %microdaq.private.connection_id = -1;
    %microdaq.private.has_mdaq_block = %f
end

endfunction

function []=post_xcos_simulate(%cpr, scs_m, needcompile)
    global %microdaq;

    for i = 1:size(scs_m.objs)
        curObj= scs_m.objs(i);
        if (typeof(curObj) == "Block" & curObj.gui == "mdaq_setup")
            if  %microdaq.dsp_loaded == %T then

                // make scope nicer
                list_fig=winsid();
                for i=1:length(list_fig)
                    h=get_figure_handle(list_fig(i));
                    if h.children.type == "Axes" then
                        axes = h.children;
                        axes.grid = [1,1];
                        axes.grid_style = [9,10];
                        poliline = axes.children;
                        if isempty(poliline.children) then
                            poliline.polyline_style = 2;
                        end
                    end
                end

                client_disconnect(1);
                %microdaq.dsp_loaded = %F;

                connection_id = mdaq_open();
                if connection_id < 0 then
                    return;
                end

                if connection_id > -1 then
                    mlink_set_obj(connection_id, 'model_stop_flag', 1 );
                    mlink_set_obj(connection_id, 'terminate_signal_task', 1 );

                    // save dsp profiling data
                    if curObj.model.ipar(3) == 1 then
                        //get number of records
                        [nr_records, result] = mlink_profile_data_get(connection_id, 1);
                        if nr_records > 0 & nr_records < 250000 & result > -1 then
                            [profile_data, result] = mlink_profile_data_get(connection_id, nr_records + 1);
                            if result > -1 then
                                if %microdaq.private.mdaq_hwid(4) == 0 then
                                    cpu_clock = 300000000;
                                else
                                    cpu_clock = 456000000;
                                end
                                profile_data = profile_data / (cpu_clock / 1000000);
                                dsp_exec_profile = tlist(["listtype","init","step","end"], [], []);
                                dsp_exec_profile.init = profile_data(3);
                                dsp_exec_profile.step = profile_data(4:nr_records);
                            dsp_exec_profile.end = profile_data(2);
                            save(TMPDIR + filesep() + "profiling_data", "dsp_exec_profile");
                            clear dsp_exec_profile;
                        end
                    end
                end
                mdaq_close(connection_id);
            end
        end
    end
end

if %microdaq.private.connection_id > -1 & %microdaq.private.has_mdaq_block then
    mdaq_close(%microdaq.private.connection_id);
    %microdaq.private.connection_id = -1;
    %microdaq.private.has_mdaq_block = %f
end

endfunction


INTEGRATION: CWS unoapi3 (1.5.96); FILE MERGED 2008/01/14 19:44:58 cn 1.5.96.1: #i84995 # update lists

-o svtools.AccessibleIconChoiceCtrlEntry
-o svtools.AccessibleTabBarPage
-o svtools.AccessibleBrowseBox
-o svtools.AccessibleBrowseBoxHeaderBar
-o svtools.AccessibleBrowseBoxHeaderCell
-o svtools.AccessibleBrowseBoxTable
#i85245 -o svtools.AccessibleBrowseBoxTableCell
-o svtools.AccessibleIconChoiceCtrl
-o svtools.AccessibleTabBar
#i85246 -o svtools.AccessibleTabBarPageList
-o svtools.AccessibleTreeListBox
-o svtools.AccessibleTreeListBoxEntry

-o svtools.AccessibleIconChoiceCtrlEntry
#-o svtools.AccessibleTabBarPage
-o svtools.AccessibleBrowseBox
-o svtools.AccessibleBrowseBoxHeaderBar
-o svtools.AccessibleBrowseBoxHeaderCell
-o svtools.AccessibleBrowseBoxTable
#-o svtools.AccessibleBrowseBoxTableCell
-o svtools.AccessibleIconChoiceCtrl
-o svtools.AccessibleTabBar
#-o svtools.AccessibleTabBarPageList
-o svtools.AccessibleTreeListBox
-o svtools.AccessibleTreeListBoxEntry


chart47: #i111102# enable chart tests again

-o xmloff.Chart.XMLContentExporter
-o xmloff.Chart.XMLContentImporter
-o xmloff.Chart.XMLExporter
-o xmloff.Chart.XMLImporter
-o xmloff.Chart.XMLStylesExporter
-o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
#i111200 -o xmloff.Draw.XMLMetaImporter
#i111287 -o xmloff.Draw.XMLSettingsExporter
#i111287 -o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
#i111224 -o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
#i111111# -o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
#i111287 -o xmloff.Impress.XMLSettingsExporter
#i111287 -o xmloff.Impress.XMLSettingsImporter
#i87695 -o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter

#111102# -o xmloff.Chart.XMLContentExporter
#111102# -o xmloff.Chart.XMLContentImporter
#111102# -o xmloff.Chart.XMLExporter
#111102# -o xmloff.Chart.XMLImporter
#111102# -o xmloff.Chart.XMLStylesExporter
#111102# -o xmloff.Chart.XMLStylesImporter
-o xmloff.Draw.XMLContentExporter
-o xmloff.Draw.XMLContentImporter
-o xmloff.Draw.XMLExporter
-o xmloff.Draw.XMLImporter
-o xmloff.Draw.XMLMetaExporter
#i111200 -o xmloff.Draw.XMLMetaImporter
#i111287 -o xmloff.Draw.XMLSettingsExporter
#i111287 -o xmloff.Draw.XMLSettingsImporter
#i87695 -o xmloff.Draw.XMLStylesExporter
-o xmloff.Draw.XMLStylesImporter
#i111224 -o xmloff.Impress.XMLContentExporter
-o xmloff.Impress.XMLContentImporter
-o xmloff.Impress.XMLExporter
#i111111# -o xmloff.Impress.XMLImporter
-o xmloff.Impress.XMLMetaExporter
-o xmloff.Impress.XMLMetaImporter
#i111287 -o xmloff.Impress.XMLSettingsExporter
#i111287 -o xmloff.Impress.XMLSettingsImporter
#i87695 -o xmloff.Impress.XMLStylesExporter
-o xmloff.Impress.XMLStylesImporter


Fix AiScan call without parameters

Fix AiScan call without parameters

function [data, result] = mdaqAIScan(arg1, arg2, arg3)
    link_id = -1;
    data = [];
    result = [];

    ch_count = call("sci_mlink_ai_scan_get_ch_count", "out", [1, 1], 1, "i");
    if ch_count < 1 | ch_count > 16 then
        error("AI scan not initialized");
    end

    if argn(2) == 2 then;
        scan_count = arg1;
        timeout = arg2;
    end

    if argn(2) == 3 then
        link_id = arg1;
        scan_count = arg2;
        timeout = arg3;

        if link_id < 0 then
            disp("ERROR: Invalid link ID!")
            return;
        end
    end

    if argn(2) > 3 | argn(2) < 2 then
        mprintf("Description:\n");
        mprintf("\tStarts scanning operation and reads acquired data\n");
        mprintf("Usage:\n");
        mprintf("\t[data, result] = mdaqAIScan(linkID, scanCount, timeout)\n")
        mprintf("\tlinkID - connection id returned by mdaqOpen() (OPTIONAL)\n");
        mprintf("\tscanCount - number of scans to read, when 0 - start acquisition only\n");
        mprintf("\ttimeout - amount of time in seconds to wait for samples (-1 - wait indefinitely)\n");
        return;
    end

    if type(timeout) == 4 then
        error("isBlocking boolean argument is obsolete, provide timeout in seconds instead");
    end

    if timeout < 0 then
        timeout = -1;
    end

    if timeout > 0 then
        timeout = timeout * 1000;
    end

    if scan_count < 0 then
        error("scanCount parameter has to be equal or grater than 0");
    end

    if argn(2) == 2 then
        link_id = mdaqOpen();
        if link_id < 0 then
            disp("ERROR: Unable to connect to MicroDAQ device!");
            return;
        end
    end

    [ data result ] = call("sci_mlink_ai_scan",..
                link_id, 1, "i", ..
                scan_count, 3, "i",..
                timeout, 4, "i",..
            "out",..
                [ch_count, scan_count], 2, "d",..
                [1, 1], 5, "i");

    if argn(2) == 2 then
        mdaqClose(link_id);
    end

    if result < 0 then
        error(mdaq_error2(result), 10000 + abs(result))
    end

    data = data';
    result = round(result / ch_count);

    if result < scan_count then
        data = data(1:result,:)
    end
endfunction

function [data, result] = mdaqAIScan(arg1, arg2, arg3)
    link_id = -1;
    data = [];
    result = [];

    ch_count = call("sci_mlink_ai_scan_get_ch_count", "out", [1, 1], 1, "i");
    if ch_count < 1 | ch_count > 16 then
        error("AI scan not initialized");
    end

    if argn(2) == 2 then;
        scan_count = arg1;
        timeout = arg2;
    end

    if argn(2) == 3 then
        link_id = arg1;
        scan_count = arg2;
        timeout = arg3;

        if link_id < 0 then
            disp("ERROR: Invalid link ID!")
            return;
        end
    end

    if type(timeout) == 4 then
        error("isBlocking boolean argument is obsolete, provide timeout in seconds instead");
    end

    if argn(2) > 3 | argn(2) < 2 then
        mprintf("Description:\n");
        mprintf("\tStarts scanning operation and reads acquired data\n");
        mprintf("Usage:\n");
        mprintf("\t[data, result] = mdaqAIScan(linkID, scanCount, timeout\n")
        mprintf("\tlinkID - connection id returned by mdaqOpen() (OPTIONAL)\n");
        mprintf("\tscanCount - number of scans to read, when 0 - start acquisition only\n");
        mprintf("\ttimeout - amount of time in seconds to wait for samples (-1 - wait indefinitely)\n");
        return;
    end

    if timeout < 0 then
        timeout = -1;
    end

    if timeout > 0 then
        timeout = timeout * 1000;
    end

    if scan_count < 0 then
        error("scanCount parameter has to be equal or grater than 0");
    end

    if argn(2) == 2 then
        link_id = mdaqOpen();
        if link_id < 0 then
            disp("ERROR: Unable to connect to MicroDAQ device!");
            return;
        end
    end

    [ data result ] = call("sci_mlink_ai_scan",..
                link_id, 1, "i", ..
                scan_count, 3, "i",..
                timeout, 4, "i",..
            "out",..
                [ch_count, scan_count], 2, "d",..
                [1, 1], 5, "i");

    if argn(2) == 2 then
        mdaqClose(link_id);
    end

    if result < 0 then
        error(mdaq_error2(result), 10000 + abs(result))
    end

    data = data';
    result = round(result / ch_count);

    if result < scan_count then
        data = data(1:result,:)
    end
endfunction


Commmentaar

Commmentaar

Fss = 10000;
N=size(t,'*');//Aantal samples
sin_100Hz = 2*sin(2*%pi*100*t);
sin_500Hz = 1*sin(2*%pi*500*t);
sin_1000Hz = 0.5*sin(2*%pi*1000*t);
testsign = sin_100Hz + sin_500Hz + sin_1000Hz;//samengesteld signaal

Freq_FFT = abs(fft(testsign));
//abs take absolute value
//FFT() kan je een signaal decomposeren in de sinuscompenten waarmee dit signaal is samengesteld.

f = Fss*(0:(N/2))/N;//geassocieerde frequentie vector
n=size(f,'*');
figure;//grijze achtergrond
plot(f,Freq_FFT(1:n));//

[HD_coeff, amplitude, frequentie] = wfir('lp',100,[750/Fss],'hm',[0 0]);
//lp = lowpas filter; 100 = orde; 750/Fss = cut of frequentie; hm = hamming filter; window parameters
//frequentie = Frequency grid
//amplitude = frequency domain filter response on the grid fr
//time domain filter coefficients     niet nodig voor deze toepassing

plot(frequentie*Fss, amplitude*N, 'r');
//frequentie = Frequency grid
//
//filter output weergeven in rood

Fss = 10000;
t = [0:1/Fss:0.1];
N=size(t,'*');
sin_100Hz = 2*sin(2*%pi*100*t);
sin_500Hz = 1*sin(2*%pi*500*t);
sin_1000Hz = 0.5*sin(2*%pi*1000*t);
testsign = sin_100Hz + sin_500Hz + sin_1000Hz;

Freq_FFT = abs(fft(testsign));
f = Fss*(0:(N/2))/N;
n=size(f,'*');
figure;
plot(f,Freq_FFT(1:n));

[HD_coeff, amplitude, frequentie] = wfir('lp',100,[750/Fss],'hm',[0 0]);

plot(frequentie*Fss, amplitude*N, 'r');


INTEGRATION: CWS qadev32 (1.2.382); FILE MERGED 2008/04/16 18:08:45 cn 1.2.382.1: #i87216# update lists

-o pcr.ObjectInspector
# this object must be tests twice since it is the onle one in this module
# The runner only prints "[0-9]+? of [0-9]+? tests failed"
# if more then one tests is executed. This is needed by cwscheckapi.
-o pcr.ObjectInspector


INTEGRATION: CWS dba30 (1.2.6); FILE MERGED 2006/07/19 12:04:50 fs 1.2.6.2: RESYNC: (1.2-1.3); FILE MERGED 2005/04/06 07:12:46 fs 1.2.6.1: #i46768# added test for PropertyBag implementation in this module

-o complex.dbaccess.SingleSelectQueryComposer
-o complex.dbaccess.RowSet
-o complex.dbaccess.PropertyBag
-o complex.dbaccess.Query
-o complex.dbaccess.QueryInQuery

-o complex.dbaccess.SingleSelectQueryComposer
-o complex.dbaccess.RowSet
-o complex.dbaccess.Query
-o complex.dbaccess.QueryInQuery


INTEGRATION: CWS qadev32 (1.4.40); FILE MERGED 2008/03/18 21:08:04 cn 1.4.40.1: #i87216# update lists with issues

-o sch.ChXChartDocument
#i79073 -o sch.AccArea
#i79073 -o sch.AccAxis
#i79073 -o sch.AccDataPoint
#i79073 -o sch.AccDataSeries
#i79073 -o sch.AccDiagram
#i79073 -o sch.AccFloor
#i79073 -o sch.AccGrid
#i79073 -o sch.AccLegend
#i79073 -o sch.AccLegendEntry
#i79073 -o sch.AccStatisticsObject
#i79073 -o sch.AccTitle
#i79073 -o sch.AccWall
#i79073 -o sch.AccessibleDocumentView
-o sch.ChXChartAxis
-o sch.ChXChartData
-o sch.ChXChartDataArray
-o sch.ChXChartView
#i83867 -o sch.ChXDataPoint
#i83868 -o sch.ChXDataRow
#i87138 -o sch.ChXDiagram
-o sch.ChartArea
-o sch.ChartGrid
-o sch.ChartLegend
-o sch.ChartLine
-o sch.ChartTitle

-o sch.ChXChartDocument
#i79073 -o sch.AccArea
#i79073 -o sch.AccAxis
#i79073 -o sch.AccDataPoint
#i79073 -o sch.AccDataSeries
#i79073 -o sch.AccDiagram
#i79073 -o sch.AccFloor
#i79073 -o sch.AccGrid
#i79073 -o sch.AccLegend
#i79073 -o sch.AccLegendEntry
#i79073 -o sch.AccStatisticsObject
#i79073 -o sch.AccTitle
#i79073 -o sch.AccWall
#i79073 -o sch.AccessibleDocumentView
-o sch.ChXChartAxis
-o sch.ChXChartData
-o sch.ChXChartDataArray
-o sch.ChXChartView
#i83867 -o sch.ChXDataPoint
#i83868 -o sch.ChXDataRow
-o sch.ChXDiagram
-o sch.ChartArea
-o sch.ChartGrid
-o sch.ChartLegend
-o sch.ChartLine
-o sch.ChartTitle


INTEGRATION: CWS qadev18 (1.4.60); FILE MERGED 2004/07/09 15:36:45 sg 1.4.60.1: #115090#CHG: added new services with docking1 cws

#-o fwk.DispatchRecorder
#-o fwk.DispatchRecorderSupplier
#-o fwk.Frame
#-o fwk.JobExecutor
#-o fwk.JobHandler
#-o fwk.MailToDispatcher
#-o fwk.ServiceHandler
#-o fwk.SoundHandler
#-o fwk.URLTransformer
#-o fwl.ContentHandlerFactory
#-o fwl.FilterFactory
#-o fwl.FrameLoaderFactory
#-o fwl.SubstituteVariables
#-o fwl.TypeDetection
#-o fwl.PathSettings
#-o fwk.Desktop
#-o fwk.MacrosMenuController
#-o fwk.ModuleManager
#-o fwk.UIElementFactoryManager
#-o fwk.UICommandDescription
#-o fwk.LayoutManager
-o fwk.UIConfigurationManager
#-o fwk.MenuBarFactory
#-o fwk.FontSizeMenuController
#-o fwk.FooterMenuController
#-o fwk.FormatMenuController
#-o fwk.HeaderMenuController
#-o fwk.ControlMenuController
#-o fwk.FontMenuController
#-o fwk.ModuleUIConfigurationManagerSupplier
#-o fwk.ObjectMenuController
#-o fwk.ModuleUIConfigurationManager
#-o fwk.PopupMenuControllerFactory

-o fwk.DispatchRecorder
-o fwk.DispatchRecorderSupplier
-o fwk.Frame
-o fwk.JobExecutor
-o fwk.JobHandler
-o fwk.MailToDispatcher
-o fwk.ServiceHandler
-o fwk.SoundHandler
-o fwk.URLTransformer
-o fwl.ContentHandlerFactory
-o fwl.FilterFactory
-o fwl.FrameLoaderFactory
-o fwl.SubstituteVariables
-o fwl.TypeDetection
-o fwl.PathSettings
-o fwk.Desktop
-o fwk.ModuleManager
-o fwk.UIElementFactoryManager
-o fwk.LayoutManager
-o fwk.UIConfigurationManager
-o fwk.MenuBarFactory
-o fwk.FontSizeMenuController
-o fwk.FooterMenuController
-o fwk.FormatMenuController
-o fwk.HeaderMenuController
-o fwk.ControlMenuController
-o fwk.FontMenuController
-o fwk.ModuleUIConfigurationManagerSupplier
-o fwk.ObjectMenuController
-o fwk.ModuleUIConfigurationManager
-o fwk.PopupMenuControllerFactory


Small fix in mdaq_hwinfo macro

Small fix in mdaq_hwinfo macro

function mdaq_hwinfo()
    hwid = [];
    connection_id = mdaq_open();
    if connection_id > -1 then
        result = -1;
        [hwid, result] = call("sci_mlink_hwid",..
        connection_id, 1, "i",..
        "out",..
        [5, 1], 2, "i",..
        [1, 1], 3, "i");
        mdaq_close(connection_id);

        if hwid(1) <> 0 then
            global %microdaq;
            if isequal(%microdaq.private.mdaq_hwid, hwid) == %F |..
                isfile(mdaq_toolbox_path() + "etc"+filesep()+"mlink"+filesep()+"hwid") ==  %F then
                %microdaq.private.mdaq_hwid = hwid;
                %microdaq.model = 'MicroDAQ E' + string(hwid(1))..
                + '-ADC0' + string(hwid(2))..
                + '-DAC0' + string(hwid(3))..
                + '-' + string(hwid(4)) + string(hwid(5));
                mdaq_hwid = hwid;
                save(mdaq_toolbox_path() + "etc"+filesep()+"mlink"+filesep()+"hwid", 'mdaq_hwid');
            end

            if hwid(4) == 0 then
                cpu = 375;
            else
                cpu = 456;
            end

            if hwid(5) == 0  then
                storage = 4;
            end

            if hwid(5) == 1  then
                storage = 16;
            end

            if hwid(5) == 2  then
                storage = 32;
            end

            if hwid(1) == 2000 then
                ai_config = ["8 channel, 166ksps, 16-bit, ±10V range",..
                "8 channel, 600ksps, 12-bit, ±10V range",..
                "16 channel, 600ksps, 12-bit, ±10V range",..
                "8 channel, 500ksps, 16-bit, ±10V range",..
                "16 channel, 500ksps, 16-bit, ±10V range"];

                ao_config = ["8 channel, 12-bit, 0-5V range",..
                "8 channel, 12-bit, ±10V range",..
                "8 channel, 16-bit, ±10V range",..
                "16 channel, 12-bit, ±10V range",..
                "16 channel, 16-bit, ±10V range"];
            else
                ai_config = ["8 channel, 166ksps, 12-bit, ±10V range",..
                "8 channel, 166ksps, 16-bit, ±10V range"];

                ao_config = ["8 channel, 12-bit, 0-5V range"];
            end

            mprintf("-----------------------------------\n");
            mprintf("   %s\n", %microdaq.model);
            mprintf("-----------------------------------\n");
            mprintf("Hardware configuration:\n");
            mprintf("\tCPU: %dMHz\n", cpu);
            mprintf("\tStorage: %dGB\n", storage);

            mprintf("\tAnalog inputs (AI): %s\n", ai_config(hwid(2)));
            mprintf("\tAnalog outputs (AO): %s\n", ao_config(hwid(3)));
            mprintf("\tDigital input/output (DIO): %d channels, 5V/TTL\n", mdaq_get_dio_config());

            mprintf("IP settings:\n");
            mprintf("\tIP address: %s\n", %microdaq.ip_address);

            mprintf("Firmware version:\n");
            mdaq_fw = mdaq_fw_version();
            if mdaq_fw <> [] then
                mprintf("\t%d.%d.%d (build: %d)\n",..
                        mdaq_fw(1),..
                        mdaq_fw(2),..
                        mdaq_fw(3),..
                        mdaq_fw(4));
            else
                mprintf("\tUnable to read firmware version!\n");
            end

        else
            disp("Unable to read hardware ID - upgrade MicroDAQ firmware!")
        end
    else
        disp("Unable to connect to MicroDAQ device!");
    end
endfunction

function mdaq_hwinfo()
    hwid = [];
    connection_id = mdaq_open();
    if connection_id > -1 then
        result = -1;
        [hwid, result] = call("sci_mlink_hwid",..
                connection_id, 1, "i",..
            "out",..
                [5, 1], 2, "i",..
                [1, 1], 3, "i");
        mdaq_close(connection_id);

        global %microdaq;
        if isequal(%microdaq.private.mdaq_hwid, hwid) == %F |..
           isfile(mdaq_toolbox_path() + "etc"+filesep()+"mlink"+filesep()+"hwid") ==  %F then
            %microdaq.private.mdaq_hwid = hwid;
            %microdaq.model = 'MicroDAQ E' + string(hwid(1))..
                            + '-ADC0' + string(hwid(2))..
                            + '-DAC0' + string(hwid(3))..
                            + '-' + string(hwid(4)) + string(hwid(5));
            mdaq_hwid = hwid;
            save(mdaq_toolbox_path() + "etc"+filesep()+"mlink"+filesep()+"hwid", 'mdaq_hwid');
        end

        if hwid(4) == 0 then
            cpu = 375;
        else
            cpu = 456;
        end

        if hwid(5) == 0  then
            storage = 4;
        else
            storage = 32;
        end

        ai_config = ["8 channel, 166ksps, 12-bit, ±10V range",..
                      "8 channel, 166ksps, 16-bit, ±10V range",..
                      "8 channel, 600ksps, 12-bit, ±10V range",..
                      "16 channel, 600ksps, 12-bit, ±10V range",..
                      "16 channel, 500ksps, 16-bit, ±10V range"];

        ao_config = ["8 channel, 12-bit, 0-5V range",..
                     "8 channel, 12-bit, ±10V range",..
                     "8 channel, 16-bit, ±10V range"];

        mprintf("-----------------------------------\n");
        mprintf("   %s\n", %microdaq.model);
        mprintf("-----------------------------------\n");
        mprintf("Hardware configuration:\n");
        mprintf("\tCPU: %dMHz\n", cpu);
        mprintf("\tStorage: %dGB\n", storage);

        mprintf("\tAnalog inputs: %s\n", ai_config(hwid(2)));
        mprintf("\tAnalog outputs: %s\n", ao_config(hwid(3)));

        mprintf("IP settings:\n");
        mprintf("\tIP address: %s\n", %microdaq.ip_address);

        mprintf("Firmware version:\n");
        mdaq_fw = mdaq_fw_version();
        if mdaq_fw <> [] then
            mprintf("\t%d.%d.%d (build: %d)\n",..
                        mdaq_fw(1),..
                        mdaq_fw(2),..
                        mdaq_fw(3),..
                        mdaq_fw(4)..
                        );
        else
            mprintf("\tUnable to read!\n");
        end

    else
        disp("Unable to connect to MicroDAQ device!");
    end

endfunction


Fix mdaq_close - connection_id not defined

function mdaq_close(link_id)
    if argn(2) == 1 then
        if link_id < 0 then
            error("ERROR: Invalid connection id!");
        end
        result = call("sci_mlink_disconnect",..
                        link_id, 1, "i",..
                    "out",..
                        [1, 1], 2, "i");
    else
        call("sci_mlink_disconnect_all");
    end
endfunction

function mdaq_close(link_id)
    if argn(2) == 1 then
        if link_id < 0 then
            error("ERROR: Invalid connection id!");
        end
        result = call("sci_mlink_disconnect",..
                        connection_id, 1, "i",..
                    "out",..
                        [1, 1], 2, "i");
    else
        call("sci_mlink_disconnect_all");
    end
endfunction


Added RAND block to mdaq palette

Added RAND block to mdaq palette

function [res] = build_mdaq_palette(palette_path)
    toolbox_dir = mdaq_toolbox_path();
    xpal = list();

    //Create complete mdaq palette
    if isdef("gen_palette") == %T then
        //load xcos library
        if isdef("c_pass1") == %F then
            loadXcosLibs();
        end
    end

    //Temporary (load & use them somewhere else)
    blocks = [
    "mdaq_sinus"
    "mdaq_square"
    "mdaq_step"
    ];
    xpal_temp = tbx_build_pal(toolbox_dir, "temp_blocks", blocks);
    xcosPalAdd( xpal_temp, ['temp']);

    // MicroDAQ
    blocks = ["mdaq_adc"
    "mdaq_dac"
    "mdaq_dio_config"
    "mdaq_dio_get"
    "mdaq_dio_set"
    "mdaq_encoder"
    "mdaq_func_key"
    "mdaq_led"
    "mdaq_mem_read"
    "mdaq_mem_write"
    "mdaq_pwm"
    "mdaq_signal"
    "mdaq_param"
    "mdaq_tcp_recv"
    "mdaq_tcp_send"
    "mdaq_udp_recv"
    "mdaq_udp_send"
    "mdaq_to_file"
    "mdaq_uart_config"
    "mdaq_uart_read"
    "mdaq_uart_write"
    "mdaq_time"
    "mdaq_stop"
    "mdaq_setup"
    ];
    xpal($+1) = tbx_build_pal(toolbox_dir, "MicroDAQ", blocks);

    // Commonly Used Blocks
    blocks = ["mdaq_setup"
    "mdaq_signal"
    "CONST_m"
    "MUX"
    "DEMUX"
    "GAINBLK"
    "PROD_f"
    "SUMMATION"
    "mdaq_step"
    "mdaq_sinus"
    "DOLLAR"
    "CLOCK_c"
    "IFTHEL_f"
    "CLKFROM"
    "CLKGOTO"
    "CSCOPE"
    "TOWS_c"
    ];
    xpal($+1) = tbx_compose_pal('Commonly Used Blocks', blocks);

    //Continuous time systems
    blocks = ["CLSS"
    "DERIV"
    "INTEGRAL_m"
    "TCLSS"
    "VARIABLE_DELAY"
    ];
    xpal($+1) = tbx_compose_pal('Continuous time systems', blocks);

    //Discontinuities
    blocks = ["SATURATION"
    "BACKLASH"
    "DEADBAND"
    "HYSTHERESIS"
    "RATELIMITER"
    ];
    xpal($+1) = tbx_compose_pal('Discontinuities', blocks);

    //Discrete time systems
    blocks = ["mdaq_pid_z"
    "DLR"
    "DLSS"
    "DOLLAR"
    "DOLLAR_m"
    "REGISTER"
    "SAMPHOLD_m"
    "TCLSS"
    ];
    xpal($+1) = tbx_compose_pal('Discrete time systems', blocks);

    //Lookup Tables
//    blocks = ["INTRP2BLK_f"
//    "INTRPLBLK_f"
//    "LOOKUP_f"
//    ];
//    xpal($+1) = tbx_compose_pal('Lookup Tables', blocks);
//

    //Event handling
    blocks = ["CLOCK_c"
    "SampleCLK"
    "CLKFROM"
    "CLKGOTO"
    "CLKOUTV_f"
    "CLKSOMV_f"
    "EDGE_TRIGGER"
    "ESELECT_f"
    "EVTGEN_f"
    "Extract_Activation"
    "M_freq"
    "MCLOCK_f"
    "MFCLCK_f"
    "freq_div"
    "IFTHEL_f"
    ];
    xpal($+1) = tbx_compose_pal('Event handling', blocks);

    //Mathematical Operations
    blocks = ["ABS_VALUE"
    "BIGSOM_f"
    "EXPBLK_m"
    "GAINBLK"
    "MAXMIN"
    "PROD_f"
    "PRODUCT"
    "SIGNUM"
    "SQRT"
    "SUM_f"
    "SUMMATION"
    "TrigFun"
    ];
    xpal($+1) = tbx_compose_pal('Mathematical Operations', blocks);

    //Matrix
    blocks = ["CUMSUM"
    "EXTRACT"
    "MATCATV"
    "MATMAGPHI"
    "MATMUL"
    "MATRESH"
    "MATSUM"
    "SQRT"
    "SUBMAT"
    ];
    xpal($+1) = tbx_compose_pal('Matrix', blocks);

    //Integer
    blocks = ["BITCLEAR"
    "BITSET"
    "DLATCH"
    "EXTRACTBITS"
    "INTMUL"
    "JKFLIPFLOP"
    ];
    xpal($+1) = tbx_compose_pal('Integer', blocks);

    //Port & Subsystem
    blocks = ["CLKINV_f"
    "CLKOUTV_f"
    "SUPER_f"
    ];
    xpal($+1) = tbx_compose_pal('Port & Subsystem', blocks);

    //    //Zero crossing detection
    //    blocks = [];
    //    xpal($+1) = tbx_compose_pal('Zero crossing detection', blocks);

    //Signal Routing
    blocks = ["DEMUX"
    "MUX"
    "FROM"
    "GOTO"
    "CLKFROM"
    "CLKGOTO"
    "ISELECT_m"
    "M_SWITCH"
    "SELECT_m"
    "SWITCH2_m"
    ];
    xpal($+1) = tbx_compose_pal('Signal Routing', blocks);

    //Signal Processing
    blocks = ["SAMPHOLD_m"];
    xpal($+1) = tbx_compose_pal('Signal Processing', blocks);

    //    //Implicit
    //    blocks = [];
    //    xpal($+1) = tbx_compose_pal('Implicit', blocks);

    //    //Annotations
    //    blocks = [];
    //    xpal($+1) = tbx_compose_pal('Annotations', blocks);

    //Sinks
    blocks = ["AFFICH_m"
    "CLKOUTV_f"
    "CSCOPE"
    "CMSCOPE"
    "OUT_f"
    "TOWS_c"
    ];
    xpal($+1) = tbx_compose_pal('Sinks', blocks);

    //Sources
    blocks = ["CLKINV_f"
    "CLOCK_c"
    "CONST_m"
    "CONST"
    "mdaq_sinus"
    "mdaq_square"
    "mdaq_step"
    "TKSCALE"
    "RAND_m"];
    xpal($+1) = tbx_compose_pal('Sources', blocks);

    //User-Defined Functions
    blocks = ["SUPER_f"];
    xpal($+1) = tbx_compose_pal('User-Defined Functions', blocks);

    for i=1:size(xpal)
        xcosPalAdd(xpal(i), ['MicroDAQ']);
        if i < 10 then
            idx = "0"+string(i);
        else
            idx = string(i);
        end
        xcosPalExport(xpal(i), palette_path+filesep()+idx+".sod");
    end

    xcosPalDelete("temp");
    res = 0;
endfunction

function [res] = build_mdaq_palette(palette_path)
    toolbox_dir = mdaq_toolbox_path();
    xpal = list();

    //Create complete mdaq palette
    if isdef("gen_palette") == %T then
        //load xcos library
        if isdef("c_pass1") == %F then
            loadXcosLibs();
        end
    end

    //Temporary (load & use them somewhere else)
    blocks = [
    "mdaq_sinus"
    "mdaq_square"
    "mdaq_step"
    ];
    xpal_temp = tbx_build_pal(toolbox_dir, "temp_blocks", blocks);
    xcosPalAdd( xpal_temp, ['temp']);

    // MicroDAQ
    blocks = ["mdaq_adc"
    "mdaq_dac"
    "mdaq_dio_config"
    "mdaq_dio_get"
    "mdaq_dio_set"
    "mdaq_encoder"
    "mdaq_func_key"
    "mdaq_led"
    "mdaq_mem_read"
    "mdaq_mem_write"
    "mdaq_pwm"
    "mdaq_signal"
    "mdaq_param"
    "mdaq_tcp_recv"
    "mdaq_tcp_send"
    "mdaq_udp_recv"
    "mdaq_udp_send"
    "mdaq_to_file"
    "mdaq_uart_config"
    "mdaq_uart_read"
    "mdaq_uart_write"
    "mdaq_time"
    "mdaq_stop"
    "mdaq_setup"
    ];
    xpal($+1) = tbx_build_pal(toolbox_dir, "MicroDAQ", blocks);

    // Commonly Used Blocks
    blocks = ["mdaq_setup"
    "mdaq_signal"
    "CONST_m"
    "MUX"
    "DEMUX"
    "GAINBLK"
    "PROD_f"
    "SUMMATION"
    "mdaq_step"
    "mdaq_sinus"
    "DOLLAR"
    "CLOCK_c"
    "IFTHEL_f"
    "CLKFROM"
    "CLKGOTO"
    "CSCOPE"
    "TOWS_c"
    ];
    xpal($+1) = tbx_compose_pal('Commonly Used Blocks', blocks);

    //Continuous time systems
    blocks = ["CLSS"
    "DERIV"
    "INTEGRAL_m"
    "TCLSS"
    "VARIABLE_DELAY"
    ];
    xpal($+1) = tbx_compose_pal('Continuous time systems', blocks);

    //Discontinuities
    blocks = ["SATURATION"
    "BACKLASH"
    "DEADBAND"
    "HYSTHERESIS"
    "RATELIMITER"
    ];
    xpal($+1) = tbx_compose_pal('Discontinuities', blocks);

    //Discrete time systems
    blocks = ["mdaq_pid_z"
    "DLR"
    "DLSS"
    "DOLLAR"
    "DOLLAR_m"
    "REGISTER"
    "SAMPHOLD_m"
    "TCLSS"
    ];
    xpal($+1) = tbx_compose_pal('Discrete time systems', blocks);

    //Lookup Tables
//    blocks = ["INTRP2BLK_f"
//    "INTRPLBLK_f"
//    "LOOKUP_f"
//    ];
//    xpal($+1) = tbx_compose_pal('Lookup Tables', blocks);
//

    //Event handling
    blocks = ["CLOCK_c"
    "SampleCLK"
    "CLKFROM"
    "CLKGOTO"
    "CLKOUTV_f"
    "CLKSOMV_f"
    "EDGE_TRIGGER"
    "ESELECT_f"
    "EVTGEN_f"
    "Extract_Activation"
    "M_freq"
    "MCLOCK_f"
    "MFCLCK_f"
    "freq_div"
    "IFTHEL_f"
    ];
    xpal($+1) = tbx_compose_pal('Event handling', blocks);

    //Mathematical Operations
    blocks = ["ABS_VALUE"
    "BIGSOM_f"
    "EXPBLK_m"
    "GAINBLK"
    "MAXMIN"
    "PROD_f"
    "PRODUCT"
    "SIGNUM"
    "SQRT"
    "SUM_f"
    "SUMMATION"
    "TrigFun"
    ];
    xpal($+1) = tbx_compose_pal('Mathematical Operations', blocks);

    //Matrix
    blocks = ["CUMSUM"
    "EXTRACT"
    "MATCATV"
    "MATMAGPHI"
    "MATMUL"
    "MATRESH"
    "MATSUM"
    "SQRT"
    "SUBMAT"
    ];
    xpal($+1) = tbx_compose_pal('Matrix', blocks);

    //Integer
    blocks = ["BITCLEAR"
    "BITSET"
    "DLATCH"
    "EXTRACTBITS"
    "INTMUL"
    "JKFLIPFLOP"
    ];
    xpal($+1) = tbx_compose_pal('Integer', blocks);

    //Port & Subsystem
    blocks = ["CLKINV_f"
    "CLKOUTV_f"
    "SUPER_f"
    ];
    xpal($+1) = tbx_compose_pal('Port & Subsystem', blocks);

    //    //Zero crossing detection
    //    blocks = [];
    //    xpal($+1) = tbx_compose_pal('Zero crossing detection', blocks);

    //Signal Routing
    blocks = ["DEMUX"
    "MUX"
    "FROM"
    "GOTO"
    "CLKFROM"
    "CLKGOTO"
    "ISELECT_m"
    "M_SWITCH"
    "SELECT_m"
    "SWITCH2_m"
    ];
    xpal($+1) = tbx_compose_pal('Signal Routing', blocks);

    //Signal Processing
    blocks = ["SAMPHOLD_m"];
    xpal($+1) = tbx_compose_pal('Signal Processing', blocks);

    //    //Implicit
    //    blocks = [];
    //    xpal($+1) = tbx_compose_pal('Implicit', blocks);

    //    //Annotations
    //    blocks = [];
    //    xpal($+1) = tbx_compose_pal('Annotations', blocks);

    //Sinks
    blocks = ["AFFICH_m"
    "CLKOUTV_f"
    "CSCOPE"
    "CMSCOPE"
    "OUT_f"
    "TOWS_c"
    ];
    xpal($+1) = tbx_compose_pal('Sinks', blocks);

    //Sources
    blocks = ["CLKINV_f"
    "CLOCK_c"
    "CONST_m"
    "CONST"
    "mdaq_sinus"
    "mdaq_square"
    "mdaq_step"
    "TKSCALE"];
    xpal($+1) = tbx_compose_pal('Sources', blocks);

    //User-Defined Functions
    blocks = ["SUPER_f"];
    xpal($+1) = tbx_compose_pal('User-Defined Functions', blocks);

    for i=1:size(xpal)
        xcosPalAdd(xpal(i), ['MicroDAQ']);
        if i < 10 then
            idx = "0"+string(i);
        else
            idx = string(i);
        end
        xcosPalExport(xpal(i), palette_path+filesep()+idx+".sod");
    end

    xcosPalDelete("temp");
    res = 0;
endfunction