aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.BL/Entities/HardwareMotorBase.cs
blob: a0fb6f66ea08a73211735ce2b67f2a7b518a2552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Logging;
using Tango.PMR.Common;
using Tango.Core.Commands;
using Tango.Transport;
using Tango.Core;

namespace Tango.Emulations
{
    /// <summary>
    /// Represents an <see cref="IEmulator"/> base class.
    /// </summary>
    /// <seealso cref="Tango.SharedUI.ExtendedObject" />
    /// <seealso cref="Tango.Emulations.IEmulator" />
    public abstract class EmulatorBase : ExtendedObject, IEmulator
    {
        #region Properties

        private bool _isStarted;
        /// <summary>
        /// Gets or sets a value indicating whether the emulator is started.
        /// </summary>
        public bool IsStarted
        {
            get { return _isStarted; }
            set { _isStarted = value; RaisePropertyChanged(nameof(IsStarted)); InvalidateRelayCommands(); }
        }

        private ITransporter _transporter;
        /// <summary>
        /// Gets or sets the transporter.
        /// </summary>
        public ITransporter Transporter
        {
            get { return _transporter; }
            set
            {
                _transporter = value;
                SetTransporter(_transporter);
            }
        }

        #endregion

        #region Commands

        /// <summary>
        /// Gets or sets the start command.
        /// </summary>
        public RelayCommand StartCommand { get; set; }

        /// <summary>
        /// Gets or sets the stop command.
        /// </summary>
        public RelayCommand StopCommand { get; set; }

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="EmulatorBase"/> class.
        /// </summary>
        public EmulatorBase()
        {
            StartCommand = new RelayCommand(async () => { await Start(); }, (x) => !IsStarted);
            StopCommand = new RelayCommand(async () => { await Stop(); }, (x) => IsStarted);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="EmulatorBase"/> class.
        /// </summary>
        /// <param name="transporter">The transporter.</param>
        public EmulatorBase(ITransporter transporter) : this()
        {
            Transporter = transporter;
        }

        #endregion

        #region Private Methods

        /// <summary>
        /// Sets the transporter.
        /// </summary>
        /// <param name="transporter">The transporter.</param>
        private void SetTransporter(ITransporter transporter)
        {
            if (_transporter != null)
            {
                _transporter.StateChanged -= OnTransporterStateChanged;
            }

            _transporter = transporter;
            _transporter.RequestReceived += OnTransporterRequestReceived;

            _transporter.StateChanged += OnTransporterStateChanged;
        }

        #endregion

        #region Public Methods

        /// <summary>
        /// Stops this instance.
        /// </summary>
        public virtual async Task Stop()
        {
            if (IsStarted)
            {
                await _transporter.Disconnect();
                IsStarted = false;
            }
        }

        /// <summary>
        /// Starts this instance.
        /// </summary>
        public virtual async Task Start()
        {
            if (!IsStarted)
            {
                await _transporter.Connect();
                IsStarted = true;
            }
        }

        #endregion

        #region Virtual Methods

        /// <summary>
        /// Called when transporter state has changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        protected virtual void OnTransporterStateChanged(object sender, TransportComponentState e)
        {
            LogManager.Log("Transporter state changed: " + e.ToString());
        }

        #endregion

        #region Abstract Methods

        /// <summary>
        /// Called on new request message.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="container">The container.</param>
        protected abstract void OnTransporterRequestReceived(object sender, RequestReceivedEventArgs e);

        #endregion

        #region Dispose

        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            Stop().Wait();
            if (Transporter != null) Transporter.Dispose();
        }

        #endregion
    }
}
ef='#n923'>923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Tango Observables Generator
// 
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. Do not modify!
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
using Newtonsoft.Json;
using System.Linq;
using Tango.DAL.Remote.DB;
using Tango.Core;
using System.ComponentModel;
using Tango.Core.CustomAttributes;

namespace Tango.BL.Entities
{
    [Table("HARDWARE_MOTORS")]
    public abstract class HardwareMotorBase : ObservableEntity<HardwareMotor>
    {

        public event EventHandler<Int32> MinFrequencyChanged;

        public event EventHandler<Int32> MaxFrequencyChanged;

        public event EventHandler<Int32> SetMicroStepChanged;

        public event EventHandler<Int32> MicroStepChanged;

        public event EventHandler<Double> MaxChangeSlopeChanged;

        public event EventHandler<Double> HighLengthMicroSecondChanged;

        public event EventHandler<Boolean> SpeedMasterChanged;

        public event EventHandler<Int32> PulsePerRoundChanged;

        public event EventHandler<Double> PulleyRadiusChanged;

        public event EventHandler<Int32> ConfigWordChanged;

        public event EventHandler<Boolean> DirectionThreadWizeChanged;

        public event EventHandler<Int32> KvalHoldChanged;

        public event EventHandler<Int32> KvalRunChanged;

        public event EventHandler<Int32> KvalAccChanged;

        public event EventHandler<Int32> KvalDecChanged;

        public event EventHandler<Int32> OverCurrentThresholdChanged;

        public event EventHandler<Int32> StallThresholdChanged;

        public event EventHandler<Int32> ThermalCompensationFactorChanged;

        public event EventHandler<Boolean> LowSpeedOptimizationChanged;

        public event EventHandler<Int32> StSlpChanged;

        public event EventHandler<Int32> IntSpdChanged;

        public event EventHandler<Int32> FnSlpAccChanged;

        public event EventHandler<Int32> FnSlpDecChanged;

        public event EventHandler<Int32> FsSpdChanged;

        public event EventHandler<Int32> GateCfg1Changed;

        public event EventHandler<Int32> GateCfg2Changed;

        public event EventHandler<Int32> TValHoldChanged;

        public event EventHandler<Int32> TValRunChanged;

        public event EventHandler<Int32> TValAccChanged;

        public event EventHandler<Int32> TValDecChanged;

        public event EventHandler<Int32> TFastChanged;

        public event EventHandler<Int32> TOnMinChanged;

        public event EventHandler<Int32> TOffMinChanged;

        public event EventHandler<Boolean> ActiveChanged;

        public event EventHandler<HardwareMotorType> HardwareMotorTypeChanged;

        public event EventHandler<HardwareVersion> HardwareVersionChanged;

        protected String _hardwaremotortypeguid;

        /// <summary>
        /// Gets or sets the hardwaremotorbase hardware motor type guid.
        /// </summary>

        [Column("HARDWARE_MOTOR_TYPE_GUID")]
        [ForeignKey("HardwareMotorType")]

        public  String HardwareMotorTypeGuid
        {
            get 
            {
                return _hardwaremotortypeguid; 
            }

            set 
            {
                if (_hardwaremotortypeguid != value)
                {
                    _hardwaremotortypeguid = value;

                }
            }
        }

        protected String _hardwareversionguid;

        /// <summary>
        /// Gets or sets the hardwaremotorbase hardware version guid.
        /// </summary>

        [Column("HARDWARE_VERSION_GUID")]
        [ForeignKey("HardwareVersion")]

        public  String HardwareVersionGuid
        {
            get 
            {
                return _hardwareversionguid; 
            }

            set 
            {
                if (_hardwareversionguid != value)
                {
                    _hardwareversionguid = value;

                }
            }
        }

        protected Int32 _minfrequency;

        /// <summary>
        /// Gets or sets the hardwaremotorbase min frequency.
        /// </summary>

        [Column("MIN_FREQUENCY")]

        public  Int32 MinFrequency
        {
            get 
            {
                return _minfrequency; 
            }

            set 
            {
                if (_minfrequency != value)
                {
                    _minfrequency = value;

                    OnMinFrequencyChanged(value);

                }
            }
        }

        protected Int32 _maxfrequency;

        /// <summary>
        /// Gets or sets the hardwaremotorbase max frequency.
        /// </summary>

        [Column("MAX_FREQUENCY")]

        public  Int32 MaxFrequency
        {
            get 
            {
                return _maxfrequency; 
            }

            set 
            {
                if (_maxfrequency != value)
                {
                    _maxfrequency = value;

                    OnMaxFrequencyChanged(value);

                }
            }
        }

        protected Int32 _setmicrostep;

        /// <summary>
        /// Gets or sets the hardwaremotorbase set micro step.
        /// </summary>

        [Column("SET_MICRO_STEP")]

        public  Int32 SetMicroStep
        {
            get 
            {
                return _setmicrostep; 
            }

            set 
            {
                if (_setmicrostep != value)
                {
                    _setmicrostep = value;

                    OnSetMicroStepChanged(value);

                }
            }
        }

        protected Int32 _microstep;

        /// <summary>
        /// Gets or sets the hardwaremotorbase micro step.
        /// </summary>

        [Column("MICRO_STEP")]

        public  Int32 MicroStep
        {
            get 
            {
                return _microstep; 
            }

            set 
            {
                if (_microstep != value)
                {
                    _microstep = value;

                    OnMicroStepChanged(value);

                }
            }
        }

        protected Double _maxchangeslope;

        /// <summary>
        /// Gets or sets the hardwaremotorbase max change slope.
        /// </summary>

        [Column("MAX_CHANGE_SLOPE")]

        public  Double MaxChangeSlope
        {
            get 
            {
                return _maxchangeslope; 
            }

            set 
            {
                if (_maxchangeslope != value)
                {
                    _maxchangeslope = value;

                    OnMaxChangeSlopeChanged(value);

                }
            }
        }

        protected Double _highlengthmicrosecond;

        /// <summary>
        /// Gets or sets the hardwaremotorbase high length micro second.
        /// </summary>

        [Column("HIGH_LENGTH_MICRO_SECOND")]

        public  Double HighLengthMicroSecond
        {
            get 
            {
                return _highlengthmicrosecond; 
            }

            set 
            {
                if (_highlengthmicrosecond != value)
                {
                    _highlengthmicrosecond = value;

                    OnHighLengthMicroSecondChanged(value);

                }
            }
        }

        protected Boolean _speedmaster;

        /// <summary>
        /// Gets or sets the hardwaremotorbase speed master.
        /// </summary>

        [Column("SPEED_MASTER")]

        public  Boolean SpeedMaster
        {
            get 
            {
                return _speedmaster; 
            }

            set 
            {
                if (_speedmaster != value)
                {
                    _speedmaster = value;

                    OnSpeedMasterChanged(value);

                }
            }
        }

        protected Int32 _pulseperround;

        /// <summary>
        /// Gets or sets the hardwaremotorbase pulse per round.
        /// </summary>

        [Column("PULSE_PER_ROUND")]

        public  Int32 PulsePerRound
        {
            get 
            {
                return _pulseperround; 
            }

            set 
            {
                if (_pulseperround != value)
                {
                    _pulseperround = value;

                    OnPulsePerRoundChanged(value);

                }
            }
        }

        protected Double _pulleyradius;

        /// <summary>
        /// Gets or sets the hardwaremotorbase pulley radius.
        /// </summary>

        [Column("PULLEY_RADIUS")]

        public  Double PulleyRadius
        {
            get 
            {
                return _pulleyradius; 
            }

            set 
            {
                if (_pulleyradius != value)
                {
                    _pulleyradius = value;

                    OnPulleyRadiusChanged(value);

                }
            }
        }

        protected Int32 _configword;

        /// <summary>
        /// Gets or sets the hardwaremotorbase config word.
        /// </summary>

        [Column("CONFIG_WORD")]

        public  Int32 ConfigWord
        {
            get 
            {
                return _configword; 
            }

            set 
            {
                if (_configword != value)
                {
                    _configword = value;

                    OnConfigWordChanged(value);

                }
            }
        }

        protected Boolean _directionthreadwize;

        /// <summary>
        /// Gets or sets the hardwaremotorbase direction thread wize.
        /// </summary>

        [Column("DIRECTION_THREAD_WIZE")]

        public  Boolean DirectionThreadWize
        {
            get 
            {
                return _directionthreadwize; 
            }

            set 
            {
                if (_directionthreadwize != value)
                {
                    _directionthreadwize = value;

                    OnDirectionThreadWizeChanged(value);

                }
            }
        }

        protected Int32 _kvalhold;

        /// <summary>
        /// Gets or sets the hardwaremotorbase kval hold.
        /// </summary>

        [Column("KVAL_HOLD")]

        public  Int32 KvalHold
        {
            get 
            {
                return _kvalhold; 
            }

            set 
            {
                if (_kvalhold != value)
                {
                    _kvalhold = value;

                    OnKvalHoldChanged(value);

                }
            }
        }

        protected Int32 _kvalrun;

        /// <summary>
        /// Gets or sets the hardwaremotorbase kval run.
        /// </summary>

        [Column("KVAL_RUN")]

        public  Int32 KvalRun
        {
            get 
            {
                return _kvalrun; 
            }

            set 
            {
                if (_kvalrun != value)
                {
                    _kvalrun = value;

                    OnKvalRunChanged(value);

                }
            }
        }

        protected Int32 _kvalacc;

        /// <summary>
        /// Gets or sets the hardwaremotorbase kval acc.
        /// </summary>

        [Column("KVAL_ACC")]

        public  Int32 KvalAcc
        {
            get 
            {
                return _kvalacc; 
            }

            set 
            {
                if (_kvalacc != value)
                {
                    _kvalacc = value;

                    OnKvalAccChanged(value);

                }
            }
        }

        protected Int32 _kvaldec;

        /// <summary>
        /// Gets or sets the hardwaremotorbase kval dec.
        /// </summary>

        [Column("KVAL_DEC")]

        public  Int32 KvalDec
        {
            get 
            {
                return _kvaldec; 
            }

            set 
            {
                if (_kvaldec != value)
                {
                    _kvaldec = value;

                    OnKvalDecChanged(value);

                }
            }
        }

        protected Int32 _overcurrentthreshold;

        /// <summary>
        /// Gets or sets the hardwaremotorbase over current threshold.
        /// </summary>

        [Column("OVER_CURRENT_THRESHOLD")]

        public  Int32 OverCurrentThreshold
        {
            get 
            {
                return _overcurrentthreshold; 
            }

            set 
            {
                if (_overcurrentthreshold != value)
                {
                    _overcurrentthreshold = value;

                    OnOverCurrentThresholdChanged(value);

                }
            }
        }

        protected Int32 _stallthreshold;

        /// <summary>
        /// Gets or sets the hardwaremotorbase stall threshold.
        /// </summary>

        [Column("STALL_THRESHOLD")]

        public  Int32 StallThreshold
        {
            get 
            {
                return _stallthreshold; 
            }

            set 
            {
                if (_stallthreshold != value)
                {
                    _stallthreshold = value;

                    OnStallThresholdChanged(value);

                }
            }
        }

        protected Int32 _thermalcompensationfactor;

        /// <summary>
        /// Gets or sets the hardwaremotorbase thermal compensation factor.
        /// </summary>

        [Column("THERMAL_COMPENSATION_FACTOR")]

        public  Int32 ThermalCompensationFactor
        {
            get 
            {
                return _thermalcompensationfactor; 
            }

            set 
            {
                if (_thermalcompensationfactor != value)
                {
                    _thermalcompensationfactor = value;

                    OnThermalCompensationFactorChanged(value);

                }
            }
        }

        protected Boolean _lowspeedoptimization;

        /// <summary>
        /// Gets or sets the hardwaremotorbase low speed optimization.
        /// </summary>

        [Column("LOW_SPEED_OPTIMIZATION")]

        public  Boolean LowSpeedOptimization
        {
            get 
            {
                return _lowspeedoptimization; 
            }

            set 
            {
                if (_lowspeedoptimization != value)
                {
                    _lowspeedoptimization = value;

                    OnLowSpeedOptimizationChanged(value);

                }
            }
        }

        protected Int32 _stslp;

        /// <summary>
        /// Gets or sets the hardwaremotorbase st slp.
        /// </summary>

        [Column("ST_SLP")]

        public  Int32 StSlp
        {
            get 
            {
                return _stslp; 
            }

            set 
            {
                if (_stslp != value)
                {
                    _stslp = value;

                    OnStSlpChanged(value);

                }
            }
        }

        protected Int32 _intspd;

        /// <summary>
        /// Gets or sets the hardwaremotorbase int spd.
        /// </summary>

        [Column("INT_SPD")]

        public  Int32 IntSpd
        {
            get 
            {
                return _intspd; 
            }

            set 
            {
                if (_intspd != value)
                {
                    _intspd = value;

                    OnIntSpdChanged(value);

                }
            }
        }

        protected Int32 _fnslpacc;

        /// <summary>
        /// Gets or sets the hardwaremotorbase fn slp acc.
        /// </summary>

        [Column("FN_SLP_ACC")]

        public  Int32 FnSlpAcc
        {
            get 
            {
                return _fnslpacc; 
            }

            set 
            {
                if (_fnslpacc != value)
                {
                    _fnslpacc = value;

                    OnFnSlpAccChanged(value);

                }
            }
        }

        protected Int32 _fnslpdec;

        /// <summary>
        /// Gets or sets the hardwaremotorbase fn slp dec.
        /// </summary>

        [Column("FN_SLP_DEC")]

        public  Int32 FnSlpDec
        {
            get 
            {
                return _fnslpdec; 
            }

            set 
            {
                if (_fnslpdec != value)
                {
                    _fnslpdec = value;

                    OnFnSlpDecChanged(value);

                }
            }
        }

        protected Int32 _fsspd;

        /// <summary>
        /// The speed in which the motor moves to full step operation.
        /// </summary>

        [Column("FS_SPD")]

        public  Int32 FsSpd
        {
            get 
            {
                return _fsspd; 
            }

            set 
            {
                if (_fsspd != value)
                {
                    _fsspd = value;

                    OnFsSpdChanged(value);

                }
            }
        }

        protected Int32 _gatecfg1;

        /// <summary>
        /// Gets or sets the hardwaremotorbase gate cfg 1.
        /// </summary>

        [Column("GATE_CFG_1")]

        public  Int32 GateCfg1
        {
            get 
            {
                return _gatecfg1; 
            }

            set 
            {
                if (_gatecfg1 != value)
                {
                    _gatecfg1 = value;

                    OnGateCfg1Changed(value);

                }
            }
        }

        protected Int32 _gatecfg2;

        /// <summary>
        /// Gets or sets the hardwaremotorbase gate cfg 2.
        /// </summary>

        [Column("GATE_CFG_2")]

        public  Int32 GateCfg2
        {
            get 
            {
                return _gatecfg2; 
            }

            set 
            {
                if (_gatecfg2 != value)
                {
                    _gatecfg2 = value;

                    OnGateCfg2Changed(value);

                }
            }
        }

        protected Int32 _tvalhold;

        /// <summary>
        /// Gets or sets the hardwaremotorbase t val hold.
        /// </summary>

        [Column("T_VAL_HOLD")]

        public  Int32 TValHold
        {
            get 
            {
                return _tvalhold; 
            }

            set 
            {
                if (_tvalhold != value)
                {
                    _tvalhold = value;

                    OnTValHoldChanged(value);

                }
            }
        }

        protected Int32 _tvalrun;

        /// <summary>
        /// Gets or sets the hardwaremotorbase t val run.
        /// </summary>

        [Column("T_VAL_RUN")]

        public  Int32 TValRun
        {
            get 
            {
                return _tvalrun; 
            }

            set 
            {
                if (_tvalrun != value)
                {
                    _tvalrun = value;

                    OnTValRunChanged(value);

                }
            }
        }

        protected Int32 _tvalacc;

        /// <summary>
        /// Gets or sets the hardwaremotorbase t val acc.
        /// </summary>

        [Column("T_VAL_ACC")]

        public  Int32 TValAcc
        {
            get 
            {
                return _tvalacc; 
            }

            set 
            {
                if (_tvalacc != value)
                {
                    _tvalacc = value;

                    OnTValAccChanged(value);

                }
            }
        }

        protected Int32 _tvaldec;

        /// <summary>
        /// Gets or sets the hardwaremotorbase t val dec.
        /// </summary>

        [Column("T_VAL_DEC")]

        public  Int32 TValDec
        {
            get 
            {
                return _tvaldec; 
            }

            set 
            {
                if (_tvaldec != value)
                {
                    _tvaldec = value;

                    OnTValDecChanged(value);

                }
            }
        }

        protected Int32 _tfast;

        /// <summary>
        /// Gets or sets the hardwaremotorbase t fast.
        /// </summary>

        [Column("T_FAST")]

        public  Int32 TFast
        {
            get 
            {
                return _tfast; 
            }

            set 
            {
                if (_tfast != value)
                {
                    _tfast = value;

                    OnTFastChanged(value);

                }
            }
        }

        protected Int32 _tonmin;

        /// <summary>
        /// Gets or sets the hardwaremotorbase t on min.
        /// </summary>

        [Column("T_ON_MIN")]

        public  Int32 TOnMin
        {
            get 
            {
                return _tonmin; 
            }

            set 
            {
                if (_tonmin != value)
                {
                    _tonmin = value;

                    OnTOnMinChanged(value);

                }
            }
        }

        protected Int32 _toffmin;

        /// <summary>
        /// Gets or sets the hardwaremotorbase t off min.
        /// </summary>

        [Column("T_OFF_MIN")]

        public  Int32 TOffMin
        {
            get 
            {
                return _toffmin; 
            }

            set 
            {
                if (_toffmin != value)
                {
                    _toffmin = value;

                    OnTOffMinChanged(value);

                }
            }
        }

        protected Boolean _active;

        /// <summary>
        /// Gets or sets the hardwaremotorbase active.
        /// </summary>

        [Column("ACTIVE")]

        public  Boolean Active
        {
            get 
            {
                return _active; 
            }

            set 
            {
                if (_active != value)
                {
                    _active = value;

                    OnActiveChanged(value);

                }
            }
        }

        protected HardwareMotorType _hardwaremotortype;

        /// <summary>
        /// Gets or sets the hardwaremotorbase hardware motor types.
        /// </summary>

        [XmlIgnore]
        [JsonIgnore]
        public virtual HardwareMotorType HardwareMotorType
        {
            get 
            {
                return _hardwaremotortype; 
            }

            set 
            {
                if (_hardwaremotortype != value)
                {
                    _hardwaremotortype = value;

                    if (HardwareMotorType != null)
                    {
                        HardwareMotorTypeGuid = HardwareMotorType.Guid;
                    }

                    OnHardwareMotorTypeChanged(value);

                }
            }
        }

        protected HardwareVersion _hardwareversion;

        /// <summary>
        /// Gets or sets the hardwaremotorbase hardware versions.
        /// </summary>

        [XmlIgnore]
        [JsonIgnore]
        public virtual HardwareVersion HardwareVersion
        {
            get 
            {
                return _hardwareversion; 
            }

            set 
            {
                if (_hardwareversion != value)
                {
                    _hardwareversion = value;

                    if (HardwareVersion != null)
                    {
                        HardwareVersionGuid = HardwareVersion.Guid;
                    }

                    OnHardwareVersionChanged(value);

                }
            }
        }

        /// <summary>
        /// Called when the MinFrequency has changed.
        /// </summary>
        protected virtual void OnMinFrequencyChanged(Int32 minfrequency)
        {
            MinFrequencyChanged?.Invoke(this, minfrequency);
            RaisePropertyChanged(nameof(MinFrequency));
        }

        /// <summary>
        /// Called when the MaxFrequency has changed.
        /// </summary>
        protected virtual void OnMaxFrequencyChanged(Int32 maxfrequency)
        {
            MaxFrequencyChanged?.Invoke(this, maxfrequency);
            RaisePropertyChanged(nameof(MaxFrequency));
        }

        /// <summary>
        /// Called when the SetMicroStep has changed.
        /// </summary>
        protected virtual void OnSetMicroStepChanged(Int32 setmicrostep)
        {
            SetMicroStepChanged?.Invoke(this, setmicrostep);
            RaisePropertyChanged(nameof(SetMicroStep));
        }

        /// <summary>
        /// Called when the MicroStep has changed.
        /// </summary>
        protected virtual void OnMicroStepChanged(Int32 microstep)
        {
            MicroStepChanged?.Invoke(this, microstep);
            RaisePropertyChanged(nameof(MicroStep));
        }

        /// <summary>
        /// Called when the MaxChangeSlope has changed.
        /// </summary>
        protected virtual void OnMaxChangeSlopeChanged(Double maxchangeslope)
        {
            MaxChangeSlopeChanged?.Invoke(this, maxchangeslope);
            RaisePropertyChanged(nameof(MaxChangeSlope));
        }

        /// <summary>
        /// Called when the HighLengthMicroSecond has changed.
        /// </summary>
        protected virtual void OnHighLengthMicroSecondChanged(Double highlengthmicrosecond)
        {
            HighLengthMicroSecondChanged?.Invoke(this, highlengthmicrosecond);
            RaisePropertyChanged(nameof(HighLengthMicroSecond));
        }

        /// <summary>
        /// Called when the SpeedMaster has changed.
        /// </summary>
        protected virtual void OnSpeedMasterChanged(Boolean speedmaster)
        {
            SpeedMasterChanged?.Invoke(this, speedmaster);
            RaisePropertyChanged(nameof(SpeedMaster));
        }

        /// <summary>
        /// Called when the PulsePerRound has changed.
        /// </summary>
        protected virtual void OnPulsePerRoundChanged(Int32 pulseperround)
        {
            PulsePerRoundChanged?.Invoke(this, pulseperround);
            RaisePropertyChanged(nameof(PulsePerRound));
        }

        /// <summary>
        /// Called when the PulleyRadius has changed.
        /// </summary>
        protected virtual void OnPulleyRadiusChanged(Double pulleyradius)
        {
            PulleyRadiusChanged?.Invoke(this, pulleyradius);
            RaisePropertyChanged(nameof(PulleyRadius));
        }

        /// <summary>
        /// Called when the ConfigWord has changed.
        /// </summary>
        protected virtual void OnConfigWordChanged(Int32 configword)
        {
            ConfigWordChanged?.Invoke(this, configword);
            RaisePropertyChanged(nameof(ConfigWord));
        }

        /// <summary>
        /// Called when the DirectionThreadWize has changed.
        /// </summary>
        protected virtual void OnDirectionThreadWizeChanged(Boolean directionthreadwize)
        {
            DirectionThreadWizeChanged?.Invoke(this, directionthreadwize);
            RaisePropertyChanged(nameof(DirectionThreadWize));
        }

        /// <summary>
        /// Called when the KvalHold has changed.
        /// </summary>
        protected virtual void OnKvalHoldChanged(Int32 kvalhold)
        {
            KvalHoldChanged?.Invoke(this, kvalhold);
            RaisePropertyChanged(nameof(KvalHold));
        }

        /// <summary>
        /// Called when the KvalRun has changed.
        /// </summary>
        protected virtual void OnKvalRunChanged(Int32 kvalrun)
        {
            KvalRunChanged?.Invoke(this, kvalrun);
            RaisePropertyChanged(nameof(KvalRun));
        }

        /// <summary>
        /// Called when the KvalAcc has changed.
        /// </summary>
        protected virtual void OnKvalAccChanged(Int32 kvalacc)
        {
            KvalAccChanged?.Invoke(this, kvalacc);
            RaisePropertyChanged(nameof(KvalAcc));
        }

        /// <summary>
        /// Called when the KvalDec has changed.
        /// </summary>
        protected virtual void OnKvalDecChanged(Int32 kvaldec)
        {
            KvalDecChanged?.Invoke(this, kvaldec);
            RaisePropertyChanged(nameof(KvalDec));
        }

        /// <summary>
        /// Called when the OverCurrentThreshold has changed.
        /// </summary>
        protected virtual void OnOverCurrentThresholdChanged(Int32 overcurrentthreshold)
        {
            OverCurrentThresholdChanged?.Invoke(this, overcurrentthreshold);
            RaisePropertyChanged(nameof(OverCurrentThreshold));
        }

        /// <summary>
        /// Called when the StallThreshold has changed.
        /// </summary>
        protected virtual void OnStallThresholdChanged(Int32 stallthreshold)
        {
            StallThresholdChanged?.Invoke(this, stallthreshold);
            RaisePropertyChanged(nameof(StallThreshold));
        }

        /// <summary>
        /// Called when the ThermalCompensationFactor has changed.
        /// </summary>
        protected virtual void OnThermalCompensationFactorChanged(Int32 thermalcompensationfactor)
        {
            ThermalCompensationFactorChanged?.Invoke(this, thermalcompensationfactor);
            RaisePropertyChanged(nameof(ThermalCompensationFactor));
        }

        /// <summary>
        /// Called when the LowSpeedOptimization has changed.
        /// </summary>
        protected virtual void OnLowSpeedOptimizationChanged(Boolean lowspeedoptimization)
        {
            LowSpeedOptimizationChanged?.Invoke(this, lowspeedoptimization);
            RaisePropertyChanged(nameof(LowSpeedOptimization));
        }

        /// <summary>
        /// Called when the StSlp has changed.
        /// </summary>
        protected virtual void OnStSlpChanged(Int32 stslp)
        {
            StSlpChanged?.Invoke(this, stslp);
            RaisePropertyChanged(nameof(StSlp));
        }

        /// <summary>
        /// Called when the IntSpd has changed.
        /// </summary>
        protected virtual void OnIntSpdChanged(Int32 intspd)
        {
            IntSpdChanged?.Invoke(this, intspd);
            RaisePropertyChanged(nameof(IntSpd));
        }

        /// <summary>
        /// Called when the FnSlpAcc has changed.
        /// </summary>
        protected virtual void OnFnSlpAccChanged(Int32 fnslpacc)
        {
            FnSlpAccChanged?.Invoke(this, fnslpacc);
            RaisePropertyChanged(nameof(FnSlpAcc));
        }

        /// <summary>
        /// Called when the FnSlpDec has changed.
        /// </summary>
        protected virtual void OnFnSlpDecChanged(Int32 fnslpdec)
        {
            FnSlpDecChanged?.Invoke(this, fnslpdec);
            RaisePropertyChanged(nameof(FnSlpDec));
        }

        /// <summary>
        /// Called when the FsSpd has changed.
        /// </summary>
        protected virtual void OnFsSpdChanged(Int32 fsspd)
        {
            FsSpdChanged?.Invoke(this, fsspd);
            RaisePropertyChanged(nameof(FsSpd));
        }

        /// <summary>
        /// Called when the GateCfg1 has changed.
        /// </summary>
        protected virtual void OnGateCfg1Changed(Int32 gatecfg1)
        {
            GateCfg1Changed?.Invoke(this, gatecfg1);
            RaisePropertyChanged(nameof(GateCfg1));
        }

        /// <summary>
        /// Called when the GateCfg2 has changed.
        /// </summary>
        protected virtual void OnGateCfg2Changed(Int32 gatecfg2)
        {
            GateCfg2Changed?.Invoke(this, gatecfg2);
            RaisePropertyChanged(nameof(GateCfg2));
        }

        /// <summary>
        /// Called when the TValHold has changed.
        /// </summary>
        protected virtual void OnTValHoldChanged(Int32 tvalhold)
        {
            TValHoldChanged?.Invoke(this, tvalhold);
            RaisePropertyChanged(nameof(TValHold));
        }

        /// <summary>
        /// Called when the TValRun has changed.
        /// </summary>
        protected virtual void OnTValRunChanged(Int32 tvalrun)
        {
            TValRunChanged?.Invoke(this, tvalrun);
            RaisePropertyChanged(nameof(TValRun));
        }

        /// <summary>
        /// Called when the TValAcc has changed.
        /// </summary>
        protected virtual void OnTValAccChanged(Int32 tvalacc)
        {
            TValAccChanged?.Invoke(this, tvalacc);
            RaisePropertyChanged(nameof(TValAcc));
        }

        /// <summary>
        /// Called when the TValDec has changed.
        /// </summary>
        protected virtual void OnTValDecChanged(Int32 tvaldec)
        {
            TValDecChanged?.Invoke(this, tvaldec);
            RaisePropertyChanged(nameof(TValDec));
        }

        /// <summary>
        /// Called when the TFast has changed.
        /// </summary>
        protected virtual void OnTFastChanged(Int32 tfast)
        {
            TFastChanged?.Invoke(this, tfast);
            RaisePropertyChanged(nameof(TFast));
        }

        /// <summary>
        /// Called when the TOnMin has changed.
        /// </summary>
        protected virtual void OnTOnMinChanged(Int32 tonmin)
        {
            TOnMinChanged?.Invoke(this, tonmin);
            RaisePropertyChanged(nameof(TOnMin));
        }

        /// <summary>
        /// Called when the TOffMin has changed.
        /// </summary>
        protected virtual void OnTOffMinChanged(Int32 toffmin)
        {
            TOffMinChanged?.Invoke(this, toffmin);
            RaisePropertyChanged(nameof(TOffMin));
        }

        /// <summary>
        /// Called when the Active has changed.
        /// </summary>
        protected virtual void OnActiveChanged(Boolean active)
        {
            ActiveChanged?.Invoke(this, active);
            RaisePropertyChanged(nameof(Active));
        }

        /// <summary>
        /// Called when the HardwareMotorType has changed.
        /// </summary>
        protected virtual void OnHardwareMotorTypeChanged(HardwareMotorType hardwaremotortype)
        {
            HardwareMotorTypeChanged?.Invoke(this, hardwaremotortype);
            RaisePropertyChanged(nameof(HardwareMotorType));
        }

        /// <summary>
        /// Called when the HardwareVersion has changed.
        /// </summary>
        protected virtual void OnHardwareVersionChanged(HardwareVersion hardwareversion)
        {
            HardwareVersionChanged?.Invoke(this, hardwareversion);
            RaisePropertyChanged(nameof(HardwareVersion));
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="HardwareMotorBase" /> class.
        /// </summary>
        public HardwareMotorBase() : base()
        {
        }
    }
}