private void initialize() { if (cCOMM == null) { cCOMM = new COMM(); cCOMM.iStation_ID_Characters = new int[4]; cCOMM.iStation_ID_Characters[0] = 23; // X cCOMM.iStation_ID_Characters[1] = 10; // K cCOMM.iStation_ID_Characters[2] = 18; // S cCOMM.iStation_ID_Characters[3] = 15; // P cCOMM.buildStationID(); sStation_ID = cCOMM.sStation_ID; dFrequency = cCOMM.getFrequency(); } if (cNav_Master == null) { cNav_Master = new NAVmaster(); } if (cADM == null) { cADM = new AirDataModule(); } ProcessorPowerRequired = 50.0 * W_Per_Charge; BroadcastPowerRequired = 10.0 * W_Per_Charge; cADM.initialize(); iLastMetarUpdateTime = -1; dTime = 0.0; }
public void SdoWrite(ushort index, byte subindex, object value) { try { COMM.AsyncWrite(SlaveNumber, index, subindex, value); } catch (Exception err) { MessageBox.Show(err.ToString()); } }
public object SdoRead(ushort index, byte subindex) { COMM.AsyncRead(SlaveNumber, index, subindex); return(ObjectDictionary.GetItem(index, subindex).Value); }
public void SetRampType(short ramp_type) { COMM.AsyncWrite(SlaveNumber, 0x6086, 0, ramp_type); }
public void SetProfileDeceleration(uint deceleration) { COMM.AsyncWrite(SlaveNumber, 0x6084, 0, deceleration); }
public void SetProfileAcceleration(uint acceleration) { COMM.AsyncWrite(SlaveNumber, 0x6083, 0, acceleration); }
public void SetProfileVelocity(uint target_velocity) { COMM.AsyncWrite(SlaveNumber, 0x6081, 0, target_velocity); }
public override void OnUpdate() { initialize(); string ResName = "ElectricCharge"; double dPowerRequired = 10.0 * dW_to_EC; // 10 W is typical receive power for NAV radio double dElectric_Draw = dPowerRequired * TimeWarp.deltaTime; double elecAvail = 0.0; if (bOn) { elecAvail = part.RequestResource(ResName, dElectric_Draw) / dElectric_Draw; } bPowered = (elecAvail > 0.90); if (cRecv.vPosition.updatePositionData(vessel.mainBody, vessel.latitude, vessel.longitude, vessel.altitude)) { cNav_Master.updateReceiver(iReceiver_ID, cRecv); } //string sMsg = "Recv freq " + cRecv.getFrequency().ToString("000.00"); //print(sMsg); cNav_Master.onReceiverUpdate(); if (bPowered) { cTuned_Station = cNav_Master.getStation(iReceiver_ID); } else { cTuned_Station = null; } if (cTuned_Station != null) { if (cTuned_Station.getFlux(cRecv.vPosition) > 2.0e-9) { sTuned_Station = cTuned_Station.sStation_ID; dReceiver_Timer += Time.deltaTime; if (dReceiver_Timer > 15.0) { COMM cComm = cTuned_Station as COMM; if (cComm != null) { ScreenMessages.PostScreenMessage(cComm.sMessage, 10.0f, ScreenMessageStyle.UPPER_CENTER); } dReceiver_Timer = 0.0; } } else { dReceiver_Timer = 0.0; sTuned_Station = "---"; } } else { dReceiver_Timer = 0.0; sTuned_Station = "---"; } }