Hi Sri I think you might possibly be using ASCEND in a way that it was not designed to be used. The idea of ASCEND is that you write all the equations for your model in the MODEL part of your model, and in the METHODS part of your model, you only write certain 'initialisation' commands. The job of solving your system of equations is given to the ASCEND solver, such as QRSlv. The mindset is more akin to creating a spreadsheet than writing a program with steps that are followed in sequence. Although the METHODS syntax includes certain procedural and conditional capability, it is not really intended that you should use METHODS for solving equations, in general.
If you could send us a sample file (perhaps you could 'boil the problem down' a little), it would help us greatly in solving your problem. Cheers JP T.Sri Hari Vikram wrote: > SRI: > > Dear Prof. Art, > > We brought all the calculations under a single method. All the 4 > non-linear equations were seperately placed before the methods because > it is not possible set of 4NLEs in methods. > We want to solve the 4NLEs in METHODS that too in loop to update and > solve in each iteration. Is it possible to call the equations which is > placed outside method by function inside the method for each iteration? > We have while loop for iteration in which the equation should be > available to solve the problem and update the values for each iteration. > But in ASCEND, how to place the equations inside the methods. > Is there any command for printing(i.e., saving) the value of the > variable in file? > Please help us in this regard. Thanks a lot. > > With Regards, > T.Sri Hari Vikram > > ----- Original Message ----- From: "Arthur W. Westerberg" > <[email protected]> > To: "John Pye" <[email protected]> > Cc: "T.Sri Hari Vikram" <[email protected]>; > <[email protected]> > Sent: Thursday, December 25, 2008 2:56 AM > Subject: Re: [Ascend-sim-users] Printing a variable in a loop - reg. > > >> Sri, >> >> John forwarded his reply so I will offer some ideas that could be >> useful also. >> >> 1. If you solve using the original GUI (run ascend4 rather than >> ascend), then you can create and run a script to setup and solve an >> existing model. >> >> 2. There is a tool in the Solver tool set to single step the solution. >> Note a single step is one step of the Newton Solve method. >> >> 3. So, if you learn enough Tcl to write a simple loop, you can create >> a script to single step a model until it converges. You can also >> write out the name and value of any variable in that script while >> inside that single stepping loop. >> >> To see what a script looks like that has such a loop, look at the file >> ..../models/westerberg/ivpNondimensional/ivpStepN.tcl. Also go online >> to find a manual for the Tcl language to learn how to write >> instructions using it. It is not that difficult. >> >> It should be useful for you to note that ASCEND itself will write a >> script that captures the steps you take when working with a model in >> ASCEND. The tool is in the SCRIPT window and is called >> Script/Edit/Record Actions (i.e., open the Script window, select the >> Edit tool set and then the tool called Record Actions. Select it to >> operate as you are playing with a model and watch it write the Tcl >> script that reproduces what you are doing. It will NOT write a script >> with a loop. But you can do a number of steps to see the >> corresponding Tcl, which should help you to produce the script you >> want. >> >> How to work with scripts is in the "Original Documentation." I attach >> the .pdf file referred to there. >> >> You should note that ASCEND solves a model by finding a sequence of >> irreducible blocks it can solve in sequence. So a single iteration is >> of the first irreducible block only and not of the entire model. When >> it converges, ASCEND then moves to the next block and iterates it, >> etc. You can force ASCEND to skip finding these irreducible blocks >> and to solve the entire model as a simultaneous set of nonlinear >> equations as one of the options available. If you wish more on this >> topic, ask me to explain in more detail. >> >> John has also added the ability to run a model using a python script >> in his pygtk version of the ASCEND GUI, but you will have to ask him >> for details on this. >> >> Art >> >> >> >> >> On Tue, Dec 23, 2008 at 7:22 PM, John Pye <[email protected]> wrote: >>> Hi Sri >>> >>> This depends a little bit on the solver being used, and also on the GUI >>> you're using. I think that with the Tcl/Tk GUI and the QRSlv solver, >>> you >>> might be able to achieve what you need, but I don't think that this >>> feature is implemented in the PyGTK GUI. >>> >>> I should note that the way the solver, eg QRSlv, operates is quite >>> independent from the way your variables and equations are defined. Just >>> because you define them in a FOR..CREATE loop doesn't mean they're >>> evaluated in the same order, etc. And if you are talking about the >>> METHODS in your model, then currently there is nothing to make specific >>> output of variables, although it is also a feature that we have >>> dicussed, something like a PRINTF statement -- is that perhaps what >>> you're looking for? >>> >>> Cheers >>> JP >>> >>> T.Sri Hari Vikram wrote: >>>> SRI: >>>> >>>> Dear John, >>>> >>>> How are you? >>>> How to print a variable used in ASCEND after every iteration? >>>> For e.g., a variable is calculated in a while loop(which runs as per >>>> condition specified). >>>> How to print the calculated variable after every iteration in the >>>> while loop. >>>> Say, while loop runs for 10 times. How to print the variable that is >>>> calculated in while loop to print 10 times after end of every >>>> iteration. >>>> >>>> Thanks, >>>> T. Sri Hari Vikram. >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Ascend-sim-users mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/ascend-sim-users >>> >> > ------------------------------------------------------------------------------ _______________________________________________ Ascend-sim-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ascend-sim-users

