Skip to main content

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.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prototwin 0.3.0
File Size Uploaded Provenance Actions
prototwin-0.3.0.tar.gz 6.6 kB Without provenance Details for prototwin-0.3.0.tar.gz

Release files / prototwin-0.3.0.tar.gz

Download URL prototwin-0.3.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
32aebd9715bddc27063712502319080ae4d0d1c14d928e4d527f38ef73ad8328
BLAKE2b-256 checksum
How to use checksums
b9c5d3535e78a42ee240c10e99b5f9e1b7b5030ab9b8bc8f7db446692ae5ae0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for prototwin 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page