Commit 0f82b26b authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Improve limit of i2t when some budget is already taken...

parent 348c480c
......@@ -67,7 +67,7 @@ static void i2t_calculate(struct controller_block *block)
if (i2t >= peak2t)
priv->Ilim = priv->continuous;
else
priv->Ilim = priv->peaklim;
priv->Ilim = sqrtf(peak2t - i2t + continuous2);
priv->i2t = i2t;
}
......@@ -75,10 +75,9 @@ static void i2t_calculate(struct controller_block *block)
static void set_peak2t(struct controller_block *i2t)
{
struct controller_block_private *priv = i2t->private;
double tick = controller_time_period_get(i2t->time);
priv->peak2t = (priv->peak * priv->peak - priv->continuous2) * priv->duration / tick;
priv->peaklim = priv->peak / tick;
priv->peak2t = (priv->peak * priv->peak - priv->continuous2) * priv->duration;
priv->peaklim = priv->peak * priv->duration;
}
static int param_set_peak(struct controller_block *i2t, char *param, int argc,
......@@ -96,8 +95,9 @@ static int param_set_duration(struct controller_block *i2t, char *param, int arg
va_list val)
{
struct controller_block_private *priv = i2t->private;
double tick = controller_time_period_get(i2t->time);
priv->duration = va_arg(val, double);
priv->duration = va_arg(val, double) / tick;
set_peak2t(i2t);
return 0;
......
......@@ -39,14 +39,14 @@ params {
}
{ "test_1_Ilim", "value", 30,
(float) {
30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0,
30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 30.0, 10.0,
10.0, 10.0, 10.0, 10.0, 10.0, 30.0, 30.0, 30.0, 30.0, 30.0
90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0, 90.0,
85.0, 81.0, 75.0, 70.0, 64.0, 57.0, 50.0, 41.0, 30.0, 10.0,
10.0, 10.0, 10.0, 10.0, 10.0, 12.0, 13.0, 16.0, 19.0, 22.0
},
(float) {
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0
}
}
{ "test_10_I", "value", 30, (float) {
......@@ -56,14 +56,14 @@ params {
}
{ "test_10_Ilim", "value", 30,
(float) {
300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0,
300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0, 300.0,
10.0, 10.0, 10.0, 10.0, 10.0, 300.0, 300.0, 300.0, 300.0, 300.0
283.0, 283.0, 283.0, 283.0, 283.0, 283.0, 283.0, 283.0, 283.0, 283.0,
281.0, 267.0, 252.0, 235.0, 217.0, 198.0, 177.0, 153.0, 124.0, 85.0,
10.0, 10.0, 10.0, 10.0, 10.0, 12.0, 22.0, 30.0, 44.0, 54.0
},
(float) {
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment