Files
simple_models_esp.py
├── def.discrete_FOP() - First Order Process discrete model
├── class FOPDT_model() - First Order Process with Delay Time discrete model
├── class dc_model() - disctere dc motor model
└──
RingBuffer.py
└── class ring_buffer() - ring buffer ( for creating delay line) First Order Proces with Delay time FOPDT_model() described by diff. equation:
Discrete DC motor (permament magnet) model: dc_motor() described by diff. equation:
DC motor
❗
- static friction model not implemented.
- note that by substituting catalog values of pmdc motor parameters, model will compute higher speed value than real one (but time constants should be similar).
- to add Friction Torque (Tf) ( given from motor catalog) to the model:
Td += Tf*sign(sinmodel._x1), since micropython have not sign() math function implemented then use if else condiition. - sampling time (Ts) for dc motor model should be at lest 5 times smaller than min(Te,tm), Te: electrical time constant, Tm: mechanical time constant.
example:
model = dc_motor()
# model._x0 -> angular rotor position[rad]
# model._x1 -> angular speed [ rad/s]
# model._x2 -> current [A]
print('model step responce')
for i in range(0,100):
yk = model.update(1.0) # .update(self, V,Td=0,Ts=0.01)
print(i, yk)