Hi Tim,

I think the API must be at a very low level, bits, bytes, memory addresses.

This would allow everyone to customize their application.

For example, if my application were in the "mechatronics" area, a high
percentage of queries would only refer to peripheral addresses (bits,
bytes, words), but if my application is for "processes", then I must
handle models
of abstract objects such as valves, motors, measurements all with
parameters, signals and associated events.

As for the second option, there are interesting projects that can serve as
a reference, such as EPICS [1] and the Milo project [2] used in PLC4X. The
interesting thing is that both projects define in their own way the way to
implement the highest level objects.

Best regards,

[1]. https://epics.anl.gov/
[2]. https://github.com/eclipse/milo

El mar., 15 oct. 2019 a las 7:21, Tim Kläsener (<
tim.klaese...@codecentric.de>) escribió:

> Hi everyone,
>
> I'm currently working on creating a frontend and REST interface for
> the PLC Simulator to control the different simulation modules for
> testing and presentation purposes.
> One question came up this morning with Chris about whether the backend
> should be more low level or high level.
> To clarify, the simulated PLC modules are basically just some objects
> with metadata (name etc.), some properties (basically a map with
> key/value pairs) and optionally some business logic and the question
> asked is how to best interact with them.
>
> Let me explain the question by the example of a simplified water tank
> with the following three properties:
>
> - VALVE_IN (boolean: true = open)
> - VALVE_OUT (boolean: true = open)
> - FILL_LEVEL (int: 0-100 percent)
>
> High-level API
> -------------------
> The high-level API would allow the simulation modules to expose the
> actions or states to be performed with them, e.g. you would call a
> REST endpoint like "PUT /simulator/water_tank_1/state/fill" and then
> the internal logic of the simulation module would change the
> properties of the water tank accordingly over time.
>
> Advantages:
> - Communication with the simulation modules via a defined set of
> actions, therefore the frontend wouldn't have to understand the
> meaning of individual properties.
> - Business logic in the simulation modules is based on defined set of
> actions, i.e. they don't have to look at all the different properties
> to derive how to properly simulate the real PLC's behaviour.
>
> Disadvantages:
> - Level of abstraction over the raw values, harder to simulate
> specific or even 'dangerous' states.
>
>
> Low-level API
> ------------------
> The low-level API would modify the properties of the water tank
> directly, e.g. you would call a REST endpoint like "PUT
> /simulator/water_tank_1" with a payload of
> "{
> VALVE_IN: false,
> VALVE_OUT: true,
> FILL_LEVEL: 50
> }"
> (or only some of the values).
>
> Advantages:
> - All properties are exposed: You could interact with everything and
> also construct potential invalid combinations to cover more cases.
> - Probably closest to how interfaces interact with real PLCs.
>
> Disadvantages:
> - To create complex business logic, any user of the API/the frontend
> would have to know how a business flow (e.g. "Fill water tank until
> it's full") translates into changes of the individual properties over
> time.
> - Alternatively, the simulation backend would have to react to any
> combination of the property values to figure out what to do.
>
>
> Personally, I would go for a combination of the two approaches, i.e.
> allow the mutation of the raw values from the low-level approach to be
> able to create the full set of valid and invalid states in the
> simulator - BUT this does not trigger any business logic (like setting
> VALVE_IN to true slowly raising the FILL_LEVEL). The complex business
> logic should only be triggered via a higher-level API to keep the
> complexity in the front-end low.
>
> Any opinions on the matter?
>
> Cheers and nice to digitally meet you all
>
> Tim
> (sorry, another one ;-) )
>


-- 
*CEOS Automatización, C.A.*
*GALPON SERVICIO INDUSTRIALES Y NAVALES FA, C.A.,*
*PISO 1, OFICINA 2, AV. RAUL LEONI, SECTOR GUAMACHITO,*

*FRENTE A LA ASOCIACION DE GANADEROS,BARCELONA,EDO. ANZOATEGUI*
*Ing. César García*
*Cel: 0416-681.03.99*

*Cel: 0414-760.98.95*

*Hotline Técnica SIEMENS: 0800 1005080*

*Email: support.aan.automat...@siemens.com
<support.aan.automat...@siemens.com>*

Reply via email to