Hi everybody,
we are trying to model a system, using Electrical Linear Network, implementing the following equation:
I(out1) = ddt(V(in1))
That is, we want that the current of the output is the derivative of the voltage of the input terminal.
to do this we declared:
- two terminals (in1 and out1),
- two VCCS (v1 and v2),
- a sca_node (n)
- an inductor (ind).
Here you can find the implementation code:
#include "../inc/template_1.hh"
template_1::template_1( sc_core::sc_module_name name_ ) :
sc_core::sc_module( name_ ),
in1("in1"),
out1("out1"),
n("n"),
scams_ground("scams_ground"),
v1("v1", 1.0),
v2("v2", 1.0),
ind( "pattern_1", 1.0 , sca_util::SCA_UNDEFINED )
{
v1.ncp(in1);
v1.np(n);
v1.nn(scams_ground);
v1.ncn(scams_ground);
v2.ncp(n);
v2.np(out1);
v2.nn(scams_ground);
v2.ncn(scams_ground);
ind.p( n );
ind.n( scams_ground );
}
template_1::~template_1()
{}
We were expecting that what is modeled here was a derivative. However, when executing and reading the current value on out1, we see unexpected behaviors. In particular, we are writing as input (in1) a double signal, using a sca_de_vsource that starts from 1.0 and every microsecond it is self-multiplied by 1.01. Thus, we were expecting 1.01 constant output. This does not happen and very strange values, ranging from 0 to -1.59561833143e+47 are traced as output (using a tabular file). To read the output value we are using a sca_de_isink.
We are probably forgetting or misinterpreting something. Does anyone have any idea?
Thank you very much,
Michele.