Applies To:
  • CitectSCADA 5.10, 5.20

Summary:

I Have a non-English OS, and am using a comma as the decimal separator (Windows Regional Settings)

I am having trouble with my TaskNew or MsgRPC function. This is because the arguments of type REAL are not passed properly into the TaskNew() function when using a comma as decimal separator.
Another symptom is that, in the Example project, my SPC_Pareto_Chart does not work properly.


Solution:
You can solve this issue and see the correct Pareto page by applying one of the following solutions.
  1. Go to Control Panel | Regional Settings | Number and change the decimal delimiter character from , (a comma) to . (a full stop)
  2. OR

  3. Go to the Example project and change a line in the simultr.ci file. In the function TagSimulate() is the following line:


  4. IF iRangeOK THEN
        hSimTask = TaskNew("_TagSimulateTask", "^""+sTag +"^",^""+ sWaveForm +"^","+  
            iPeriod:### +","+ rMin:#####.## +","+ rMax:####.## +","+ iOffset:###,0);

    Please change this to:

    IF iRangeOK THEN
        hSimTask = TaskNew("_TagSimulateTask", "^""+sTag +"^",^""+ sWaveForm +"^","+  
            
    iPeriod:### +","+ rMin:##### +","+ rMax:#### +","+ iOffset:###, 0);


    Then it will also work also with the , (comma) sign as the decimal delimiter character, but you will lose precision as you are passing real tags without their decimal places. 

    OR

  5. You can set a parameter in the Citect.ini file. 
  6.     [Intl]bDecimal=0

    Then Citect will use the setting as specified by the the [Intl]sDecimal parameter, that defaults to . (a fullstop). See the Citect help for more info on the [Intl]bDecimal parameter.


Further Explanations

If you are running a non-English XP machine, you may be using a comma as your decimal separator.

Background: In this case, the return value for the
function "RealToStr(1.25,6,2)" would be "1,25" . which is normal and expected.

Let us work on the SPC Pareto Chart in the Example project. The Simulatr.ci file includes the TagSimulate function.
This function calls the following command:

hSimTask = TaskNew( "_TagSimulateTask", "^""+sTag +"^",^""+ sWaveForm +
"^","+iPeriod:### +","+ rMin:#####.## +","+ rMax:####.## +","+ iOffset:###, 0);

When using a comma as the decimal separator, in runtime, the substituted list of arguments passed as the 2nd argument of the TaskNew function will be, for example:
"TT001","RANDOM",10, 5,00, 79,00, 0

In the English version, it would be:
"TT001","RANDOM",10, 5.00, 79.00, 0

We can see here the problem: 8 arguments are listed in the the first case, but only 6 in the second case.

=Work Around=:

We need to put "" around the real numbers as well as the strings, so that the substituted list of arguments would now look like:
"TT001","RANDOM","10", "5,00", "79,00", "0"

For example, we could substitute the original cicode with the following cicode line:

hSimTask = TaskNew( "_TagSimulateTask", "^""+sTag +"^",^""+ sWaveForm +
"^",^""+iPeriod:###+"^",^"" +rMin:#####.## +"^",^""+ rMax:####.## +"^",^""+
iOffset:###+"^"", 0);

Note: Setting up the
[Intl]
bDecimal=0
sDecimal=,
does not help

Setting
bDecimal=0
sDecimal=.
would help, but is not really desirable, as it would use a dot as a decimal separator in the whole Citect environment.

The specific problem with the SPC Pareto Chart will be fixed in the Example project of v7.2.
Other custom cicode functions using TaskNew, MsgRPC, ... functions need to be called with caution. 


Keywords:
 

Attachments