-
Notifications
You must be signed in to change notification settings - Fork 0
Class for scpn-simulator application.
License
michal-josef-spacek/App-SCPN-Simulator
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
NAME App::SCPN::Simulator - Base class for scpn-simulator script. SYNOPSIS use App::SCPN::Simulator; my $app = App::SCPN::Simulator->new; $app->run; METHODS "new()" Constructor. "run()" Run method. Returns undef. ERRORS new(): new: Cannot load %s module From Class::Utils::set_params(): Unknown parameter '%s'. EXAMPLE1 use strict; use warnings; use App::SCPN::Simulator; use File::Temp; use IO::Barf qw(barf); # Scenario. my $scenario = <<'END'; { "conditions": { "in_1" : { "title" : "First input" }, "in_2" : { "title" : "Second input" }, "in_3" : { "title" : "Third input" }, "out" : { "title" : "Output" } }, "events":{ "run":{ "title": "Run", "class": "run", "input_edges":[ {"condition":"in_1"}, {"condition":"in_2","count":2}, {"condition":"in_3","count":2} ], "output_edges":[ {"condition":"out"} ] } }, "case":{ "in_1":{ "init_config_1":{"value":"bullet"}, "init_config_2":{"value":"bullet"} }, "in_2":{ "init_config_1":{"value":"bullet"}, "init_config_2":{"value":"bullet"} }, "in_3":{ "init_config_1":{"value":"bullet"}, "init_config_2":{"value":"bullet"}, "init_config_3":{"value":"bullet"} }, "out":{ "init_config":{"value":"bullet"} } } } END my $temp_scenario = File::Temp->new->filename; barf($temp_scenario, $scenario); # Arguments. @ARGV = ( '-v', $temp_scenario, ); # Run. App::SCPN::Simulator->new->run; # Application is running. EXAMPLE2 use strict; use warnings; use App::SCPN::Simulator; use File::Temp; use IO::Barf qw(barf); # Scenario. my $scenario = <<'END'; { "conditions": { "spring" : { "title" : "Spring" }, "summer" : { "title" : "Summer" }, "autumn" : { "title" : "Autumn" }, "winter" : { "title" : "Winter" } }, "events":{ "t0":{ "title": "t0", "class": "t0", "input_edges":[ {"condition":"spring"} ], "output_edges":[ {"condition":"summer"} ] }, "t1":{ "title": "t1", "class": "t1", "input_edges":[ {"condition":"summer"} ], "output_edges":[ {"condition":"autumn"} ] }, "t2":{ "title": "t2", "class": "t2", "input_edges":[ {"condition":"autumn"} ], "output_edges":[ {"condition":"winter"} ] }, "t3":{ "title": "t3", "class": "t3", "input_edges":[ {"condition":"winter"} ], "output_edges":[ {"condition":"spring"} ] } }, "case":{ "spring":{ "init_config_1":{"value":"bullet"} } } } END my $temp_scenario = File::Temp->new->filename; barf($temp_scenario, $scenario); # Arguments. @ARGV = ( '-t', '-v', $temp_scenario, ); # Run. App::SCPN::Simulator->new->run; # Application is running. EXAMPLE3 use strict; use warnings; use App::SCPN::Simulator; use File::Temp; use IO::Barf qw(barf); # Scenario. my $scenario = <<'END'; { "conditions": { "car_red" : { "title" : "RED for car" }, "car_yellow" : { "title" : "YELLOW for car" }, "car_green" : { "title" : "GREEN for car" }, "p0" : { "title" : "" }, "p1" : { "title" : "" }, "person_green" : { "title" : "GREEN for person" }, "person_red" : { "title" : "RED for person" } }, "events":{ "t0":{ "title": "", "class": "t0", "input_edges":[ {"condition":"car_green"} ], "output_edges":[ {"condition":"p0"}, {"condition":"car_red"} ] }, "t1":{ "title": "", "class": "t1", "input_edges":[ {"condition":"car_red"}, {"condition":"p1"} ], "output_edges":[ {"condition":"car_yellow"} ] }, "t2":{ "title": "", "class": "t2", "input_edges":[ {"condition":"car_yellow"} ], "output_edges":[ {"condition":"car_green"} ] }, "t3":{ "title": "", "class": "t3", "input_edges":[ {"condition":"p0"}, {"condition":"person_red"} ], "output_edges":[ {"condition":"person_green"} ] }, "t4":{ "title": "", "class": "t4", "input_edges":[ {"condition":"person_green"} ], "output_edges":[ {"condition":"person_red"}, {"condition":"p1"} ] } }, "case":{ "car_red":{ "init_config_1":{"value":"bullet"} }, "p0":{ "init_config_1":{"value":"bullet"} }, "person_red":{ "init_config_1":{"value":"bullet"} } } } END my $temp_scenario = File::Temp->new->filename; barf($temp_scenario, $scenario); # Arguments. @ARGV = ( '-t', '-v', $temp_scenario, ); # Run. App::SCPN::Simulator->new->run; # Application is running. DEPENDENCIES Class::Utils, English, File::Temp, Getopt::Std, Mojo::Exception, SCPN::Engine::Simple, SCPN::Schema::GraphViz, Tk, Tk::PNG. AUTHOR Michal Josef Špaček <mailto:skim@cpan.org> <http://skim.cz> LICENSE AND COPYRIGHT © 2017-2022 Michal Josef Špaček BSD 2-Clause License VERSION 0.01
About
Class for scpn-simulator application.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published