Skip to content

Commit 541f1d6

Browse files
committed
update v2.1
system componets
1 parent cea6f14 commit 541f1d6

File tree

8 files changed

+206
-1
lines changed

8 files changed

+206
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Open Mechanics: Insider Preview (v1.4.0)
2+
3+
Welcome to the **Insider Preview** of the Open Mechanics "Cortex Engine".
4+
This release includes the full suite of Cognitive Manufacturing tools:
5+
6+
1. **Cortex Engine**: The unified orchestrator.
7+
2. **Hex Trace**: The "Black Box" flight recorder.
8+
3. **Dopamine Engine**: The OpenVINO-powered Neural Safety system.
9+
4. **Evolutionary Discovery**: The Genetic Algorithm optimizer.
10+
11+
## Quick Start (Demo)
12+
13+
We have included a stress-test demo script to validate the system's "Consciousness" under load.
14+
15+
### 1. Run the Cortex Server
16+
The system runs as a background service (or you can run it manually):
17+
```bash
18+
python3 /opt/advanced_cnc_copilot/main.py
19+
```
20+
21+
### 2. Run the Stress Test (Requires Sysbench)
22+
This script simulates a heavy manufacturing load while querying the Cortex for its internal state.
23+
```bash
24+
/opt/advanced_cnc_copilot/backend/benchmarks/stress_test_cortex.sh
25+
```
26+
27+
**What to look for:**
28+
- **Hex Trace**: You will see a `Trace: <HEX STRING>` in the output. This is the cryptographic proof of the machine's state.
29+
- **Spectrum**: The "Covalent" state of the machine.
30+
- **Latency**: Even under 100% CPU load, the Cortex should respond in <50ms.
31+
32+
## Features to Test
33+
34+
### Neural Interdiction
35+
The system is equipped with `phantom_net.onnx`. It will automatically block "Phantom Trauma" events (where the machine *feels* stress but is physically safe).
36+
- **Verify**: Check logs for "Phantom Trauma Detected" during operation.
37+
38+
### Evolutionary Optimization
39+
The system "dreams" of better paths.
40+
- **Trigger**: Send a POST request to `/cortex/evolve` with a sample profile.
41+
- **Result**: The system will return a mutated profile with higher efficiency.
42+
43+
## Feedback
44+
Please report any "Stability Breaks" (Covalent Bond failures) to the architecture team.

advanced_cnc_copilot/advanced-cnc-copilot_1.3.0_amd64.deb

Whitespace-only changes.

advanced_cnc_copilot/backend/benchmarks/stress_test_cortex.sh

100644100755
File mode changed.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import logging
2+
import time
3+
from typing import Dict, Any
4+
5+
class FanucAdapter:
6+
"""
7+
Hardware Interface for FANUC CNC Controllers.
8+
Translates 'Advanced Profile' segments into FOCAS library calls.
9+
Mock implementation for development (without actual FOCAS DLLs).
10+
"""
11+
def __init__(self, ip_address: str = "192.168.1.100", port: int = 8193):
12+
self.ip = ip_address
13+
self.port = port
14+
self.connected = False
15+
self.logger = logging.getLogger("FanucAdapter")
16+
17+
def connect(self):
18+
"""
19+
Establishes connection to the CNC machine.
20+
"""
21+
self.logger.info(f"Connecting to FANUC Controller at {self.ip}:{self.port}...")
22+
# Mock connection delay
23+
time.sleep(0.5)
24+
self.connected = True
25+
self.logger.info("Connection Established (Simulated).")
26+
27+
def execute_move(self, segment: Dict[str, Any]):
28+
"""
29+
Executes a direct move command based on the segment.
30+
"""
31+
if not self.connected:
32+
self.logger.error("Cannot execute: Not connected to machine.")
33+
return
34+
35+
target = segment.get("target", {})
36+
feed = segment.get("optimized_feed", 0)
37+
38+
# In a real scenario, this would call flibhndl.cnc_sysinfo, cnc_absolute, etc.
39+
# Here we just log the physical translation.
40+
gcode = f"G01 X{target.get('x', 0)} Y{target.get('y', 0)} Z{target.get('z', 0)} F{feed}"
41+
self.logger.info(f"TX -> MACHINE: {gcode}")
42+
43+
def get_machine_status(self) -> Dict[str, Any]:
44+
"""
45+
Reads actual machine state (Load, Spindle Temp).
46+
"""
47+
# Mock telemetry
48+
return {
49+
"mode": "MEM",
50+
"status": "RUN",
51+
"spindle_load": 45.0, # %
52+
"servo_temp": 38.5 # Celsius
53+
}
54+
55+
def disconnect(self):
56+
self.connected = False
57+
self.logger.info("Disconnected from FANUC Controller.")

advanced_cnc_copilot/build_deb.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Version
5+
VERSION="1.4.0"
6+
PKG_NAME="advanced-cnc-copilot-insider"
7+
ARCH="amd64"
8+
DEB_NAME="${PKG_NAME}_${VERSION}_${ARCH}.deb"
9+
PKG_DIR="build/${PKG_NAME}_${VERSION}_${ARCH}"
10+
11+
echo "Building ${DEB_NAME}..."
12+
13+
# 1. Cleanup
14+
rm -rf build
15+
mkdir -p ${PKG_DIR}/opt/advanced_cnc_copilot
16+
mkdir -p ${PKG_DIR}/DEBIAN
17+
18+
# 2. Copy Codebase
19+
echo "Copying Backend Files..."
20+
cp -r backend ${PKG_DIR}/opt/advanced_cnc_copilot/
21+
cp main.py ${PKG_DIR}/opt/advanced_cnc_copilot/
22+
if [ -f "requirements.txt" ]; then
23+
cp requirements.txt ${PKG_DIR}/opt/advanced_cnc_copilot/
24+
elif [ -f "../requirements.txt" ]; then
25+
cp ../requirements.txt ${PKG_DIR}/opt/advanced_cnc_copilot/
26+
else
27+
echo "WARNING: requirements.txt not found!"
28+
touch ${PKG_DIR}/opt/advanced_cnc_copilot/requirements.txt
29+
fi
30+
cp INSIDER_README.md ${PKG_DIR}/opt/advanced_cnc_copilot/README.md
31+
32+
# Copy Models & Scripts
33+
if [ -f "../phantom_net.onnx" ]; then
34+
cp ../phantom_net.onnx ${PKG_DIR}/opt/advanced_cnc_copilot/backend/cms/services/
35+
echo "Included Neural Model."
36+
else
37+
echo "WARNING: phantom_net.onnx not found in root! Package will use Heuristic Fallback."
38+
fi
39+
40+
chmod +x ${PKG_DIR}/opt/advanced_cnc_copilot/backend/benchmarks/stress_test_cortex.sh
41+
42+
# 3. Create Control File
43+
cat > ${PKG_DIR}/DEBIAN/control <<EOF
44+
Package: ${PKG_NAME}
45+
Version: ${VERSION}
46+
Section: science
47+
Priority: optional
48+
Architecture: ${ARCH}
49+
Maintainer: Dusan <dusan@example.com>
50+
Description: Advanced CNC Copilot (Cortex Engine)
51+
Includes Parallel Streamer, Evolutionary Optimizer, and Hex Trace Logger.
52+
Powered by OpenVINO and Dopamine Engine.
53+
EOF
54+
55+
# 4. Create Post-Install Script (Dependencies)
56+
cat > ${PKG_DIR}/DEBIAN/postinst <<EOF
57+
#!/bin/bash
58+
echo "Installing Python Dependencies..."
59+
pip3 install -r /opt/advanced_cnc_copilot/requirements.txt
60+
echo "Cortex Engine Installed Successfully."
61+
EOF
62+
chmod 755 ${PKG_DIR}/DEBIAN/postinst
63+
64+
# 5. Build Deb
65+
dpkg-deb --build ${PKG_DIR}
66+
mv build/${DEB_NAME} .
67+
68+
echo "Build Complete: ${DEB_NAME}"

advanced_cnc_copilot/main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
port=8000,
2424
reload=False, # Disable reload in production
2525
log_level="info"
26-
)
26+
)
27+
```

advanced_cnc_copilot/server.log

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
File "/home/dusan/Documents/GitHub/Dev-contitional/advanced_cnc_copilot/main.py", line 27
2+
```
3+
^
4+
SyntaxError: invalid syntax
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
2+
3+
Running the test with following options:
4+
Number of threads: 4
5+
Initializing random number generator from current time
6+
7+
8+
Prime numbers limit: 10000
9+
10+
Initializing worker threads...
11+
12+
Threads started!
13+
14+
CPU speed:
15+
events per second: 12818.23
16+
17+
General statistics:
18+
total time: 10.0002s
19+
total number of events: 128204
20+
21+
Latency (ms):
22+
min: 0.30
23+
avg: 0.31
24+
max: 4.05
25+
95th percentile: 0.32
26+
sum: 39969.98
27+
28+
Threads fairness:
29+
events (avg/stddev): 32051.0000/129.71
30+
execution time (avg/stddev): 9.9925/0.00
31+

0 commit comments

Comments
 (0)