Bounded QSS Integrator
Rational
The output of the QSS integrator is q(t), the quantified approximation of the function. If q(t) is used to detect when the function will cross certain boundary, the caculation is approximate.
For some problems, for example the reservoir problem, passing the boundary should not be allowed. (i.e. it is imposible to have a pool with -0.00001 water).
See some attempts and options to implement this without a new model:
How to implement boundary conditions in PowerDEVS QSS
Example: when executed the model from the link above, with QSS2 the minQueue=- 0.0000305. With QSS minQueue=-0.1134968
with QSS1, the timeSerie near the crossing:
Queue.t = [5.99999999996226130 5.99999999998226130
6.0000000000022613 28.0000000000100009 28.0000000000200018 28.0000000000300027 28.0000000000400036 ]
QueueValue.value = [1.88650321781733510 0.88650321781733521
- 0.11349678218266468 0.88650321781733521 1.88650321781733510 2.88650321781733510 3.88650321781733510
Solution: make a new QSS integrator that also output x(t). When x(t) is used to calculate the boundary crossing, the calculation is exact.
Implementation 1: to test
To test the hypothesis a first quick test. add a new implementation of qss.h. The new qssWithXOutput.cpp has only one different line:
Comented the line were the degree of the polinom is decreesed.
Event qssWithXOutput::lambda(double t) {
//This function return an event:
// Event(%&Value%, %NroPort%)
//where:
// %&Value% is a direction to the variable that contain the value.
// %NroPort% is the port number (from 0 to n-1)
y[0]=X[0];
y[1]=X[1];
advance_time(y,sigma,1);
//y[1]=0; < -- this line commentedreturn Event(&y,0);
}
This solution does not work. The bounded queue behaved badly:
--
MatiasAlejandroBonaventura - 2017-04-10