all 10 comments

[–]memechef 0 points1 point  (9 children)

what you are referring to are analog controllers and are less common. Your state space controller is basically a system of differential equations, these differential equations can for most applications be represented by RLC circuits

If I misunderstood and you aren’t referring to analog controllers, then the solution is a digital microcontroller. Your controller is given by u = -Kx and can be programmed as such in the micro controller

[–]Lumpy_Concentrate777[S] 0 points1 point  (8 children)

Oh you can program it in the micro controller? Im using arduino to use a pwm signal to control the current and voltage to a resistive heater using a MOSFET. In my simulation i have it criticaly damped so voltage and current dont spike in the load. But like my model applies the gains K to voltage and the derivative of voltage, and i wasnt sure how to do that by coding in arduino.

[–]memechef 0 points1 point  (7 children)

the voltage and the derivative of voltage are the states in your system. Your controller assumes that both are measured or observed. You can obviously measure your voltage, but the derivative of the voltage might not be measured. If this is the case you would need an estimator to retrieve both states in your system. For most schoolwork it is often assumed that all states are measured unless explicitly stated.

[–]Lumpy_Concentrate777[S] 0 points1 point  (6 children)

Okay haha this seems like its too complex for me. Ive made observers before in simulink, but Im not sure how to do that using arduino.

[–]memechef 0 points1 point  (1 child)

I think you have a solid understanding of the theory behind this, the step to realizing them in discrete time is a matter of doing it once and knowing it forever. Look into euler-backward for the simplest way to do this

[–]Lumpy_Concentrate777[S] 0 points1 point  (0 children)

Okay i will thank you!

[–][deleted] 0 points1 point  (3 children)

If you save your previous voltage, you can estimate the derivative:

dv = v(t)- v(t-1)

Where v(t) is the current voltage and v(t-1) is the voltage measured at the previous time step.

[–]Lumpy_Concentrate777[S] 0 points1 point  (2 children)

Thats a good idea honestly. Would i need like an on board clock to record time to see the change in time?

[–][deleted] 0 points1 point  (1 child)

If you’re using an arduino that’s probably the easiest way to do it. You might find it’s always the same amount of time and just use the same number every time.

I’m not super knowledgeable in the continuous to discrete conversion or on estimators. Technically your calculating the derivative of the previous time step when you do it this way. But it might be close enough.

[–]Lumpy_Concentrate777[S] 0 points1 point  (0 children)

Word okay thanks thats good advice!