simulation

Netlogo Programming question - Chemical Equilibrium temperature and pressure implementation

Hi I am trying to code something in Netlogo..I am using an existing model Chemical Equilibrium and am trying to implement the following: turtles-own [speed ] ask turtles [ ;; set velocity ( ambient-temperature = 30 ) ;; fd velocity if temp > 40 [ "speed" increases of turtles ] ifelse temperature < 30 [ speed of turtles decrease...

All things equal what is the fastest way to output data to disk in C++?

I am running simulation code that is largely bound by CPU speed. I am not interested in pushing data in/out to a user interface, simply saving it to disk as it is computed. What would be the fastest solution that would reduce overhead? iostreams? printf? I have previously read that printf is faster. Will this depend on my code and i...

Netlogo programming question - turtle that has no effect on other turtles implementation but speeds up the reaction

Hi I am using an existing model in netlogo called Chemical Equilibrium and am adding some more code I want to add turtles (catalyst) which have no effect on the reaction/other turtles but speeds up the FORWARD reaction. note: forward reaction has been defined as follows to react-forward [t] ask t [ set color red ] set color green rt...

How can I write simulations in Erlang?

Hi guys, I want to do some numerical stuff in Erlang like this: You've got an array with the following values: [2,3,4] In each iteration, you calculate 0.1 * [n-1] + 0.7 *[n] + 0.2 * [n+1] This becomes the new [n]. If n == 0 then [n-1] = 0. If [n] == length of array then [n] = 0. So I try an example: [2,3,4] calculations:...

Netlogo programming question - is it possible to put balanced chemical equations in a model?

hi I was wondering if it was possible to put balanced chemical equations, and if possible including state symbols, in the existing netlogo model that i am using, i havenot seen any examples in the models library so was not sure if it was possible. I wanted the model to be able to allow the user to input a balanced chemical equilibrium ...

netlogo programming question - catalyst implementation part 2

hi the catalyst speeds up the reaction but remains unchanged after the reaction has taken place i tried the following code breed [catalysts catalyst] breed [chemical-x chemical-x] ;then the forward reaction is sped up by the existence of catalysts to react-forward let num-catalysts count catalysts ;speed up by num-catalysts...

Random Number generator function ran2 Numerical Recipes

Hi, Given that we start the call to the function ran2 with a negative integer [the seed] it will produce a series of random numbers. The sequence can be regenerated exactly if the same seed is used. Now my question is that is there a way that we can directly enter into some point in the sequence and then continue from that point onwar...

Which data structure(s) to back a Final Fantasy ATB-style queue? (a delay queue)

Situation: There are several entities in a simulated environment, which has an artificial notion of time called "ticks", which has no link to real time. Each entity takes it in turns to move, but some are faster than others. This is expressed by a delay, in ticks. So entity A might have a delay of 10, and B 25. In this case the turn orde...

Which physical open source simulation methods worth to port to GPU

Hi, I am writing a report, and I would like to know, in your opinion, which open source physical simulation methods (like Molecular Dynamics, Brownian Dynamics, etc) and not ported yet, would be worth to port to GPU or another special hardware that can potentially speedup the calculation. Links to the projects would be really appreciat...

Elegant way of parsing Data files for Simulation

I am working on this project where I need to read in a lot of data from .dat files and use the data to perform simulations. The data in my .dat file looks as follows: DeviceID InteractingDeviceID InteractionStartTime InteractionEndTime 1 2 1101 1105 1,2 1101 and 1105 are tab delimited and ...

Javascript event simulation library

Do you know a JS library for dom events simulation? I know that this operation can be done but i can't find any library to do it. UPDATE: I try to explain better my question. Javascript can simulate events like the user click, i'm looking for a library that helps me with this operation. ...

Unable to change the value of the variable

I'm using a discrete event simulator called ns-2 that was built using Tcl and C++. I was trying to write some code in TCL: set ns [new Simulator] set state 0 $ns at 0.0 "puts \"At 0.0 value of state is: $state\"" $ns at 1.0 "changeVal" $ns at 2.0 "puts \"At 2.0 values of state is: $state\"" proc changeVal {} { global state gl...

NetLogo 4.1 - implementation of a motorway ( Problem creating collision of cars )

Hi there, I am trying to create a simulation of motorway and the behaviour of the drivers in NetLogo. I have some questions that I m struggling to solve. Here is my code: globals [ selected-car ;; the currently selected car average-speed ;; average speed of all the cars look-ahead ] turtles-own [ speed ;; the...

Ideas on simulating webservices for local automated testing.

I am testing an app, which talks to different webservices over the internet. For my automated testing, I don't want to go over the network. To achieve this, I need to simulate the webservice on my machine using another app. My initial thought is to record all the requests and responses between client and webservice, and then just write ...

Algorithms for City Simulation?

I want to create a city filled with virtual creatures. Say like Sim City, where each creature walks around, doing it's own tasks. I'd prefer the city to not 'explode' or do weird things -- like the population dies off, or the population leaves, or any other unexpected crap. Is there a set of basic rules I can encode each agent with so...

What is the standard way to parse floats at runtime in C?

Hello, I have a scientific application for which I want to input initial values at runtime. I have an option to get them from the command line, or to get them from an input file. Either of these options are input to a generic parser that uses strtod to return a linked list of initial values for each simulation run. I either use the co...

Plot multiple files

Hi I'd like to make an animation that illustrates the positions of some agents I'm simulating under Linux. Basically, I have some files named file00001.dat, file00002.dat and so on. I have to generate "something" that get files in order, and output an animated gif, a dynamic graph or whatever, that simulates the moving reading data f...

Python: Traffic-Simulation (cars on a road)

Hello! I want to create a traffic simulator like here: http://www.doobybrain.com/wp-content/uploads/2008/03/traffic-simulation.gif But I didn't thougt very deep about this. I would create the class car. Every car has his own color, position and so on. And I could create the road with an array. But how to tell the car where to go? Co...

open source smooth particle hydrodynamics

Anyone know of any open source libraries for particle based large scale smooth particle hydrodynamics. I am looking for a easier way of simulating large scale planetary body impacts with rotation. I was also wondering if you had any ideas on how to visualize the output from said simulation. I have tried using IBM graphviz, but it is ver...

I'm trying to simulate a directly mapped cache in java. Any ideas on which data structure to use to represent the cache?

I'm trying to simulate a directly mapped cache in java. Any ideas on which data structure to use to represent the cache? ...