Skip to content

Commit

Permalink
Merge pull request #17 from andystevens91/master
Browse files Browse the repository at this point in the history
Update startmas.sh and ReadME.md in Examples folder, edit active_dali_wi.pl to reduce CPU usage
  • Loading branch information
giodegas committed Nov 9, 2017
2 parents 952beb5 + d1e171a commit e8cbf55
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 214 deletions.
4 changes: 3 additions & 1 deletion Examples/ReadME.md
Expand Up @@ -13,7 +13,9 @@ The examples are divided into two subfolders:
With Linux if you need to start the MAS during debug many times, you can avoid the server error, with the following command

sudo sysctl net.ipv4.tcp_tw_recycle=1


(Note: this does not work if you have kernel version >= 4.12. See [this](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4396e46187ca5070219b81773c4e65088dac50cc) for more information.)

### Line command editor with memory
With Linux, Mac OS X when you start the MAS from the shell, the user agent may not have memory of the commands already sent. You can install rlwrap:

Expand Down
14 changes: 8 additions & 6 deletions Examples/advanced/startmas.sh
@@ -1,28 +1,29 @@
#exec 1>/dev/null # @echo off
clear # cls
#title "MAS"
sicstus_home=/usr/local/sicstus4.2.3
sicstus_home=/usr/local/sicstus4.3.5
#sicstus_home=/usr/local/sicstus4.2.3
main_home=../..
dali_home=../../src
conf_dir=conf
prolog="$sicstus_home/bin/sicstus"
WAIT="ping -c 4 127.0.0.1"
WAIT="ping -c 4 127.0.0.1"
instances_home=mas/instances
types_home=mas/types
build_home=build

rm -rf tmp/*
rm -rf build/*
rm -f work/*.txt # remove everything if you want to clear agent history
rm -f work/* # remove everything if you want to clear agent history
rm -rf conf/mas/*

# Build agents by creating a file with the instance name containing the type content for each instance.
for instance_filename in $instances_home/*.txt
do
do
type=$(<$instance_filename) # agent type name is the content of the instance file
type_filename="$types_home/$type.txt"
instance_base="${instance_filename##*/}" # e.g. 'mas/instances/agent1.txt' -> 'agent1.txt'
echo $type_filename
echo $type_filename
cat $type_filename >> "$build_home/$instance_base"
done

Expand All @@ -42,7 +43,8 @@ do
agent_base="${agent_filename##*/}"
echo "Agente: $agent_base"
xterm -e "./conf/makeconf.sh $agent_base $dali_home" &
xterm -hold -e "./conf/startagent.sh $agent_base $prolog $dali_home" &
xterm -T "$agent_base" -hold -e "./conf/startagent.sh $agent_base $prolog $dali_home" &
sleep 2s
$WAIT > /dev/null # %WAIT% >nul
done

Expand Down

0 comments on commit e8cbf55

Please sign in to comment.