Simscape – Source component – Input
I created a hydraulic system with my own custom components (pipes, elbows, tees, orifices,… ) in order to calculate the flow rate at the outlets.
The fluid temperature is changed with the help of a parameter at a "source component". This temperature is used at two lookuptables in order to determine the corresponding viscosity and density of the fluid.
Viscosity and density are domain parameters which are changed by the "source component" in order to provide these for the rest of the model.
Now I want to change the temperature at run time with the help of a "ramp block". Therefor I created an input at the "source component" and connected the "ramp block" by a "simulink-ps-converter".
The issue is now that of course I can´t use an input for lookuptables at the parameter section of the "source component".
I can move the lookuptables to the equations section, but this creates new issues with missing variables for viscosity and density.
Any Idee how I can solve this problem?
This is my source component…
component(Propagation=source) oil_properties
% Oil properties
%
% Temperature range: -15°C – 110°C
%
%
% Fluid type:
%
%Viscosity | CLP | CLP-PG | CLP-HC | *according Rickmeier – Viscosity/Temperature diagram
%
%——————————————————
%
% 100 | 1 | – | – |
%
% 150 | 2 | 6 | 10 |
%
% 220 | 3 | 7 | 11 |
%
% 320 | 4 | 8 | 12 |
%
% 460 | 5 | 9 | 13 |
%
%——————————————————
parameters
fluid_type = 11;
temperature ={20,’1′};
end
parameters (Access=private)
% Temperatur-Viskositätsdiagramm von Rickmeier
%CLP – Mineralöl
temp_CLP_100 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_100 = {[907 904 902 899 896 893 890 887 884 881 878 876 873 870 867 864 861 858 855 852 850 847 844 841 838 835 ], ‘kg/m^3’};
visk_CLP_100 = {[9300 5000 3000 1800 1100 750 500 350 240 170 130 100 70 60 46 38 32 27 22 19 16.5 14.5 12.5 11 9.6 8.6 ], ‘mm^2/s’};
temp_CLP_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_150 = {[908 905 903 900 897 894 891 888 885 882 879 877 874 871 868 865 862 859 856 853 850 848 845 842 839 836 ], ‘kg/m^3’};
visk_CLP_150 = {[18000 10000 5500 3400 2000 1200 800 550 380 280 200 150 110 85 65 54 44 36 30 25 22 18.5 16.5 14.5 12.5 11 ], ‘mm^2/s’};
temp_CLP_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_220 = {[912 910 907 904 901 898 895 892 889 886 883 880 878 875 872 869 866 863 860 857 854 851 848 846 843 840 ], ‘kg/m^3’};
visk_CLP_220 = {[34000 18000 10000 5500 3400 2000 1300 820 600 420 300 220 165 130 100 80 60 51 42 36 30 26 22 19 17 15 ], ‘mm^2/s’};
temp_CLP_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_320 = {[920 917 914 911 908 905 902 899 896 893 890 887 884 881 879 876 873 870 867 864 861 858 855 852 849 846 ], ‘kg/m^3’};
visk_CLP_320 = {[60000 30000 16000 9000 5500 3400 2200 1400 900 600 440 320 240 180 140 110 90 70 58 46 40 32 28 24 21 18.5 ], ‘mm^2/s’};
temp_CLP_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_460 = {[920 917 914 911 908 905 902 899 896 893 890 887 884 881 879 876 873 870 867 864 861 858 855 852 849 846 ], ‘kg/m^3’};
visk_CLP_460 = {[110000 50000 28000 16000 9000 5500 3400 2100 1400 900 650 460 340 260 200 150 120 95 75 60 50 44 36 31 27 23 ], ‘mm^2/s’};
%CLP PG – Synthetisches Öl auf Basis Polyglykole
temp_CLP_PG_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_150 = {[1084 1080 1077 1073 1070 1066 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1022 1018 1015 1011 1008 1004 1001 997 ], ‘kg/m^3’};
visk_CLP_PG_150 = {[7500 3900 2420 1650 1200 850 610 440 340 260 210 150 130 105 90 71 61 52 44 38 32 29 25.5 22.5 20 18.5 ], ‘mm^2/s’};
temp_CLP_PG_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_220 = {[1084 1080 1077 1073 1070 1066 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1022 1018 1015 1011 1008 1004 1001 997 ], ‘kg/m^3’};
visk_CLP_PG_220 = {[6100 4100 2800 2000 1400 1020 750 550 440 340 260 220 170 140 115 100 95 70 60 50 44 40 34 30 27 24 ], ‘mm^2/s’};
temp_CLP_PG_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_320 = {[1091 1087 1084 1080 1077 1073 1070 1067 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1021 1018 1014 1011 1007 1004 ], ‘kg/m^3’};
visk_CLP_PG_320 = {[5600 4000 3000 2200 1600 1220 950 775 600 480 400 320 272 225 190 165 140 120 105 92 80 70 62 55 50 45 ], ‘mm^2/s’};
temp_CLP_PG_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_460 = {[1081 1077 1074 1070 1067 1063 1060 1057 1053 1050 1046 1043 1039 1036 1032 1029 1026 1022 1019 1015 1012 1008 1005 1001 998 995 ], ‘kg/m^3’};
visk_CLP_PG_460 = {[7300 5400 3900 2900 2200 1700 1300 1050 810 650 550 460 360 310 260 222 190 165 140 120 108 95 85 75 67 60 ], ‘mm^2/s’};
%CLP HC – Synthetisches Öl auf Basis Polyalphaolefine
temp_CLP_HC_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_150 = {[871 868 865 862 860 857 854 851 848 846 843 840 837 835 832 829 826 823 821 818 815 812 810 807 804 801 ], ‘kg/m^3’};
visk_CLP_HC_150 = {[6900 4000 2450 1650 1120 800 560 420 310 230 180 150 110 90 71 60 50 42 35 31 27 23.3 20.3 18.2 16 14.5 ], ‘mm^2/s’};
temp_CLP_HC_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_220 = {[876 873 870 867 865 862 859 856 853 851 848 845 842 839 837 834 831 828 825 823 820 817 814 812 809 806 ], ‘kg/m^3’};
visk_CLP_HC_220 = {[6900 4000 2600 1800 1300 950 680 510 380 300 230 190 150 120 100 81 70 60 50 44 38 32 29 26 23 21 ], ‘mm^2/s’};
temp_CLP_HC_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_320 = {[879 876 873 870 868 865 862 859 856 854 851 848 845 842 840 837 834 831 828 826 823 820 817 814 812 809 ], ‘kg/m^3’};
visk_CLP_HC_320 = {[14500 9000 6000 4000 2700 1900 1350 960 720 540 420 320 260 205 165 137 115 95 80 65 59 50 43 38 33 29.5 ], ‘mm^2/s’};
temp_CLP_HC_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_460 = {[881 878 875 872 870 867 864 861 858 856 853 850 847 844 842 839 836 833 830 827 825 822 819 816 813 811 ], ‘kg/m^3’};
visk_CLP_HC_460 = {[25000 14500 9500 6000 4000 2800 1900 1400 1000 720 550 420 340 260 210 170 140 115 95 80 68 59 51 44 38 34 ], ‘mm^2/s’};
temp = [temp_CLP_100; temp_CLP_150; temp_CLP_220; temp_CLP_320; temp_CLP_460; temp_CLP_PG_150; temp_CLP_PG_220; temp_CLP_PG_320; temp_CLP_PG_460; temp_CLP_HC_150; temp_CLP_HC_220; temp_CLP_HC_320; temp_CLP_HC_460];
dens = [dens_CLP_100; dens_CLP_150; dens_CLP_220; dens_CLP_320; dens_CLP_460; dens_CLP_PG_150; dens_CLP_PG_220; dens_CLP_PG_320; dens_CLP_PG_460; dens_CLP_HC_150; dens_CLP_HC_220; dens_CLP_HC_320; dens_CLP_HC_460];
visk = [visk_CLP_100; visk_CLP_150; visk_CLP_220; visk_CLP_320; visk_CLP_460; visk_CLP_PG_150; visk_CLP_PG_220; visk_CLP_PG_320; visk_CLP_PG_460; visk_CLP_HC_150; visk_CLP_HC_220; visk_CLP_HC_320; visk_CLP_HC_460];
density = tablelookup(temp(fluid_type,:) ,dens(fluid_type,:) ,temperature, interpolation = smooth);
viscosity_kin = tablelookup(temp(fluid_type,:) ,visk(fluid_type,:) ,temperature, interpolation = smooth);
end
%inputs
% temperature = {1 , ‘1’ }; % :left
%end
nodes
G = NORD.Hydraulics.Domain.hydraulic(density=density,viscosity_kin=viscosity_kin); % :right
end
end
… and this is my custom domain:
domain hydraulic
% Hydraulic Domain
variables % Across
p = {value={1,’bar’},imin={0,’bar’}}; % Pressure
end
variables(Balancing = true) % Through
q = {0,’lpm’ }; % Flow rate
end
parameters
viscosity_kin = {0,’mm^2/s’ }; % kinematische Viskosität
density = {0,’kg/m^3′ }; % Dichte des Öls
bulk = {0.8e9 ,’Pa’ }; % Bulk modulus at atm. pressure and no gas
alpha = {0.005 ,’1′ }; % Relative amount of trapped air
range_error = {2 ,’1′ }; % Pressure below absolute zero
RD_18 = {0.015, ‘m’ }; % Rohrdurchmesser NW18
RD_10 = {0.008, ‘m’ }; % Rohrdurchmesser NW10
RD_12_5 = {0.0125,’m’ }; % Rohrdurchmesser für DMO
RD_06 = {0.006, ‘m’ }; % Rohrdurchmesser für DMO
BR_18 = {0.060, ‘m’ }; % Biegeradius des Rohres NW18
BR_10 = {0.027, ‘m’ }; % Biegeradius des Rohres NW10
Zeta_R_AURO = {1 , ‘1’ }; % Zeta Wert für Ausfluß (AURO)
Zeta_U_90_18 = {0.110, ‘1’ }; % Zeta Wert für 90° Rohrbogen
Zeta_U_90_10 = {0.117, ‘1’ }; % Zeta Wert für 90° Rohrbogen
Zeta_U_WV = {1.07, ‘1’ }; % Zeta Wert für WV
end
endI created a hydraulic system with my own custom components (pipes, elbows, tees, orifices,… ) in order to calculate the flow rate at the outlets.
The fluid temperature is changed with the help of a parameter at a "source component". This temperature is used at two lookuptables in order to determine the corresponding viscosity and density of the fluid.
Viscosity and density are domain parameters which are changed by the "source component" in order to provide these for the rest of the model.
Now I want to change the temperature at run time with the help of a "ramp block". Therefor I created an input at the "source component" and connected the "ramp block" by a "simulink-ps-converter".
The issue is now that of course I can´t use an input for lookuptables at the parameter section of the "source component".
I can move the lookuptables to the equations section, but this creates new issues with missing variables for viscosity and density.
Any Idee how I can solve this problem?
This is my source component…
component(Propagation=source) oil_properties
% Oil properties
%
% Temperature range: -15°C – 110°C
%
%
% Fluid type:
%
%Viscosity | CLP | CLP-PG | CLP-HC | *according Rickmeier – Viscosity/Temperature diagram
%
%——————————————————
%
% 100 | 1 | – | – |
%
% 150 | 2 | 6 | 10 |
%
% 220 | 3 | 7 | 11 |
%
% 320 | 4 | 8 | 12 |
%
% 460 | 5 | 9 | 13 |
%
%——————————————————
parameters
fluid_type = 11;
temperature ={20,’1′};
end
parameters (Access=private)
% Temperatur-Viskositätsdiagramm von Rickmeier
%CLP – Mineralöl
temp_CLP_100 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_100 = {[907 904 902 899 896 893 890 887 884 881 878 876 873 870 867 864 861 858 855 852 850 847 844 841 838 835 ], ‘kg/m^3’};
visk_CLP_100 = {[9300 5000 3000 1800 1100 750 500 350 240 170 130 100 70 60 46 38 32 27 22 19 16.5 14.5 12.5 11 9.6 8.6 ], ‘mm^2/s’};
temp_CLP_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_150 = {[908 905 903 900 897 894 891 888 885 882 879 877 874 871 868 865 862 859 856 853 850 848 845 842 839 836 ], ‘kg/m^3’};
visk_CLP_150 = {[18000 10000 5500 3400 2000 1200 800 550 380 280 200 150 110 85 65 54 44 36 30 25 22 18.5 16.5 14.5 12.5 11 ], ‘mm^2/s’};
temp_CLP_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_220 = {[912 910 907 904 901 898 895 892 889 886 883 880 878 875 872 869 866 863 860 857 854 851 848 846 843 840 ], ‘kg/m^3’};
visk_CLP_220 = {[34000 18000 10000 5500 3400 2000 1300 820 600 420 300 220 165 130 100 80 60 51 42 36 30 26 22 19 17 15 ], ‘mm^2/s’};
temp_CLP_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_320 = {[920 917 914 911 908 905 902 899 896 893 890 887 884 881 879 876 873 870 867 864 861 858 855 852 849 846 ], ‘kg/m^3’};
visk_CLP_320 = {[60000 30000 16000 9000 5500 3400 2200 1400 900 600 440 320 240 180 140 110 90 70 58 46 40 32 28 24 21 18.5 ], ‘mm^2/s’};
temp_CLP_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_460 = {[920 917 914 911 908 905 902 899 896 893 890 887 884 881 879 876 873 870 867 864 861 858 855 852 849 846 ], ‘kg/m^3’};
visk_CLP_460 = {[110000 50000 28000 16000 9000 5500 3400 2100 1400 900 650 460 340 260 200 150 120 95 75 60 50 44 36 31 27 23 ], ‘mm^2/s’};
%CLP PG – Synthetisches Öl auf Basis Polyglykole
temp_CLP_PG_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_150 = {[1084 1080 1077 1073 1070 1066 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1022 1018 1015 1011 1008 1004 1001 997 ], ‘kg/m^3’};
visk_CLP_PG_150 = {[7500 3900 2420 1650 1200 850 610 440 340 260 210 150 130 105 90 71 61 52 44 38 32 29 25.5 22.5 20 18.5 ], ‘mm^2/s’};
temp_CLP_PG_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_220 = {[1084 1080 1077 1073 1070 1066 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1022 1018 1015 1011 1008 1004 1001 997 ], ‘kg/m^3’};
visk_CLP_PG_220 = {[6100 4100 2800 2000 1400 1020 750 550 440 340 260 220 170 140 115 100 95 70 60 50 44 40 34 30 27 24 ], ‘mm^2/s’};
temp_CLP_PG_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_320 = {[1091 1087 1084 1080 1077 1073 1070 1067 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1021 1018 1014 1011 1007 1004 ], ‘kg/m^3’};
visk_CLP_PG_320 = {[5600 4000 3000 2200 1600 1220 950 775 600 480 400 320 272 225 190 165 140 120 105 92 80 70 62 55 50 45 ], ‘mm^2/s’};
temp_CLP_PG_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_460 = {[1081 1077 1074 1070 1067 1063 1060 1057 1053 1050 1046 1043 1039 1036 1032 1029 1026 1022 1019 1015 1012 1008 1005 1001 998 995 ], ‘kg/m^3’};
visk_CLP_PG_460 = {[7300 5400 3900 2900 2200 1700 1300 1050 810 650 550 460 360 310 260 222 190 165 140 120 108 95 85 75 67 60 ], ‘mm^2/s’};
%CLP HC – Synthetisches Öl auf Basis Polyalphaolefine
temp_CLP_HC_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_150 = {[871 868 865 862 860 857 854 851 848 846 843 840 837 835 832 829 826 823 821 818 815 812 810 807 804 801 ], ‘kg/m^3’};
visk_CLP_HC_150 = {[6900 4000 2450 1650 1120 800 560 420 310 230 180 150 110 90 71 60 50 42 35 31 27 23.3 20.3 18.2 16 14.5 ], ‘mm^2/s’};
temp_CLP_HC_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_220 = {[876 873 870 867 865 862 859 856 853 851 848 845 842 839 837 834 831 828 825 823 820 817 814 812 809 806 ], ‘kg/m^3’};
visk_CLP_HC_220 = {[6900 4000 2600 1800 1300 950 680 510 380 300 230 190 150 120 100 81 70 60 50 44 38 32 29 26 23 21 ], ‘mm^2/s’};
temp_CLP_HC_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_320 = {[879 876 873 870 868 865 862 859 856 854 851 848 845 842 840 837 834 831 828 826 823 820 817 814 812 809 ], ‘kg/m^3’};
visk_CLP_HC_320 = {[14500 9000 6000 4000 2700 1900 1350 960 720 540 420 320 260 205 165 137 115 95 80 65 59 50 43 38 33 29.5 ], ‘mm^2/s’};
temp_CLP_HC_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_460 = {[881 878 875 872 870 867 864 861 858 856 853 850 847 844 842 839 836 833 830 827 825 822 819 816 813 811 ], ‘kg/m^3’};
visk_CLP_HC_460 = {[25000 14500 9500 6000 4000 2800 1900 1400 1000 720 550 420 340 260 210 170 140 115 95 80 68 59 51 44 38 34 ], ‘mm^2/s’};
temp = [temp_CLP_100; temp_CLP_150; temp_CLP_220; temp_CLP_320; temp_CLP_460; temp_CLP_PG_150; temp_CLP_PG_220; temp_CLP_PG_320; temp_CLP_PG_460; temp_CLP_HC_150; temp_CLP_HC_220; temp_CLP_HC_320; temp_CLP_HC_460];
dens = [dens_CLP_100; dens_CLP_150; dens_CLP_220; dens_CLP_320; dens_CLP_460; dens_CLP_PG_150; dens_CLP_PG_220; dens_CLP_PG_320; dens_CLP_PG_460; dens_CLP_HC_150; dens_CLP_HC_220; dens_CLP_HC_320; dens_CLP_HC_460];
visk = [visk_CLP_100; visk_CLP_150; visk_CLP_220; visk_CLP_320; visk_CLP_460; visk_CLP_PG_150; visk_CLP_PG_220; visk_CLP_PG_320; visk_CLP_PG_460; visk_CLP_HC_150; visk_CLP_HC_220; visk_CLP_HC_320; visk_CLP_HC_460];
density = tablelookup(temp(fluid_type,:) ,dens(fluid_type,:) ,temperature, interpolation = smooth);
viscosity_kin = tablelookup(temp(fluid_type,:) ,visk(fluid_type,:) ,temperature, interpolation = smooth);
end
%inputs
% temperature = {1 , ‘1’ }; % :left
%end
nodes
G = NORD.Hydraulics.Domain.hydraulic(density=density,viscosity_kin=viscosity_kin); % :right
end
end
… and this is my custom domain:
domain hydraulic
% Hydraulic Domain
variables % Across
p = {value={1,’bar’},imin={0,’bar’}}; % Pressure
end
variables(Balancing = true) % Through
q = {0,’lpm’ }; % Flow rate
end
parameters
viscosity_kin = {0,’mm^2/s’ }; % kinematische Viskosität
density = {0,’kg/m^3′ }; % Dichte des Öls
bulk = {0.8e9 ,’Pa’ }; % Bulk modulus at atm. pressure and no gas
alpha = {0.005 ,’1′ }; % Relative amount of trapped air
range_error = {2 ,’1′ }; % Pressure below absolute zero
RD_18 = {0.015, ‘m’ }; % Rohrdurchmesser NW18
RD_10 = {0.008, ‘m’ }; % Rohrdurchmesser NW10
RD_12_5 = {0.0125,’m’ }; % Rohrdurchmesser für DMO
RD_06 = {0.006, ‘m’ }; % Rohrdurchmesser für DMO
BR_18 = {0.060, ‘m’ }; % Biegeradius des Rohres NW18
BR_10 = {0.027, ‘m’ }; % Biegeradius des Rohres NW10
Zeta_R_AURO = {1 , ‘1’ }; % Zeta Wert für Ausfluß (AURO)
Zeta_U_90_18 = {0.110, ‘1’ }; % Zeta Wert für 90° Rohrbogen
Zeta_U_90_10 = {0.117, ‘1’ }; % Zeta Wert für 90° Rohrbogen
Zeta_U_WV = {1.07, ‘1’ }; % Zeta Wert für WV
end
end I created a hydraulic system with my own custom components (pipes, elbows, tees, orifices,… ) in order to calculate the flow rate at the outlets.
The fluid temperature is changed with the help of a parameter at a "source component". This temperature is used at two lookuptables in order to determine the corresponding viscosity and density of the fluid.
Viscosity and density are domain parameters which are changed by the "source component" in order to provide these for the rest of the model.
Now I want to change the temperature at run time with the help of a "ramp block". Therefor I created an input at the "source component" and connected the "ramp block" by a "simulink-ps-converter".
The issue is now that of course I can´t use an input for lookuptables at the parameter section of the "source component".
I can move the lookuptables to the equations section, but this creates new issues with missing variables for viscosity and density.
Any Idee how I can solve this problem?
This is my source component…
component(Propagation=source) oil_properties
% Oil properties
%
% Temperature range: -15°C – 110°C
%
%
% Fluid type:
%
%Viscosity | CLP | CLP-PG | CLP-HC | *according Rickmeier – Viscosity/Temperature diagram
%
%——————————————————
%
% 100 | 1 | – | – |
%
% 150 | 2 | 6 | 10 |
%
% 220 | 3 | 7 | 11 |
%
% 320 | 4 | 8 | 12 |
%
% 460 | 5 | 9 | 13 |
%
%——————————————————
parameters
fluid_type = 11;
temperature ={20,’1′};
end
parameters (Access=private)
% Temperatur-Viskositätsdiagramm von Rickmeier
%CLP – Mineralöl
temp_CLP_100 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_100 = {[907 904 902 899 896 893 890 887 884 881 878 876 873 870 867 864 861 858 855 852 850 847 844 841 838 835 ], ‘kg/m^3’};
visk_CLP_100 = {[9300 5000 3000 1800 1100 750 500 350 240 170 130 100 70 60 46 38 32 27 22 19 16.5 14.5 12.5 11 9.6 8.6 ], ‘mm^2/s’};
temp_CLP_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_150 = {[908 905 903 900 897 894 891 888 885 882 879 877 874 871 868 865 862 859 856 853 850 848 845 842 839 836 ], ‘kg/m^3’};
visk_CLP_150 = {[18000 10000 5500 3400 2000 1200 800 550 380 280 200 150 110 85 65 54 44 36 30 25 22 18.5 16.5 14.5 12.5 11 ], ‘mm^2/s’};
temp_CLP_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_220 = {[912 910 907 904 901 898 895 892 889 886 883 880 878 875 872 869 866 863 860 857 854 851 848 846 843 840 ], ‘kg/m^3’};
visk_CLP_220 = {[34000 18000 10000 5500 3400 2000 1300 820 600 420 300 220 165 130 100 80 60 51 42 36 30 26 22 19 17 15 ], ‘mm^2/s’};
temp_CLP_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_320 = {[920 917 914 911 908 905 902 899 896 893 890 887 884 881 879 876 873 870 867 864 861 858 855 852 849 846 ], ‘kg/m^3’};
visk_CLP_320 = {[60000 30000 16000 9000 5500 3400 2200 1400 900 600 440 320 240 180 140 110 90 70 58 46 40 32 28 24 21 18.5 ], ‘mm^2/s’};
temp_CLP_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_460 = {[920 917 914 911 908 905 902 899 896 893 890 887 884 881 879 876 873 870 867 864 861 858 855 852 849 846 ], ‘kg/m^3’};
visk_CLP_460 = {[110000 50000 28000 16000 9000 5500 3400 2100 1400 900 650 460 340 260 200 150 120 95 75 60 50 44 36 31 27 23 ], ‘mm^2/s’};
%CLP PG – Synthetisches Öl auf Basis Polyglykole
temp_CLP_PG_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_150 = {[1084 1080 1077 1073 1070 1066 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1022 1018 1015 1011 1008 1004 1001 997 ], ‘kg/m^3’};
visk_CLP_PG_150 = {[7500 3900 2420 1650 1200 850 610 440 340 260 210 150 130 105 90 71 61 52 44 38 32 29 25.5 22.5 20 18.5 ], ‘mm^2/s’};
temp_CLP_PG_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_220 = {[1084 1080 1077 1073 1070 1066 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1022 1018 1015 1011 1008 1004 1001 997 ], ‘kg/m^3’};
visk_CLP_PG_220 = {[6100 4100 2800 2000 1400 1020 750 550 440 340 260 220 170 140 115 100 95 70 60 50 44 40 34 30 27 24 ], ‘mm^2/s’};
temp_CLP_PG_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_320 = {[1091 1087 1084 1080 1077 1073 1070 1067 1063 1060 1056 1053 1049 1046 1042 1039 1035 1032 1028 1025 1021 1018 1014 1011 1007 1004 ], ‘kg/m^3’};
visk_CLP_PG_320 = {[5600 4000 3000 2200 1600 1220 950 775 600 480 400 320 272 225 190 165 140 120 105 92 80 70 62 55 50 45 ], ‘mm^2/s’};
temp_CLP_PG_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_PG_460 = {[1081 1077 1074 1070 1067 1063 1060 1057 1053 1050 1046 1043 1039 1036 1032 1029 1026 1022 1019 1015 1012 1008 1005 1001 998 995 ], ‘kg/m^3’};
visk_CLP_PG_460 = {[7300 5400 3900 2900 2200 1700 1300 1050 810 650 550 460 360 310 260 222 190 165 140 120 108 95 85 75 67 60 ], ‘mm^2/s’};
%CLP HC – Synthetisches Öl auf Basis Polyalphaolefine
temp_CLP_HC_150 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_150 = {[871 868 865 862 860 857 854 851 848 846 843 840 837 835 832 829 826 823 821 818 815 812 810 807 804 801 ], ‘kg/m^3’};
visk_CLP_HC_150 = {[6900 4000 2450 1650 1120 800 560 420 310 230 180 150 110 90 71 60 50 42 35 31 27 23.3 20.3 18.2 16 14.5 ], ‘mm^2/s’};
temp_CLP_HC_220 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_220 = {[876 873 870 867 865 862 859 856 853 851 848 845 842 839 837 834 831 828 825 823 820 817 814 812 809 806 ], ‘kg/m^3’};
visk_CLP_HC_220 = {[6900 4000 2600 1800 1300 950 680 510 380 300 230 190 150 120 100 81 70 60 50 44 38 32 29 26 23 21 ], ‘mm^2/s’};
temp_CLP_HC_320 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_320 = {[879 876 873 870 868 865 862 859 856 854 851 848 845 842 840 837 834 831 828 826 823 820 817 814 812 809 ], ‘kg/m^3’};
visk_CLP_HC_320 = {[14500 9000 6000 4000 2700 1900 1350 960 720 540 420 320 260 205 165 137 115 95 80 65 59 50 43 38 33 29.5 ], ‘mm^2/s’};
temp_CLP_HC_460 = {[-15.00 -10.00 -5.00 0.00 5.00 10.00 15.00 20.00 25.00 30.00 35.00 40.00 45.00 50.00 55.00 60.00 65.00 70.00 75.00 80.00 85.00 90.00 95.00 100.00 105.00 110.00], ‘1’};
dens_CLP_HC_460 = {[881 878 875 872 870 867 864 861 858 856 853 850 847 844 842 839 836 833 830 827 825 822 819 816 813 811 ], ‘kg/m^3’};
visk_CLP_HC_460 = {[25000 14500 9500 6000 4000 2800 1900 1400 1000 720 550 420 340 260 210 170 140 115 95 80 68 59 51 44 38 34 ], ‘mm^2/s’};
temp = [temp_CLP_100; temp_CLP_150; temp_CLP_220; temp_CLP_320; temp_CLP_460; temp_CLP_PG_150; temp_CLP_PG_220; temp_CLP_PG_320; temp_CLP_PG_460; temp_CLP_HC_150; temp_CLP_HC_220; temp_CLP_HC_320; temp_CLP_HC_460];
dens = [dens_CLP_100; dens_CLP_150; dens_CLP_220; dens_CLP_320; dens_CLP_460; dens_CLP_PG_150; dens_CLP_PG_220; dens_CLP_PG_320; dens_CLP_PG_460; dens_CLP_HC_150; dens_CLP_HC_220; dens_CLP_HC_320; dens_CLP_HC_460];
visk = [visk_CLP_100; visk_CLP_150; visk_CLP_220; visk_CLP_320; visk_CLP_460; visk_CLP_PG_150; visk_CLP_PG_220; visk_CLP_PG_320; visk_CLP_PG_460; visk_CLP_HC_150; visk_CLP_HC_220; visk_CLP_HC_320; visk_CLP_HC_460];
density = tablelookup(temp(fluid_type,:) ,dens(fluid_type,:) ,temperature, interpolation = smooth);
viscosity_kin = tablelookup(temp(fluid_type,:) ,visk(fluid_type,:) ,temperature, interpolation = smooth);
end
%inputs
% temperature = {1 , ‘1’ }; % :left
%end
nodes
G = NORD.Hydraulics.Domain.hydraulic(density=density,viscosity_kin=viscosity_kin); % :right
end
end
… and this is my custom domain:
domain hydraulic
% Hydraulic Domain
variables % Across
p = {value={1,’bar’},imin={0,’bar’}}; % Pressure
end
variables(Balancing = true) % Through
q = {0,’lpm’ }; % Flow rate
end
parameters
viscosity_kin = {0,’mm^2/s’ }; % kinematische Viskosität
density = {0,’kg/m^3′ }; % Dichte des Öls
bulk = {0.8e9 ,’Pa’ }; % Bulk modulus at atm. pressure and no gas
alpha = {0.005 ,’1′ }; % Relative amount of trapped air
range_error = {2 ,’1′ }; % Pressure below absolute zero
RD_18 = {0.015, ‘m’ }; % Rohrdurchmesser NW18
RD_10 = {0.008, ‘m’ }; % Rohrdurchmesser NW10
RD_12_5 = {0.0125,’m’ }; % Rohrdurchmesser für DMO
RD_06 = {0.006, ‘m’ }; % Rohrdurchmesser für DMO
BR_18 = {0.060, ‘m’ }; % Biegeradius des Rohres NW18
BR_10 = {0.027, ‘m’ }; % Biegeradius des Rohres NW10
Zeta_R_AURO = {1 , ‘1’ }; % Zeta Wert für Ausfluß (AURO)
Zeta_U_90_18 = {0.110, ‘1’ }; % Zeta Wert für 90° Rohrbogen
Zeta_U_90_10 = {0.117, ‘1’ }; % Zeta Wert für 90° Rohrbogen
Zeta_U_WV = {1.07, ‘1’ }; % Zeta Wert für WV
end
end domain parameters, inputs, source component, simscape MATLAB Answers — New Questions