Dynamical System - Train - Xholon App

What is it

This model implements a dynamical system in which a toy train starts up and stops.

It replicates a system modeled using Simulink and demonstrates how to model dynamical systems using Xholon.

How to use it

Run it:

  1. Run the Java application through the Xhn GUI (org.primordion.xholon.app.Xhn.java), and select File --> Open --> dynsys --> Train --> Train_xhn.xml.
  2. Expand the Controller node in the tree.
  3. Press the Start node.
  4. If you have JFreeChart installed you should see a chart identical to the one below showing the acceleration of the train's cars over time.

Dynamical System - Train Acceleration

Things to notice

In the acceleration graph you can see the effects the cars have on each other during acceleration and deceleration. This is done in Xholon by having the car, engine, and coupler, which are themselves xholons, communicating with each other via ports.

Things to try

In addition to the acceleration graph, you can output position/time or velocity/time. In Train_xhn.xml, select which one to output by placing 1, 2, or 3 in param name="PlotType" value="3"/>, then uncomment the appropriate labels to appear on the graph.

Change the mass of the train by editing CompositeStructureHierarchy.xml. If you set it to 100kg the train will not travel so far.

Change the length of time for the train to run by editing Train_xhn.xml (param name="MaxProcessLoops" value="1000"/>).

Try changing the value of timeStepMultiplier in XhTrain.java. The default value is IIntegration.M_8, which means that it will break each time step into 8 smaller intervals. This is Xholon's approach to implementing an Euler-type numerical integration. Compare what happens if the value is set to M_4, M_2, M1, or M_32.

Xholon features

This application produces smooth and continuous graphical outputs using discretized blocks of XholonTime.

Credits and references

source: Simulink Modeling Tutorial, Train System http://www.library.cmu.edu/ctms/ctms/simulink/model/model.htm