To add to this,
I have safety checks to add and a few other things which will start to get very messy. It could all be cleaned up and condensed into a 20 line or so script, however I see some issues with that.
Using a PV480 for reference and Power Vision 2.8 OEM.
IO Control
Digital outputs appear to be read only and can only be accessed with the IO Port Manager, which is fine, but wouldn't that mean I should be able to use the SendAction function? E.G.
Code: Select all
SendAction(ApplicationIDs.IO, ActionIDs.IO_Digital_Output_High, VariableIDs.IO_Digital_Output_1);
I tried this in another area and it wouldn't work, the only way I can toggle a output is by a setting up an event with the IO function defined as an action which I can call from a state machine or button press, but again this will not work.
Code: Select all
SendAction(ApplicationIDs.CCM, ActionIDs.CCM_Fire_Event, EventIDs.StartSigHigh);
Forcing me to use a state machine, activity program, or button press.
Stability With Timers
I think I can set up a timer using a state machine to increment a variable that can then be read from the script, however that would mean I'd have to sit in a loop within the script like this.
Code: Select all
int timerVar, timerMax;
smRead(VariableIDs.TimerVar, timerVar);
smRead(VariableIDs.TimerMax, timerMax);
SendAction(ApplicationIDs.CCM, ActionIDs.CCM_Start_Timer, VariableIDs.Start_Timer);
while (timerVar < timerMax);
SendAction(ApplicationIDs.CCM, ActionIDs.CCM_Stop_Timer, VariableIDs.Start_Timer);
With no way to delay the script I think this would be very resource intensive on the panel, also I'm not sure how threading works in the background and I'm not sure if sitting in a loop like this would prevent any UI feed back.
I haven't put a lot of time into writing this as a script because I've tried something similar before and the scripting side seems somewhat limited to what you can do even though the functions are available, which is a little disappointing.
Just looking for confirmation on working on the scripting side, I'd prefer to work with scripts rather than state machines due to increasing complexity but can work around it if it's not an option.