mmslite库学习备忘

一、如何判断一个var是否可写

Mvl_uca.c中u_mvl_write_ind函数中,chk_var_writable检验了函数是否是writable,跟踪该函数主要根据rt->mvluTypeInfo.wrIndFunIndex == idx_u_no_write_allowed这句来判断,而rt->mvluTypeInfo.wrIndFunIndex又是在userlef.c中u_set_all_leaf_functions函数赋值,该函数片段如下:


            /*所有ST MX EX SG 的类对象均不可写 */
            if (!(strcmp (comp_name, "ST")
                    && strcmp (comp_name, "MX")
                    && strcmp (comp_name, "EX") 
                    && strcmp (comp_name, "CO")
                    /*&& strcmp (comp_name, "DC")*/))   /*增加DC不可写*/
            {
                if (rt_type->el_tag == RT_STR_START) /* "Oper" must be struct*/
                {
                    fc_nest_level++;
                }
                else
                {
                    MVL_LOG_ERR1 ("FC '%s' is not a struct. Data type is NOT a valid IEC-61850 type.", comp_name);
                    retcode = SD_FAILURE;
                    break;
                }
            } 

要知道哪些FC对象不可写,将其加入if判断中即可。


PS:7-2 table8中对CF/DC这两种FC的可读可写描述是这样的,DataAttribute shall represent a configuration/description information whose value may be written and read.

注意到该描述用到的语气词是may be 而非 should be,即这两种FC对象并非一定要(should be)既可读又可写,而是可以(may be)可读和可写。

你可能感兴趣的:(IEC61850)