Compare commits

...

3 Commits

3 changed files with 13 additions and 4 deletions

View File

@ -41,14 +41,23 @@ nucon.set_dummy_mode(True)
# Read a parameter
core_temp = nucon.CORE_TEMP.value
print(f"Core Temperature: {core_temp}")
# >> Core Temperature: 500.0
# Read a parameter with an enum type
pump_status = nucon.COOLANT_CORE_CIRCULATION_PUMP_0_STATUS.value
print(f"Pump 0 Status: {pump_status}")
if nucon.COOLANT_CORE_CIRCULATION_PUMP_0_STATUS.value:
print('Pump 0 is active.')
# >> Pump 0 Status: PumpStatus.INACTIVE
# Write to a parameter
# Write to a parameter (has no effect in dummy mode)
nucon.RODS_POS_ORDERED.value = 50
print(f"Rods Position Ordered: {nucon.RODS_POS_ORDERED.value}")
# >> Rods Position Ordered: 50.0
# The repr of an attribute contains all contained info
nucon.CORE_TEMP
# >> NuconParameter(id='CORE_TEMP', value=500.0, param_type=float, writable=False)
```
## API Reference
@ -74,7 +83,7 @@ Class methods:
- `nucon.get_all_iter()`: Get all parameter values as a dictionary as a generator
- `nucon.get_multiple(params)`: Get values for multiple specified parameters
- `nucon.get_multiple_iter(params)`: Get values for multiple specified parameters as a generator
- `nucon.set_dummy_mode(dummy_mode)`: Enable or disable dummy mode for testing
- `nucon.set_dummy_mode(dummy_mode)`: Enable or disable dummy mode for testing. In dummy mode we won't connect to the game and just return sensible values for all params and allow but ignore all writes to writable parameters.
Custom Enum Types:
- `PumpStatus`: Enum for pump status (INACTIVE, ACTIVE_NO_SPEED_REACHED\*, ACTIVE_SPEED_REACHED\*, REQUIRES_MAINTENANCE, NOT_INSTALLED, INSUFFICIENT_ENERGY)

View File

@ -1 +1 @@
from nucon.core import *
from nucon.core import Nucon, PumpStatus, PumpDryStatus, PumpOverloadStatus, PumpOverloadStatus, CoreState, CoolantCoreState, RodsState, NuconParameter

View File

@ -99,7 +99,7 @@ class NuconParameter:
self.nucon.set(self, new_value, force)
def __repr__(self):
return f"NuconParameter(id='{self.id}', value={self.value}, type={self.param_type.__name__}, writable={self.is_writable})"
return f"NuconParameter(id='{self.id}', value={self.value}, param_type={self.param_type.__name__}, writable={self.is_writable})"
def __str__(self):
return self.id