simulation

What is a Calendar Queue?

霸气de小男生 提交于 2019-12-31 21:36:11
问题 I am working on a building a discrete event simulator. Wikipedia mentioned that there are several general purpose priority queues that are good for use in DES's. Specifically, it mentions that a Calendar Queue is a good structure. I found one pdf (from 1988) that mentions Calendar Queues, but for the most part I can't find anything else out about them. Would someone mind explaining what Calendar Queue's are, how they're used, and where I might find a sample implementation? 回答1: A Google

What is a Calendar Queue?

北城余情 提交于 2019-12-31 21:35:49
问题 I am working on a building a discrete event simulator. Wikipedia mentioned that there are several general purpose priority queues that are good for use in DES's. Specifically, it mentions that a Calendar Queue is a good structure. I found one pdf (from 1988) that mentions Calendar Queues, but for the most part I can't find anything else out about them. Would someone mind explaining what Calendar Queue's are, how they're used, and where I might find a sample implementation? 回答1: A Google

Two-Phase Modelica Media example

こ雲淡風輕ζ 提交于 2019-12-30 07:18:06
问题 I am trying to develop a simulation in OpenModelica of a flow that has a single substance that will be liquid or vapor. The Modelica.Media.Water models do have two phases, but are extremely complicated, and would be very hard to reproduce for a completely different substance. I would like to find a simple example of a two phase medium that I can work from. There is a partial package TemplateMedium and a partial package PartialTwoPhaseMedium, but I don't see any examples of how to write a

Python leapfrog trajectory code

*爱你&永不变心* 提交于 2019-12-25 17:55:42
问题 I'm a physics student, but newbie in programming. Years ago I've learned how to do write a C code for a leapfrog integrator for a particle in gravitational field, but the memory is vague, and what I'm doing now is the writing code in Python for a leapfrog integrator for a particle in a certain magnetic field. Somebody told me Boris algorithm is better for this kind of simulation, but I decided first I would experiment with what I learned before, leapfrog integrator. But difference of syntax

Do something randomly within a certain time frame

ぃ、小莉子 提交于 2019-12-25 04:22:46
问题 I have a timer with interval of 1000 ms. I want to do something at random time but within a given time frame. E.g. If I specify the time frame to be for example 10 seconds, 1-10, 11-20, 21-30 and so on. This means that in the first 10 seconds something will happen between the 1st time frame 1 to 10 seconds at random. E.g. could happen in the 2nd second or the 8th second. Then again from 11 to 20 seconds something occurs again any time between the second time frame. E.g. this could be the 13th

How to structure an easily extensible Monte Carlo model in R

*爱你&永不变心* 提交于 2019-12-25 02:18:36
问题 I have a simple model for a company with two farms, growing two crops (apples and pears) on each farm. The first step is just to multiply the number of trees by the amount of fruit on each tree. The amount of fruit on each tree is simulated (across farms and crops). I face at least three decisions when modeling this in R: How to structure the variables How to simulate How to multiply a simulated variable with a non-simulated variable I want it to work even if I add another crop and/or farm -

Loop structure for basic simulation model in R

孤街浪徒 提交于 2019-12-24 23:22:40
问题 I'm trying to write a basic model that simulates the growth of a population (whose initial size is drawn randomly from a normal distribution) and then grows by a user defined amount each 'year' (currently 2 individuals in the code below for arguments sake). The output that is produced only shows the results of one simulation and, within this simulation, the population hasn't grown at all i.e. for each 'year' the population hasn't grown/doesn't add to the previous 'years' population. I'm

Ns3 - How to send WSMP packets in VANET periodically, through the CCH channel (wave-simple-device.cc edit)?

左心房为你撑大大i 提交于 2019-12-24 23:17:28
问题 I'm newbie with ns3. i wanted to simulate a vanet network with two nodes, in which a node send periodically (each 0.1 second) wsmp packet on the CCH channel. i used the code : wave-simple-device.cc and i did some modification in the following function: ''' void WaveNetDeviceExample::SendOneWsmpPacket (uint32_t channel, uint32_t seq) { Ptr<WaveNetDevice> sender = DynamicCast<WaveNetDevice> (devices.Get (0)); Ptr<WaveNetDevice> receiver = DynamicCast<WaveNetDevice> (devices.Get (1)); const

I want to make a virtual keyboard. Do I need to send WM_KEYDOWN to the current active window or HWND_BROADCAST?

不想你离开。 提交于 2019-12-24 19:53:56
问题 I am making an app that simulates a keyboard. I will do it by sending WM_KEYDOWN to a window, but I am not sure where to send the message. to the currently active window or to HWND_BROADCAST? Here is an other question I posted, related to this one. If I send a WM_KEYDOWN message (using wndproc) will the computer hold the key down until I send WM_KEYUP? 回答1: If make a generic virtual keyboard and not worry about which window is active (which is the window manager's business), you can use

Can't use palette to fill object with colour

会有一股神秘感。 提交于 2019-12-24 19:52:41
问题 I was trying to plot number of particles in a square lattice. and I need each one to be coloured different. So I tried using palette.. by picking some random numbers but it always gives me black rectangles.. what should I do? set obj rect from 1,5 to 2,6 fc palette 0.454545 → this is what is not working for me. This is the image with all same color. I need different colour for each particle: 回答1: Plot using the boxxyerror style, and fill the boxes: set size ratio -1 set style fill solid plot