Hi Steven, Thank you so much for your help. It worked. That was the mistake I had. I had (i,j) instead of [i,j]
Thanks again Pooja On Sat, Sep 10, 2016 at 12:23 PM, Pooja Bhalode <poojabhalod...@gmail.com> wrote: > Hi everyone, > > I am sorry about the confusion earlier, > I am trying to run Pyomo environment in Python on sublime text editor. > Python version of 2.7.11. I am running the code in sublime itself. > > The code is somewhat long, around 200 lines. > I can add snippets of it though. > > Code: > > m.z = ContinuousSet(bounds = (0,10)) > m.t = ContinuousSet(bounds = (0,10)) > where all the variables that I am defining, are varying along the z and t > direction. > > Variables: > m.C = Var(m.z,m.t) > m.Cair = Var(m.z,m.t) > m.masswater = Var(m.z,m.t) > m.massair = Param(initialize = 1833.50) > > that is C and Cair and all other variables are varying along z and t > direction. > > After this, when I define the equations, > > def _calculations(m,i,j): > if i == 0 or i == 1 or j == 0: > return Constraint.Skip > > return m.wateraccumulated(j) == 916.50 - (m.C(i,j)*46*28/(28*18*1.205 + > m.C(i,j) * 46*28))*2750 > > if i == 0: > return m.vel(i,j) == m.inmassflowrate/ ((m.outerdiameter * m.outerdiameter > * m.pi/4)*m.densityfeed) > if i == 1: > return m.vel(i,j) == m.outmassflowrate/((m.outerdiameter * > m.outerdiameter * m.pi/4)*m.densityfeed) > > return m.vel(i,j) == m.flowrate/((m.outerdiameter * m.outerdiameter * > m.pi/4)*m.densityfeed) > m.calculations = Constraint(m.z,m.t, rule = _calculations) > > It tells me that TypeError: 'IndexedVar' object is not callable for m.C > itself. I think the syntax is correct but I am not able to figure out why > the variable is not callable. > > I am aware that the language is slightly different than Python here, I am > just stuck and would appreciate any help here. > > On Fri, Sep 9, 2016 at 9:49 PM, Alex Kleider <aklei...@sonic.net> wrote: > >> On 2016-09-09 18:13, Steven D'Aprano wrote: >> >>> Please read this article first for >>> how you can improve the chances of getting good answers to your >>> questions: >>> >>> http://sscce.org/ >>> >> >> In addition to the link Seven provides above, I've also found the >> following to be worth perusing: >> http://www.catb.org/esr/faqs/smart-questions.html >> >> _______________________________________________ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change subscription options: >> https://mail.python.org/mailman/listinfo/tutor >> > > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor