ProtoTwin Connect Client
This package provides a simple client that can be used to interface with ProtoTwin Connect.
Basic Example
# STEP 1: Import the ProtoTwin client
import prototwin
import asyncio
import os
import math
# STEP 2: Define your signal addresses (obtain these from your ProtoTwin model)
simulation_time_address = 0
motor_target_velocity_address = 3
async def main():
# STEP 3: Start ProtoTwin Connect, load and initialize the model
path = os.path.join(os.path.dirname(__file__), "example.ptm")
client = await prototwin.start()
await client.load(path)
await client.initialize()
# STEP 4: Create the simulation loop
while True:
t = client.get(simulation_time_address) # Read signal values
client.set(motor_target_velocity_address, math.sin(t)) # Write signal values
await client.step() # Step the simulation forward in time
asyncio.run(main()) # Run the simulation loop
Metadata
Release files for prototwin 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| prototwin-0.2.1.tar.gz | 5.1 kB | Details |
Release files / prototwin-0.2.1.tar.gz
| Download URL | prototwin-0.2.1.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20e0c3b7e2c0c5bea7515a07a1696a33af4cdc7c2e3bd22583e4bf2fad63eaff
|
|
BLAKE2b-256 checksum How to use checksums |
7793cf70b4ccf143efb9184b96b4a67dae548d3a9f2d68f935e5c8e11d2781ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|