I'm trying to get NetLogo to run a function every 30 minutes. Can anyone suggest how to do this? Thanks.
The structure of go looks like this:
to go
get-data (run every 30 mins)
execute-and-return-decision-based-on-the-data-just-retrieved
end
Check out every. It makes sure the given command block runs at most once per time period. Anyway, if your go is being run by a forever button, then this should work:
to go
every 30 * 60 [
get-data
execute-and-return-decision-based-on-the-data-just-retrieved
]
end
Related
I would like to give the user a button that allows them to skip ahead 1 hour in the simulation and then continue running the model if play is clicked. The code below allows the user to skip ahead an hour, however they are unable to resume the simulation when play is clicked.
double nextHour = time() + 60;
pauseSimulation();
getEngine().runFast(nextHour); //Runs the model to the next hour when button is clicked
Any help much appreciated.
Try adding runSimulation() after the last line. But probably, that does not work. In that case:
Create a dynamic event (not the normal event) with the line runSimulation() in its action code.
In the button code, before the runFast... line, write create_MyDynamicEvent(1, HOUR). This will trigger the even 1 hour later and unpause the model.
AnyLogic Support suggested the following solution, which I have used:
Unfortunately, Ben's suggestion didn't didn't work; it seems to cause an issue when pauseSimulation() is used.
Autosys | JIL
i wish to run a job every 30 mins from 2100 till 0600 next day.
when i place the condition in jil for the job as below and try to upload
start_times: "21:00,21:30,22:00,22:30,23:00,23:30,00:00,00:30,01:00,01:30,02:00,02:30,03:00,03:30,04:00,04:30,05:00,05:30,06:00"
i get an error
start_times exceeds 255 bytes.
I think it will work like Piyush said. I would probably put it like this:
run_window: "21:00-06:00"
start_mins: "0,30"
If I remember correctly, you can also use the ":"
start_mins: ":0,:30"
check if :30 works, if not, try like Piyush suggested
run_window: "21:00-06:00"
start_mins: "0,30"
this was working , tested well
I was wondering if someone could help me. I want to introduce a 10 minute wait or time delay within my sahi script.
Can someone confirm the correct command to use?
Thanks in advance
Just have a look at the docs, the command you are looking for is _wait
https://sahipro.com/docs/sahi-apis/action-apis.html#Waits
Write _wait(parameter); where parameter is your the time in milli-seconds you want to introduce the delay for.
In your case try _wait(600000);
You can also use the setSpeed(parameter); API , in this case Sahi will wait for the time specified in milli-seconds as a parameter , after each task in the script. But I guess waiting 10 mins after each task is not your requirement.
You can use this method:
_wait($timeout, [$condition])
here $timeout is the duration you want to wait for. And $Condition is something that you can customize based on what condition you want to wait for.
Or you can just use the overloaded method _wait($timeout) if you want to wait for a specific duration.
You can also apply a conditional wait:
_wait(timeOut, _isVisible($element));
This will either wait till "timeOut" milliseconds, or till $element is visible. (whichever condition is satisfied earlier)
My code has one condition:
if ticks = 10^7 [ do-something ]
Now this condition is checked on every ticks though I know exactly when I have to execute the command. This might be slowing my code. The time extension does exactly this by time:go command. My command using time extension is:
time:schedule-event patches task do-something 1000000
But this throwing an error:
Extension exception: Attempted to schedule an event for tick 999999.0 which is before the present 'moment' of 1000000.0
error while observer running TIME:SCHEDULE-EVENT
called by procedure GO
called by Button 'go'
Is there something I am missing? Or any other efficient way to schedule some event at specific tick without checking the ticks condition every tick?
If this looks like a bug in the time extension, please post it at https://github.com/colinsheppard/time/issues
and tell us where we can find your code. (Or email it to me.)
I have created task on controller and there is loop which is loading for 100 times.
Now I want to load it for 25 times and pause that loop for 1 min and after that it will execute next 25 items same for next 25.
I have checked it with sleep but its not working.
Can you please advise me if is there any way on plugin event or any other method.
Thanks
This is actually unrelated to Joomla! Since you're creating a long running process you need to start it with something else than a browser. A CRON job is a good idea here if you want to execute this operation multiple times. Otherwise it can run via command line. Make sure the max_execution time setting of PHP does not cause any trouble.
If you still need this within Joomla please have a look at the CLI documentation.
https://docs.joomla.org/How_to_create_a_stand-alone_application_using_the_Joomla!_Platform