On 26 April 2011 11:50, Klemen Dovrtel <[email protected]> wrote:
> Hello everybody,
>
> I would like to make a pid control of fan. Fan air flow is controlled by a 
> triac. So i need to write a formula of triac_trigger_time as function of 
> fan_air_flow. This formula/module should then be "attached" to pid output to 
> control the fan.
> The same should be done for fan_air_flow measurement for pid feedback. So i 
> also need to write the formula of fan_air_flow as function of 
> measurement_signal (pwm in my case). This formula/module should be "attached" 
> to pid feedback.

I am not sure that this needs the scaling functions that you describe,
it might well be possible to incorporate all the conversions into the
PID gain parameters.

If linear scaling (gain and offset) is sufficient then the existing
"scale" HAL function should do the job.

However:
> How can i write this hal formula/module - did anybody already tried this?

I have been considering this myself. I have recently been quite deeply
involved in the definition of a number of new PID controller modules
in vehicle ECU code.
These typically all have a very similar structure, with a set of 2D
precontrol maps with setpoint and an environmental parameter (coolant
temperature, air pressure, fuel temperature, basically the main "noise
factor" of the controller) and a set of 2D lookups for the P, I and D
terms.
Given that a car low-pressure lift-pump is likely to be a lot easier
to control than a CNC axis, the difference in complexity is
surprising.
The P I and D gains of the HAL pid component are pins, so can be
altered in real time. This does mean that they could be made to vary
with error relatively easily.

So, no, I don't think that interpolation tables exist in HAL, but I
have given some thought to adding the function. I don't think we need
2D maps, but 1D curves might be useful. In fact I might have a quick
look at doing it tonight.

I imagine you would load it like this: (borrowing Matlab notation)

loadrt curve config="[-1, -0.5, 0.5, 1 ; 0.2, 0.1, 0.2, 0.2]", "[-1,
-0.5, 0.5, 1 ; 0.2, 0.1, 0.2, 0.2]"

to create two 4-entry lookups.

-- 
atp
"Torque wrenches are for the obedience of fools and the guidance of wise men"

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to