Exemplo n.º 1
0
        public static IValueModel ParseValue(string valueString, LadderValueType type, Device contextDevice)
        {
            switch (type)
            {
            case LadderValueType.Bool:
                return(ParseBitValue(valueString, contextDevice));

            case LadderValueType.DoubleWord:
                return(ParseDoubleWordValue(valueString, contextDevice));

            case LadderValueType.Float:
                return(ParseFloatValue(valueString, contextDevice));

            case LadderValueType.Word:
                return(ParseWordValue(valueString, contextDevice));

            default:
                throw new ValueParseException("Unexpected input");
            }
        }
Exemplo n.º 2
0
        private int GetDataType(LadderValueType type)
        {
            switch (type)
            {
            case LadderValueType.Bool:
                return(0);

            case LadderValueType.DoubleWord:
                return(3);

            case LadderValueType.Word:
                return(1);

            case LadderValueType.Float:
                return(6);

            default:
                return(-1);
            }
        }
Exemplo n.º 3
0
        public static IVariableValue CreateVariableValue(string name, string mappedValuestring, LadderValueType type, string comment)
        {
            switch (type)
            {
            case LadderValueType.Bool:
                return(CreateVariableBitValue(name, mappedValuestring, comment));

            case LadderValueType.DoubleWord:
                return(CreateVariableDoubleWordValue(name, mappedValuestring, comment));

            case LadderValueType.Float:
                return(CreateVariableFloatValue(name, mappedValuestring, comment));

            case LadderValueType.Word:
                return(CreateVariableWordValue(name, mappedValuestring, comment));
            }
            throw new ValueParseException("Unexpected input");
        }