Re: [daetools-users] Howto: discrete signal?
Object-oriented equation-based modelling and optimisation software
Brought to you by:
ciroki
|
From: StUstD <st...@gm...> - 2018-03-07 14:05:23
|
Thanks, I'm going to give it a try in a simple test environment. Let you know the results. - Henk On Wed, Mar 7, 2018 at 2:49 PM, Dragan Nikolic <dra...@gm...> wrote: > Hi, > > Well, it is a bit difficult because of the way the equation-based systems > are solved numerically but it might work. > > If you wish to change a model variable you can use daeModel.ON_CONDITION > function (have a look on tutorials 5, 14). If iT is a model variable, you > can put the following in the function DeclareEquations: > > self.ON_CONDITION(Time() > iT, switchToStates = [], > setVariableValues = [iT, iT+1], # here you > may need to use self.iT() > triggerEvents = [], > userDefinedActions = []) > > But, you need to be careful here: your condition Time() > iT will be > triggered EVERY time step once the simulation time becomes greater than iT. > However, you change it each time the condition is satisfied, so it might > work. Please check and let me know, I am curious if it works or not. > > Cheers > Dragan > > > > On 07/03/18 11:45, StUstD wrote: > >> How is it possible to create a discrete-time signal, e.g. a counter (in >> pseudo code): >> >> initial Time = 0 >> iT = 1 # counter >> >> if Time() > iT: >> iT += 1 >> endif >> >> Thanks. >> >> >> >> ------------------------------------------------------------ >> ------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> >> >> _______________________________________________ >> daetools-users mailing list >> dae...@li... >> https://lists.sourceforge.net/lists/listinfo/daetools-users >> > > |