Lotka-Volterra Systems - ClassicModel

Gallery
Tutorial
Click on the image to view it full size
The Modelica By Example target code is:

model ClassicModel "This is the typical equation-oriented model"
  parameter Real alpha=0.1 "Reproduction rate of prey";
  parameter Real beta=0.02 "Mortality rate of predator per prey";
  parameter Real gamma=0.4 "Mortality rate of predator";
  parameter Real delta=0.02 "Reproduction rate of predator per prey";
  parameter Real x0=10 "Start value of prey population";
  parameter Real y0=10 "Start value of predator population";
  Real x(start=x0) "Prey population";
  Real y(start=y0) "Predator population";
equation
  der(x) = x*(alpha-beta*y);
  der(y) = y*(delta*x-gamma);
end ClassicModel;

The exported Modelica code is:


model ClassicModel
  parameter Real alpha(start=0.1,fixed=true);
  parameter Real beta(start=0.02,fixed=true);
  parameter Real gamma(start=0.4,fixed=true);
  parameter Real delta(start=0.02,fixed=true);
  parameter Real x0(start=10.0,fixed=true);
  parameter Real y0(start=10.0,fixed=true);
  Real x(start=10.0,fixed=true);
  Real y(start=10.0,fixed=true);
equation
  der(x)=x*(alpha-beta*y);
  der(y)=y*(delta*x-gamma);
end ClassicModel;
In the SysPhS version direct defaults as 'start' values were assigned to x and y instead of via x0 and y0 because:
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)
External links