VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Channel does not have write access error code -307665

I'm new to using Veristand and controlling it with python. I'm stuck trying to understand how I can fix an error I'm seeing with one specific control. My python script can successfully switch several other controls that are linked to PXI channels.

 

We are using Veristand to control the power supply of our test system. The main panel has an on/off control that is linked to a simulation model that controls the power supply. We can manually switch on the power supply by clicking on this control.

PowerOnM.jpg

PowerOnM_parameter.jpg

I'm using an Alias to refer to the control.

PowerOnM_alias.jpg

When I try to switch this control with python, I get an error message. It indicates that the channel does not have write access. I'm using slightly modified python code from a Veristand engine demo example. 

Hannes777_0-1732015092297.png

I assume that the engine demo example has something different regarding the control being used and the model it is linked to. I cannot figure out what to do to gain write access to the power supply parameter in the model. I found the information below that refers to model parameters, but I do not understand what it means for my problem, or if it is even related.

Veristand_restrictions_parameter.png

 

Below is the full error report:

d:\Python_code\Veristand\test_set_points.py::test_run_engine_set_points_python failed: def test_run_engine_set_points_python():
> set_engine_power(True)

test_set_points.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv\lib\site-packages\niveristand\_decorators.py:27: in ret_func
retval = func(*args, **kwargs)
.venv\lib\site-packages\niveristand\_decorators.py:71: in ret_func
return func(*args, **kwargs)
test_set_points.py:22: in set_engine_power
PowerOnM.value = on_off.value
.venv\lib\site-packages\niveristand\clientapi\_datatypes\rtprimitives.py:388: in value
_DefaultGatewayFactory.get_workspace2().set_single_channel_value(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <niveristand.clientapi._workspace2._Workspace2 object at 0x000002A649C42B80>
name = 'Aliases/PowerOnM', new_val = True

def set_single_channel_value(self, name, new_val):
"""
Sets the value of a single channel on the target.

Args:
name (str): The name of the channel. You must enter the full path to the channel as specified in the system
definition file.
new_val (float): The value to set.

Returns:
None:

"""
err = self._dot_net_instance.SetSingleChannelValue(name, new_val)
err = _Error(err)
if err.is_error:
> raise errors.VeristandError(
_errormessages.csharp_call_failed % (err.error_code, err.resolved_error_message)
)
E niveristand.errors.VeristandError: The call into the C# API failed with error code -307665. Message: NI VeriStand: Channel does not have write access.
E .

.venv\lib\site-packages\niveristand\clientapi\_workspace2.py:124: VeristandError

0 Kudos
Message 1 of 2
(46 Views)

You should use NIVeriStand.ModelManager2 class instead to read/write parameter.

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 2
(21 Views)