Giter VIP home page Giter VIP logo

lacyccom's Introduction

@simatic-ax.lacyccom

Description

The following section shows a scenario for a possible application of the LAcycCom library:

With acyclic data exchange, contrary to cyclic communication, data transfer takes place when an explicit request is made, e.g. in order to read and write drive object parameters. Acyclic parameter access occurs parallel to the cyclic process data exchange. This saves resources, since the data is only requested on demand, i. e. when a parameter has to be transferred.The "Read data record" and "Write data record" services are available for acyclic data exchange.

According to the PROFIdrive profile, for drives in conformance with PROFIdrive, only one DPV1 (asynchronous PROFIBUS communication) request is permissible for each drive object and control unit for non-cyclic (acyclic) communication (parameter requests). If two or more DPV1 requests are simultaneously issued to a drive unit, conflicts can occur when processing the request in the drive unit. These conflicts then cause the different DPV1 requests to mutually interfere with one another. In order to prevent that such bus conflict occurs, it is the user’s responsibility to avoid that and a check must be made for each new DPV1 request whether another request is already active on the drive object involved. This is certainly the case if system functions are also used that are not exclusively intended to communicate to drive units via DPV1 services.

In order to relieve the user of this task a request management called Resource Manager exists that handles the management of DPV1 services for the user. This function is presented here. However, the introduction of this request management assumes as prerequisite that each function, which utilizes DPV1 services, will also actually use them.

Install this package

Enter:

apax add @simatic-ax/lacyccom

Namespace

Simatic.Ax.LAcycCom;

Objects

Example

USING Simatic.Ax.LAcycCom;

PROGRAM MyProgram
    VAR
        Resourcemanager         : OOPLAcycCom_ResourceManager;
        WriteParameterSingle    : LAcycCom_classWriteDriveSingleParams;
        ReadParameterSingle     : LAcycCom_classReadDriveSingleParams;
        WriteParameter          : LAcycCom_classWriteDriveParams;
        ReadParameter           : LAcycCom_classReadDriveParams;
        diagnostic : LAcycCom_ooptypeDrivediagnostics;
        RVALUEp304 : real;
        RVALUEp305 : real;
        RVALUEp310 : real;
        FirstCycle : Bool := TRUE;
        datasetitemread : LAcycCom_typeDriveDataset;
        datasetitemwrite : LAcycCom_typeDriveDataset;
        elements : int;
    END_VAR

    Resourcemanager.execute();

    ReadParameter.execute();
    ReadParameterSingle.execute();
    WriteParameter.execute();
    WriteParameterSingle.execute();

    If FirstCycle Then
        ReadParameter.Config(requestBuffer   := Resourcemanager);
        ReadParameterSingle.Config(requestBuffer   := Resourcemanager);
        WriteParameter.Config(requestBuffer   := Resourcemanager);
        WriteParameterSingle.Config(requestBuffer   := Resourcemanager);
    end_IF;

    CASE ReadParameter.Status() OF
        LAcycComstateDef#BUSY :
            ;

        LAcycComstateDef#IDLE :
            datasetitemread.parameterNumber := uint#304;
            elements := ReadParameter.AddatasetItem(datasetItem := datasetitemread,
                                                    element_no  := -1);

            datasetitemread.parameterNumber := uint#305;
            elements := ReadParameter.AddatasetItem(datasetItem := datasetitemread,
                                                     element_no := -1);

            ReadParameter.Start(driveObjectId  := uint#5,
                                hardwareId     := word#269);

        LAcycComstateDef#DONE :
            datasetitemread := ReadParameter.ReaddatasetItem(element_no := 0);
            RVALUEp304 := datasetitemread.Rvalue;
            datasetitemread := ReadParameter.ReaddatasetItem(element_no := 1);
            RVALUEp305 := datasetitemread.Rvalue;

        LAcycComstateDef#ERROR :
            diagnostic := ReadParameter.errordiagnostics();
    END_CASE;

    CASE ReadParameterSingle.Status() OF
        LAcycComstateDef#BUSY :
            ;

        LAcycComstateDef#IDLE :
            ReadParameterSingle.Start(  driveObjectId      := uint#5,
                                        hardwareId         := word#269,
                                        parameterNumber    := uint#310,
                                        index              := uint#0);

        LAcycComstateDef#DONE :
        RVALUEp310 := ReadParameterSingle.GetValueREAL();

        LAcycComstateDef#ERROR :
            diagnostic := ReadParameterSingle.errordiagnostics();
    END_CASE;

    CASE WriteParameter.Status() OF
        LAcycComstateDef#BUSY :
            ;

        LAcycComstateDef#IDLE :

            datasetitemwrite.parameterNumber := uint#2900;
            datasetitemwrite.Rvalue  := real#12.3;
            elements := WriteParameter.AddatasetItem(datasetItem := datasetitemwrite,
                                                      element_no := -1);

            datasetitemwrite.parameterNumber := uint#2901;
            datasetitemwrite.Rvalue  := real#45.6;
            elements := WriteParameter.AddatasetItem(datasetItem := datasetitemwrite,
                                                    element_no   := -1);

            WriteParameter.Start(driveObjectId  := uint#5,
                                 hardwareId     := word#269);

        LAcycComstateDef#DONE :
            ;

        LAcycComstateDef#ERROR :
            diagnostic := WriteParameter.errordiagnostics();
    END_CASE;

    CASE WriteParameterSingle.Status() OF
        LAcycComstateDef#BUSY :
            ;

        LAcycComstateDef#IDLE :
        WriteParameterSingle.Start( driveObjectId   := uint#5,
                                    hardwareId      := word#269,
                                    parameterNumber := uint#2930,
                                    value           := REAL#78.9,
                                    index           := uint#0);

        LAcycComstateDef#DONE :
            ;

        LAcycComstateDef#ERROR :
            diagnostic := WriteParameterSingle.errordiagnostics();
    END_CASE;

    FirstCycle := False;
END_PROGRAM

Contribution

Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests.

License and Legal information

Please read the Legal information

lacyccom's People

Contributors

beckersts avatar daviddko avatar reinerschinkoethe avatar simatic-ax-bot avatar sjuergen avatar thkindler avatar web-flow avatar

Stargazers

 avatar  avatar

Forkers

zantiu

lacyccom's Issues

State of Lacycom?

Hey guys, thanks for contributing...

but what's the current state of the library?

  • is it functionally in a state, so that we can publish it?
  • before publishing, we need to do some clearings (ECC, OSS, Patent)... I'll support you in this case
  • are there some open points?

Please give me a feedback.
@sjuergen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.