Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- decimal Best_Output;
- bool Base_Found;
- bool Reverse;
- bool Reverse_Pause;
- void Main(string argument)
- {
- IMySolarPanel Solar_1 = GridTerminalSystem.GetBlockWithName("Solar1") as IMySolarPanel;
- IMyMotorStator Rotor_Base = GridTerminalSystem.GetBlockWithName("Rotor Base") as IMyMotorStator;
- IMyMotorStator Arm_1 = GridTerminalSystem.GetBlockWithName("Arm 1") as IMyMotorStator;
- IMyMotorStator Arm_2 = GridTerminalSystem.GetBlockWithName("Arm 2") as IMyMotorStator;
- IMyTimerBlock Check_Timer = GridTerminalSystem.GetBlockWithName("Check Timer") as IMyTimerBlock;
- IMyTimerBlock Angle_Timer = GridTerminalSystem.GetBlockWithName("Angle Timer") as IMyTimerBlock;
- List<string> Solar_Info;
- Solar_Info = new List<string>(Solar_1.DetailedInfo.Split(new string[] {" ","\n","\r"}, StringSplitOptions.None));
- if(argument == "Check")
- {
- Best_Output = Convert.ToDecimal(Solar_Info[5]);
- if(Best_Output < (decimal)115.00)
- {
- Base_Found = false;
- Reverse = false;
- Reverse_Pause = false;
- Rotor_Base.GetActionWithName("OnOff_On").Apply(Rotor_Base);
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- else
- {
- Check_Timer.GetActionWithName("Start").Apply(Check_Timer);
- }
- }
- else if(argument == "Angle")
- {
- decimal Output = Convert.ToDecimal(Solar_Info[5]);
- if(Base_Found == false)
- {
- if(Reverse == false)
- {
- if(Output > Best_Output)
- {
- Best_Output = Output;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- else
- {
- Rotor_Base.GetActionWithName("Reverse").Apply(Rotor_Base);
- Reverse = true;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- }
- else
- {
- if(Reverse_Pause == false)
- {
- Reverse_Pause = true;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- else
- {
- if(Output > Best_Output)
- {
- Best_Output = Output;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- else
- {
- Rotor_Base.GetActionWithName("OnOff_Off").Apply(Rotor_Base);
- Arm_1.GetActionWithName("OnOff_On").Apply(Arm_1);
- Arm_2.GetActionWithName("OnOff_On").Apply(Arm_2);
- Reverse = false;
- Reverse_Pause = false;
- Base_Found = true;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- }
- }
- }
- else
- {
- if(Reverse == false)
- {
- if(Output > Best_Output)
- {
- Best_Output = Output;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- else
- {
- Arm_1.GetActionWithName("Reverse").Apply(Arm_1);
- Arm_2.GetActionWithName("Reverse").Apply(Arm_2);
- Reverse = true;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- }
- else
- {
- if(Reverse_Pause == false)
- {
- Reverse_Pause = true;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- else
- {
- if(Output > Best_Output)
- {
- Best_Output = Output;
- Angle_Timer.GetActionWithName("Start").Apply(Angle_Timer);
- }
- else
- {
- Arm_1.GetActionWithName("OnOff_Off").Apply(Arm_1);
- Arm_2.GetActionWithName("OnOff_Off").Apply(Arm_2);
- Check_Timer.GetActionWithName("Start").Apply(Check_Timer);
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement