Ligral is a textual simulation language as an alternative to Simulink. The goal of ligral is to describe simulation models with a set of statements instead of a graphic implementation. The syntax of ligral ensures equally powerful ability of model description. Meanwhile, ligral provides various solvers to solve the ode problems given by the interpreter.
We now have released v0.2.2 which is available at GitHub. Alternatively, you may also want to clone the source to your workspace and build ligral manually.
git clone https://github.com/jry-zheng/ligral.git
cd ligral
dotnet build
./bin/Debug/netcoreapp3.1/ligral
For detailed installation guide see Quick Start。
The main function of ligral absolutely is run a simulation project. The project name, usually a .lig
file name, should be the first positional parameter, like ligral path/file.lig
. Besides, many parameters are supported:
Parameters | Functions |
---|---|
[ProjectFileName] | Simulation project name, usually a .lig file or a .lig.json file. |
-s, --step-size [StepSize] | The step size of simulation, works only with fixed step solvers. |
-t, --stop-time [StopTime] | The total time when the solver should stop. |
-j, --json [bool]? | Toggle the input to be .lig.json file. Ligral parse the project as .lig file if this is not toggled |
-o, --output [Folder] | Redirect the output folder. |
The other commands that ligral supports include doc
, trim
, lin
and exm
, run ligral [command] --help
to see more about the usage.
If InnerPlotter
is enabled and Scope
or PhaseDiagram
is used in your project, you need python 3 to let them work. Packages numpy、matplotlib、pandas are also required.
Following is a mass-spring-damper system implemented by ligral.
# Define a route named MassSpringDamper
route MassSpringDamper(m, k, d, x0, v0; F; x, v)
F-k*x-d*v -> Gain{value:1/m} -> Integrator{initial:v0} -> v;
v -> Integrator{initial:x0} -> x;
end
# Define a step signal
Step[F]{start:3, level:5};
# Instantiate a MassSpringDamper object
MassSpringDamper[sys]{m:0.1, k:10, d:0.3, x0:1, v0: 0};
# Link models
F -> sys;
sys:x[position] -> Scope;
(sys:x, sys:v[velocity]) -> PhaseDiagram;
# Configure the solver
conf step_size = 0.001;
conf stop_time = 10;
# Redirect the output folder
conf output_folder = 'out';
More examples see examples.
See detailed syntax in User Guide, which are written in Chinese currently. If you are interested in ligral but cannot read Chinese, please contact me via zhengjry@outlook.com. Followings are completed:
We are working hard to write Development Guide. Now the followings are available with Chinese version.
If you found a bug please submit an issue.
Development plan:
if-else
, for
, while
statements and functions syntax for pre- and post-simulation process;此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.