package 'Decision Example' {
	import ScalarValues::*;
	
	attribute def BatteryCharged;
	
	part battery;
	part powerSystem;
	
	action def MonitorBattery (out charge : Real);
	action def AddCharge (in charge : Real);
	action def EndCharging;
	
	action def ChargeBattery {
		first start;

		then merge continueCharging;
		
		then action monitor : MonitorBattery {
			out batteryCharge : Real;
		}
		
		then decide;
			if monitor::batteryCharge < 100 then addCharge;
			if monitor::batteryCharge >= 100 then endCharging;
			
		action addCharge : AddCharge (batteryCharge);
		then continueCharging;
		
		action endCharging;
		then done;
	}
}