3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
9 #include <msp/core/except.h>
10 #include "traincontrol.h"
17 void TrainControl::set(float v)
25 else if(type==DISCRETE)
26 value = min_value+floor((v-min_value)/step)*step;
27 else if(type==CONTINUOUS)
31 TrainControl TrainControl::binary(const string &n)
44 TrainControl TrainControl::discrete(const string &n, float m, float x, float s)
47 throw InvalidParameterValue("Max value must be greater than min value");
53 tc.max_value = m+floor((x-m)/s)*s;
60 TrainControl TrainControl::continuous(const string &n, float m, float x)
63 throw InvalidParameterValue("Max value must be greater than min value");
76 } // namespace Marklin