diff --git a/Thermo.Active.Config/Config/Recipes/template.json b/Thermo.Active.Config/Config/Recipes/template.json
new file mode 100644
index 00000000..a63cae56
--- /dev/null
+++ b/Thermo.Active.Config/Config/Recipes/template.json
@@ -0,0 +1 @@
+{"RecipeName":"template.json","RecipeParameters":{"general_sizes_mould_dim_x":400.0,"general_sizes_mould_dim_y":150.0,"general_sizes_mould_max_height":0.0,"general_sizes_mould_min_height":0.0,"general_sizes_mould_base_height":0.0,"general_sizes_sheet_material":0.0,"general_sizes_sheet_dim_x":0.0,"general_sizes_sheet_dim_y":0.0,"general_sizes_sheet_thickness":3.0,"general_sizes_plate_type":0.0,"general_sizes_plate_dim_x":1000.0,"general_sizes_plate_dim_y":900.0,"general_sizes_frame_traverses":0.0,"general_sizes_frame_dim_x":1100.0,"general_sizes_frame_dim_y":600.0,"general_sizes_upperplate_max_height":0.0,"general_area_working_dxsx":0.0,"positions_mould_lower_position":150.0,"positions_mould_lower_speed":350.0,"positions_mould_intermediate_position":800.0,"positions_mould_upper_position":850.0,"positions_mould_upper_speed":350.0,"positions_mould_upperdeceleration_position":820.0,"positions_mould_upperdeceleration_speed":150.0,"positions_mould_lowerdeceleration_position":830.0,"positions_mould_lowerdeceleration_speed":150.0,"positions_frame_lower_position":40.0,"positions_frame_lower_speed":500.0,"positions_frame_upper_position":980.0,"positions_frame_upper_speed":450.0,"positions_frame_intermediate_position":700.0,"positions_frame_intermediate_speed":400.0,"positions_frame_unload_position":650.0,"positions_upperplate_lower_position":245.0,"positions_upperplate_lower_speed":150.0,"positions_upperplate_upper_position":1150.0,"positions_upperplate_upper_speed":350.0,"positions_upperplate_upperdeceleration_position":270.0,"positions_upperplate_upperdeceleration_speed":150.0,"positions_upperplate_lowerdeceleration_position":250.0,"positions_upperplate_lowerdeceleration_speed":50.0,"cycle_forming_type":0.0,"cycle_forming_pause_cycle":0.0,"cycle_forming_cooling_enabled":0.0,"cycle_forming_blowingbox_enabled":0.0,"cycle_acrylicframe_enabled":0.0,"cycle_acrylicframe_time":4000.0,"cycle_upperoverheating_enabled":0.0,"cycle_upperoverheating_time":15000.0,"cycle_crystallisation_type":0.0,"cycle_crystallisation_time":0.0,"cycle_loader_enable":0.0,"cycle_loader_lifter_lowerposition_delay":0.0,"cycle_loader_lifter_upperposition_delay":0.0,"cycle_loader_split_sheet_time":0.0,"cycle_loader_ejector_position":400.0,"cycle_loader_pallet_height":110.0,"cycle_loader_center_x":0.0,"cycle_loader_center_y":1.0,"cycle_loader_checktichness_enabled":0.0,"cycle_loader_suckers_vacuum":1.0,"cycle_loader_ionizer_enabled":1.0,"cycle_loader_manualunloading_enabled":0.0,"heats_lowerheaters_max_time":20000.0,"heats_lowerheaters_movement_enabled":1.0,"heats_lowerheaters_enabled":1.0,"heats_lowerheaters_oscillation":0.0,"heats_upperheaters_max_time":20000.0,"heats_upperheaters_movement_enabled":1.0,"heats_upperheaters_enabled":1.0,"heats_upperheaters_oscillation":0.0,"heats_decomsustain_type":1.0,"heats_decomsustain_decompression_flow":50.0,"heats_decomsustain_min_blowing_time":300.0,"heats_decomsustain_sustain_delay":1000.0,"heats_decomsustain_decompression_delay":1000.0,"heats_decomsustain_decompression_duration":1000.0,"heats_decomsustain_smoke_function_enabled":0.0,"pyrometer_pyrometer_enabled":1.0,"pyrometer_pyrometer_setpoint":250.0,"pyrometer_pyrometer_delay":10000.0,"pyrometer_upperthermoregulator_start_adjustment":100.0,"pyrometer_upperthermoregulator_end_adjustment":200.0,"pyrometer_upperthermoregulator_min_percentage":70.0,"pyrometer_upperthermoregulator_max_percentage":100.0,"pyrometer_upperthermoregulator_sleep_enabled":1.0,"pyrometer_upperthermoregulator_sleep_percentage":25.0,"pyrometer_lowerthermoregulator_start_adjustment":100.0,"pyrometer_lowerthermoregulator_end_adjustment":200.0,"pyrometer_lowerthermoregulator_min_percentage":70.0,"pyrometer_lowerthermoregulator_max_percentage":100.0,"pyrometer_lowerthermoregulator_sleep_enabled":1.0,"pyrometer_lowerthermoregulator_sleep_percentage":25.0,"pyrometer_upperthermoregulator_sleep_temperature":0.0,"pyrometer_upperthermoregulator_working_temperature":0.0,"pyrometer_lowerthermoregulator_sleep_temperature":0.0,"pyrometer_lowerthermoregulator_working_temperature":0.0,"drawing_type":4.0,"drawing_height":100.0,"drawing_delay":2000.0,"drawing_1_chart_setpointx":6000.0,"drawing_1_chart_setpointy":100.0,"drawing_photocell":1.0,"drawing_mantaining_flow":20.0,"drawing_manual":50.0,"drawing_mould_up_delay":3000.0,"upperplate_cycle_type":1.0,"upperplate_cycle_delay":0.0,"upperplate_cycle_time":3000.0,"upperplate_air_enable":0.0,"upperplate_air_delay":0.0,"upperplate_air_max_time":0.0,"upperplate_air_1_chart_setpointx":0.0,"upperplate_air_1_chart_setpointy":0.0,"upperplate_air_2_chart_setpointx":0.0,"upperplate_air_2_chart_setpointy":0.0,"upperplate_air_3_chart_setpointx":0.0,"upperplate_air_3_chart_setpointy":0.0,"upperplate_air_manual":0.0,"upperplate_vacuum_enable":0.0,"upperplate_vacuum_delay":0.0,"upperplate_vacuum_max_time":0.0,"upperplate_vacuum_1_chart_setpointx":0.0,"upperplate_vacuum_1_chart_setpointy":0.0,"upperplate_vacuum_2_chart_setpointx":0.0,"upperplate_vacuum_2_chart_setpointy":0.0,"upperplate_vacuum_3_chart_setpointx":0.0,"upperplate_vacuum_3_chart_setpointy":0.0,"upperplate_vacuum_manual":0.0,"upperplate_extraction_enable":0.0,"upperplate_extraction_delay":0.0,"upperplate_extraction_1_chart_setpointx":0.0,"upperplate_extraction_1_chart_setpointy":0.0,"upperplate_extraction_manual":0.0,"cooling_blowing_type":4.0,"cooling_blowing_delay":5000.0,"cooling_blowing_time":10000.0,"cooling_pyrometer_enabled":0.0,"cooling_pyrometer_setpoint":50.0,"cooling_pyrometer_delay":8000.0,"cooling_nebulizer_type":1.0,"cooling_nebulizer_delay":2000.0,"cooling_nebulizer_time":2000.0,"cooling_telescopic_enable":0.0,"cooling_telescopic_position":0.0,"cooling_telescopic_swing_enable":0.0,"cooling_telescopic_swing_stroke":0.0,"cooling_shutter_1_opening_perc":0.0,"cooling_shutter_2_opening_perc":0.0,"cooling_shutter_3_opening_perc":0.0,"cooling_shutter_4_opening_perc":0.0,"cooling_shutter_5_opening_perc":0.0,"cooling_shutter_6_opening_perc":0.0,"cooling_shutter_7_opening_perc":0.0,"cooling_shutter_8_opening_perc":0.0,"cooling_shutter_9_opening_perc":0.0,"cooling_shutter_10_opening_perc":0.0,"cooling_shutter_11_opening_perc":0.0,"cooling_shutter_12_opening_perc":0.0,"cooling_shutter_13_opening_perc":0.0,"cooling_shutter_14_opening_perc":0.0,"cooling_shutter_15_opening_perc":0.0,"cooling_shutter_16_opening_perc":0.0,"vacuum_main_start":0.0,"vacuum_main_delay":1000.0,"vacuum_main_max_time":30000.0,"vacuum_main_1_chart_setpointx":2000.0,"vacuum_main_1_chart_setpointy":30.0,"vacuum_main_2_chart_setpointx":3000.0,"vacuum_main_2_chart_setpointy":60.0,"vacuum_main_3_chart_setpointx":15000.0,"vacuum_main_3_chart_setpointy":90.0,"vacuum_main_manual":40.0,"vacuum_direct_enabled":1.0,"vacuum_direct_delay":2000.0,"vacuum_direct_time":3000.0,"vacuum_aux_enabled":0.0,"vacuum_aux_delay":0.0,"vacuum_aux_max_time":0.0,"vacuum_aux_1_chart_setpointx":0.0,"vacuum_aux_1_chart_setpointy":0.0,"vacuum_aux_2_chart_setpointx":0.0,"vacuum_aux_2_chart_setpointy":0.0,"vacuum_aux_3_chart_setpointx":0.0,"vacuum_aux_3_chart_setpointy":0.0,"vacuum_aux_manual":0.0,"vacuum_pre_enabled":0.0,"vacuum_pre_delay":0.0,"vacuum_pre_max_time":0.0,"vacuum_pre_1_chart_setpointx":0.0,"vacuum_pre_1_chart_setpointy":0.0,"vacuum_pre_2_chart_setpointx":0.0,"vacuum_pre_2_chart_setpointy":0.0,"vacuum_pre_3_chart_setpointx":0.0,"vacuum_pre_3_chart_setpointy":0.0,"extraction_main_type":2.0,"extraction_main_mould_dw_delay":3000.0,"extraction_main_delay":2000.0,"extraction_main_1_chart_setpointx":3000.0,"extraction_main_1_chart_setpointy":85.0,"extraction_main_manual":60.0,"extraction_aux_enabled":0.0,"extraction_aux_delay":0.0,"extraction_aux_1_chart_setpointx":0.0,"extraction_aux_1_chart_setpointy":0.0,"extraction_aux_manual":0.0,"options_undercutmould_1_mode":0.0,"options_undercutmould_1_position":500.0,"options_undercutmould_1_delay_acti":0.0,"options_undercutmould_1_delay_dis":0.0,"options_undercutmould_2_mode":0.0,"options_undercutmould_2_position":500.0,"options_undercutmould_2_delay_acti":1000.0,"options_undercutmould_2_delay_dis":1000.0,"options_undercutmould_3_mode":0.0,"options_undercutmould_3_position":0.0,"options_undercutmould_3_delay_acti":0.0,"options_undercutmould_3_delay_dis":0.0,"options_undercutmould_4_mode":0.0,"options_undercutmould_4_position":0.0,"options_undercutmould_4_delay_acti":0.0,"options_undercutmould_4_delay_dis":0.0,"options_undercutmould_5_mode":0.0,"options_undercutmould_5_position":0.0,"options_undercutmould_5_delay_acti":0.0,"options_undercutmould_5_delay_dis":0.0,"options_undercutmould_6_mode":0.0,"options_undercutmould_6_position":0.0,"options_undercutmould_6_delay_acti":0.0,"options_undercutmould_6_delay_dis":0.0,"options_undercutmould_7_mode":0.0,"options_undercutmould_7_position":0.0,"options_undercutmould_7_delay_acti":0.0,"options_undercutmould_7_delay_dis":0.0,"options_undercutmould_8_mode":0.0,"options_undercutmould_8_position":0.0,"options_undercutmould_8_delay_acti":0.0,"options_undercutmould_8_delay_dis":0.0,"options_undercutmould_9_mode":0.0,"options_undercutmould_9_position":0.0,"options_undercutmould_9_delay_acti":0.0,"options_undercutmould_9_delay_dis":0.0,"options_undercutmould_10_mode":0.0,"options_undercutmould_10_position":0.0,"options_undercutmould_10_delay_acti":0.0,"options_undercutmould_10_delay_dis":0.0,"options_undercutupperplate_1_mode":0.0,"options_undercutupperplate_1_position":600.0,"options_undercutupperplate_1_delay_acti":0.0,"options_undercutupperplate_1_delay_dis":0.0,"options_undercutupperplate_2_mode":0.0,"options_undercutupperplate_2_position":600.0,"options_undercutupperplate_2_delay_acti":1000.0,"options_undercutupperplate_2_delay_dis":1000.0,"options_undercutupperplate_3_mode":0.0,"options_undercutupperplate_3_position":0.0,"options_undercutupperplate_3_delay_acti":0.0,"options_undercutupperplate_3_delay_dis":0.0,"options_undercutupperplate_4_mode":0.0,"options_undercutupperplate_4_position":0.0,"options_undercutupperplate_4_delay_acti":0.0,"options_undercutupperplate_4_delay_dis":0.0,"options_undercutupperplate_5_mode":0.0,"options_undercutupperplate_5_position":0.0,"options_undercutupperplate_5_delay_acti":0.0,"options_undercutupperplate_5_delay_dis":0.0,"options_undercutupperplate_6_mode":0.0,"options_undercutupperplate_6_position":0.0,"options_undercutupperplate_6_delay_acti":0.0,"options_undercutupperplate_6_delay_dis":0.0,"options_undercutupperplate_7_mode":0.0,"options_undercutupperplate_7_position":0.0,"options_undercutupperplate_7_delay_acti":0.0,"options_undercutupperplate_7_delay_dis":0.0,"options_undercutupperplate_8_mode":0.0,"options_undercutupperplate_8_position":0.0,"options_undercutupperplate_8_delay_acti":0.0,"options_undercutupperplate_8_delay_dis":0.0,"options_undercutupperplate_9_mode":0.0,"options_undercutupperplate_9_position":0.0,"options_undercutupperplate_9_delay_acti":0.0,"options_undercutupperplate_9_delay_dis":0.0,"options_undercutupperplate_10_mode":0.0,"options_undercutupperplate_10_position":0.0,"options_undercutupperplate_10_delay_acti":0.0,"options_undercutupperplate_10_delay_dis":0.0,"options_thermoregulator_1_enabled":1.0,"options_thermoregulator_1_setpoint":55.0,"options_thermoregulator_2_enabled":1.0,"options_thermoregulator_2_setpoint":60.0,"options_thermoregulator_3_enabled":1.0,"options_thermoregulator_3_setpoint":65.0,"options_thermoregulator_4_enabled":0.0,"options_thermoregulator_4_setpoint":0.0,"options_thermoregulator_5_enabled":0.0,"options_thermoregulator_5_setpoint":0.0,"options_thermoregulator_6_enabled":0.0,"options_thermoregulator_6_setpoint":0.0,"options_thermoregulator_7_enabled":0.0,"options_thermoregulator_7_setpoint":0.0,"options_thermoregulator_8_enabled":0.0,"options_thermoregulator_8_setpoint":0.0,"options_thermoregulator_9_enabled":0.0,"options_thermoregulator_9_setpoint":0.0,"options_thermoregulator_10_enabled":0.0,"options_thermoregulator_10_setpoint":0.0},"ChannelSetpoints":{"7":80.0,"44":80.0,"81":80.0,"118":80.0,"155":80.0,"192":80.0,"229":80.0,"266":80.0,"303":80.0,"340":80.0,"377":80.0,"414":80.0,"1":80.0,"8":80.0,"45":80.0,"82":80.0,"119":80.0,"156":80.0,"193":80.0,"230":80.0,"267":80.0,"304":80.0,"341":80.0,"378":80.0,"415":80.0,"9":80.0,"46":80.0,"83":80.0,"120":80.0,"157":80.0,"194":80.0,"231":80.0,"268":80.0,"305":80.0,"342":80.0,"379":80.0,"416":80.0,"10":80.0,"47":80.0,"84":80.0,"121":80.0,"158":80.0,"195":80.0,"232":80.0,"269":80.0,"306":80.0,"343":80.0,"380":80.0,"11":80.0,"48":80.0,"85":80.0,"122":80.0,"159":80.0,"196":80.0,"233":80.0,"270":80.0,"307":80.0,"344":80.0,"381":80.0,"417":80.0,"12":80.0,"49":80.0,"86":80.0,"123":80.0,"160":80.0,"197":80.0,"234":80.0,"271":80.0,"308":80.0,"345":80.0,"382":80.0,"13":80.0,"50":80.0,"87":80.0,"124":80.0,"161":80.0,"198":80.0,"235":80.0,"272":80.0,"309":80.0,"346":80.0,"383":80.0,"418":80.0,"2":80.0,"14":80.0,"51":80.0,"88":80.0,"125":80.0,"162":80.0,"199":80.0,"236":80.0,"273":80.0,"310":80.0,"347":80.0,"384":80.0,"419":80.0,"15":80.0,"52":80.0,"89":80.0,"126":80.0,"163":80.0,"200":80.0,"237":80.0,"274":80.0,"311":80.0,"348":80.0,"385":80.0,"420":80.0,"16":80.0,"53":80.0,"90":80.0,"127":80.0,"164":80.0,"201":80.0,"238":80.0,"275":80.0,"312":80.0,"349":80.0,"386":80.0,"17":80.0,"54":80.0,"91":80.0,"128":80.0,"165":80.0,"202":80.0,"239":80.0,"276":80.0,"313":80.0,"350":80.0,"387":80.0,"421":80.0,"18":80.0,"55":80.0,"92":80.0,"129":80.0,"166":80.0,"203":80.0,"240":80.0,"277":80.0,"314":80.0,"351":80.0,"388":80.0,"19":80.0,"56":80.0,"93":80.0,"130":80.0,"167":80.0,"204":80.0,"241":80.0,"278":80.0,"315":80.0,"352":80.0,"389":80.0,"422":80.0,"3":80.0,"20":80.0,"57":80.0,"94":80.0,"131":80.0,"168":80.0,"205":80.0,"242":80.0,"279":80.0,"316":80.0,"353":80.0,"390":80.0,"423":80.0,"21":80.0,"58":80.0,"95":80.0,"132":80.0,"169":80.0,"206":80.0,"243":80.0,"280":80.0,"317":80.0,"354":80.0,"391":80.0,"424":80.0,"22":80.0,"59":80.0,"96":80.0,"133":80.0,"170":80.0,"207":80.0,"244":80.0,"281":80.0,"318":80.0,"355":80.0,"392":80.0,"23":80.0,"60":80.0,"97":80.0,"134":80.0,"171":80.0,"208":80.0,"245":80.0,"282":80.0,"319":80.0,"356":80.0,"393":80.0,"425":80.0,"24":80.0,"61":80.0,"98":80.0,"135":80.0,"172":80.0,"209":80.0,"246":80.0,"283":80.0,"320":80.0,"357":80.0,"394":80.0,"25":80.0,"62":80.0,"99":80.0,"136":80.0,"173":80.0,"210":80.0,"247":80.0,"284":80.0,"321":80.0,"358":80.0,"395":80.0,"426":80.0,"4":80.0,"26":80.0,"63":80.0,"100":80.0,"137":80.0,"174":80.0,"211":80.0,"248":80.0,"285":80.0,"322":80.0,"359":80.0,"396":80.0,"427":80.0,"27":80.0,"64":80.0,"101":80.0,"138":80.0,"175":80.0,"212":80.0,"249":80.0,"286":80.0,"323":80.0,"360":80.0,"397":80.0,"428":80.0,"28":80.0,"65":80.0,"102":80.0,"139":80.0,"176":80.0,"213":80.0,"250":80.0,"287":80.0,"324":80.0,"361":80.0,"398":80.0,"29":80.0,"66":80.0,"103":80.0,"140":80.0,"177":80.0,"214":80.0,"251":80.0,"288":80.0,"325":80.0,"362":80.0,"399":80.0,"429":80.0,"30":80.0,"67":80.0,"104":80.0,"141":80.0,"178":80.0,"215":80.0,"252":80.0,"289":80.0,"326":80.0,"363":80.0,"400":80.0,"31":80.0,"68":80.0,"105":80.0,"142":80.0,"179":80.0,"216":80.0,"253":80.0,"290":80.0,"327":80.0,"364":80.0,"401":80.0,"430":80.0,"5":80.0,"32":80.0,"69":80.0,"106":80.0,"143":80.0,"180":80.0,"217":80.0,"254":80.0,"291":80.0,"328":80.0,"365":80.0,"402":80.0,"431":80.0,"33":80.0,"70":80.0,"107":80.0,"144":80.0,"181":80.0,"218":80.0,"255":80.0,"292":80.0,"329":80.0,"366":80.0,"403":80.0,"432":80.0,"34":80.0,"71":80.0,"108":80.0,"145":80.0,"182":80.0,"219":80.0,"256":80.0,"293":80.0,"330":80.0,"367":80.0,"404":80.0,"35":80.0,"72":80.0,"109":80.0,"146":80.0,"183":80.0,"220":80.0,"257":80.0,"294":80.0,"331":80.0,"368":80.0,"405":80.0,"433":80.0,"36":80.0,"73":80.0,"110":80.0,"147":80.0,"184":80.0,"221":80.0,"258":80.0,"295":80.0,"332":80.0,"369":80.0,"406":80.0,"37":80.0,"74":80.0,"111":80.0,"148":80.0,"185":80.0,"222":80.0,"259":80.0,"296":80.0,"333":80.0,"370":80.0,"407":80.0,"434":80.0,"6":80.0,"38":80.0,"75":80.0,"112":80.0,"149":80.0,"186":80.0,"223":80.0,"260":80.0,"297":80.0,"334":80.0,"371":80.0,"408":80.0,"435":80.0,"39":80.0,"76":80.0,"113":80.0,"150":80.0,"187":80.0,"224":80.0,"261":80.0,"298":80.0,"335":80.0,"372":80.0,"409":80.0,"436":80.0,"40":80.0,"77":80.0,"114":80.0,"151":80.0,"188":80.0,"225":80.0,"262":80.0,"299":80.0,"336":80.0,"373":80.0,"410":80.0,"41":80.0,"78":80.0,"115":80.0,"152":80.0,"189":80.0,"226":80.0,"263":80.0,"300":80.0,"337":80.0,"374":80.0,"411":80.0,"437":80.0,"42":80.0,"79":80.0,"116":80.0,"153":80.0,"190":80.0,"227":80.0,"264":80.0,"301":80.0,"338":80.0,"375":80.0,"412":80.0,"43":80.0,"80":80.0,"117":80.0,"154":80.0,"191":80.0,"228":80.0,"265":80.0,"302":80.0,"339":80.0,"376":80.0,"413":80.0,"438":80.0,"513":80.0,"520":80.0,"557":80.0,"594":80.0,"631":80.0,"668":80.0,"705":80.0,"742":80.0,"779":80.0,"816":80.0,"853":80.0,"890":80.0,"927":80.0,"521":80.0,"558":80.0,"595":80.0,"632":80.0,"669":80.0,"706":80.0,"743":80.0,"780":80.0,"817":80.0,"854":80.0,"891":80.0,"928":80.0,"522":80.0,"559":80.0,"596":80.0,"633":80.0,"670":80.0,"707":80.0,"744":80.0,"781":80.0,"818":80.0,"855":80.0,"892":80.0,"523":80.0,"560":80.0,"597":80.0,"634":80.0,"671":80.0,"708":80.0,"745":80.0,"782":80.0,"819":80.0,"856":80.0,"893":80.0,"929":80.0,"524":80.0,"561":80.0,"598":80.0,"635":80.0,"672":80.0,"709":80.0,"746":80.0,"783":80.0,"820":80.0,"857":80.0,"894":80.0,"525":80.0,"562":80.0,"599":80.0,"636":80.0,"673":80.0,"710":80.0,"747":80.0,"784":80.0,"821":80.0,"858":80.0,"895":80.0,"930":80.0,"514":80.0,"526":80.0,"563":80.0,"600":80.0,"637":80.0,"674":80.0,"711":80.0,"748":80.0,"785":80.0,"822":80.0,"859":80.0,"896":80.0,"931":80.0,"527":80.0,"564":80.0,"601":80.0,"638":80.0,"675":80.0,"712":80.0,"749":80.0,"786":80.0,"823":80.0,"860":80.0,"897":80.0,"932":80.0,"528":80.0,"565":80.0,"602":80.0,"639":80.0,"676":80.0,"713":80.0,"750":80.0,"787":80.0,"824":80.0,"861":80.0,"898":80.0,"529":80.0,"566":80.0,"603":80.0,"640":80.0,"677":80.0,"714":80.0,"751":80.0,"788":80.0,"825":80.0,"862":80.0,"899":80.0,"933":80.0,"530":80.0,"567":80.0,"604":80.0,"641":80.0,"678":80.0,"715":80.0,"752":80.0,"789":80.0,"826":80.0,"863":80.0,"900":80.0,"531":80.0,"568":80.0,"605":80.0,"642":80.0,"679":80.0,"716":80.0,"753":80.0,"790":80.0,"827":80.0,"864":80.0,"901":80.0,"934":80.0,"515":80.0,"532":80.0,"569":80.0,"606":80.0,"643":80.0,"680":80.0,"717":80.0,"754":80.0,"791":80.0,"828":80.0,"865":80.0,"902":80.0,"935":80.0,"533":80.0,"570":80.0,"607":80.0,"644":80.0,"681":80.0,"718":80.0,"755":80.0,"792":80.0,"829":80.0,"866":80.0,"903":80.0,"936":80.0,"534":80.0,"571":80.0,"608":80.0,"645":80.0,"682":80.0,"719":80.0,"756":80.0,"793":80.0,"830":80.0,"867":80.0,"904":80.0,"535":80.0,"572":80.0,"609":80.0,"646":80.0,"683":80.0,"720":80.0,"757":80.0,"794":80.0,"831":80.0,"868":80.0,"905":80.0,"937":80.0,"536":80.0,"573":80.0,"610":80.0,"647":80.0,"684":80.0,"721":80.0,"758":80.0,"795":80.0,"832":80.0,"869":80.0,"906":80.0,"537":80.0,"574":80.0,"611":80.0,"648":80.0,"685":80.0,"722":80.0,"759":80.0,"796":80.0,"833":80.0,"870":80.0,"907":80.0,"938":80.0,"516":80.0,"538":80.0,"575":80.0,"612":80.0,"649":80.0,"686":80.0,"723":80.0,"760":80.0,"797":80.0,"834":80.0,"871":80.0,"908":80.0,"939":80.0,"539":80.0,"576":80.0,"613":80.0,"650":80.0,"687":80.0,"724":80.0,"761":80.0,"798":80.0,"835":80.0,"872":80.0,"909":80.0,"940":80.0,"517":80.0,"540":80.0,"577":80.0,"614":80.0,"651":80.0,"688":80.0,"725":80.0,"762":80.0,"799":80.0,"836":80.0,"873":80.0,"910":80.0,"941":80.0,"541":80.0,"578":80.0,"615":80.0,"652":80.0,"689":80.0,"726":80.0,"763":80.0,"800":80.0,"837":80.0,"874":80.0,"911":80.0,"942":80.0,"542":80.0,"579":80.0,"616":80.0,"653":80.0,"690":80.0,"727":80.0,"764":80.0,"801":80.0,"838":80.0,"875":80.0,"912":80.0,"543":80.0,"580":80.0,"617":80.0,"654":80.0,"691":80.0,"728":80.0,"765":80.0,"802":80.0,"839":80.0,"876":80.0,"913":80.0,"943":80.0,"544":80.0,"581":80.0,"618":80.0,"655":80.0,"692":80.0,"729":80.0,"766":80.0,"803":80.0,"840":80.0,"877":80.0,"914":80.0,"545":80.0,"582":80.0,"619":80.0,"656":80.0,"693":80.0,"730":80.0,"767":80.0,"804":80.0,"841":80.0,"878":80.0,"915":80.0,"944":80.0,"518":80.0,"546":80.0,"583":80.0,"620":80.0,"657":80.0,"694":80.0,"731":80.0,"768":80.0,"805":80.0,"842":80.0,"879":80.0,"916":80.0,"945":80.0,"547":80.0,"584":80.0,"621":80.0,"658":80.0,"695":80.0,"732":80.0,"769":80.0,"806":80.0,"843":80.0,"880":80.0,"917":80.0,"946":80.0,"548":80.0,"585":80.0,"622":80.0,"659":80.0,"696":80.0,"733":80.0,"770":80.0,"807":80.0,"844":80.0,"881":80.0,"918":80.0,"549":80.0,"586":80.0,"623":80.0,"660":80.0,"697":80.0,"734":80.0,"771":80.0,"808":80.0,"845":80.0,"882":80.0,"919":80.0,"947":80.0,"550":80.0,"587":80.0,"624":80.0,"661":80.0,"698":80.0,"735":80.0,"772":80.0,"809":80.0,"846":80.0,"883":80.0,"920":80.0,"551":80.0,"588":80.0,"625":80.0,"662":80.0,"699":80.0,"736":80.0,"773":80.0,"810":80.0,"847":80.0,"884":80.0,"921":80.0,"948":80.0,"519":80.0,"552":80.0,"589":80.0,"626":80.0,"663":80.0,"700":80.0,"737":80.0,"774":80.0,"811":80.0,"848":80.0,"885":80.0,"922":80.0,"949":80.0,"553":80.0,"590":80.0,"627":80.0,"664":80.0,"701":80.0,"738":80.0,"775":80.0,"812":80.0,"849":80.0,"886":80.0,"923":80.0,"950":80.0,"554":80.0,"591":80.0,"628":80.0,"665":80.0,"702":80.0,"739":80.0,"776":80.0,"813":80.0,"850":80.0,"887":80.0,"924":80.0,"555":80.0,"592":80.0,"629":80.0,"666":80.0,"703":80.0,"740":80.0,"777":80.0,"814":80.0,"851":80.0,"888":80.0,"925":80.0,"951":80.0,"556":80.0,"593":80.0,"630":80.0,"667":80.0,"704":80.0,"741":80.0,"778":80.0,"815":80.0,"852":80.0,"889":80.0,"926":80.0}}
\ No newline at end of file
diff --git a/Thermo.Active.Config/Recipes/.placeholder.txt b/Thermo.Active.Config/Recipes/.placeholder.txt
new file mode 100644
index 00000000..5f282702
--- /dev/null
+++ b/Thermo.Active.Config/Recipes/.placeholder.txt
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Thermo.Active.Config/ServerConfigController.cs b/Thermo.Active.Config/ServerConfigController.cs
index b9c4c7be..58f3b771 100644
--- a/Thermo.Active.Config/ServerConfigController.cs
+++ b/Thermo.Active.Config/ServerConfigController.cs
@@ -794,8 +794,9 @@ namespace Thermo.Active.Config
///
/// Try to load live data from json persistence file
///
- public static void ReadLiveData()
+ public static bool ReadLiveData()
{
+ bool answ = false;
if (File.Exists(LIVE_RECIPE_PATH))
{
// load all text data
@@ -807,46 +808,48 @@ namespace Thermo.Active.Config
}
catch
{ }
+ answ = true;
}
else
{
- // setup new object
- RecipeLiveData = new LiveData()
+ // reload from template...
+ var rawData = File.ReadAllText(RECIPE_TEMPLATE_PATH);
+ try
{
- RecipeName = "current.json",
- ChannelSetpoints = new Dictionary(),
- RecipeParameters = new Dictionary()
- };
+ // deserialize to object
+ RecipeLiveData = JsonConvert.DeserializeObject(rawData);
+ }
+ catch
+ { }
+ answ = true;
}
- }
- ///
- /// Try to write live data to json persistence file
- ///
- public static void WriteLiveData()
- {
- try
- {
- // serialize
- string rawData = JsonConvert.SerializeObject(RecipeLiveData);
- // save live!
- File.WriteAllText(LIVE_RECIPE_PATH, rawData);
- }
- catch
- { }
+ // rendo se fatto
+ return answ;
}
///
/// Try to load selected recipe to live data (memory and json persistence file)
///
- public static void LoadRecipe(string filePath)
+ public static bool LoadRecipe(string filePath)
{
+ bool answ = false;
+
+ // check file extension
+ string fileName = Path.GetFileName(filePath);
+ if (!fileName.EndsWith(".json"))
+ {
+ fileName += ".json";
+ filePath += ".json";
+ }
+
+ // check filePath...
+ if (!filePath.Contains(RECIPE_DIRECTORY) && filePath != RECIPE_TEMPLATE_PATH)
+ {
+ // aggiungo base path!
+ filePath = RECIPE_DIRECTORY + filePath;
+ }
if (File.Exists(filePath))
{
- // check filePath...
- if (!filePath.Contains(RECIPE_DIRECTORY))
- {
- // aggiungo base path!
- filePath = RECIPE_DIRECTORY + filePath;
- }
+ answ = true;
// load all text data
var rawData = File.ReadAllText(filePath);
@@ -858,22 +861,95 @@ namespace Thermo.Active.Config
catch
{ }
// update current live data!
- WriteLiveData();
+ SaveRecipeCurrent();
}
+ // rendo se fatto
+ return answ;
+ }
+ ///
+ /// Try to load template recipe
+ ///
+ public static bool LoadTemplate()
+ {
+ bool answ = false;
+ // check filePath...
+ if (File.Exists(RECIPE_TEMPLATE_PATH))
+ {
+ answ = true;
+
+ // load all text data
+ var rawData = File.ReadAllText(RECIPE_TEMPLATE_PATH);
+ try
+ {
+ // deserialize to object
+ RecipeLiveData = JsonConvert.DeserializeObject(rawData);
+ // update NAME
+ RecipeLiveData.RecipeName = $"{DateTime.Now:yyyyMMss_HHmmss}.json";
+ }
+ catch
+ { }
+ // update current live data!
+ SaveRecipeCurrent();
+ }
+ // rendo se fatto
+ return answ;
+ }
+ ///
+ /// Try to write live data to json persistence file
+ ///
+ public static bool SaveRecipeCurrent()
+ {
+ bool answ = false;
+ try
+ {
+ answ = true;
+ // serialize
+ string rawData = JsonConvert.SerializeObject(RecipeLiveData);
+ // save live!
+ var dir = Path.GetDirectoryName(LIVE_RECIPE_PATH);
+ if(!Directory.Exists(dir))
+ {
+ Directory.CreateDirectory(dir);
+ }
+ File.WriteAllText(LIVE_RECIPE_PATH, rawData);
+ }
+ catch
+ { }
+ // rendo se fatto
+ return answ;
+ }
+ ///
+ /// Try to save live recipe as NEW template
+ ///
+ public static bool SaveRecipeTemplate()
+ {
+
+ RecipeLiveData.RecipeName = "template.json";
+ return SaveRecipe(RECIPE_TEMPLATE_PATH);
}
///
/// Try to save live recipe to selected filePath
///
- public static void SaveRecipe(string filePath)
+ public static bool SaveRecipe(string filePath)
{
+ bool answ = false;
try
{
+ answ = true;
+ string fileName = Path.GetFileName(filePath);
+ if(!fileName.EndsWith(".json"))
+ {
+ fileName += ".json";
+ filePath += ".json";
+ }
+ // fix name!
+ RecipeLiveData.RecipeName=fileName;
// serialize
string rawData = JsonConvert.SerializeObject(RecipeLiveData);
// save live!
File.WriteAllText(LIVE_RECIPE_PATH, rawData);
// check filePath...
- if (!filePath.Contains(RECIPE_DIRECTORY))
+ if (!filePath.Contains(RECIPE_DIRECTORY) && filePath != RECIPE_TEMPLATE_PATH)
{
// aggiungo base path!
filePath = RECIPE_DIRECTORY + filePath;
@@ -883,6 +959,8 @@ namespace Thermo.Active.Config
}
catch
{ }
+ // rendo se fatto
+ return answ;
}
#if false
diff --git a/Thermo.Active.Config/Thermo.Active.Config.csproj b/Thermo.Active.Config/Thermo.Active.Config.csproj
index 59b4e97b..aab7c136 100644
--- a/Thermo.Active.Config/Thermo.Active.Config.csproj
+++ b/Thermo.Active.Config/Thermo.Active.Config.csproj
@@ -59,6 +59,9 @@
+
+ Always
+
Always
@@ -179,10 +182,11 @@
Designer
+
-
-
-
+
+ PreserveNewest
+
diff --git a/Thermo.Active.Model/Constants.cs b/Thermo.Active.Model/Constants.cs
index fb3022fa..cfd49200 100644
--- a/Thermo.Active.Model/Constants.cs
+++ b/Thermo.Active.Model/Constants.cs
@@ -211,6 +211,8 @@ namespace Thermo.Active.Model
#endif
public const string CONFIG_DIRECTORY = "Config\\";
public const string RECIPE_DIRECTORY = "Recipes\\";
+ public const string RECIPE_TEMPLATE_PATH = CONFIG_DIRECTORY + RECIPE_DIRECTORY + "template.json";
+ public const string LIVE_RECIPE_PATH = TEMP_FOLDER + RECIPE_DIRECTORY + "current.json";
public const string RESOURCE_DIRECTORY = @"Thermo.Active.Config.Config.";
public const string SERVER_CONFIG_SCHEMA_PATH = RESOURCE_DIRECTORY + @"serverConfigValidator.xsd";
public const string SERVER_CONFIG_PATH = CONFIG_DIRECTORY + "serverConfig.xml";
@@ -253,7 +255,6 @@ namespace Thermo.Active.Model
public const string MAIN_PROGRAM_CONFIG_PATH = CONFIG_DIRECTORY + "customMainProgram.txt";
- public const string LIVE_RECIPE_PATH = RECIPE_DIRECTORY + "current.json";
public static string LANGUAGE_PACK_DIRECTORY = BASE_PATH + "\\languages\\";
public static string LANGUAGE_SCHEMA_PATH = BASE_PATH + "\\LanguageValidator.xsd";
diff --git a/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs b/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs
index 66fb0f79..bab4dd6c 100644
--- a/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs
+++ b/Thermo.Active.Model/DTOModels/Recipe/DTOWarmers.cs
@@ -8,32 +8,39 @@ namespace Thermo.Active.Model.DTOModels.Recipe
{
public class DTOWarmers
{
- public int Id { get; set; } = 0;
- public double SetpointHMI { get; set; } = 0;
- public double SetpointPLC { get; set; } = 0;
- //public RPRange Range { get; set; }
- //public RPStatus Status { get; set; }
- public string UnitMeasure { get; set; }
- public double ValueAct { get; set; }
+ public int IdChannel { get; set; } = 0;
+ public int IdReflector { get; set; } = 0;
+ public int SetpointRecipe { get; set; } = 0;
+ public int SetpointTermocam { get; set; } = 0;
+ public int SetpointPLC { get; set; } = 0;
+ public int ChannelStatus { get; set; } = 0;
+ public double ActualCurrent { get; set; } = 0;
+ public int ActualPerc { get; set; } = 0;
+ public int MaxPower { get; set; } = 0;
+
public override bool Equals(object obj)
{
if (!(obj is DTOWarmers item))
return false;
- if (Id!= item.Id)
+ if (IdChannel != item.IdChannel)
return false;
- if (SetpointHMI != item.SetpointHMI)
+ if (IdReflector != item.IdReflector)
+ return false;
+ if (SetpointRecipe != item.SetpointRecipe)
+ return false;
+ if (SetpointTermocam != item.SetpointTermocam)
return false;
if (SetpointPLC != item.SetpointPLC)
return false;
- //if (!Range.Equals(item.Range))
- // return false;
- //if (!Status.Equals(item.Status))
- // return false;
- if (UnitMeasure != item.UnitMeasure)
+ if (ChannelStatus != item.ChannelStatus)
return false;
- if (ValueAct != item.ValueAct)
+ if (ActualCurrent != item.ActualCurrent)
+ return false;
+ if (ActualPerc != item.ActualPerc)
+ return false;
+ if (MaxPower != item.MaxPower)
return false;
return true;
@@ -45,53 +52,4 @@ namespace Thermo.Active.Model.DTOModels.Recipe
}
}
-#if false
- public struct RPRange
- {
- public double Min { get; set; }
- public double Max { get; set; }
- public override bool Equals(object obj)
- {
- if (!(obj is RPRange item))
- return false;
-
- if (Min != item.Min)
- return false;
- if (Max != item.Max)
- return false;
-
- return true;
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- }
- public struct RPStatus
- {
- public bool Visible { get; set; }
- public bool Enabled { get; set; }
- public bool HasError { get; set; }
- public override bool Equals(object obj)
- {
- if (!(obj is RPStatus item))
- return false;
-
- if (Visible != item.Visible)
- return false;
- if (Enabled != item.Enabled)
- return false;
- if (HasError != item.HasError)
- return false;
-
- return true;
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- }
-#endif
}
diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs
index 1b79e3f7..391117d9 100644
--- a/Thermo.Active.NC/NcAdapter.cs
+++ b/Thermo.Active.NC/NcAdapter.cs
@@ -1170,11 +1170,11 @@ namespace Thermo.Active.NC
return NO_ERROR;
}
///
- /// Scrittura memoria (SOLO SetpointHMI invero)
+ /// Recipe Parameters write to PLC (only SetpointHMI)
///
///
///
- public CmsError WriteRecipeData(Dictionary updtRecipe)
+ public CmsError WriteRecipeParametersToPLC(Dictionary updtRecipe)
{
// solo x S7...
if (NcConfig.NcVendor == NC_VENDOR.S7NET)
@@ -1225,6 +1225,43 @@ namespace Thermo.Active.NC
return NO_ERROR;
}
+ ///
+ /// Recipe Parameters write to PLC (only SetpointHMI)
+ ///
+ ///
+ ///
+ public CmsError WriteRecipeWarmersToPLC(Dictionary updtRecipe)
+ {
+ // solo x S7...
+ if (NcConfig.NcVendor == NC_VENDOR.S7NET)
+ {
+ // FIXME TODO WRITE CH LOAD DATA
+#if false
+ // ciclo x ogni valore della ricetta aggiornata ricevuto
+ ThermoModels.RecipeParam currParam;
+ foreach (var item in updtRecipe)
+ {
+ // salvo SOLO il setpoint HMI...
+ currParam = new ThermoModels.RecipeParam()
+ {
+ Id = (short)item.Value.Id,
+ SetpointHMI = item.Value.SetpointHMI
+ };
+ // scrivo!
+ CmsError cmsError = numericalControl.PLC_WRecipeParam(currParam);
+ if (cmsError.IsError())
+ return cmsError;
+ }
+#endif
+
+ }
+ else
+ {
+ return FUNCTION_NOT_ALLOWED_ERROR;
+ }
+
+ return NO_ERROR;
+ }
public CmsError ReadNcScada(ScadaSchemaModel scadaSchema, out DTOScadaModel scadaValue)
@@ -1606,7 +1643,7 @@ namespace Thermo.Active.NC
///
public CmsError WriteRecipeParams(Dictionary updtRecipe)
{
- CmsError cmsError = WriteRecipeData(updtRecipe);
+ CmsError cmsError = WriteRecipeParametersToPLC(updtRecipe);
return cmsError;
}
@@ -1719,26 +1756,40 @@ namespace Thermo.Active.NC
}
///
- /// Legge tutti i parametri della ricetta
+ /// GEt all warmers data by channel
///
- /// Oggetto elenco 1024 ch riscaldi
+ /// List of <= 1024 warmers channels
///
public CmsError ReadWarmers(out Dictionary currWarmers)
{
CmsError cmsError = NO_ERROR;
currWarmers = new Dictionary();
+ DTOWarmers currVal = new DTOWarmers();
- // FIXME TODO
-#if false
- DTORecipeParam currParam = new DTORecipeParam();
- RPRange currRange = new RPRange();
- RPStatus currStatus = new RPStatus();
+ // read and return config
+ if (NcConfig.NcVendor == NC_VENDOR.S7NET)
+ {
+ foreach (var item in RiskChannelConfig)
+ {
+ currVal = new DTOWarmers()
+ {
+ IdChannel = item.IdChannel,
+ IdReflector = item.IdReflector,
+ SetpointRecipe = 80, // leggere da NUOVA area PLC?
+ SetpointTermocam = 0, // per ora a zero
+ SetpointPLC = 0, // leggere da PLC!
+ ChannelStatus = 0, // leggere da PLC
+ ActualCurrent = 0, // leggere da PLC
+ ActualPerc = 0, // leggere da PLC
+ MaxPower = item.MaxPower
+ };
+ currWarmers.Add(item.IdChannel, currVal);
+ }
+ }
// gestione errore
- cmsError = ReadRecipeData(false, true, out currModules);
if (cmsError.IsError())
- return cmsError;
-#endif
+ return cmsError;
// restituisco cod errore se trovato
return cmsError;
@@ -1767,6 +1818,18 @@ namespace Thermo.Active.NC
return cmsError;
}
+ ///
+ /// Write all warmers load for recipe
+ ///
+ /// Oggetto parametri da aggiornare (from HMI)
+ ///
+ public CmsError WriteRecipeWarmers(Dictionary updtRecipe)
+ {
+ CmsError cmsError = WriteRecipeWarmersToPLC(updtRecipe);
+
+ return cmsError;
+ }
+
#endregion Read Data
#region Write data
diff --git a/Thermo.Active/Controllers/WebApi/RecipeController.cs b/Thermo.Active/Controllers/WebApi/RecipeController.cs
index 8466f6a0..9da46752 100644
--- a/Thermo.Active/Controllers/WebApi/RecipeController.cs
+++ b/Thermo.Active/Controllers/WebApi/RecipeController.cs
@@ -127,10 +127,7 @@ namespace Thermo.Active.Controllers.WebApi
currParams.Add(item.Key, item.Value.SetpointHMI);
}
- // ora salvo ANCHE i dati live...
- RecipeLiveData.RecipeParameters = currParams;
- // e salvo su disco
- ServerConfigController.WriteLiveData();
+ saveCurrentRecipeParams(currParams);
// ritorno solo fatto!
return Ok();
@@ -168,9 +165,66 @@ namespace Thermo.Active.Controllers.WebApi
}
// ora salvo ANCHE i dati live...
- RecipeLiveData.RecipeParameters = currParams;
- // e salvo su disco
- ServerConfigController.WriteLiveData();
+ saveCurrentRecipeParams(currParams);
+
+ // ritorno solo fatto!
+ return Ok();
+ }
+ }
+
+ ///
+ /// load recipe from file and send to PLC
+ ///
+ ///
+ [Route("load"), HttpPut]
+ public IHttpActionResult Load(string newName)
+ {
+ using (NcFileAdapter ncAdapter = new NcFileAdapter())
+ {
+ // Try connection
+ CmsError libraryError = ncAdapter.Connect();
+ if (libraryError.errorCode != 0)
+ return NotFound();
+
+ // chiamo metodo di lettura...
+ //CmsError cmsError = ServerConfigController.LoadRecipe(newName);
+ bool fatto = ServerConfigController.LoadRecipe(newName);
+ if (!fatto)
+ return NotFound();
+
+
+ CmsError cmsError = writeCurrentRecipeToPlc();
+ if (cmsError.IsError())
+ return BadRequest(cmsError.localizationKey);
+
+ // ritorno solo fatto!
+ return Ok();
+ }
+ }
+
+ ///
+ /// Load tempalte recipe from file and save as new current...
+ ///
+ ///
+ [Route("new"), HttpPut]
+ public IHttpActionResult NewRecipe()
+ {
+ using (NcFileAdapter ncAdapter = new NcFileAdapter())
+ {
+ // Try connection
+ CmsError libraryError = ncAdapter.Connect();
+ if (libraryError.errorCode != 0)
+ return NotFound();
+
+ // chiamo metodo di lettura...
+ bool fatto = ServerConfigController.LoadTemplate();
+
+ if (!fatto)
+ return NotFound();
+
+ CmsError cmsError = writeCurrentRecipeToPlc();
+ if (cmsError.IsError())
+ return BadRequest(cmsError.localizationKey);
// ritorno solo fatto!
return Ok();
@@ -203,15 +257,12 @@ namespace Thermo.Active.Controllers.WebApi
}
// ora salvo ANCHE i dati live...
- RecipeLiveData.RecipeParameters = currParams;
- // e salvo su disco
- ServerConfigController.WriteLiveData();
+ saveCurrentRecipeParams(currParams);
// ritorno solo fatto!
return Ok();
}
}
-
///
/// Save current recipe from PLC with new name
///
@@ -247,11 +298,11 @@ namespace Thermo.Active.Controllers.WebApi
}
}
///
- /// load recipe from file and send to PLC
+ /// Save current recipe from PLC to Template
///
///
- [Route("load"), HttpPut]
- public IHttpActionResult Load(string newName)
+ [Route("saveTemplate"), HttpPut]
+ public IHttpActionResult SaveTemplate()
{
using (NcFileAdapter ncAdapter = new NcFileAdapter())
{
@@ -260,13 +311,117 @@ namespace Thermo.Active.Controllers.WebApi
if (libraryError.errorCode != 0)
return NotFound();
- // chiamo metodo di lettura...
- ServerConfigController.LoadRecipe(newName);
+ // recupero i dati LIVE dei parametri HMI della ricetta...
+ CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe);
+ if (cmsError.IsError())
+ return BadRequest(cmsError.localizationKey);
+
+
+ // recupero i dati LIVE dei carichi load dei cahnnels di riscaldo...
+ cmsError = ncAdapter.ReadWarmers(out Dictionary currWarmers);
+ if (cmsError.IsError())
+ return BadRequest(cmsError.localizationKey);
+
+ // uso i valopri HMI...
+ var currParams = new Dictionary();
+ foreach (var item in currRecipe)
+ {
+ currParams.Add(item.Key, item.Value.SetpointHMI);
+ }
+
+ // ora salvo nei dati live...
+ RecipeLiveData.RecipeParameters = currParams;
+
+ // carico i dati dei riscaldi...
+ var currChSet = new Dictionary();
+ foreach (var item in currWarmers)
+ {
+ currChSet.Add(item.Key, item.Value.SetpointRecipe);
+ }
+ RecipeLiveData.ChannelSetpoints = currChSet;
+
+
+ // e salvo su disco
+ ServerConfigController.SaveRecipeTemplate();
// ritorno solo fatto!
return Ok();
}
}
+
+ ///
+ /// Do actual recipe parameters FileSave
+ ///
+ ///
+ private static void saveCurrentRecipeParams(Dictionary currParams)
+ {
+ // ora salvo ANCHE i dati live...
+ RecipeLiveData.RecipeParameters = currParams;
+ // e salvo su disco
+ ServerConfigController.SaveRecipeCurrent();
+ }
+
+ protected static CmsError writeCurrentRecipeToPlc()
+ {
+ CmsError checkError = NO_ERROR;
+
+ using (NcAdapter ncAdapter = new NcAdapter())
+ {
+ // copy data to PLC
+ checkError = ncAdapter.ReadFullRecipe(out Dictionary prevRecipe);
+ if (checkError.IsError())
+ return checkError;
+
+ // save parameters to PLC!!!
+ Dictionary updtRecipe = new Dictionary();
+ foreach (var item in RecipeLiveData.RecipeParameters)
+ {
+ if (prevRecipe.ContainsKey(item.Key))
+ {
+ // aggiorno il valore HMI nel parametro
+ var currParam = prevRecipe[item.Key];
+ currParam.SetpointHMI = item.Value;
+ // salvo (1 parametro, potrei fare N...)
+ updtRecipe.Add(item.Key, currParam);
+ }
+ else
+ {
+ return NOT_FOUND_ERROR;
+ }
+ }
+
+ // write to PLC
+ checkError = ncAdapter.WriteRecipeParams(updtRecipe);
+
+ // FIXME TODO warmers to be completed!!!
+#if false
+ // reading warmers data...
+ cmsError = ncAdapter.ReadWarmers(out Dictionary prevWarmers);
+ if (cmsError.IsError())
+ return BadRequest(cmsError.localizationKey);
+
+ // save warmers to PLC
+ foreach (var item in RecipeLiveData.ChannelSetpoints)
+ {
+ //if (prevRecipe.ContainsKey(item.Key))
+ //{
+ // // aggiorno il valore HMI nel parametro
+ // var currParam = prevRecipe[item.Key];
+ // currParam.SetpointHMI = item.Value;
+ // // salvo (1 parametro, potrei fare N...)
+ // updtRecipe.Add(item.Key, currParam);
+ //}
+ //else
+ //{
+ // return NotFound();
+ //}
+ }
+ // write to PLC
+ ncAdapter.WriteRecipeWarmers(updtRecipe);
+#endif
+ }
+ return checkError;
+ }
}
}
\ No newline at end of file