154) ГЕНЕРАТОР НЕПРЕРЫВНЫХ СЛУЧАЙНЫХ ВЕЛИЧИН154) GENERATOR OF CONTINUOUS RANDOM VALUES
Изобретение относитс к вычислительной технике и может быть использо вано в специализированных и универсальных вычислительных машинах при проведении машинных имитационных экспериментов , в которых требуетс моделировать непрерывную случайную величину Известен генератор непрерывных слу чайных величин, содержащий блоки пам ти , цифроаналоговый преобразователь датчик случайных чисел, генератор гар монического сигнала, интегратор, генератор линейного напр жени , сумматор , умножитель, логические элементы l . Недостатком генератора вл етс его сложность. Наиболее близким к предлагаемому вл етс генератор непрерывных случайных величин, содержащий блок пам ти , блок сравнени , элементы И, генератор напр жени , переключатель, индикатор, датчик случайных чисел, функциональный преобразователь 2д. Однако это устройство позвол ет получать случайные числа с неизменным диапазоном. Цель изобретени - расширение функциональных возможностей генератора за счет изменени диапазона моделируемых случайных чисел. Поставленна цель достигаетс тем, что генератор непрерывных случайных величин, содержащий генератор тактовых импульсов, выход которого соеди- нен со входом датчика случайных чисел и с первым входом первого элемента И, выход которого соединен с первым входом генератора ступенчатого напр жени , выход которого соединен с первым входом блока сравнени , второй вход которого через первый блок пам ти подключен к выходу второго элемента И, первый вход которого подключен к выходу датчика случайных чисел, введены второй и третий блоки пам ти третий элемент И, первый и второй элементы задержки, умножитель, сумматор , формирователь импульсов, счетчи дешифратор и триггер, счетный вход . которого через первьш элемент задерж ки подключен к выходу генератора так товых импульсов,- единичный выход триггера соединен со вторыми входами первого и второго элементов И, нулевой выход трриггера соединен с первым входом третьего элемента И, второй вход которого подключен к выходу дат чика слз айньгх чисат, выход блока сравнени соединен со вторым входом генератора ступенчатого напр жени , с управл ющим входом дешифратора и через второй элемент задержки со входом Установка счетчика, счетный вход которого через формировател импульсов подключен к выходу генератора ступенчатого напр жени , а -выход счетчика подключен ко входу дешифратора, выход которого соединен со входами второго и третьего блоков пам ти, выходы которых соединены соответственно с первыми входами сумматора и умножител , второй вход которого соединен с выходом тре тьего элемента И, а выход умножител соединен со вторым входом сумматора , выход которого вл етс выходо генератора. На чертеже приведена блок-схема. Генератор содержит генератор 1 тактовых импульсов, выход которого соединен со входом датчика 2 случайных чисел, равномерно распределенных в интервале (0,1),.через первый элемент 3 задержки со счетным входом триггера 4 и с первым входом первого элемента И 5, Выход датчика 2 случайных чисел соединен с первыми входами второго 6 и третьего 7 элементо И. Единичный выход триггера 4 соединен со вторыми входами первого 5 и второго 6 элементов И. Нулевой выход триггера. 4 соединен со вторым входом третьего элемента И- 7. Выход первого элемента И 5 роединен с первым входом генератора 8 ступенчатого напр жени . Выход второго элемента И 6 через первый блок 9 пам ти соединен с первым входом блока 10 сравнени , второй вход которого подключен к выходу генератор 8 ступенчатого напр жени и через формирователь 11 импул сов к счетному входу счетчика 12, вход Установка которого через второй элемент 13 задержки .соединен со входом генератора 8 ступенчатого 34 . . 4 напр жени , с управл ющим входом дешифратора 14 и с выходом блока 0 сравнеш . Выход счетчика 12 через дешифратор 14 соединен со входами второго 15 и третьего 16 блоков пам ти , выходы которых соединены с первыми входами умножител 17 и сумматора 18. Выход третьего элемента И 7 через умножитель соединен со входом сумматора 18, выход которого вл етс выходом устройства. Генератор 8 ступенчатого напр жe ffl последовательно, начина с исходного положени , при. котором напр жение на его выходе равно нулю, воспроизводит ступенчато возрастающее напр жение, пропорциональное величинам , Р , Р +Р7,... ,Р +Р,+. . .+,..., Р + + . „о+Ру, 1 В качестве генератора ступенчатого напр жени могут быть использованы блок переменных коэффициентов или электронньй мультикомпаратор, позвол ющие воспроизводить ступенчато возрастающие функции. Устройство работает следующим образом . В исходном положении триггера 4 элементы 5 и 6 открыты, элемент И 7 закрыт. Импульс, вырабатываемьш генератором 1 при пуске, проходит через элемен-т И 5 и запускает .генератор 8 ступенчатого напр жени , а также побуждает датчик 2 выдать случайное число R, которое проходит через элемент И б на вход блока 9 пам ти и на блок 10 сравнени . Этот же импульс через элемент 3 задержки поступает на триггер 4 и переключает его. При этом закрываютс элементы И 5 и 6 и открываетс элемент И 7, Врем задержки необходимо дл того, чтобы переключение элементов И не произошло раньше того, как будет запущен генератор 8 и случайное число R поступит на вход блока 9 пам ти, С выхода генератора 8 на второй вход блока 10 сравнени последовательно поступают скачки напр жени , значени которых пропорциональны величинам ( 1 ), В блоке 10 сравнени эти веичины в той же последовательности сравниваютс .с числом R, Блок 10 сравнени выдает сигнал только в том случае, когда удовлетвор етс одно из неравенств , -t-P,j, .. ..j ../p. Если удовлетвор етс неравенство ., то, в силу последовательности проверки неравенства(2} , этоозначает что выполн етс также неравенство Р...- .... С другой стороны, Р(,,--t-Pj- Я Р +Ра4-,.. ...-VP)-Pj. Блоки 11,12,14 предназначены дл то чтобы определить случайную величину Xс веро тностью Р и интервал(X -f-f-X Ступенчато возрастающее выходное напр жение генератора 8 подаетс на вход формировател 11 импульсов. При каждом скачке напр жени формирователь 11 выдает импульс. В качестве формировател импульсов можно использоватб дифференцирующее устройство . Импульсы накапливаютс в счеТ чике 12. Число накопленных в счетчик 12 импульсов вл етс адресом, по ко торому в блоках 15. и 16 записаны величины X;i и Хи4./| соответстве но. Содержимое -счетчика 12 подаетс в блоки 15 и 16 через дешифратор 14, Из блока 15 величина У поступает в сумматор 18, а из блока 16 величина .-Х в блок 17 умножени . 3 момент, когда выполн етс неравенство (3 , импульсов в счет чике 12 равно . В этот момент выходной сигнал блока 10 сравнени поступает на второй вход дешифратора 14 и разрешает выдачу адреса из счет чика 12 в блоки 14 и 15.Одновременно выходной сигнал блока сравнени поступает на вход генератора 8 ступен-so t The invention relates to computing and can be used in specialized and universal computers when conducting computer simulation experiments in which it is required to simulate a continuous random variable. A generator of continuous random variables containing memory blocks, a digital-to-analog converter, a random number generator, and a harmonic generator are known. signal, integrator, linear voltage generator, adder, multiplier, logic elements l. The disadvantage of the generator is its complexity. Closest to the present invention is a continuous random variable generator comprising a memory block, a comparison block, AND elements, a voltage generator, a switch, an indicator, a random number sensor, a functional converter 2d. However, this device allows to obtain random numbers with a constant range. The purpose of the invention is to expand the functionality of the generator by changing the range of simulated random numbers. The goal is achieved by the fact that a continuous random variable generator contains a clock pulse generator, the output of which is connected to the input of a random number sensor and the first input of the first element I, the output of which is connected to the first input of a step voltage generator, the output of which is connected to the first the input of the comparator, the second input of which through the first memory block is connected to the output of the second element I, the first input of which is connected to the output of the random number sensor, introduced the second and third memory blocks a third AND gate, the first and second delay elements, a multiplier, adder, pulse shaper, and COUNT decoder trigger count input. which, through the first delay element, is connected to the generator output of such pulses, - the single trigger output is connected to the second inputs of the first and second AND elements, the zero output of the trigger, is connected to the first input of the third And element, the second input of which is connected to the output of the SLZ uny ng sensor , the output of the comparator unit is connected to the second input of the step voltage generator, to the control input of the decoder and through the second delay element to the input of the meter installation, the counting input of which through the pulse shaper They are connected to the output of the step voltage generator, and the output of the counter is connected to the input of the decoder, the output of which is connected to the inputs of the second and third memory blocks, the outputs of which are connected respectively to the first inputs of the adder and multiplier, the second input to which is connected to the output of the third element And, and the output of the multiplier is connected to the second input of the adder, the output of which is the output of the generator. The drawing shows a block diagram. The generator contains a generator of 1 clock pulses, the output of which is connected to the sensor input 2 random numbers uniformly distributed in the interval (0.1), through the first delay element 3 with the counting input of the trigger 4 and the first input of the first element And 5, Sensor output 2 random numbers are connected to the first inputs of the second 6 and third 7 elements I. The unit output of the trigger 4 is connected to the second inputs of the first 5 and second 6 elements I. The zero output of the trigger. 4 is connected to the second input of the third element AND 7. The output of the first element 5 is connected to the first input of the 8-stage voltage generator. The output of the second element 6 through the first memory block 9 is connected to the first input of the comparator block 10, the second input of which is connected to the output of the 8-step voltage generator and through the pulse shaper 11 to the counting input of the counter 12, the input of which is set through the second delay element 13 . connected to the input of the generator 8 speed 34. . 4 voltages, with the control input of the decoder 14 and with the output of block 0, the same. The output of the counter 12 is connected via the decoder 14 to the inputs of the second 15 and third 16 memory blocks, the outputs of which are connected to the first inputs of the multiplier 17 and the adder 18. The output of the third element And 7 is connected through the multiplier to the input of the adder 18, the output of which is the output of the device. The generator 8 is a stepwise voltage ffl sequentially, starting from the initial position, at. wherein the voltage at its output is zero, reproduces a stepwise increasing voltage proportional to the values, P, P + P7, ..., P + P, +. . . +, ..., P + +. The "o + py, 1" As a step voltage generator, a block of variable coefficients or an electron multiparator can be used to reproduce stepwise increasing functions. The device works as follows. In the initial position of the trigger 4, the elements 5 and 6 are open, the element And 7 is closed. The impulse produced by the generator 1 at start-up passes through the element I 5 and starts the generator of 8-step voltage, and also causes the sensor 2 to issue a random number R which passes through the element Ib to the input of block 9 of memory and to block 10 compare. The same pulse through the element 3 of the delay enters the trigger 4 and switches it. At the same time, elements 5 and 6 are closed and element 7 is opened. The delay time is necessary so that switching of elements does not occur before generator 8 is started and a random number R arrives at the input of memory block 9, from generator output 8 To the second input of the comparison unit 10, voltage jumps are successively received, the values of which are proportional to the values (1). In comparison unit 10, these variables are compared in the same sequence with the number R, the comparison unit 10 outputs a signal only when one of the inequalities, -t-P, j, .. ..j ../p. If the inequality is satisfied., Then, by virtue of the sequence of checking inequality (2}, this means that the inequality P ...- .... is also satisfied. On the other hand, P (,, - t-Pj-I F + Pa4 -, .. ...- VP) -Pj. Blocks 11,12,14 are designed to determine a random value X with probability P and interval (X -ffX The step-increasing output voltage of the generator 8 is fed to the input of the driver 11 of pulses. At each voltage jump, driver 11 generates a pulse. A differentiator can be used as a pulse driver. The bins accumulate in the counter 12. The number of pulses accumulated in the counter 12 is the address over which the quantities X; i and Chi4 are recorded in blocks 15. and 16. The contents of the counter-12 are fed into blocks 15 and 16 through decoder 14, From block 15, the value of Y goes to the adder 18, and from block 16, the value of.-X to multiplication block 17. 3 the moment when the inequality holds (3, the pulses in the counter 12 is equal. At this moment the output signal of block 10 Comparison arrives at the second input of the decoder 14 and allows the issuance of the address from the counter 12 in blocks 14 and 15. At the same time you the reference signal of the comparison unit is fed to the input of the generator 8 steps-so t
чатого напр жени и через элемент 13 задержки на вход Установка счетчика 12. Под действием этого сигнала генератор 8 возвращаетс в исходное положение и очищаетс счетчик 12. Врем задержки необходимо дл завершени процесса в дешифраторе 14 и блоках 15 и 16 до того, как очиститс счетчик 12.voltage and through the input delay element 13. Installing the counter 12. Under the influence of this signal, the generator 8 returns to its original position and clears the counter 12. The delay time is necessary to complete the process in the decoder 14 and blocks 15 and 16 before the counter 12 is cleared .