- I'm starting use CurModel() Clarkpark() functions when speed is more than 100 RPM. I measure speed by optic sensor - 1 pulse per 1 revolution.
- I have calculated Rr and Lr values by locked shaft and no-load motor test so I don't need to estimate it.
Ok, you need to do some work before starting with FOC
1) You must get your speed sensor (encoder?) to give you at least correct rotor speed (minimum 25 pulses per revolution, preferable 60 + if you need to identify quick speed changes). Even the shitty variable reluctance sensors which are used together with rusty ABS-rings can do that.
For control of Electric motors you need at least Hall effect sensor with decent sprocket wheel (usually at least 50 + teeth).
Note: Regardless of sensor the basic idea is to feed the pulses to a counter mechanism in the microprocessor, there are different ways to do that.
Here is some literature on that, see link below and attachment
https://www.electronicproducts.com/...s_VR_Which_speed_sensor_is_wrong_for_you.aspx
2) When you think you have correct speed you should verifiy it with a closed loop V/f where you use the feedback of the speed sensor to control the slip. You can work from nominal parameters you already know. This gives you an idea how quick the reaction is.
3) Parallel and independent to 1) and 2) you can develop a FOC-schema based ONLY on current measured. If you are confident with your V/f control and you are driving your motor in a steady state, you can calculate the Id and Iq currents from the measured phase currents with the transformation. You can store these values and use them later to control the motor in FOC (without speed measurement) and compare it to the (open loop for example ) V/f under same steady(!) load/frequency/voltage. It should be quite identical, meaning giving similar slip.
Note: This is "sensorless" FOC, meaning you have a slip estimator based on only current measurement. This will work well for smaller motors with constant load / tourque/ speed. The slip will be relative to (Iq/Id)(1/Time-constant).
4) When you are confident with 1-3) you add the speed feedback to your FOC-model and calculate the "real" angle of the electric flux from calculated slip as mentioned in before comments.
You still have not the fastest control most responsive but you are getting there.
You still have indirect FOC, meaning you are reacting to changes.
You have though the possibilities to pre-act by setting Voltage and slip or by setting known Id/Iq from known values.
5) Now you want to do better and not only calculate slip but also get the exact rotor position. One method to get it from the encoder is to use some index marker on the sprocket. In the most primitive way it can be a tooth missing

With the rotor position and speed you can refine your model even better and now you are in position of direct FOC (or direct torque control DTC if you have a good Space-Vector-Map).
Note: for a synchronous permanent magnet motor you only would need position from encoder (better than only speed because of starting condition). For an asynchronous induction machine under variable load/speed you need both.
6) Now we want to abandon the universal model and optimize it for our motor. We will add parmeters like inertia and calculate the rotor "constants" from measured heat values to get the complete motor model.
PS: I have been playing around with this stuff for a few years , I am still in step 4
Best regards, and wishes for your project, you will have a lot of fun and learning...
