caproto.ioc_examples.random_walk.RandomWalkIOC

class caproto.ioc_examples.random_walk.RandomWalkIOC(prefix, *, macros=None, parent=None, name=None)[source]
RandomWalkIOC pvproperties

Attribute

Suffix

Docs

Type

Notes

Alarm Group

dt

dt

float

x

x

float

Startup

Methods

group_read(instance)

Generic read called for channels without get defined

group_write(instance, value)

Generic write called for channels without put defined

Attributes

default_values

type_map

type_map_read_only

pvproperty methods

x.startup(self, instance, async_lib)

Periodically update the value

Source code: x.startup
10
11
12
13
14
15
16
17
18
19
20
21
    @x.startup
    async def x(self, instance, async_lib):
        'Periodically update the value'
        while True:
            # compute next value
            x = self.x.value + 2 * random.random() - 1

            # update the ChannelData instance and notify any subscribers
            await instance.write(value=x)

            # Let the async library wait for the next iteration
            await async_lib.library.sleep(self.dt.value)