nikhilgupta10 / GridLAB-D

Other
1 stars 0 forks source link

#781 player variable ignores imaginary part, #1510

Open nikhilgupta10 opened 8 years ago

nikhilgupta10 commented 8 years ago

I'd like to use a player in the following way, similar to the example in the wiki. (except that I define 'value' as complex , not as double)
http://sourceforge.net/apps/mediawiki/gridlab-d/index.php?title=Player

module tape;
module powerflow;

clock {
    timezone GMT0+1;
    starttime '2012-12-19 11:00:00';
    stoptime '2012-12-19 11:59:59';
}

class player {
    complex value; // define variable
}

...

object load {
    name load1;
    parent meter1;
    phases \ABCN\;
    constant_power_A s1H.value*1.0133;
    constant_power_B s2H.value*1.0064;
    constant_power_C s3H.value*1.0095;
    nominal_voltage 230V;
}

...

object player {
    name s1H;
    file Haus_s1_H1_2012121911.csv;
};
object player {
    name s2H;
    file Haus_s2_H1_2012121911.csv;
};
object player {
    name s3H;
    file Haus_s3_H1_2012121911.csv;
};

In the csv files all values are complex, but the player only uses the real part. This can be observed by a recorder on meter1:measured_power_A

I consider this a bug.

,

nikhilgupta10 commented 8 years ago

nikhilgupta10 imported these comments from Sourceforge: This however works like it should:

object load {
    name load1;
    parent meter1;
    phases \ABCN\;

    object player {
        property constant_power_A;
        file Haus_s1_H1_2012121911.csv;
    };
    object player {
        property constant_power_B;
        file Haus_s2_H1_2012121911.csv;
    };
    object player {
        property constant_power_C;
        file Haus_s3_H1_2012121911.csv;
    };
    nominal_voltage 230V;
}

But this way I can't do gain correction.

,

Brenzikofer,

Recommend posting this to the forums. This was discussed somewhat at:

http://sourceforge.net/p/gridlab-d/discussion/842561/thread/f51cb19e/?limit=25#75b3

among other forum posts. The player transform only supports the manipulation of double values (as they are inherent to C++), but there are ways to achieve what you are looking for - varying from accessing the real and imaginary portions individually to runtime code.

,

Diff: