'############## 'Electricity Script '############## 'Controls Bus Electicity and tells the systems 'if the busbar is active or not '(c) 13.06.2009 Marcel Kuhnt ' modified for Hamburg addon Darius Bode 2012 'Script Version: 1.0 'Omsi release: 1.0 'Needs: '- engine 'Revision History: '- Marcel Kuhnt 13.06.2009 File Created '- Rüdiger Hülsmann 23.12.2010 L.L.elec_busbar_avail = 1 by init 'Attention: '============ 'All voltages are measured without units. '1.0 means 100% of the normal voltage, 0.0 means no voltage. '-------------------------------------------------------------- {macro:Elec_Init} 'At the beginning, battery has enough voltage: 1.0 (S.L.elec_V_battery) (L.L.elec_busbar_avail) {end} {macro:Elec_Frame} 'If engine's RPM is high enough, generator will become active: (L.L.generator_failure) ! (L.L.engine_on) && {if} (L.L.engine_n) (C.L.elec_generator_minRPM) > (S.L.elec_V_generator) {endif} 'Battery's voltage decrease while main busbar switch is on (but only to zero ;-) ) (L.L.elec_busbar_main_sw) (L.L.lights_beleuchtung_vorn) || (L.L.lights_beleuchtung_hinten) || (L.L.lights_fahrerlicht) || {if} (L.L.elec_V_battery) (L.S.Timegap) (C.L.elec_battery_duration) / - 0 max (S.L.elec_V_battery) {endif} 'Fast decrease when generator failure and engine running (L.L.engine_on) (L.L.generator_failure) && {if} (L.L.elec_V_battery) (L.S.Timegap) (C.L.elec_battery_duration) 400 / / - 0 max (S.L.elec_V_battery) (L.L.elec_V_battery) 0 = {if} 1 (S.L.engine_failure_general) {endif} {endif} 'But battery's voltage instantly grows up to the level of the generator voltage (L.L.generator_failure) ! {if} (L.L.elec_V_battery) (L.L.elec_V_generator) max (S.L.elec_V_battery) {endif} 'If the battery voltage is above minimum and there is no electricity failure, the busbar becomes available (L.L.elec_V_battery) (C.L.elec_busbar_Vmin) >= (L.L.elec_failure_general) ! && {if} 1 (S.L.elec_busbar_avail) {else} 0 (S.L.elec_busbar_avail) {endif} 'If the battery or generator has voltage and if the switch is on and if there is no electricity failure, 'the main busbar will become active: (L.L.elec_busbar_avail) (L.L.elec_busbar_main_sw) && (L.L.elec_failure_general) ! && (S.L.elec_busbar_main) {end}