Skip to content

Commit

Permalink
Merge pull request #125 from LEMS/experimental
Browse files Browse the repository at this point in the history
Some formatting changes in examples - note tests don't like xml heade…
  • Loading branch information
pgleeson authored Aug 13, 2024
2 parents 1e06f8f + 8539ec0 commit 722616f
Show file tree
Hide file tree
Showing 20 changed files with 236 additions and 545 deletions.
1 change: 1 addition & 0 deletions src/test/java/org/lemsml/jlems/test/ExamplesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void testExample10() throws ContentError, ConnectionError, RuntimeError,

public boolean executeExample(String filename) throws ContentError, ConnectionError, RuntimeError, ParseError, IOException, ParseException, BuildException, XMLException {
URL url = this.getClass().getResource("/"+filename);
System.out.println(" - Testing: "+url);
File f = new File(url.getFile());

FileInclusionReader fir = new FileInclusionReader(f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void testReadFromString() throws ParseException, BuildException,
File fdir = new File(url.getFile());

for (File fx : fdir.listFiles()) {
E.info("Testing: " + fx);
E.info(" >>> Testing: " + fx);
if (fx.isFile() && fx.getName().endsWith(".xml")) {
String stxt = FileUtil.readStringFromFile(fx);
XMLElementReader xmlReader = new XMLElementReader(stxt);
Expand All @@ -53,7 +53,7 @@ public void testReadFromString() throws ParseException, BuildException,
+ "'<Element a=\"val\"/>' and not '<Element a=\"val\"></Element>'");
}

assertEquals("Rewrite matches", sns.length(), tns.length());
assertEquals("Rewrite matches ("+fx+")", sns.length(), tns.length());
}
}
}
Expand Down
9 changes: 1 addition & 8 deletions src/test/resources/SimpleNetwork.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<Children name="connectivities" type="EventConnectivity"/>
</ComponentType>


<ComponentType name="Population">
<ComponentReference name="component" type="Component"/>
<Parameter name="size" dimension="none"/>
Expand All @@ -13,8 +12,6 @@
</Structure>
</ComponentType>



<ComponentType name="EventConnectivity">
<Link name="source" type="Population"/>
<Link name="target" type="Population"/>
Expand All @@ -23,17 +20,13 @@

<ComponentType name="ConnectionPattern"/>



<ComponentType name="AllAll" extends="ConnectionPattern">
<Structure>
<ForEach instances="../source" as="a">
<ForEach instances="../target" as="b">
<EventConnection from="a" to="b"/>
</ForEach>
</ForEach>
</ForEach>
</Structure>

</ComponentType>

</Lems>
25 changes: 2 additions & 23 deletions src/test/resources/SingleSimulation.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<Lems>


<ComponentType name="Display">
<Text name="title"/>
<Text name="title"/>
<Parameter name="xmin" dimension="none"/>
<Parameter name="xmax" dimension="none"/>
<Parameter name="ymin" dimension="none"/>
<Parameter name="ymax" dimension="none"/>

<Parameter name="timeScale" dimension="time"/>
<Children name="lines" type="Line"/>

<Simulation>
<DataDisplay title="title" dataRegion="xmin,xmax,ymin,ymax"/>
</Simulation>
</ComponentType>


<ComponentType name="Line">
<Parameter name="scale" dimension="*"/>
<Parameter name="timeScale" dimension="*"/>
Expand All @@ -27,49 +22,33 @@
</Simulation>
</ComponentType>


<ComponentType name="OutputFile">
<Text name="path"/>
<Text name="fileName"/>

<Children name="outputColumn" type="OutputColumn"/>

<Simulation>
<DataWriter path="path" fileName="fileName"/>
</Simulation>

</ComponentType>


<ComponentType name="OutputColumn">
<Path name="quantity"/>
<Simulation>
<Record quantity="quantity"/>
</Simulation>
</ComponentType>



<ComponentType name="Simulation">
<Parameter name="length" dimension="time"/>
<Parameter name="step" dimension="time"/>

<ComponentReference name="target" type="Component"/>


<Children name="displays" type="Display"/>

<Children name="outputs" type="OutputFile"/>

<Dynamics>
<StateVariable name="t" dimension="time"/>
</Dynamics>

<Simulation>
<Run component="target" variable="t" increment="step" total="length"/>
</Simulation>
</ComponentType>



</Lems>
</Lems>
3 changes: 1 addition & 2 deletions src/test/resources/elecdims.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
<Dimension name="conductance" m="-1" l="-2" t="3" i="2"/>
<Dimension name="capacitance" m="-1" l="-2" t="4" i="2"/>
<Dimension name="current" i="1"/>

</Lems>
</Lems>
10 changes: 4 additions & 6 deletions src/test/resources/ex2dims.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<Lems>

<Lems>
<Dimension name="voltage" m="1" l="2" t="-3" i="-1"/>
<Dimension name="time" t="1"/>
<Dimension name="per_time" t="-1"/>
Expand All @@ -8,8 +7,8 @@
<Dimension name="current" i="1"/>
<Dimension name="temperature" k="1"/>

<Unit symbol="mV" dimension="voltage" power="-3"/>
<Unit symbol="ms" dimension="time" power="-3"/>
<Unit symbol="mV" dimension="voltage" power="-3"/>
<Unit symbol="ms" dimension="time" power="-3"/>
<Unit symbol="pS" dimension="conductance" power="-12"/>
<Unit symbol="nS" dimension="conductance" power="-9"/>
<Unit symbol="uF" dimension="capacitance" power="-6"/>
Expand All @@ -19,5 +18,4 @@
<Unit symbol="pA" dimension="current" power="-12"/>
<Unit symbol="nA" dimension="current" power="-9"/>
<Unit symbol="degC" dimension="temperature" offset="273.15"/>

</Lems>
</Lems>
Loading

0 comments on commit 722616f

Please sign in to comment.