コード例 #1
0
    def setup_api(self):

        from rackio import Rackio

        app = Rackio()

        resource = MappingResource(self.serialize_mappings())
        app.add_route("/api/modbus/mappings", resource)
コード例 #2
0
import time

from random import random

from rackio import Rackio, TagEngine
from rackio_swagger import RackioSwagger
from rackio.managers import VISITOR_ROLE

app = Rackio()

RackioSwagger(app)

tag_egine = TagEngine()

# Tags definitions

tag_egine.set_tag("T1", "float")
tag_egine.set_tag("T2", "float")
tag_egine.set_tag("T3", "float")

tag_egine.set_tag("RAND1", "float")
tag_egine.set_tag("RAND2", "float")


@app.rackit(1)
def writer1():

    tag_egine.write_tag("T1", 15)
    tag_egine.write_tag("T2", 40)

    direction = 1
コード例 #3
0
    def on_back(self):

        self.count = 0

    def while_state1(self):

        self.count += 1

        logging.warning("{}: {}".format(self.name, self.count))

    def while_state2(self):

        self.count -= 1

        logging.warning("{}: {}".format(self.name, self.count))

app = Rackio()

machine1 = TwoStep("machine 1")
machine2 = TwoStep("machine 2")

app.append_machine(machine1, 1, "async")
app.append_machine(machine2, 2, "async")

if __name__ == "__main__":

    app.set_log(file="app.log")
    app.run()

コード例 #4
0
import time

from rackio import Rackio, TagEngine
from rackio.models import Tag
from rackio.controls import ValueAction, Condition, Control

from random import random

app = Rackio()

tag_egine = TagEngine()

# Tags definitions

tag_egine.set_tag("RAND1", "float")
tag_egine.set_tag("RAND2", "float")
tag_egine.set_tag("T1", "float")
tag_egine.set_tag("T2", "float")
tag_egine.set_tag("T3", "float")

# Conditions definitions

cond1 = Condition("T1", ">=", "T2")
cond2 = Condition("T1", "<", "T2")

# Actions definitions

act1 = ValueAction("T3", 40)
act2 = ValueAction("T3", 80)

# Controls Definitions
コード例 #5
0
import time

from random import random

from rackio import Rackio, TagEngine
from rackio_admin import RackioAdmin

app = Rackio()

RackioAdmin(app)

tag_egine = TagEngine()

# Tags definitions

tag_egine.set_tag("T1", "float")
tag_egine.set_tag("T2", "float")
tag_egine.set_tag("T3", "float")


@app.rackit(1)
def writer1():

    tag_egine.write_tag("T1", 15)
    tag_egine.write_tag("T2", 40)

    direction = 1

    while True:

        time.sleep(0.5)
コード例 #6
0
ファイル: example11.py プロジェクト: crivero7/RackioAI
from rackio_AI import RackioEDA, RackioAI, Preprocessing
from rackio import Rackio

app = Rackio()

RackioAI(app)

EDA1 = RackioEDA(name='EDA1', description='Object 1 Exploratory Data Analysis')

EDA2 = RackioEDA(name='EDA2', description='Object 2 Exploratory Data Analysis')

RackioAI.append_data(EDA1)

RackioAI.append_data(EDA2)

preprocess1 = Preprocessing(name='Preprocess1',
                            description='preprocess for data',
                            problem_type='regression')

preprocess2 = Preprocessing(name='Preprocess2',
                            description='preprocess for data',
                            problem_type='classification')

RackioAI.append_preprocessing_model(preprocess1)

RackioAI.append_preprocessing_model(preprocess2)

print(RackioAI.summary())
コード例 #7
0
import time

from rackio import Rackio, TagEngine
from rackio import RackioModel, TextField

app = Rackio()


@app.define_table
class Car(RackioModel):

    name = TextField()


@app.rackit(1)
def function():

    time.sleep(0.5)

    Car.create(name="Lamborghini Huracan")


# app.set_db(dbfile="tags.db")

if __name__ == "__main__":

    app.run()
コード例 #8
0
import time

from rackio import Rackio, TagEngine
from rackio.models import Tag
from rackio.controls import MathAction, Condition, Control

from random import random

app = Rackio()

tag_egine = TagEngine()

# Tags definitions

tag_egine.set_tag("RAND1", "float")
tag_egine.set_tag("RAND2", "float")
tag_egine.set_tag("T1", "float")
tag_egine.set_tag("T2", "float")
tag_egine.set_tag("T3", "float")
tag_egine.set_tag("T4", "float")
tag_egine.set_tag("T5", "float")

# Conditions definitions

cond1 = Condition("T1",">=", "T2")
cond2 = Condition("T1","<", "T2")

# Actions definitions

act1 = MathAction("T3", "T1 + T2")
act2 = MathAction("T3", "2 * T2 - T1")
コード例 #9
0
        if self.count == 4:
            self.forward()

    def while_state2(self):

        self.count += 1

        T1 = self.begin.T1
        T2 = self.begin.T2

        self.end.T3 = T1 + T2
        self.end.T4 = T1 - T2

        logging.warning("{}: {}".format(self.name, self.count))
        if self.count >= 10:
            self.back()

app = Rackio()

RackioSwagger(app)

machine = TwoStep("machine")

app.append_machine(machine, 1)

if __name__ == "__main__":

    app.set_log(file="app.log")
    app.run()

コード例 #10
0
import time

from rackio import Rackio, TagEngine
from rackio.managers import ADMIN_ROLE, VISITOR_ROLE
from rackio.controls import MathAction, Condition, Control
from rackio.alarms import HI, LO

from random import random
from math import sin

app = Rackio()

tag_egine = TagEngine()

# Tags definitions

tag_egine.set_tag("RAND1", "float")
tag_egine.set_tag("SINE_WAVE", "float")
tag_egine.set_tag("T1", "float")
tag_egine.set_tag("T2", "float")
tag_egine.set_tag("T3", "float")
tag_egine.set_tag("T4", "float")
tag_egine.set_tag("T5", "float")
tag_egine.set_tag("ALARM1", "bool")
tag_egine.set_tag("ALARM2", "bool")

tag_egine.set_tag("message", "str")

# Conditions definitions

cond1 = Condition("T1", ">=", "T2")
コード例 #11
0
import time

from random import random

from rackio import Rackio, TagEngine
from rackio_socket import RackioSocket

app = Rackio()

RackioSocket(app)

tag_egine = TagEngine()

# Tags definitions

tag_egine.set_tag("T1", "float")
tag_egine.set_tag("T2", "float")
tag_egine.set_tag("T3", "float")


@app.rackit(1)
def writer1():

    tag_egine.write_tag("T1", 15)
    tag_egine.write_tag("T2", 40)

    direction = 1

    while True:

        time.sleep(0.5)
コード例 #12
0
import time

from random import random

from rackio import Rackio, TagEngine
from rackio_swagger import RackioSwagger

app = Rackio()

RackioSwagger(app)

tag_egine = TagEngine()

# Tags definitions

tag_egine.set_tag("T1", "float")
tag_egine.set_tag("T2", "float")
tag_egine.set_tag("T3", "float")

@app.rackit(1)
def writer1():

    tag_egine.write_tag("T1", 15)
    tag_egine.write_tag("T2", 40)

    direction = 1

    while True:

        time.sleep(0.5)
コード例 #13
0
import time

from rackio import Rackio, TagEngine
from rackio.controls import MathAction, Condition, Control
from rackio.alarms import HI, LO

from random import random
from math import sin

app = Rackio()

tag_egine = TagEngine()

# Tags definitions

tag_egine.set_tag("RAND1", "float")
tag_egine.set_tag("SINE_WAVE", "float")
tag_egine.set_tag("T1", "float")
tag_egine.set_tag("T2", "float")
tag_egine.set_tag("T3", "float")
tag_egine.set_tag("T4", "float")
tag_egine.set_tag("T5", "float")
tag_egine.set_tag("ALARM1", "bool")
tag_egine.set_tag("ALARM2", "bool")

tag_egine.set_tag("message", "str")

# Conditions definitions

cond1 = Condition("T1", ">=", "T2")
cond2 = Condition("T1", "<", "T2")