<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ascend4.org/index.php?action=history&amp;feed=atom&amp;title=User%3AKarthik0112358%2Ftest_radau5</id>
	<title>User:Karthik0112358/test radau5 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ascend4.org/index.php?action=history&amp;feed=atom&amp;title=User%3AKarthik0112358%2Ftest_radau5"/>
	<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=User:Karthik0112358/test_radau5&amp;action=history"/>
	<updated>2026-04-28T23:28:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://ascend4.org/index.php?title=User:Karthik0112358/test_radau5&amp;diff=3012&amp;oldid=prev</id>
		<title>Karthik0112358 at 23:22, 19 August 2011</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=User:Karthik0112358/test_radau5&amp;diff=3012&amp;oldid=prev"/>
		<updated>2011-08-19T23:22:58Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:22, 19 August 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l45&quot;&gt;Line 45:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 45:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;test/common.h&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;test/common.h&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;/* Help taken from Shrikanth */&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/* a simple integrator reporter for testing */&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/* a simple integrator reporter for testing */&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;int test_radau5_reporter_init(struct IntegratorSystemStruct *integ){&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;int test_radau5_reporter_init(struct IntegratorSystemStruct *integ){&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki:diff:1.41:old-3010:rev-3012:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Karthik0112358</name></author>
	</entry>
	<entry>
		<id>https://ascend4.org/index.php?title=User:Karthik0112358/test_radau5&amp;diff=3010&amp;oldid=prev</id>
		<title>Karthik0112358: Created page with &#039;&lt;source lang=&quot;c&quot;&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdio.h&gt;  #include &lt;ascend/general/env.h&gt; #include &lt;ascend/general/ospath.h&gt; #include &lt;ascend/general/list.h&gt; …&#039;</title>
		<link rel="alternate" type="text/html" href="https://ascend4.org/index.php?title=User:Karthik0112358/test_radau5&amp;diff=3010&amp;oldid=prev"/>
		<updated>2011-08-19T22:47:33Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt; #include &amp;lt;string.h&amp;gt; #include &amp;lt;stdlib.h&amp;gt; #include &amp;lt;stdio.h&amp;gt;  #include &amp;lt;ascend/general/env.h&amp;gt; #include &amp;lt;ascend/general/ospath.h&amp;gt; #include &amp;lt;ascend/general/list.h&amp;gt; …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;ascend/general/env.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/general/ospath.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/general/list.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/general/ltmatrix.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;ascend/general/platform.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/utilities/ascEnvVar.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/utilities/error.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;ascend/compiler/ascCompiler.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/module.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/parser.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/library.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/symtab.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/simlist.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/instquery.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/parentchild.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/atomvalue.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/relation_io.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/reverse_ad.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/relation_util.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/mathinst.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/watchpt.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/initialize.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/name.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/visitinst.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/functype.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/safe.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/qlfdid.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/compiler/instance_io.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;ascend/compiler/slvreq.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;ascend/system/system.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/system/slv_client.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/solver/solver.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/system/slv_server.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/system/slv_param.h&amp;gt;&lt;br /&gt;
#include &amp;lt;ascend/integrator/integrator.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;test/common.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/* a simple integrator reporter for testing */&lt;br /&gt;
int test_radau5_reporter_init(struct IntegratorSystemStruct *integ){&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int test_radau5_reporter_write(struct IntegratorSystemStruct *integ){&lt;br /&gt;
	return 0; /* no interrupt */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int test_radau5_reporter_writeobs(struct IntegratorSystemStruct *integ){&lt;br /&gt;
	CONSOLE_DEBUG(&amp;quot;x = %f&amp;quot;, var_value(integ-&amp;gt;x));&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int test_radau5_reporter_close(struct IntegratorSystemStruct *integ){&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
IntegratorReporter test_radau5_reporter = {&lt;br /&gt;
	test_radau5_reporter_init&lt;br /&gt;
	,test_radau5_reporter_write&lt;br /&gt;
	,test_radau5_reporter_writeobs&lt;br /&gt;
	,test_radau5_reporter_close&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
	Test solving a simple IPOPT model&lt;br /&gt;
*/&lt;br /&gt;
static void test_boundary(){&lt;br /&gt;
&lt;br /&gt;
	struct module_t *m;&lt;br /&gt;
&lt;br /&gt;
	Asc_CompilerInit(1);&lt;br /&gt;
	Asc_PutEnv(ASC_ENV_LIBRARY &amp;quot;=models:solvers/conopt:solvers/qrslv:solvers/cmslv:solvers/ida:solvers/lsode:solvers/ipopt&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	/* load the file */&lt;br /&gt;
	char path[PATH_MAX];&lt;br /&gt;
	strcpy((char *)path,&amp;quot;test/radau5/&amp;quot;);&lt;br /&gt;
#define FILESTEM &amp;quot;boundaries&amp;quot;&lt;br /&gt;
	strncat(path, FILESTEM, PATH_MAX - strlen(path));&lt;br /&gt;
	strncat(path, &amp;quot;.a4c&amp;quot;, PATH_MAX - strlen(path));&lt;br /&gt;
	{&lt;br /&gt;
		int status;&lt;br /&gt;
		m = Asc_OpenModule(path,&amp;amp;status);&lt;br /&gt;
		CU_ASSERT_FATAL(status == 0);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	/* parse it */&lt;br /&gt;
	CU_ASSERT(0 == zz_parse());&lt;br /&gt;
&lt;br /&gt;
	/* find the model */&lt;br /&gt;
	CU_ASSERT(FindType(AddSymbol(FILESTEM))!=NULL);&lt;br /&gt;
&lt;br /&gt;
	/* instantiate it */&lt;br /&gt;
	struct Instance *siminst = SimsCreateInstance(AddSymbol(FILESTEM), AddSymbol(&amp;quot;sim1&amp;quot;), e_normal, NULL);&lt;br /&gt;
	CU_ASSERT_FATAL(siminst!=NULL);&lt;br /&gt;
&lt;br /&gt;
    CONSOLE_DEBUG(&amp;quot;RUNNING ON_LOAD&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	/** Call on_load */&lt;br /&gt;
	struct Name *name = CreateIdName(AddSymbol(&amp;quot;on_load&amp;quot;));&lt;br /&gt;
	enum Proc_enum pe = Initialize(GetSimulationRoot(siminst),name,&amp;quot;sim1&amp;quot;, ASCERR, WP_STOPONERR, NULL, NULL);&lt;br /&gt;
	CU_ASSERT(pe==Proc_all_ok);&lt;br /&gt;
&lt;br /&gt;
	/* create the integrator */&lt;br /&gt;
&lt;br /&gt;
	slv_system_t sys = system_build(GetSimulationRoot(siminst));&lt;br /&gt;
	CU_ASSERT_FATAL(sys != NULL);&lt;br /&gt;
&lt;br /&gt;
	IntegratorSystem *integ = integrator_new(sys,siminst);&lt;br /&gt;
	&lt;br /&gt;
	CU_ASSERT_FATAL(0 == integrator_set_engine(integ,&amp;quot;RADAU5&amp;quot;));&lt;br /&gt;
	CONSOLE_DEBUG(&amp;quot;Assigned integrator &amp;#039;%s&amp;#039;...&amp;quot;,integ-&amp;gt;internals-&amp;gt;name);&lt;br /&gt;
&lt;br /&gt;
	slv_parameters_t p;&lt;br /&gt;
	CU_ASSERT(0 == integrator_params_get(integ,&amp;amp;p));&lt;br /&gt;
	/* TODO set some parameters? */&lt;br /&gt;
&lt;br /&gt;
	/* perform problem analysis */&lt;br /&gt;
	CU_ASSERT_FATAL(0 == integrator_analyse(integ));&lt;br /&gt;
&lt;br /&gt;
	/* TODO assign an integrator reporter */&lt;br /&gt;
	integrator_set_reporter(integ, &amp;amp;test_radau5_reporter);&lt;br /&gt;
&lt;br /&gt;
	integrator_set_minstep(integ,0);&lt;br /&gt;
	integrator_set_maxstep(integ,0);&lt;br /&gt;
	integrator_set_stepzero(integ,0);&lt;br /&gt;
	integrator_set_maxsubsteps(integ,0);&lt;br /&gt;
&lt;br /&gt;
	/* set a linearly-distributed samplelist */&lt;br /&gt;
	double start = 0, end = 2.0;&lt;br /&gt;
	int num = 500;&lt;br /&gt;
	dim_type d;&lt;br /&gt;
	SetDimFraction(d,D_TIME,CreateFraction(1,1));&lt;br /&gt;
	SampleList *samplelist = samplelist_new(num+1, &amp;amp;d);&lt;br /&gt;
	double val = start;&lt;br /&gt;
	double inc = (end-start)/(num);&lt;br /&gt;
	unsigned long i;&lt;br /&gt;
	for(i=0; i&amp;lt;=num; ++i){&lt;br /&gt;
		samplelist_set(samplelist,i,val);&lt;br /&gt;
		val += inc;&lt;br /&gt;
	}&lt;br /&gt;
	integrator_set_samples(integ,samplelist);&lt;br /&gt;
&lt;br /&gt;
	CU_ASSERT_FATAL(0 == integrator_solve(integ, 0, samplelist_length(samplelist)-1));&lt;br /&gt;
&lt;br /&gt;
	integrator_free(integ);&lt;br /&gt;
	samplelist_free(samplelist);&lt;br /&gt;
	&lt;br /&gt;
	CU_ASSERT_FATAL(NULL != sys);&lt;br /&gt;
	system_destroy(sys);&lt;br /&gt;
	system_free_reused_mem();&lt;br /&gt;
&lt;br /&gt;
	/* destroy all that stuff */&lt;br /&gt;
	CONSOLE_DEBUG(&amp;quot;Destroying instance tree&amp;quot;);&lt;br /&gt;
	CU_ASSERT(siminst != NULL);&lt;br /&gt;
&lt;br /&gt;
	solver_destroy_engines();&lt;br /&gt;
	sim_destroy(siminst);&lt;br /&gt;
	Asc_CompilerDestroy();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/*===========================================================================*/&lt;br /&gt;
/* Registration information */&lt;br /&gt;
&lt;br /&gt;
#define TESTS(T) \&lt;br /&gt;
	T(boundary)&lt;br /&gt;
&lt;br /&gt;
REGISTER_TESTS_SIMPLE(solver_radau5, TESTS)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Karthik0112358</name></author>
	</entry>
</feed>